/* AttendIQ — Main Stylesheet
   Premium jewel-tone theme: cool navy-charcoal surfaces with a switchable
   brand accent + highlight pair, replacing the earlier flat green/indigo
   passes. Status colors keep the same green/amber/red/blue families on a
   fixed light pastel *-bg tint (see comment below) — only brand chrome
   (logo, nav, buttons, gauges) uses the accent/highlight pairing.
   Three appearance themes share this token set — see the [data-theme]
   blocks right after :root. Surfaces/status colors don't vary by theme,
   only the --accent-... and --accent-gold-... families do, so every
   component built on those tokens re-themes for free. */
:root {
  --primary: #10111b;
  --primary-light: #181a2c;
  /* Midnight Violet (default) — deep indigo-violet brand accent with a
     champagne-gold highlight. --accent-rgb/--accent-gold-rgb back rgba()
     usages elsewhere in this file; --accent-ink/--accent-gold-ink are the
     text colors used ON TOP of accent/highlight-colored backgrounds. */
  --accent: #5D4FD1;
  --accent-dark: #3D2FA8;
  --accent-mid: #241E63;
  --accent-light: rgba(93,79,209,0.16);
  --accent-rgb: 93,79,209;
  --accent-ink: #ffffff;
  --accent-gold: #E8B94A;
  --accent-gold-soft: #F0C05C;
  --accent-gold-dark: #C9982F;
  --accent-gold-pale: #F3D27A;
  --accent-gold-light: rgba(232,185,74,0.18);
  --accent-gold-rgb: 232,185,74;
  --accent-gold-ink: #241536;
  /* Status colors sit on a fixed light pastel *-bg tint everywhere they're
     used (badges, kpi icons, calendar days), so they stay readable against
     that same light backdrop regardless of the page being otherwise dark. */
  --success: #12b569;
  --success-bg: #DCFCE7;
  --warning: #d99a1b;
  --warning-bg: #FEF3C7;
  --danger: #e0455a;
  --danger-bg: #FEE2E2;
  --info: #3d8bf5;
  --info-bg: #CFFAFE;
  --surface: #14151f;
  --surface-2: #1b1d2e;
  --card-bg: #191a29;
  --border: rgba(255,255,255,0.10);
  --border-light: rgba(255,255,255,0.05);
  --text-primary: #ffffff;
  --text-secondary: #b7bad4;
  --text-muted: #82869f;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.02) inset;
  --sidebar-w: 240px;
  --header-h: 60px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Deep Ocean — sapphire blue accent with a cyan-aqua highlight. Cool jewel
   tone; ink colors switch to dark teal since white-on-cyan fails contrast. */
html[data-theme="ocean"] {
  --accent: #2E5CD9;
  --accent-dark: #1A3FAE;
  --accent-mid: #12235E;
  --accent-light: rgba(46,92,217,0.16);
  --accent-rgb: 46,92,217;
  --accent-ink: #ffffff;
  --accent-gold: #22D3EE;
  --accent-gold-soft: #5EEAF9;
  --accent-gold-dark: #0EA5B8;
  --accent-gold-pale: #A5F3FC;
  --accent-gold-light: rgba(34,211,238,0.18);
  --accent-gold-rgb: 34,211,238;
  --accent-gold-ink: #062024;
}

/* Copper Ember — burnt-copper accent with the same champagne-gold
   highlight (copper + gold is a natural warm pairing, so only --accent*
   needs to move). */
html[data-theme="ember"] {
  --accent: #C1571F;
  --accent-dark: #8F3F12;
  --accent-mid: #3A1D0C;
  --accent-light: rgba(193,87,31,0.16);
  --accent-rgb: 193,87,31;
  --accent-ink: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Document-wide, not just on .form-control: a color-scheme set only on the
   input/select element itself is inconsistently honored by browsers for the
   actual native popup surface (the <option> dropdown list, date pickers) —
   several render that popup using the *document's* color-scheme regardless
   of what the triggering element declares, leaving light-colored option text
   sitting on a browser-default white popup background. Setting it here once
   makes every native form control consistently dark, not just the closed
   control itself. */
html { color-scheme: dark; }
body { font-family: var(--font); background: var(--surface); color: var(--text-primary); font-size: 14px; line-height: 1.5; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--primary); display: flex; flex-direction: column; z-index: 200;
  transition: transform 0.25s ease; overflow: hidden;
}
.sidebar-logo {
  height: var(--header-h); display: flex; align-items: center; padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08); gap: 10px; flex-shrink: 0;
}
.logo-icon {
  width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--accent-ink);
  font-size: 16px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(var(--accent-rgb),0.4);
  animation: logo-icon-pulse 3.2s ease-in-out infinite;
}
@keyframes logo-icon-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(var(--accent-rgb),0.4); }
  50% { box-shadow: 0 2px 16px rgba(var(--accent-rgb),0.75), 0 0 0 4px rgba(var(--accent-rgb),0.12); }
}
.sidebar-logo-img { height: 32px; max-width: 120px; width: auto; flex-shrink: 0; object-fit: contain; }
/* Wordmark: a distinct display face (not the body's Inter) so the brand
   name reads as a logotype, with a slow gold shimmer sweeping through it —
   ties into the gold highlight used for premium chrome elsewhere. */
