/* ============================================================
   Staff-InOUT — Global Styles
   Olive / cream design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Core palette */
  --black:        #131310;
  --grey-dark:    #374151;
  --grey-mid:     #6b7280;
  --grey-light:   #e5e7eb;
  --grey-bg:      #F2EDE3;
  --white:        #ffffff;

  /* Brand colours */
  --primary:      #6B7A3E;
  --primary-hover:#556130;
  --primary-light:#EBF0DB;
  --primary-glow: rgba(107,122,62,.22);

  /* Accent */
  --accent:       #6B7A3E;
  --accent-hover: #556130;
  --accent-light: #EBF0DB;
  --accent-ring:  rgba(107,122,62,.18);

  /* Functional */
  --green:        #059669;
  --green-hover:  #047857;
  --green-light:  #d1fae5;
  --red:          #dc2626;
  --red-hover:    #b91c1c;
  --red-light:    #fee2e2;
  --yellow:       #d97706;
  --yellow-light: #fef3c7;
  --blue:         #2563eb;
  --blue-light:   #dbeafe;
  --orange:       #ea580c;
  --orange-light: #ffedd5;
  --teal:         #0d9488;
  --teal-light:   #ccfbf1;
  --pink:         #db2777;
  --pink-light:   #fce7f3;

  /* Sidebar gradient */
  --sidebar-from: #1A1F0E;
  --sidebar-to:   #252B12;

  /* Shape */
  --radius:    14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow:    0 2px 8px rgba(107,122,62,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(107,122,62,.15), 0 4px 12px rgba(0,0,0,.08);
  --shadow-card: 0 4px 16px rgba(107,122,62,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;          /* prevent page-level scroll — only .page-body scrolls */
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--grey-bg);
  color: var(--black);
  line-height: 1.5;
}

/* ── Layout ── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 268px;
  background: linear-gradient(175deg, var(--sidebar-from) 0%, #252B12 50%, #1A1F0E 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 26px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #A5B86B, #6B7A3E);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(107,122,62,.4);
}
.sidebar-logo-icon svg { width: 24px; height: 24px; color: #fff; }
.sidebar-logo-text { font-size: .9rem; font-weight: 800; letter-spacing: .01em; color: #fff; }
.sidebar-logo-sub  { font-size: .68rem; color: rgba(255,255,255,.45); margin-top: 2px; letter-spacing: .03em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px; }
.sidebar-section-label {
  font-size: .62rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: 18px 8px 7px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
  margin-bottom: 3px;
  position: relative;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.1);
  color: var(--white);
  padding-left: 18px;
}
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(165,184,107,.22), rgba(107,122,62,.12));
  color: #A5B86B;
  border-left: 3px solid #A5B86B;
  padding-left: 11px;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #A5B86B, #6B7A3E);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .875rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(107,122,62,.35);
}
.sidebar-user-name { font-size: .875rem; font-weight: 700; color: #fff; }
.sidebar-user-role { font-size: .68rem; color: rgba(255,255,255,.45); text-transform: capitalize; letter-spacing: .03em; }

/* ── Main content ── */
.main-content {
  flex: 1;
  margin-left: 268px;
  height: 100vh;           /* exact viewport height */
  display: flex; flex-direction: column;
  min-width: 0;
  overflow: hidden;        /* children must scroll, not this */
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid rgba(107,122,62,.08);
  padding: 0 28px;
  height: 66px;
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(107,122,62,.06);
}
.topbar-title { font-size: 1.1rem; font-weight: 800; color: var(--black); flex: 1; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: nowrap; margin-left: auto; }
.topbar-clock { font-size: .875rem; color: var(--grey-mid); font-variant-numeric: tabular-nums; background: var(--grey-bg); padding: 6px 14px; border-radius: 999px; font-weight: 600; flex-shrink: 0; white-space: nowrap; }
.hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer; padding: 6px;
  color: var(--black);
}
.hamburger svg { width: 24px; height: 24px; }

.page-body {
  padding: 28px;
  flex: 1;
  min-height: 0;           /* critical: allows flex child to shrink and overflow-y to work */
  overflow-y: auto;        /* THIS is the only scroll area */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(107,122,62,.08);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(107,122,62,.08);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: rgba(242,237,227,.5);
}
.card-header h2 { font-size: 1rem; font-weight: 800; color: var(--black); }
.card-body { padding: 24px; }
.card-body-sm { padding: 14px 24px; }