.logo-name {
  font-family: 'Space Grotesk', var(--font); font-size: 17px; font-weight: 700; letter-spacing: 0.2px;
  display: block; line-height: 1.2; background-size: 200% auto;
  background-image: linear-gradient(90deg, #fff 0%, #fff 35%, var(--accent-gold) 50%, #fff 65%, #fff 100%);
  background-clip: text; -webkit-background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  animation: logo-shimmer 5s linear infinite;
}
@keyframes logo-shimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@media (prefers-reduced-motion: reduce) {
  .logo-icon, .logo-name { animation: none; }
}
.logo-sub { font-size: 10px; color: rgba(255,255,255,0.4); display: block; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
.nav-section-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,0.42); padding: 14px 10px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0;
  color: rgba(255,255,255,0.82); cursor: pointer; font-size: 13.5px; font-weight: 500;
  border-radius: 9px; text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.09); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.45) 0%, rgba(var(--accent-rgb),0.18) 100%);
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 12px rgba(var(--accent-rgb),0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}
.nav-item i { font-size: 18px; width: 20px; flex-shrink: 0; }
.nav-item.active i { color: var(--accent-gold); text-shadow: 0 0 10px rgba(var(--accent-gold-rgb),0.6); }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 10px; min-width: 18px; text-align: center; }
.sidebar-footer { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
/* Dimming scrim behind the off-canvas drawer on tablet/mobile (see the
   ≤992px media query below) — hidden at desktop widths regardless of the
   .open class since the sidebar is pinned there and never toggled. */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 190; }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--accent-ink); flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; color: #fff; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ===================== TOPBAR ===================== */
.topbar {
  position: fixed; left: var(--sidebar-w); right: 0; top: 0; height: var(--header-h);
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; z-index: 199;
}
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); background: transparent; cursor: pointer; color: var(--text-secondary); font-size: 18px; transition: all 0.15s; }
.icon-btn:hover { background: var(--border-light); color: var(--text-primary); }
/* .icon-btn's own `display: flex` has the same specificity as the browser's
   default `[hidden]{display:none}` rule, so an author stylesheet loaded
   after the UA one would otherwise win and show the button anyway (e.g.
   #pwa-install-btn, hidden by default until beforeinstallprompt fires). */
.icon-btn[hidden] { display: none; }
.notif-dot { position: relative; }
.notif-dot::after { content: ''; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--danger); border-radius: 50%; border: 2px solid var(--card-bg); }
.search-wrap { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.search-wrap i { color: var(--text-muted); font-size: 16px; }
.search-wrap input { border: none; background: transparent; outline: none; font-size: 13px; color: var(--text-primary); width: 200px; }
.user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--accent-ink); cursor: pointer; }

/* ===================== LAYOUT ===================== */
.main-content { margin-left: var(--sidebar-w); padding-top: var(--header-h); min-height: 100vh; }
.page-body { padding: 24px; }
.alert-container { padding: 16px 24px 0; }
.app-footer { text-align: right; padding: 20px 24px; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 11px; font-weight: 500; letter-spacing: 0.4px; color: var(--text-muted); }

/* ===================== CARDS ===================== */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-card); transition: box-shadow 0.2s ease; }
.card-header { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 16px; color: var(--text-primary); }
.card-footer { padding: 13px 16px; border-top: 1px solid var(--border); color: var(--text-primary); }
.card-body code, .card-footer code { color: var(--accent); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* ===================== KPI CARDS ===================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
/* For pages with exactly 3 KPI cards — a plain inline style="grid-template-
   columns:repeat(3,1fr)" would out-specificity the .kpi-grid media queries
   below and never collapse on tablet/mobile, so this gets its own class
   with its own tiers instead. */
.kpi-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; display: flex; align-items: flex-start; gap: 12px; box-shadow: var(--shadow-card); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(var(--accent-rgb),0.16); }
.kpi-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.kpi-icon.blue { background: var(--accent-light); color: var(--accent); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.teal { background: var(--info-bg); color: var(--info); }
.kpi-icon.purple { background: var(--accent-light); color: var(--accent); }
.kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ===================== INSIGHT WIDGETS ===================== */
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.insight-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-card); transition: transform 0.15s ease, box-shadow 0.15s ease; animation: insight-fade-in 0.4s ease both; }
.insight-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(var(--accent-rgb),0.16); }
.insight-grid .insight-card:nth-child(1) { animation-delay: 0.02s; }
.insight-grid .insight-card:nth-child(2) { animation-delay: 0.08s; }
.insight-grid .insight-card:nth-child(3) { animation-delay: 0.14s; }
.insight-grid .insight-card:nth-child(4) { animation-delay: 0.20s; }
@keyframes insight-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.insight-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.insight-icon.accent { background: var(--accent-light); color: var(--accent); }
.insight-icon.muted { background: var(--border-light); color: var(--text-muted); }
.insight-icon.info { background: var(--info-bg); color: var(--info); }
.insight-icon.green { background: var(--success-bg); color: var(--success); }
.insight-icon.amber { background: var(--warning-bg); color: var(--warning); }
.insight-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.insight-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.insight-unit { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.insight-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Health score ring — pure CSS conic-gradient, driven by --pct custom property */
.health-ring { --pct: 0; width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; background: conic-gradient(from -90deg, var(--accent-gold) 0%, var(--accent) calc(var(--pct) * 1%), var(--border-light) 0); display: flex; align-items: center; justify-content: center; }
.health-ring-inner { width: 42px; height: 42px; border-radius: 50%; background: var(--card-bg); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--text-primary); }
.health-ring-inner span { font-size: 10px; font-weight: 500; color: var(--text-muted); margin-left: 1px; }

/* Focus-time split bar (productive vs distracting) */
.activity-bar { display: flex; background: var(--border-light); border-radius: 4px; height: 5px; overflow: hidden; margin: 6px 0; }
.activity-bar-fill { height: 100%; }
.activity-bar-fill.productive { background: var(--success); }
.activity-bar-fill.distracting { background: var(--danger); }