/* ── Stat cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.stat-card {
  background: var(--white);
  border: 1px solid rgba(107,122,62,.08);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow .2s, transform .2s;
  cursor: default;
}
.stat-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-value { font-size: 1.85rem; font-weight: 800; line-height: 1; color: var(--black); }
.stat-label { font-size: .775rem; color: var(--grey-mid); margin-top: 5px; font-weight: 600; letter-spacing: .01em; }

/* ── Clock card ── */
.clock-card {
  background: linear-gradient(135deg, #1A1F0E 0%, #3A4220 40%, #6B7A3E 75%, #6B7A3E 100%);
  color: var(--white);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(107,122,62,.4);
}
.clock-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(196,210,145,.15) 0%, transparent 70%);
  border-radius: 50%;
}
.clock-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(165,184,107,.12) 0%, transparent 70%);
  border-radius: 50%;
}
.clock-status-dot {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: .8rem; font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: .04em;
  backdrop-filter: blur(8px);
}
.clock-status-dot .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.dot-green { background: #34d399; box-shadow: 0 0 6px #34d399; }
.dot-red   { background: #f87171; box-shadow: 0 0 6px #f87171; }
.dot-grey  { background: var(--grey-mid); animation: none !important; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.85); }
}
.clock-time { font-size: 3.2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.02em; }
.clock-sub  { font-size: .9rem; color: rgba(255,255,255,.6); margin-top: 8px; font-weight: 500; }
.clock-timer { font-size: 1.3rem; font-weight: 800; color: #a7f3d0; margin-top: 12px; font-variant-numeric: tabular-nums; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: .875rem; font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: .01em;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn:active:not(:disabled) { transform: scale(0.96) !important; }

.btn-green {
  background: linear-gradient(135deg, #059669, #10b981);
  color: var(--white);
  font-size: 1.1rem; padding: 16px 44px; border-radius: 16px;
  box-shadow: 0 6px 20px rgba(5,150,105,.35);
}
.btn-green:hover:not(:disabled) { background: linear-gradient(135deg, #047857, #059669); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(5,150,105,.45); }

.btn-red {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: var(--white);
  font-size: 1.1rem; padding: 16px 44px; border-radius: 16px;
  box-shadow: 0 6px 20px rgba(220,38,38,.35);
}
.btn-red:hover:not(:disabled) { background: linear-gradient(135deg, #b91c1c, #dc2626); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(220,38,38,.45); }

.btn-black {
  background: linear-gradient(135deg, var(--black), #1A1F0E);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(19,19,16,.3);
}
.btn-black:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(19,19,16,.4); }

.btn-outline {
  background: transparent; color: var(--grey-dark);
  border: 1.5px solid var(--grey-light);
}
.btn-outline:hover:not(:disabled) { background: var(--grey-bg); border-color: #A5B86B; color: var(--primary); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #A5B86B);
  color: #fff;
  box-shadow: 0 4px 16px rgba(107,122,62,.35);
}
.btn-accent:hover:not(:disabled) { background: linear-gradient(135deg, var(--accent-hover), var(--accent)); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(107,122,62,.45); }

.btn-sm { padding: 6px 14px; font-size: .8rem; border-radius: 8px; }
.btn-full { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .825rem; font-weight: 700; color: var(--grey-dark); margin-bottom: 7px; }
.form-control {
  width: 100%;
  border: 1.5px solid var(--grey-light);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: .875rem;
  font-family: inherit;
  background: var(--white);
  color: var(--black);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  font-weight: 500;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-control::placeholder { color: #b0aab8; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  background: linear-gradient(90deg, rgba(242,237,227,1), rgba(235,240,219,.6));
  padding: 12px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--primary);
  border-bottom: 1.5px solid rgba(107,122,62,.1);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(107,122,62,.05); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(242,237,227,.6); }
tbody td { padding: 13px 16px; vertical-align: middle; font-weight: 500; }
tbody td:empty::after { content: '—'; color: var(--grey-mid); }

/* ── Data table (admin tables with scroll wrapper) ── */
.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table thead th {
  background: linear-gradient(90deg, rgba(242,237,227,1), rgba(235,240,219,.6));
  padding: 10px 14px;
  text-align: left;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  border-bottom: 1.5px solid rgba(107,122,62,.1);
  white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid rgba(107,122,62,.05); transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(242,237,227,.6); }
.data-table tbody td { padding: 11px 14px; vertical-align: middle; font-weight: 500; font-size: .82rem; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem; font-weight: 700;
  white-space: nowrap;
  letter-spacing: .02em;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: var(--red-light); color: #991b1b; }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-blue   { background: var(--blue-light); color: #1e40af; }
.badge-grey   { background: var(--grey-light); color: var(--grey-dark); }
.badge-accent { background: var(--accent-light); color: var(--accent); }
.badge-purple { background: #EBF0DB; color: #556130; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-teal   { background: #ccfbf1; color: #134e4a; }
.badge-pink   { background: #fce7f3; color: #9d174d; }

/* ── Alerts ── */
.alert {
  padding: 13px 18px;
  border-radius: 12px;
  font-size: .875rem;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  font-weight: 500;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: var(--red-light);   color: #991b1b;   border: 1px solid #fca5a5; }
.alert-warning { background: var(--yellow-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--accent-light); color: #556130; border: 1px solid #A5B86B; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #131310 0%, #1A1F0E 40%, #252B12 70%, #3A4220 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -20%; left: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(165,184,107,.15) 0%, transparent 65%);
  border-radius: 50%;
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%; right: -10%;
  width: 50vw; height: 50vw;
  background: radial-gradient(circle, rgba(107,122,62,.12) 0%, transparent 65%);
  border-radius: 50%;
}
.login-box {
  background: var(--white);
  border-radius: 24px;
  width: 100%; max-width: 460px;
  box-shadow: 0 32px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);
  overflow: hidden;
  position: relative; z-index: 1;
}
.login-header {
  background: linear-gradient(135deg, #1A1F0E, #3A4220, #6B7A3E);
  padding: 36px 32px 30px;
  text-align: center;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.login-header::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(165,184,107,.15);
  border-radius: 50%;
}
.login-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #A5B86B, #6B7A3E);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(107,122,62,.5);
}
.login-logo svg { width: 32px; height: 32px; color: #fff; }
.login-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.login-sub   { font-size: .825rem; color: rgba(255,255,255,.55); margin-top: 5px; font-weight: 500; }
.login-body  { padding: 30px 32px 34px; }

/* ── Who is in ── */
.who-in-list { display: flex; flex-direction: column; gap: 10px; }
.who-in-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  background: rgba(242,237,227,.5);
  border-radius: 12px;
  border: 1px solid rgba(107,122,62,.08);
  transition: border-color .15s, background .15s;
}
.who-in-item:hover { background: rgba(235,240,219,.4); border-color: #A5B86B; }
.who-in-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #6B7A3E, #A5B86B);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 800; font-size: .875rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(107,122,62,.3);
}
.who-in-name { font-weight: 700; font-size: .875rem; }
.who-in-sub  { font-size: .75rem; color: var(--grey-mid); }
.who-in-time { margin-left: auto; font-size: .8rem; font-weight: 700; color: var(--green); white-space: nowrap; }

/* ── WFH card ── */
.wfh-card {
  background: linear-gradient(90deg, #fef3c7, #fffbeb);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.wfh-card-text { font-size: .875rem; font-weight: 700; color: #92400e; }
.wfh-card-sub  { font-size: .775rem; color: #b45309; margin-top: 2px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(19,19,16,.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 20px;
  width: 100%; max-width: 520px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3), 0 0 0 1px rgba(107,122,62,.08);
  animation: modalIn .22s cubic-bezier(.4,0,.2,1);
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.94) translateY(-14px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid rgba(107,122,62,.08);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(242,237,227,.5);
}
.modal-header h3 { font-size: 1rem; font-weight: 800; color: var(--black); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--grey-mid); padding: 4px; border-radius: 6px; transition: all .15s; }
.modal-close:hover { color: var(--black); background: var(--grey-bg); }
.modal-body { padding: 26px; }
.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid rgba(107,122,62,.08);
  display: flex; gap: 10px; justify-content: flex-end;
  background: rgba(242,237,227,.3);
}

/* ── Tab nav ── */
.tab-nav { display: flex; gap: 4px; background: rgba(107,122,62,.06); border-radius: 12px; padding: 4px; }
.tab-btn {
  flex: 1; padding: 9px 16px;
  background: none; border: none;
  border-radius: 9px;
  font-size: .825rem; font-weight: 700;
  color: var(--grey-mid);
  cursor: pointer; transition: all .18s;
  text-align: center;
  font-family: inherit;
}
.tab-btn.active { background: var(--white); color: var(--primary); box-shadow: 0 2px 8px rgba(107,122,62,.12); }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 28px; right: 28px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--black); color: var(--white);
  padding: 13px 20px;
  border-radius: 12px;
  font-size: .875rem; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideIn .22s cubic-bezier(.4,0,.2,1);
  max-width: 340px;
  border-left: 4px solid rgba(165,184,107,.6);
}
.toast.toast-error   { background: #991b1b; border-left-color: #f87171; }
.toast.toast-success { background: #065f46; border-left-color: #34d399; }
.toast.toast-warning { background: #92400e; color: #fff; border-left-color: #fbbf24; }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } }

/* ── GPS indicator ── */
.gps-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid rgba(107,122,62,.15);
  font-weight: 600;
  backdrop-filter: blur(4px);
  max-width: calc(100% - 0px);
  box-sizing: border-box;
}
.gps-indicator svg { width: 16px; height: 16px; flex-shrink: 0; }
.gps-indicator.gps-ok    { color: #34d399; border-color: rgba(52,211,153,.3); }
.gps-indicator.gps-error { color: #f87171; border-color: rgba(248,113,113,.3); }

/* ── Location row wrapper (ensures GPS box never touches edge) ── */
.gps-row {
  margin: 20px 0 16px;
  display: flex;
  justify-content: center;
  padding: 0 4px;
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(19,19,16,.6);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* ── Spinners ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
.spinner-dark {
  border-color: rgba(107,122,62,.15);
  border-top-color: var(--primary);
}

/* ── Page entrance animation ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeSlideUp .35s ease both; }

/* ── Document list ── */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border: 1.5px solid rgba(107,122,62,.08);
  border-radius: 14px;
  background: var(--white);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.doc-row:hover {
  border-color: #A5B86B;
  box-shadow: 0 4px 16px rgba(107,122,62,.12);
  transform: translateY(-1px);
}
.doc-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent-light), #F0F4E0);
  color: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-icon svg { width: 20px; height: 20px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-weight: 700; font-size: .875rem; }
.doc-sub  { font-size: .72rem; color: var(--grey-mid); margin-top: 2px; }
.doc-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed rgba(107,122,62,.2);
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
  background: rgba(242,237,227,.4);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone p { font-size: .825rem; color: var(--grey-mid); margin-top: 8px; font-weight: 500; }

/* ── Stat icon colour helpers ── */
.stat-icon-accent  { background: linear-gradient(135deg, #EBF0DB, #D0DCA6); color: var(--accent); }
.stat-icon-green   { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #059669; }
.stat-icon-blue    { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #2563eb; }
.stat-icon-orange  { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #ea580c; }
.stat-icon-purple  { background: linear-gradient(135deg, #F0F4E0, #DDE8B8); color: #6B7A3E; }
.stat-icon-teal    { background: linear-gradient(135deg, #ccfbf1, #99f6e4); color: #0d9488; }
.stat-icon-pink    { background: linear-gradient(135deg, #fce7f3, #fbcfe8); color: #db2777; }

/* ── Profile detail grid ── */
.profile-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Rota grid ── */
.rota-grid { width: 100%; border-collapse: collapse; min-width: 600px; font-size: .82rem; }
.rota-grid th {
  background: linear-gradient(90deg, rgba(242,237,227,1), rgba(235,240,219,.7));
  padding: 10px 12px;
  font-weight: 800; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--primary);
  border: 1px solid rgba(107,122,62,.1);
  text-align: center;
}
.rota-grid td {
  border: 1px solid rgba(107,122,62,.07);
  padding: 8px 10px;
  vertical-align: middle;
  text-align: center;
  transition: background .15s;
}
.rota-grid td:hover { background: rgba(235,240,219,.3); }
.rota-grid td:first-child { text-align: left; font-weight: 700; color: var(--black); background: rgba(242,237,227,.4); }

/* ── Training Matrix: always scroll inside the container, never the page ── */
#tm-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
#tm-wrap::-webkit-scrollbar { height: 6px; }
#tm-wrap::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 3px; }
#tm-wrap::-webkit-scrollbar-thumb { background: #A5B86B; border-radius: 3px; }

/* ══════════════════════════════════════════════════════
   COMPLIANCE PILL TABS  (replaces old underline style)
   ══════════════════════════════════════════════════════ */
.comp-tabs-nav {
  display: flex;
  gap: 4px;
  background: rgba(107,122,62,.07);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 26px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.comp-tabs-nav::-webkit-scrollbar { display: none; }

.comp-tab-btn {
  flex: 1;
  min-width: max-content;
  padding: 10px 20px;
  background: none;
  border: none;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--grey-mid);
  cursor: pointer;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  text-align: center;
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: .01em;
}
.comp-tab-btn:hover  { color: var(--black); background: rgba(255,255,255,.6); }
.comp-tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(107,122,62,.14), 0 1px 3px rgba(0,0,0,.06);
}

/* ── Section loading spinner ── */
.section-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 52px 20px;
  color: var(--grey-mid);
  font-size: .875rem;
  font-weight: 600;
}
.section-loader .spin-ring {
  width: 26px; height: 26px;
  border: 3px solid rgba(107,122,62,.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  flex-shrink: 0;
}

/* ── Skeleton shimmer ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}
.skeleton-line.wide  { width: 80%; }
.skeleton-line.mid   { width: 55%; }
.skeleton-line.short { width: 35%; }

/* ── Mini progress bar (compliance %) ── */
.mini-progress-wrap {
  margin-top: 6px;
  background: rgba(0,0,0,.06);
  border-radius: 99px;
  height: 5px;
  overflow: hidden;
  width: 100%;
}
.mini-progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.mini-progress-bar.green  { background: linear-gradient(90deg,#10b981,#34d399); }
.mini-progress-bar.amber  { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.mini-progress-bar.red    { background: linear-gradient(90deg,#ef4444,#f87171); }

/* ── Compliance summary strip ── */
.comp-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(90deg,rgba(107,122,62,.04),rgba(107,122,62,.02));
  border-radius: 12px;
  border: 1px solid rgba(107,122,62,.08);
  margin-bottom: 20px;
}
.comp-summary-item { display: flex; flex-direction: column; gap: 2px; }
.comp-summary-val  { font-size: 1.35rem; font-weight: 800; color: var(--black); line-height: 1; }
.comp-summary-lbl  { font-size: .7rem; font-weight: 700; color: var(--grey-mid); text-transform: uppercase; letter-spacing: .06em; }
.comp-summary-divider { width: 1px; background: rgba(107,122,62,.1); margin: 0 4px; }

/* ── Stat card: no hover lift (prevents jitter inside compliance sections) ── */
.card.no-hover:hover { transform: none; box-shadow: var(--shadow); }

/* ── Maintenance card improvements ── */
.maint-item { transition: box-shadow .18s, border-color .18s, transform .18s; }
.maint-item:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); border-color: #d1d5db; transform: translateY(-1px); }

/* ── Utilities ── */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-grey   { color: var(--grey-mid); }
.text-accent { color: var(--accent); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.font-bold   { font-weight: 700; }
.font-black  { font-weight: 800; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--grey-mid);
}
.empty-state svg { width: 52px; height: 52px; margin: 0 auto 14px; opacity: .25; }
.empty-state p { font-size: .875rem; font-weight: 500; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet first, then mobile
   Breakpoints:
     1100px  tablet: sidebar collapses, hamburger appears
      768px  mobile: tighter layout, larger touch targets
      480px  small phone: single-column everything
   ════════════════════════════════════════════════════════════ */

/* ── Tablet (≤1100px): sidebar slides off, hamburger shows ── */
@media (max-width: 1100px) {
  .sidebar {
    transform: translateX(-268px);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,.35);
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .topbar { padding: 0 20px; }
  .page-body { padding: 20px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
  /* Better touch targets in sidebar nav */
  .sidebar-nav a { padding: 12px 14px; min-height: 44px; }
  .comp-tab-btn { min-height: 44px; padding: 10px 18px; }
}

/* ── Mobile (≤768px): compact layout ── */
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar { transform: translateX(-268px); }
  .sidebar.open { transform: translateX(0); }

  /* Topbar */
  .topbar { padding: 0 14px; height: 58px; }
  .topbar-title { font-size: .95rem; }
  .topbar-clock { font-size: .78rem; padding: 5px 10px; }

  /* Page body */
  .page-body { padding: 14px; }

  /* Cards */
  .card-header { padding: 14px 16px; }
  .card-header h2 { font-size: .92rem; }
  .card-body { padding: 14px 16px; }
  .card-body-sm { padding: 10px 16px; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; gap: 12px; }
  .stat-value { font-size: 1.4rem !important; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-icon svg { width: 18px; height: 18px; }

  /* Tables */
  table { font-size: .78rem; }
  thead th { padding: 9px 10px; font-size: .67rem; }
  tbody td { padding: 10px 10px; }

  /* Buttons — minimum 44px touch targets */
  .btn { min-height: 40px; }
  .btn-green, .btn-red { font-size: .95rem; padding: 13px 28px; min-height: 50px; }
  .btn-sm { min-height: 34px; font-size: .78rem; }

  /* Forms */
  .form-control { padding: 12px 14px; font-size: .9rem; }
  .form-label { font-size: .8rem; }

  /* Modals — full-width, attach to bottom on small screens */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 0;
  }
  .modal-body { padding: 18px; }
  .modal-header { padding: 16px 18px; }

  /* Toasts */
  #toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: 100%; }

  /* Clock card */
  .clock-time { font-size: 2.4rem !important; }

  /* Profile detail */
  .profile-detail { grid-template-columns: 1fr; }

  /* Section page headers */
  .topbar-title { max-width: calc(100vw - 140px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Training Matrix filters: stack on mobile */
  #tm-filters-bar { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  #tm-filters-bar select { width: 100% !important; }
}

/* ── Small phones (≤480px): single-column ── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px 12px; }
  .stat-value { font-size: 1.2rem !important; }
  .stat-label { font-size: .67rem; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .profile-detail { grid-template-columns: 1fr; }

  .topbar-clock { display: none; }   /* hide clock on very small phones to save space */

  /* Training matrix cells become slightly narrower */
  .tm-table thead th { min-width: 60px; max-width: 70px; }
  .tm-table tbody td:first-child { min-width: 140px; max-width: 160px; font-size: .75rem; }

  /* Modals */
  .modal-body { padding: 14px; }

  /* Doc rows: stack actions */
  .doc-row { flex-wrap: wrap; }
  .doc-actions { width: 100%; justify-content: flex-end; margin-top: 8px; }
}

/* ── Mobile polish: tab navs, filter bars, action rows ── */
@media (max-width: 768px) {

  /* Tab navigation — scrolls horizontally so all tabs remain reachable */
  .tab-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 2px;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; padding: 8px 14px; font-size: .8rem; }

  /* Section tabs (HR/Manager section switchers) */
  .section-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    gap: 4px;
    padding-bottom: 2px;
  }
  .section-tabs::-webkit-scrollbar { display: none; }
  .section-tab { white-space: nowrap; flex-shrink: 0; }

  /* Generic filter rows — stack select + button on mobile */
  .filter-row,
  [style*="display:flex"][style*="gap"][style*="align-items"] > select,
  .filters-bar { flex-wrap: wrap; }

  /* Any flex row with inputs/selects — make them grow full-width */
  .input-row { flex-direction: column; }
  .input-row .form-control,
  .input-row select { width: 100%; }

  /* Clock card — full-width action buttons */
  .clock-card .btn,
  #btn-clock-in,
  #btn-clock-out { width: 100%; justify-content: center; }

  /* GPS status bar — shrink text so it fits */
  #gps-status { font-size: .75rem; }

  /* Compact rota header row on the staff dashboard */
  .rota-controls { flex-direction: column; gap: 8px; align-items: stretch !important; }
  .rota-controls > * { width: 100%; }

  /* Leave request cards — stack info and actions */
  .leave-card { flex-direction: column; gap: 10px; }
  .leave-card-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }

  /* HR/Manager search bars — stack input + button */
  .search-bar { flex-direction: column; gap: 8px; }
  .search-bar input,
  .search-bar select { width: 100%; }
  .search-bar .btn { width: 100%; }

  /* Attendance action buttons inside table cells — prevent overflow */
  .attendance-actions { display: flex; flex-wrap: wrap; gap: 4px; }

  /* Payroll table — shrink columns */
  .payroll-table th,
  .payroll-table td { font-size: .72rem; padding: 8px 6px; }

  /* Compliance badges — wrap */
  .compliance-summary { flex-wrap: wrap; gap: 8px; }
  .compliance-badge { flex-shrink: 0; }

  /* Page-level action buttons (e.g. "Add Staff", "Add Shift") — full width on phones */
  .page-actions { flex-direction: column; gap: 8px; }
  .page-actions .btn { width: 100%; text-align: center; justify-content: center; }

  /* Staff list cards on mobile */
  .staff-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .staff-card-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .staff-card-actions .btn { flex: 1; min-width: 0; justify-content: center; }

  /* Inline grid overrides for HR dashboard inline-styled grids */
  [style*="grid-template-columns:repeat(3"] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns: repeat(3"] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns:repeat(4"] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns: repeat(4"] { grid-template-columns: 1fr 1fr !important; }

  /* Modal inline action rows */
  .modal-footer { flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}

/* ── Small phone extras (≤480px) ── */
@media (max-width: 480px) {
  /* Stat grids: 2-up is fine down to 380px, single below */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Any repeated(3) or repeated(4) grid → single column */
  [style*="grid-template-columns:repeat(3"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: repeat(3"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:repeat(4"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: repeat(4"] { grid-template-columns: 1fr !important; }

  /* Inline-flex rows with many buttons → wrap */
  .btn-group { flex-wrap: wrap; gap: 6px; }
  .btn-group .btn { flex: 1; min-width: 120px; justify-content: center; }

  /* Modal footer always stacks */
  .modal-footer { flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; }
}

/* ── Landscape small phones ── */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-overlay { align-items: center; padding: 16px; }
  .modal { border-radius: 16px !important; max-height: 95vh; }
  .clock-card { padding: 20px !important; }
}

/* ============================================================
   DARK MODE — [data-theme="dark"] on <html>
   ============================================================ */
[data-theme="dark"] {
  --black:        #f1f0ee;
  --grey-dark:    #d1d5db;
  --grey-mid:     #9ca3af;
  --grey-light:   #374151;
  --grey-bg:      #141414;
  --white:        #1e1e1e;

  --primary:      #A5B86B;
  --primary-hover:#bfcf80;
  --primary-light:rgba(165,184,107,.15);
  --primary-glow: rgba(165,184,107,.18);

  --accent:       #A5B86B;
  --accent-hover: #bfcf80;
  --accent-light: rgba(165,184,107,.15);

  --green-light:  rgba(5,150,105,.25);
  --red-light:    rgba(220,38,38,.25);
  --yellow-light: rgba(217,119,6,.25);
  --blue-light:   rgba(37,99,235,.25);
  --orange-light: rgba(234,88,12,.25);
  --teal-light:   rgba(13,148,136,.25);
  --pink-light:   rgba(219,39,119,.25);

  --shadow:    0 2px 8px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.45), 0 4px 12px rgba(0,0,0,.25);
  --shadow-card: 0 4px 16px rgba(0,0,0,.35);
}

[data-theme="dark"] body            { background: #141414; color: #f1f0ee; }
[data-theme="dark"] .topbar         { background: #1e1e1e; border-bottom-color: rgba(255,255,255,.07); }
[data-theme="dark"] .card           { background: #1e1e1e; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .card-header    { background: rgba(255,255,255,.04); border-bottom-color: rgba(255,255,255,.07); }
[data-theme="dark"] .card-header h2 { color: #f1f0ee; }
[data-theme="dark"] .stat-card      { background: #252525; border-color: rgba(255,255,255,.07); }
[data-theme="dark"] .stat-card:hover { background: #2a2a2a; }
[data-theme="dark"] .form-control   { background: #252525; border-color: rgba(255,255,255,.12); color: #f1f0ee; }
[data-theme="dark"] .form-control:focus { border-color: #A5B86B; background: #2a2a2a; }
[data-theme="dark"] .form-label     { color: #d1d5db; }
[data-theme="dark"] .modal-overlay  { background: rgba(0,0,0,.75); }
[data-theme="dark"] .modal          { background: #1e1e1e; }
[data-theme="dark"] .modal-header   { background: #252525; border-bottom-color: rgba(255,255,255,.08); }
[data-theme="dark"] .table-wrap table th { background: #252525; color: #d1d5db; }
[data-theme="dark"] .table-wrap table td { border-color: rgba(255,255,255,.06); color: #d1d5db; }
[data-theme="dark"] .table-wrap table tr:hover td { background: rgba(255,255,255,.04); }
[data-theme="dark"] .btn-outline    { border-color: rgba(255,255,255,.2); color: #d1d5db; }
[data-theme="dark"] .btn-outline:hover { background: rgba(255,255,255,.07); }
[data-theme="dark"] .section-tab    { background: rgba(255,255,255,.06); color: #9ca3af; }
[data-theme="dark"] .section-tab.active { background: #A5B86B; color: #141414; }
[data-theme="dark"] .topbar-clock   { background: #252525; color: #9ca3af; }
[data-theme="dark"] .page-body      { background: #141414; }
[data-theme="dark"] select.form-control option { background: #252525; }
[data-theme="dark"] .alert-error    { background: rgba(220,38,38,.15); border-color: rgba(220,38,38,.3); }
[data-theme="dark"] .alert-success  { background: rgba(5,150,105,.15); border-color: rgba(5,150,105,.3); }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.6); }

/* ── Dark mode theme toggle button ─────────────────────────── */
.theme-toggle {
  background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: 10px; color: var(--grey-mid);
  transition: all .18s; line-height: 1;
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); }
.theme-toggle svg   { width: 20px; height: 20px; display: block; }

/* ── Notification Bell ───────────────────────────────────────── */
.notif-bell-wrap { position: relative; display: inline-flex; align-items: center; }
.notif-bell {
  background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: 10px; color: var(--grey-mid);
  transition: all .18s; line-height: 1; position: relative;
}
.notif-bell:hover { background: var(--primary-light); color: var(--primary); }
.notif-bell svg   { width: 20px; height: 20px; display: block; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--red); color: #fff;
  font-size: .6rem; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; pointer-events: none;
  border: 2px solid var(--white);
  animation: badge-pop .2s cubic-bezier(.4,0,.2,1);
}
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; max-height: 420px;
  background: var(--white); border-radius: 16px;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(107,122,62,.1);
  z-index: 999; overflow: hidden; display: none; flex-direction: column;
}
.notif-dropdown.open { display: flex; }
.notif-dropdown-head {
  padding: 14px 16px; border-bottom: 1px solid rgba(107,122,62,.08);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(242,237,227,.5);
}
[data-theme="dark"] .notif-dropdown-head { background: rgba(255,255,255,.04); }
[data-theme="dark"] .notif-dropdown { background: #1e1e1e; border-color: rgba(255,255,255,.08); }
.notif-dropdown-head h4 { font-size: .85rem; font-weight: 800; color: var(--black); }
.notif-mark-all { font-size: .75rem; color: var(--primary); font-weight: 600; cursor: pointer; border: none; background: none; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid rgba(107,122,62,.06);
  display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer; transition: background .15s;
}
.notif-item:hover { background: var(--primary-light); }
.notif-item.unread { background: rgba(165,184,107,.08); }
[data-theme="dark"] .notif-item.unread { background: rgba(165,184,107,.1); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 6px; }
.notif-item.unread .notif-dot { background: var(--primary); }
.notif-item:not(.unread) .notif-dot { background: transparent; }
.notif-item-title { font-size: .82rem; font-weight: 700; color: var(--black); margin-bottom: 2px; }
.notif-item-msg   { font-size: .78rem; color: var(--grey-mid); line-height: 1.4; }
.notif-item-time  { font-size: .7rem; color: var(--grey-mid); margin-top: 4px; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--grey-mid); font-size: .85rem; }

/* ── Onboarding checklist ─────────────────────────────────── */
.onboarding-card {
  background: linear-gradient(135deg, #f0f4e8 0%, #e8f0d8 100%);
  border: 1.5px solid rgba(107,122,62,.2); border-radius: var(--radius-lg);
  padding: 22px 24px; margin-bottom: 24px; position: relative;
}
[data-theme="dark"] .onboarding-card { background: linear-gradient(135deg, rgba(107,122,62,.15), rgba(107,122,62,.08)); border-color: rgba(165,184,107,.2); }
.onboarding-title { font-size: 1rem; font-weight: 800; color: var(--black); margin-bottom: 4px; }
.onboarding-sub   { font-size: .82rem; color: var(--grey-mid); margin-bottom: 18px; }
.onboarding-steps { display: flex; flex-direction: column; gap: 8px; }
.onboarding-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--white); border-radius: 10px;
  font-size: .85rem; font-weight: 600; color: var(--grey-dark);
  border: 1px solid rgba(107,122,62,.1); cursor: pointer;
  transition: all .18s; text-decoration: none;
}
[data-theme="dark"] .onboarding-step { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); color: #d1d5db; }
.onboarding-step:hover { border-color: var(--primary); color: var(--primary); }
.onboarding-step.done { opacity: .65; }
.onboarding-step.done .ob-check { background: var(--green); border-color: var(--green); }
.onboarding-step.done .ob-check svg { display: block; }
.onboarding-step.done .ob-label { text-decoration: line-through; color: var(--grey-mid); }
.ob-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--grey-light);
  background: transparent; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s;
}
.ob-check svg { display: none; width: 12px; height: 12px; color: #fff; }
.ob-check.active { border-color: var(--primary); }
.onboarding-progress {
  margin-top: 14px; background: rgba(107,122,62,.15); border-radius: 99px;
  height: 6px; overflow: hidden;
}
.onboarding-progress-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s ease; }
.onboarding-dismiss {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--grey-mid); line-height: 1;
}

/* ── Half-day / emergency leave badge ─────────────────────── */
.leave-type-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 99px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.leave-type-annual      { background: #dbeafe; color: #1e40af; }
.leave-type-half_day_am { background: #fef3c7; color: #92400e; }
.leave-type-half_day_pm { background: #fef3c7; color: #92400e; }
.leave-type-emergency   { background: #fee2e2; color: #991b1b; }
.leave-type-sick        { background: #f0fdf4; color: #166534; }
.leave-type-unpaid      { background: #f3f4f6; color: #374151; }
.leave-type-other       { background: #fce7f3; color: #9d174d; }

/* ── Offline mode banner ─────────────────────────────────── */
#offline-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: #1a1a1a; color: #fff; padding: 12px 24px;
  font-size: .85rem; font-weight: 600; text-align: center;
  border-top: 2px solid #ea580c;
  gap: 10px; align-items: center; justify-content: center;
}
#offline-banner.show { display: flex; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: #ea580c; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Mobile: Notification dropdown full width ─────────────── */
@media (max-width: 768px) {
  .topbar-actions { gap: 4px; }
  .notif-dropdown { width: calc(100vw - 32px); right: -60px; }
  .onboarding-card { padding: 16px; }
}

/* ── Mobile: Force inline grids to stack on small screens ─── */
/* Targets the common pattern: style="display:grid;grid-template-columns:1fr 1fr…" */
@media (max-width: 768px) {
  /* Two-column inline grids */
  [style*="grid-template-columns:1fr 1fr"]     { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: 1fr 1fr"]    { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
  [style*="grid-template-columns: 1fr 1fr 1fr"]{ grid-template-columns: 1fr 1fr !important; }
  /* Three-column at 480px */
}
@media (max-width: 480px) {
  [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: 1fr 1fr 1fr"]{ grid-template-columns: 1fr !important; }
  /* Inline-flex rows with small gaps also wrap */
  [style*="display:flex"][style*="gap:1"] { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE — Inline Style Overrides
   The dashboards use inline style="background:#fff" on panels.
   CSS variable overrides don't penetrate inline styles, so we
   use attribute selectors with !important to theme them.
   ══════════════════════════════════════════════════════════════ */

/* Panel backgrounds */
[data-theme="dark"] [style*="background:#fff"]           { background: #1e1e1e !important; }
[data-theme="dark"] [style*="background: #fff"]          { background: #1e1e1e !important; }
[data-theme="dark"] [style*="background:#ffffff"]        { background: #1e1e1e !important; }
[data-theme="dark"] [style*="background: #ffffff"]       { background: #1e1e1e !important; }
[data-theme="dark"] [style*="background:#f9fafb"]        { background: #252525 !important; }
[data-theme="dark"] [style*="background: #f9fafb"]       { background: #252525 !important; }
[data-theme="dark"] [style*="background:#f3f4f6"]        { background: #2a2a2a !important; }
[data-theme="dark"] [style*="background: #f3f4f6"]       { background: #2a2a2a !important; }
[data-theme="dark"] [style*="background:#F2EDE3"]        { background: #1a1a1a !important; }

/* Text colours */
[data-theme="dark"] [style*="color:#111"]                { color: #f1f0ee !important; }
[data-theme="dark"] [style*="color: #111"]               { color: #f1f0ee !important; }
[data-theme="dark"] [style*="color:#374151"]             { color: #d1d5db !important; }
[data-theme="dark"] [style*="color: #374151"]            { color: #d1d5db !important; }
[data-theme="dark"] [style*="color:#6b7280"]             { color: #9ca3af !important; }
[data-theme="dark"] [style*="color: #6b7280"]            { color: #9ca3af !important; }
[data-theme="dark"] [style*="color:#9ca3af"]             { color: #6b7280 !important; }

/* Borders */
[data-theme="dark"] [style*="border:1px solid #e5e7eb"]  { border-color: rgba(255,255,255,.08) !important; }
[data-theme="dark"] [style*="border:1px solid #d1d5db"]  { border-color: rgba(255,255,255,.08) !important; }
[data-theme="dark"] [style*="border-bottom:1px solid #e5e7eb"] { border-bottom-color: rgba(255,255,255,.07) !important; }

/* Input/select elements with inline styles */
[data-theme="dark"] input[style],
[data-theme="dark"] select[style],
[data-theme="dark"] textarea[style] {
  background: #252525 !important;
  border-color: rgba(255,255,255,.12) !important;
  color: #f1f0ee !important;
}

/* Stat/summary boxes with cream/white inline backgrounds */
[data-theme="dark"] [style*="background:#EBF0DB"]        { background: rgba(107,122,62,.2) !important; }
[data-theme="dark"] [style*="background:#f0fdf4"]        { background: rgba(5,150,105,.15) !important; }
[data-theme="dark"] [style*="background:#fef3c7"]        { background: rgba(217,119,6,.15) !important; }
[data-theme="dark"] [style*="background:#dbeafe"]        { background: rgba(37,99,235,.15) !important; }
[data-theme="dark"] [style*="background:#fee2e2"]        { background: rgba(220,38,38,.15) !important; }
[data-theme="dark"] [style*="background:#fce7f3"]        { background: rgba(219,39,119,.15) !important; }
[data-theme="dark"] [style*="background:#fef2f2"]        { background: rgba(220,38,38,.1) !important; }

/* Dark mode tab styling */
[data-theme="dark"] .tab-nav                             { background: rgba(255,255,255,.05); }
[data-theme="dark"] .tab-btn                             { color: #9ca3af; }
[data-theme="dark"] .tab-btn.active                      { background: #252525; color: #A5B86B; }

/* Sidebar stays dark (already dark in both modes) */
[data-theme="dark"] .sidebar-nav a:hover,
[data-theme="dark"] .sidebar-nav a.active               { background: rgba(255,255,255,.1); }

/* Notification dropdown */
[data-theme="dark"] .notif-dropdown                     { background: #1e1e1e; border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .notif-dropdown-head                { border-bottom-color: rgba(255,255,255,.07); }
[data-theme="dark"] .notif-dropdown-head h4             { color: #f1f0ee; }
[data-theme="dark"] .notif-item                         { border-bottom-color: rgba(255,255,255,.04); }
[data-theme="dark"] .notif-item:hover                   { background: #252525; }
[data-theme="dark"] .notif-item.unread                  { background: rgba(107,122,62,.18); }
[data-theme="dark"] .notif-item.unread:hover            { background: rgba(107,122,62,.25); }
[data-theme="dark"] .notif-item-title                   { color: #f1f0ee; }
[data-theme="dark"] .notif-item-msg                     { color: #9ca3af; }
[data-theme="dark"] .notif-empty                        { color: #6b7280; }

/* Onboarding card */
[data-theme="dark"] .onboarding-card                    { background: linear-gradient(135deg, rgba(107,122,62,.18) 0%, rgba(107,122,62,.12) 100%); border-color: rgba(107,122,62,.3); }
[data-theme="dark"] .onboarding-title                   { color: #d4e0a0; }
[data-theme="dark"] .onboarding-sub                     { color: #9ca3af; }
[data-theme="dark"] .onboarding-progress               { background: rgba(255,255,255,.08); }
[data-theme="dark"] .onboarding-step                   { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); color: #d1d5db; }
[data-theme="dark"] .onboarding-step.done              { color: #6b7280; }

/* Dark mode icon buttons */
[data-theme="dark"] .theme-toggle:hover                 { background: rgba(255,255,255,.08); color: #a5b86b; }
[data-theme="dark"] .notif-bell:hover                   { background: rgba(255,255,255,.08); color: #a5b86b; }

/* Dark mode modal */
[data-theme="dark"] .modal                              { background: #1e1e1e; }
[data-theme="dark"] .modal-header                       { border-bottom-color: rgba(255,255,255,.07); }
[data-theme="dark"] .modal-header h3                    { color: #f1f0ee; }
[data-theme="dark"] .modal-footer                       { border-top-color: rgba(255,255,255,.07); }
[data-theme="dark"] .form-label                         { color: #d1d5db; }
[data-theme="dark"] .form-control                       { background: #252525; border-color: rgba(255,255,255,.12); color: #f1f0ee; }
[data-theme="dark"] .form-control::placeholder          { color: #6b7280; }
[data-theme="dark"] select.form-control option          { background: #252525; color: #f1f0ee; }