/* ===================== BADGES ===================== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success { background: var(--success-bg); color: #15803D; }
.badge-warning { background: var(--warning-bg); color: #B45309; }
.badge-danger { background: var(--danger-bg); color: #B91C1C; }
.badge-info { background: var(--info-bg); color: #0E7490; }
.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-secondary { background: var(--border-light); color: var(--text-secondary); }
.badge-count { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }

/* ===================== CALLOUTS ===================== */
.callout { border-radius: 8px; padding: 12px 16px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.callout i { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.callout-info { background: var(--info-bg); color: #0E7490; }
.callout-warning { background: var(--warning-bg); color: #92400E; border: 1px solid rgba(211,144,15,0.35); }

/* ===================== BUTTONS ===================== */
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); color: var(--accent-ink); border: none; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; transition: filter 0.15s, box-shadow 0.15s; box-shadow: 0 1px 3px rgba(var(--accent-rgb),0.3); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); box-shadow: 0 2px 10px rgba(var(--accent-rgb),0.4); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; transition: all 0.15s; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-success { background: var(--success); color: #fff; border: none; padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.btn-sm-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.btn-sm-link:hover { text-decoration: underline; }

/* ===================== CHECK-IN WIDGET ===================== */
.checkin-widget { background: linear-gradient(135deg, #0b0a1f 0%, var(--accent-mid) 55%, var(--accent) 100%); border-radius: 10px; padding: 24px; color: #fff; position: relative; overflow: hidden; }
.checkin-widget::after { content: ''; position: absolute; top: -40%; right: -10%; width: 280px; height: 280px; background: radial-gradient(circle, rgba(var(--accent-gold-rgb),0.25) 0%, rgba(var(--accent-gold-rgb),0) 70%); pointer-events: none; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(var(--accent-gold-rgb),0.18); border: 1px solid rgba(var(--accent-gold-rgb),0.4); color: var(--accent-gold-pale); padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; margin-bottom: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-gold); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.clock-display { font-size: 40px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.clock-date { font-size: 13px; opacity: 0.6; margin-top: 2px; }
.clock-big { font-size: 48px; font-weight: 700; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.checkin-info { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; opacity: 0.65; flex-wrap: wrap; }
.checkin-info i { font-size: 13px; vertical-align: -1px; margin-right: 2px; }
.checkin-actions { margin-top: 16px; position: relative; }
.checkin-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; border-radius: 10px; border: none; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.checkin-btn.check-in { background: linear-gradient(135deg, var(--accent-gold-soft) 0%, var(--accent-gold-dark) 100%); color: var(--accent-gold-ink); box-shadow: 0 4px 14px rgba(var(--accent-gold-rgb),0.35), inset 0 1px 0 rgba(255,255,255,0.35); }
.checkin-btn.check-in:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(var(--accent-gold-rgb),0.45), inset 0 1px 0 rgba(255,255,255,0.35); }
.checkin-btn.check-out { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.checkin-btn.check-out:hover { background: rgba(255,255,255,0.25); }
.checkin-btn.done { background: rgba(var(--accent-gold-rgb),0.2); color: var(--accent-gold-pale); font-size: 13px; pointer-events: none; }

/* ===================== LEAVE BALANCE ===================== */
.leave-bal-row { margin-bottom: 14px; }
.leave-bal-info { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.leave-type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.leave-type-name { font-size: 13px; font-weight: 500; flex: 1; }
.leave-bal-nums { font-size: 12px; color: var(--text-muted); }
.leave-bar { background: var(--border-light); border-radius: 4px; height: 5px; overflow: hidden; }
.leave-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* ===================== ATTENDANCE CALENDAR ===================== */
.att-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-day-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; padding: 3px; }
.cal-day { aspect-ratio: 1; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; cursor: default; }
.cal-day.present { background: var(--success-bg); color: #15803D; }
.cal-day.absent { background: var(--danger-bg); color: #B91C1C; }
.cal-day.on_leave { background: var(--warning-bg); color: #B45309; }
.cal-day.wfh { background: var(--info-bg); color: #0E7490; }
.cal-day.holiday { background: #E3E5FE; color: #3730C4; }
.cal-day.weekend { opacity: 0.35; }
.cal-day.future { opacity: 0.3; }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: -1px; font-weight: 700; }
.cal-day.empty { background: transparent; }
.cal-legend { font-size: 11px; font-weight: 500; }
.cal-legend.present { color: #15803D; }
.cal-legend.absent { color: #B91C1C; }
.cal-legend.leave { color: #B45309; }
.cal-legend.wfh { color: #0E7490; }
.cal-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cal-sum-item { border-radius: 8px; padding: 8px; text-align: center; }
.cal-sum-item .num { font-size: 18px; font-weight: 700; }
.cal-sum-item .lbl { font-size: 11px; }
.cal-sum-item.present { background: var(--success-bg); color: #15803D; }
.cal-sum-item.absent { background: var(--danger-bg); color: #B91C1C; }
.cal-sum-item.leave { background: var(--warning-bg); color: #B45309; }
.cal-sum-item.wfh { background: var(--info-bg); color: #0E7490; }

/* ===================== TABLES ===================== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 10px 16px; border-bottom: 1px solid var(--border); text-align: left; background: var(--surface); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; color: var(--text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface); }
.emp-cell { display: flex; align-items: center; gap: 10px; }
.emp-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* ===================== APPROVALS ===================== */
.approval-card { padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.approval-card:last-child { border-bottom: none; }
.approval-card.pending { border-left: 3px solid var(--warning); padding-left: 17px; }
.approval-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.approval-title { font-size: 14px; font-weight: 600; }
.approval-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.approval-reason { font-size: 13px; color: var(--text-secondary); font-style: italic; }
.approval-comment { margin-top: 12px; }
.approval-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ===================== NOTIFICATIONS ===================== */
.notif-dropdown { width: 340px; border-radius: 10px; border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,0.12); background: var(--card-bg); }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text-primary); transition: background 0.1s; border-bottom: 1px solid var(--border-light); }
.notif-item:last-of-type { border-bottom: none; }
.notif-item:hover { background: var(--surface); }
.notif-item.unread { background: var(--accent-light); }
.notif-icon-wrap { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.notif-icon-wrap.type-leave { background: var(--warning-bg); color: var(--warning); }
.notif-icon-wrap.type-wfh { background: var(--info-bg); color: var(--info); }
.notif-icon-wrap.type-wfs { background: var(--accent-light); color: var(--accent); }
.notif-icon-wrap.type-attendance { background: var(--danger-bg); color: var(--danger); }
.notif-icon-wrap.type-system, .notif-icon-wrap.type-holiday { background: var(--accent-light); color: var(--accent); }
.notif-icon-wrap.type-payroll { background: var(--success-bg); color: var(--success); }
.notif-icon-wrap.type-shift { background: var(--info-bg); color: var(--info); }
.notif-text { font-size: 13px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-footer { display: block; text-align: center; padding: 12px; font-size: 13px; color: var(--accent); text-decoration: none; border-top: 1px solid var(--border); }
.notif-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; }

/* ===================== APPEARANCE / THEME SWITCHER ===================== */
/* Swatch gradients are intentionally hardcoded to each theme's own colors
   (not the live --accent tokens) since all three previews must render
   simultaneously regardless of which theme is currently active. */
.theme-dropdown { width: 220px; }
.theme-dropdown-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 6px 8px 8px; }
.theme-option { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: none; padding: 8px; border-radius: 6px; cursor: pointer; color: var(--text-primary); font-size: 13px; text-align: left; transition: background 0.1s; }
.theme-option:hover { background: var(--surface-2); }
.theme-option.active { background: var(--accent-light); }
.theme-swatch { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.2); }
.theme-swatch-violet { background: linear-gradient(135deg, #5D4FD1 0%, #E8B94A 100%); }
.theme-swatch-ocean { background: linear-gradient(135deg, #2E5CD9 0%, #22D3EE 100%); }
.theme-swatch-ember { background: linear-gradient(135deg, #C1571F 0%, #E8B94A 100%); }
.theme-option-label { flex: 1; }
.theme-check { font-size: 15px; opacity: 0; color: var(--accent); }
.theme-option.active .theme-check { opacity: 1; }

/* ===================== PAGE ELEMENTS ===================== */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.alert-banner { background: var(--warning-bg); border: 1px solid #FCD34D; border-radius: 10px; padding: 12px 18px; font-size: 13px; color: #92400E; display: flex; align-items: center; gap: 10px; }
.alert-banner a { color: var(--warning); font-weight: 600; }

/* Dashboard: Company Updates widget (announcements + pulse survey nudge) */
.dash-survey-nudge { display: flex; align-items: center; gap: 12px; background: rgba(var(--accent-rgb),0.1); border: 1px solid rgba(var(--accent-rgb),0.25); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.dash-survey-nudge i { font-size: 22px; color: var(--accent); }
.dash-announcement-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.dash-announcement-row:last-child { border-bottom: none; padding-bottom: 0; }
.dash-announcement-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.dash-announcement-body { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.dash-announcement-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Shift time-of-day coloring reused on the dashboard's week strip */
.shift-label.period-morning { color: #ffb74d; }
.shift-label.period-afternoon { color: #4dabff; }
.shift-label.period-evening { color: #ff7063; }
.shift-label.period-night { color: #a78bfa; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; color: var(--success); }
.empty-state h5 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }

/* ===================== FORMS ===================== */
/* Safety net ahead of the more specific .form-control/.form-select rules
   below (class selectors always outrank this plain-element one, so it never
   fights them) — guarantees typed text is white even on an input/textarea/
   select that ends up with neither class, like the topbar search box,
   instead of depending on every current and future field remembering to
   carry one of those classes. */
input, textarea, select { color: var(--text-primary); }
::selection { background: var(--accent); color: #ffffff; }
.form-control { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 13px; padding: 8px 12px; transition: border-color 0.15s; color-scheme: dark; }
/* Bootstrap's own .form-control:focus resets color/background-color to its
   light-theme defaults (near-black text, white background) — a :focus
   compound selector outranks our plain .form-control by specificity alone,
   so it wins the instant a field is focused regardless of source order,
   then loses again on blur once :focus stops applying. That's exactly why
   typed text looked black only while actively typing and corrected itself
   the moment focus moved elsewhere: two different rules were painting it,
   not one wrong color. Repeating color/background-color here at the same
   specificity beats it back using cascade order (main.css loads after
   Bootstrap's CDN link). */
.form-control:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.25); outline: none;
  color: var(--text-primary); background-color: var(--card-bg);
}
/* crispy-bootstrap5 renders every single <select> (ChoiceField/
   ModelChoiceField) with class="form-select", not "form-control" — a
   completely different class the app never had a rule for, so every one of
   these dropdowns (Department, Role, Manager, Gender, ...) has always
   rendered as an unstyled native white select regardless of theme. Manually
   -written templates that hardcode class="form-control" on their <select>
   tags were never affected — this is specifically the crispy-rendered ones. */
.form-select {
  background-color: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-primary); font-size: 13px; padding: 8px 32px 8px 12px; cursor: pointer;
  transition: border-color 0.15s; color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2382869f' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
/* Same Bootstrap .form-select:focus specificity issue as .form-control:focus
   above — repeat color/background-color here too. */
.form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.25); outline: none;
  color: var(--text-primary); background-color: var(--card-bg);
}
/* Bootstrap's own .form-control:disabled/.form-select:disabled ship a
   light-theme background/text color at the same :disabled specificity as
   these — since neither rule used to declare background-color/color itself,
   Bootstrap's values won unopposed, rendering pale text on a pale-gray box
   regardless of this app's dark theme (nearly unreadable, e.g. the locked
   "Contractor"/Supervisor field on the Worker form). Declaring them
   explicitly here, same as the plain .form-control/.form-select rules
   above, fixes that without touching the opacity/cursor treatment. */
.form-control:disabled, .form-select:disabled {
  background-color: var(--card-bg); color: var(--text-secondary);
  opacity: 0.75; cursor: not-allowed;
}
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
/* Bootstrap ships its own `.form-control::placeholder` rule using
   --bs-secondary-color, which this app never overrides (it isn't part of
   this token system) and stays at Bootstrap's light-theme default — a
   near-black, low-opacity color. `.form-control::placeholder` is MORE
   SPECIFIC than a bare `::placeholder`, so it silently won over the
   generic rule below on every actual input/textarea in the app (which all
   carry .form-control) regardless of source order — the exact same class
   of bug already worked around for .form-text and .text-muted just above/
   below (Bootstrap setting its own explicit light-theme color rather than
   inheriting), just missed here because a plain ::placeholder looked like
   enough. Needs !important, not just higher specificity, since Bootstrap's
   rule itself carries no !important to lose a fair specificity fight against. */
.form-control::placeholder, .form-select::placeholder { color: var(--text-muted) !important; opacity: 1; }
::placeholder { color: var(--text-muted); opacity: 1; }
select.form-control { cursor: pointer; }
/* Belt-and-suspenders on top of `html { color-scheme: dark }` above: some
   browsers still render <option> as plain black-on-white regardless of
   color-scheme unless it's styled directly (support for styling <option>
   backgrounds is spottier than for the <select> itself, but every evergreen
   browser honors at least these two properties on it). */
.form-control option, select option {
  background: var(--card-bg);
  color: var(--text-primary);
}
/* Chrome/Edge/Safari autofill (saved logins, browser-remembered values)
   ignores the element's own background/color and paints its own — almost
   always a light fill with black text — via internal UA styles that only
   these two non-standard, vendor-prefixed rules can override. The absurdly
   long transition-delay is the standard trick to stop the fill color from
   re-asserting itself after the (very fast) initial paint. */
.form-control:-webkit-autofill,
.form-control:-webkit-autofill:hover,
.form-control:-webkit-autofill:focus,
.form-control:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--card-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--card-bg) inset !important;
  caret-color: var(--text-primary);
  transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s;
}
/* Native date/time/datetime-local inputs render their filled segments
   (the actual typed dd/mm/yyyy/hh/mm digits, not the empty placeholder
   skeleton) through an internal Chromium shadow-DOM tree that ignores the
   plain `color` property once a value is entered — same root cause as the
   autofill block above, same fix: -webkit-text-fill-color on every field
   part, not just the input itself. Without this, typed values render in
   Chromium's UA-default black regardless of color-scheme or .form-control. */
.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"],
.form-control[type="month"],
.form-control[type="week"] {
  color-scheme: dark;
}
.form-control[type="date"]::-webkit-datetime-edit-fields-wrapper,
.form-control[type="time"]::-webkit-datetime-edit-fields-wrapper,
.form-control[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
.form-control[type="month"]::-webkit-datetime-edit-fields-wrapper,
.form-control[type="week"]::-webkit-datetime-edit-fields-wrapper,
.form-control[type="date"]::-webkit-datetime-edit-text,
.form-control[type="time"]::-webkit-datetime-edit-text,
.form-control[type="datetime-local"]::-webkit-datetime-edit-text,
.form-control[type="date"]::-webkit-datetime-edit-day-field,
.form-control[type="date"]::-webkit-datetime-edit-month-field,
.form-control[type="date"]::-webkit-datetime-edit-year-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-day-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-month-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-year-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-hour-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-minute-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-second-field,
.form-control[type="datetime-local"]::-webkit-datetime-edit-ampm-field,
.form-control[type="time"]::-webkit-datetime-edit-hour-field,
.form-control[type="time"]::-webkit-datetime-edit-minute-field,
.form-control[type="time"]::-webkit-datetime-edit-second-field,
.form-control[type="time"]::-webkit-datetime-edit-ampm-field,
.form-control[type="month"]::-webkit-datetime-edit-month-field,
.form-control[type="month"]::-webkit-datetime-edit-year-field,
.form-control[type="week"]::-webkit-datetime-edit-week-field,
.form-control[type="week"]::-webkit-datetime-edit-year-field {
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}
/* The little calendar/clock picker glyph itself defaults to a dark
   near-invisible icon against a dark field — invert it so it's visible. */
.form-control[type="date"]::-webkit-calendar-picker-indicator,
.form-control[type="time"]::-webkit-calendar-picker-indicator,
.form-control[type="datetime-local"]::-webkit-calendar-picker-indicator,
.form-control[type="month"]::-webkit-calendar-picker-indicator,
.form-control[type="week"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.4);
  cursor: pointer;
}
/* Bootstrap sets its own explicit (light-theme) color on .form-text rather
   than inheriting — needs its own override, same root cause as .card-body. */
.form-text { color: var(--text-muted) !important; }
.form-check-input { accent-color: var(--accent); }
.form-check-label { color: var(--text-primary); font-size: 13px; }

/* ===================== UTILITIES ===================== */
.text-muted { color: var(--text-muted) !important; }
.text-secondary-color { color: var(--text-secondary); }
.fw-600 { font-weight: 600; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ===================== BOOTSTRAP OVERRIDES ===================== */
/* Bootstrap ships light-mode defaults for these components; without
   overrides they'd render as white panels against the dark theme. */
.dropdown-menu { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.35); padding: 6px; }
.dropdown-item { color: var(--text-secondary); font-size: 13px; border-radius: 6px; padding: 8px 12px; display: flex; align-items: center; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text-primary); }
.dropdown-item.text-danger { color: var(--danger) !important; }
.dropdown-item.text-danger:hover { background: var(--danger-bg); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 6px 0; }

.modal-content { background: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: 10px; }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { color: var(--text-primary); font-weight: 600; }
.modal-header .btn-close, .notif-dropdown .btn-close { filter: invert(1) grayscale(1) brightness(1.8); opacity: 0.6; }
.modal-header .btn-close:hover, .notif-dropdown .btn-close:hover { opacity: 1; }

.alert { border-radius: 10px; border: 1px solid transparent; font-size: 13px; padding: 12px 16px; }
.alert-success { background: var(--success-bg); color: #15803D; }
.alert-danger, .alert-error { background: var(--danger-bg); color: #B91C1C; }
.alert-warning { background: var(--warning-bg); color: #92400E; }
.alert-info { background: var(--info-bg); color: #0E7490; }

.pagination { gap: 4px; }
.page-item .page-link { background: var(--card-bg); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; border-radius: 6px !important; margin: 0; }
.page-item .page-link:hover { background: var(--surface-2); color: var(--text-primary); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.page-item.disabled .page-link { background: transparent; color: var(--text-muted); opacity: 0.5; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== RESPONSIVE ===================== */
/* Three tiers — Desktop (>992px, default styles above: sidebar pinned),
   Tablet (768–992px) and Mobile (<768px). Both Tablet and Mobile run the
   sidebar as an off-canvas drawer: a permanently pinned 240px rail eats
   too large a share of a tablet-portrait or phone viewport, so it slides
   in over a dimmed backdrop instead (toggled by #sidebar-toggle, which is
   hidden ≥992px — see .d-lg-none on that button in base/layout.html).
   Mobile additionally drops to single-column grids and tighter spacing. */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-backdrop { display: block; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .kpi-grid, .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .kpi-grid, .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .page-body { padding: 16px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .icon-btn { width: 32px; height: 32px; font-size: 16px; }
  .cal-summary { grid-template-columns: repeat(2, 1fr); gap: 6px; }
}
@media (max-width: 480px) {
  .kpi-grid, .kpi-grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 10px; }
  .topbar-actions { gap: 4px; }
}

/* ===================== GLASSMORPHISM ===================== */
/* A fixed, vivid gradient sits behind every page so the frosted-glass blur
   on top of it actually has something to diffuse — flat glass over a flat
   background just looks like a slightly duller solid panel. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, rgba(var(--accent-rgb),0.55) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(var(--accent-gold-rgb),0.30) 0%, transparent 50%),
    radial-gradient(circle at 25% 90%, rgba(var(--accent-rgb),0.35) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(224,69,90,0.22) 0%, transparent 40%),
    linear-gradient(160deg, #0b0c17 0%, #14152a 45%, #0d0e1c 100%);
  background-attachment: fixed;
}

.sidebar {
  background: linear-gradient(180deg, rgba(28,24,58,0.6) 0%, rgba(16,17,27,0.6) 40%, rgba(16,17,27,0.6) 100%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-right: 1px solid rgba(255,255,255,0.09);
  box-shadow: inset -1px 0 0 rgba(var(--accent-rgb),0.18), 12px 0 40px rgba(0,0,0,0.35);
}
.sidebar-logo, .sidebar-footer { border-color: rgba(255,255,255,0.08); }

.topbar {
  background: rgba(25,26,41,0.5);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.card, .kpi-card, .insight-card {
  background: rgba(25,26,41,0.5);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.05);
}
.card-header, .card-footer { border-color: rgba(255,255,255,0.08); background: transparent; }
.data-table th { background: rgba(255,255,255,0.03); }
.data-table tr:hover td { background: rgba(255,255,255,0.04); }

.dropdown-menu, .notif-dropdown {
  background: rgba(22,23,37,0.72);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 16px 48px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}

.modal-content {
  background: rgba(22,23,37,0.78);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.form-control {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
}
.form-control:focus { background: rgba(255,255,255,0.06); }

.btn-outline {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.btn-outline:hover { background: rgba(var(--accent-rgb),0.10); }

.search-wrap { background: rgba(255,255,255,0.04); backdrop-filter: blur(6px); }
.icon-btn { background: rgba(255,255,255,0.03); }
.checkin-widget { box-shadow: 0 12px 40px rgba(var(--accent-rgb),0.4), inset 0 1px 0 rgba(255,255,255,0.12); }

/* ===================== PAYROLL THEME ===================== */
/* A deliberately distinct "money" identity (emerald/gold instead of the
   global indigo accent), scoped to a wrapper class so it never touches the
   root variables every other page's badges/KPIs/calendar rely on — same
   principle as .checkin-widget's own bespoke gradient above. */
.payroll-theme {
  --payroll-accent: #17C997;
  --payroll-accent-dark: #0EA377;
  --payroll-accent-light: rgba(23,201,151,0.16);
  --payroll-gold: #E8B84B;
}
.payroll-theme .page-header h5 { position: relative; padding-left: 14px; }
.payroll-theme .page-header h5::before {
  content: ''; position: absolute; left: 0; top: 2px; bottom: 2px; width: 4px;
  border-radius: 3px; background: linear-gradient(180deg, var(--payroll-accent), var(--payroll-gold));
}
.payroll-theme .btn-primary {
  background: linear-gradient(135deg, var(--payroll-accent) 0%, var(--payroll-accent-dark) 100%);
  box-shadow: 0 1px 3px rgba(23,201,151,0.35);
}
.payroll-theme .btn-primary:hover { box-shadow: 0 2px 10px rgba(23,201,151,0.45); }
.payroll-theme .btn-outline:hover { border-color: var(--payroll-accent); color: var(--payroll-accent); }
.payroll-theme .kpi-card:hover, .payroll-theme .insight-card:hover { box-shadow: 0 4px 16px rgba(23,201,151,0.18); }
.payroll-theme .kpi-icon.money { background: var(--payroll-accent-light); color: var(--payroll-accent); }
.payroll-theme .kpi-icon.gold { background: rgba(232,184,75,0.16); color: var(--payroll-gold); }
.payroll-theme .fw-700.text-payroll, .payroll-theme .text-payroll { color: var(--payroll-accent); }
.payroll-theme .badge-payroll-statutory {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; background: rgba(232,184,75,0.16); color: var(--payroll-gold);
  border: 1px solid rgba(232,184,75,0.3);
}

/* Draft -> Review -> Approved -> Processed workflow stepper */
.payroll-stepper { display: flex; align-items: center; padding: 6px 0; }
.payroll-step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.payroll-step-dot {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; background: rgba(255,255,255,0.06); color: var(--text-muted);
  border: 2px solid var(--border); z-index: 1; transition: all 0.2s;
}
.payroll-step.done .payroll-step-dot { background: var(--payroll-accent); border-color: var(--payroll-accent); color: #06251c; }
.payroll-step.current .payroll-step-dot { background: var(--payroll-accent-light); border-color: var(--payroll-accent); color: var(--payroll-accent); box-shadow: 0 0 0 4px rgba(23,201,151,0.14); }
.payroll-step-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-top: 8px; text-align: center; }
.payroll-step.done .payroll-step-label, .payroll-step.current .payroll-step-label { color: var(--text-primary); }
.payroll-step-line { position: absolute; top: 17px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.payroll-step:last-child .payroll-step-line { display: none; }
.payroll-step.done .payroll-step-line { background: var(--payroll-accent); }

/* Tabs (Overview / Payslips etc.) */
.payroll-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.payroll-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s;
}
.payroll-tab:hover { color: var(--text-primary); }
.payroll-tab.active { color: var(--payroll-accent); border-bottom-color: var(--payroll-accent); font-weight: 600; }

/* Employee-facing "My Payslips" card grid (distinct from the plain data-table look) */
.payslip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.payslip-card {
  background: rgba(25,26,41,0.5); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.10); border-radius: 12px; padding: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.05);
  border-top: 3px solid var(--payroll-accent);
}
.payslip-card .month { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.payslip-card .net { font-size: 24px; font-weight: 800; color: var(--payroll-accent); margin: 10px 0 4px; }
.payslip-card .meta { font-size: 12px; color: var(--text-muted); }
.payslip-card .actions { display: flex; gap: 8px; margin-top: 14px; }

/* "My Pay"-style master-detail layout: period list + expandable breakdown */
.mypay-list { max-height: 640px; overflow-y: auto; }
.mypay-row { display: block; padding: 12px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; border-left: 3px solid transparent; transition: background 0.15s; }
.mypay-row:last-child { border-bottom: none; }
.mypay-row:hover { background: rgba(255,255,255,0.03); }
.mypay-row.active { background: var(--payroll-accent-light); border-left-color: var(--payroll-accent); }
.mypay-row-date { font-size: 13.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.mypay-row-figures { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); gap: 10px; }
.mypay-row-figures strong { color: var(--text-secondary); font-weight: 600; }

.payroll-tab.mypay-tab-disabled { opacity: 0.4; cursor: not-allowed; }

.mypay-expand { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.mypay-expand summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-size: 13.5px; font-weight: 600; list-style: none; }
.mypay-expand summary::-webkit-details-marker { display: none; }
.mypay-expand summary .mypay-amount { margin-left: auto; margin-right: 8px; font-weight: 700; }
.mypay-expand summary::after {
  content: ''; width: 7px; height: 7px; flex-shrink: 0;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg); transition: transform 0.15s; margin-right: 2px;
}
.mypay-expand[open] summary::after { transform: rotate(-135deg); }
.mypay-expand table { margin: 0 14px 12px; width: calc(100% - 28px); }
.mypay-static .mypay-summary-row { padding: 12px 14px; }
.mypay-summary-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.mypay-summary-row .mypay-amount { margin-left: auto; font-weight: 700; }
.mypay-netpay { border-color: var(--payroll-accent); background: var(--payroll-accent-light); }
.mypay-netpay .mypay-summary-row { color: var(--payroll-accent); font-weight: 800; }

.mypay-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.mypay-dot.earning { background: #4dabff; }
.mypay-dot.statutory { background: #E85D75; }
.mypay-dot.other { background: #9575ff; }
.mypay-dot.tax { background: #E8B84B; }
.mypay-dot.netpay { background: var(--payroll-accent); }

/* ===================== VIVID ACCENT TEXT ===================== */
/* The glass surfaces above are deliberately neutral (frosted, low-saturation)
   so they don't fight with content — vividness instead lives in the numbers
   themselves. Every stat/value picks up a saturated hue from this palette,
   keyed off the semantic color class already on its sibling icon
   (.kpi-icon.green, .insight-icon.info, etc.) so this is a pure CSS layer:
   no template changes, and it cascades to every page that uses these shared
   components (kpi-grid / insight-grid appear across dashboard, attendance,
   leave, reports, payroll, monitoring, performance...). */
:root {
  --vivid-cyan: #22D3EE;
  --vivid-blue: #818CF8;
  --vivid-purple: #C084FC;
  --vivid-pink: #FB7185;
  --vivid-amber: #FBBF24;
  --vivid-green: #34D399;
}

.kpi-value, .insight-value { color: var(--text-primary); transition: color 0.15s; }

.kpi-icon.green ~ div .kpi-value,
.insight-icon.green ~ div .insight-value { color: var(--vivid-green); text-shadow: 0 0 18px rgba(52,211,153,0.35); }
.kpi-icon.red ~ div .kpi-value { color: var(--vivid-pink); text-shadow: 0 0 18px rgba(251,113,133,0.35); }
.kpi-icon.amber ~ div .kpi-value,
.insight-icon.amber ~ div .insight-value { color: var(--vivid-amber); text-shadow: 0 0 18px rgba(251,191,36,0.35); }
.kpi-icon.teal ~ div .kpi-value,
.insight-icon.info ~ div .insight-value { color: var(--vivid-cyan); text-shadow: 0 0 18px rgba(34,211,238,0.35); }
.kpi-icon.blue ~ div .kpi-value { color: var(--vivid-blue); text-shadow: 0 0 18px rgba(129,140,248,0.35); }
.kpi-icon.purple ~ div .kpi-value,
.insight-icon.accent ~ div .insight-value { color: var(--vivid-purple); text-shadow: 0 0 18px rgba(192,132,252,0.35); }
/* .insight-icon.muted stays on --text-primary above — "no streak yet" etc.
   shouldn't glow like an achieved stat. */

.health-ring-inner { color: var(--vivid-cyan); text-shadow: 0 0 16px rgba(34,211,238,0.4); }
.mypay-row-figures strong { color: var(--vivid-green); }
.payslip-card .net { text-shadow: 0 0 18px rgba(23,201,151,0.4); }

/* Card/section titles get a small rotating accent dot rather than colored
   text — keeps body copy fully legible while still reading as "vivid" chrome. */
.card-header .card-title { position: relative; padding-left: 14px; }
.card-header .card-title::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--vivid-blue);
  box-shadow: 0 0 8px currentColor;
}
.page-body .card:nth-of-type(4n+1) .card-header .card-title::before { background: var(--vivid-cyan); }
.page-body .card:nth-of-type(4n+2) .card-header .card-title::before { background: var(--vivid-purple); }
.page-body .card:nth-of-type(4n+3) .card-header .card-title::before { background: var(--vivid-amber); }
.page-body .card:nth-of-type(4n+4) .card-header .card-title::before { background: var(--vivid-pink); }
.payroll-theme .card-header .card-title { padding-left: 0; } /* keeps its own emerald/gold identity, no dot */
.payroll-theme .card-header .card-title::before { display: none; }

/* ===================== TEAM CHAT PANEL ===================== */
.chat-toggle-badge { position: absolute; top: -4px; right: -4px; }
#chat-toggle-btn { position: relative; }

.chat-panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; }
.chat-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw;
  background: var(--card-bg); border-left: 1px solid var(--border);
  box-shadow: -16px 0 48px rgba(0,0,0,0.45);
  z-index: 1000; display: flex; flex-direction: column;
}
.chat-panel-header {
  display: flex; align-items: center; gap: 8px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.chat-panel-title { font-size: 15px; font-weight: 600; color: var(--text-primary); flex: 1; }
.chat-panel-header-actions { display: flex; gap: 6px; }

.chat-panel-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.chat-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 13px; }

.chat-conv-list { display: flex; flex-direction: column; overflow-y: auto; }
.chat-conv-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: none;
  border-bottom: 1px solid var(--border-light); background: transparent; cursor: pointer;
  text-align: left; color: var(--text-primary); font-size: 13px; width: 100%;
}
.chat-conv-item:hover { background: var(--surface); }
.chat-conv-icon { color: var(--text-muted); font-size: 16px; flex-shrink: 0; }
.chat-conv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-thread-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.chat-bubble.own { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-radius: 12px 12px 2px 12px; }
.chat-bubble.other { align-self: flex-start; background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: 12px 12px 12px 2px; }
.chat-bubble-sender { font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.chat-bubble-time { font-size: 10px; opacity: 0.7; margin-top: 4px; text-align: right; }

.chat-composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-composer-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; color: var(--text-primary); outline: none;
}
.chat-composer-input:focus { border-color: var(--accent); }
.chat-send-btn { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chat-send-btn:hover { background: var(--accent); filter: brightness(1.1); color: var(--accent-ink); }

.chat-people-picker { flex: 1; display: flex; flex-direction: column; padding: 12px 16px; gap: 10px; overflow-y: auto; }
.chat-people-search, .chat-group-name {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; color: var(--text-primary); outline: none; width: 100%;
}
.chat-people-search:focus, .chat-group-name:focus { border-color: var(--accent); }
.chat-people-selected { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-people-chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent-light);
  color: var(--accent); font-size: 12px; font-weight: 500; padding: 3px 8px 3px 10px; border-radius: 14px;
}
.chat-people-chip i { cursor: pointer; font-size: 12px; }
.chat-people-results { display: flex; flex-direction: column; gap: 2px; }
.chat-people-result {
  display: flex; align-items: center; gap: 10px; padding: 8px; border: none; background: transparent;
  border-radius: 8px; cursor: pointer; text-align: left; width: 100%;
}
.chat-people-result:hover { background: var(--surface); }
.chat-people-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.chat-people-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.chat-people-designation { font-size: 11px; color: var(--text-muted); }

@media (max-width: 480px) {
  .chat-panel { width: 100vw; }
}
