/* ─────────────────────────────────────────────────────────────────────────
   Lumen HRMS — Design tokens (exact copy from reference + legacy compat)
   ───────────────────────────────────────────────────────────────────────── */

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

:root {
  /* Brand */
  --accent: #4f46e5;
  --accent-700: #4338ca;
  --accent-50: #eef2ff;
  --accent-100: #e0e7ff;
  --accent-contrast: #ffffff;

  /* Surfaces (light theme) */
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f3f4f8;
  --sidebar-bg: #0f1226;
  --sidebar-fg: #c7c9e0;
  --sidebar-fg-muted: #7a7e9e;
  --sidebar-active: rgba(255, 255, 255, 0.08);

  /* Text */
  --text: #0b0d20;
  --text-2: #4a4e6b;
  --text-3: #8a8fa8;
  --text-inv: #ffffff;

  /* Borders */
  --border: #e7e8ef;
  --border-2: #eef0f5;
  --border-strong: #d6d8e1;

  /* States */
  --success: #16a34a;
  --success-bg: #ecfdf5;
  --success-text: #064e3b;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-text: #78350f;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-text: #7f1d1d;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-text: #0c4a6e;

  /* Charts */
  --chart-1: #4f46e5;
  --chart-2: #06b6d4;
  --chart-3: #f59e0b;
  --chart-4: #ec4899;
  --chart-5: #10b981;
  --chart-6: #8b5cf6;

  /* Type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --font-display: 'Inter', system-ui, sans-serif;
  --font: var(--font-sans);

  /* Radius / shadow */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --radius-sm: var(--r-sm);
  --radius:    var(--r-md);
  --radius-lg: var(--r-lg);
  --shadow-sm: 0 1px 2px rgba(15, 18, 38, 0.04), 0 1px 1px rgba(15, 18, 38, 0.02);
  --shadow-md: 0 4px 14px rgba(15, 18, 38, 0.06), 0 1px 2px rgba(15, 18, 38, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 18, 38, 0.15), 0 4px 10px rgba(15, 18, 38, 0.05);
  --shadow-xs: var(--shadow-sm);
  --shadow:    var(--shadow-md);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;

  /* Legacy aliases */
  --primary:       var(--accent);
  --primary-dark:  var(--accent-700);
  --primary-light: var(--accent-50);
  --primary-text:  #312e81;

  /* Legacy slate scale */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
}

[data-theme='dark'] {
  --bg: #0a0c1a;
  --surface: #11142a;
  --surface-2: #161936;
  --surface-3: #1a1e3e;
  --sidebar-bg: #07091a;
  --sidebar-fg: #aaaecd;
  --sidebar-fg-muted: #5b5f80;
  --sidebar-active: rgba(255, 255, 255, 0.06);

  --text: #f0f1f7;
  --text-2: #b4b7d0;
  --text-3: #7a7e9e;

  --border: #232852;
  --border-2: #1e2347;
  --border-strong: #2c3160;

  --accent-50: #1e1f4a;
  --accent-100: #2a2d6b;

  --success-bg: rgba(16, 163, 74, 0.12);
  --warning-bg: rgba(217, 119, 6, 0.12);
  --danger-bg: rgba(220, 38, 38, 0.12);
  --info-bg: rgba(2, 132, 199, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}
.app[data-sidebar='collapsed'] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.main {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  min-width: 0;
  background: var(--bg);
  overflow: hidden;
}
.page {
  overflow-y: auto;
  padding: 24px 28px 60px;
}

/* Legacy app layout aliases */
body.app-body { background: var(--bg); }
.app-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.main-area { min-height: 100vh; display: flex; flex-direction: column; }
.page-content { padding: 24px 28px 60px; flex: 1; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sb {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sb-logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}
.sb-name { font-weight: 700; color: white; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.sb-name-sub { font-size: 11px; color: var(--sidebar-fg-muted); margin-top: -2px; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }
.sb-section { margin-top: 16px; }
.sb-section:first-child { margin-top: 0; }
.sb-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--sidebar-fg-muted); text-transform: uppercase;
  padding: 8px 12px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px 12px;
  border-radius: 8px;
  color: var(--sidebar-fg);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.12s;
  white-space: nowrap;
  text-align: left;
  text-decoration: none;
}
.sb-item:hover { background: var(--sidebar-active); color: white; }
.sb-item.active {
  background: var(--accent);
  color: white;
}
.sb-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.sb-item svg { flex-shrink: 0; }
.sb-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
  font-weight: 600;
}
.sb-item.active .sb-badge { background: rgba(255,255,255,0.25); }

.sb-foot {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 12px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.sb-foot .avatar { flex-shrink: 0; }
.sb-foot-meta { min-width: 0; flex: 1; }
.sb-foot-name { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot-role { font-size: 11px; color: var(--sidebar-fg-muted); }

[data-sidebar='collapsed'] .sb-name,
[data-sidebar='collapsed'] .sb-name-sub,
[data-sidebar='collapsed'] .sb-item span:not(.sb-badge),
[data-sidebar='collapsed'] .sb-section-label,
[data-sidebar='collapsed'] .sb-foot-meta { display: none; }
[data-sidebar='collapsed'] .sb-item { justify-content: center; }
[data-sidebar='collapsed'] .sb-brand { justify-content: center; padding: 0; }
[data-sidebar='collapsed'] .sb-foot { justify-content: center; }

/* ─── Topbar ────────────────────────────────────────────────────────────── */
.tb {
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 100;
}
.tb-search {
  flex: 0 1 380px;
  position: relative;
}
.tb-search input {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px 7px 34px;
  font-size: 13px;
  outline: none;
  transition: all 0.12s;
  color: var(--text);
}
.tb-search input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-50); }
.tb-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.tb-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.tb-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
  color: var(--text-3);
}
.tb-spacer { flex: 1; }
.tb-actions { display: flex; align-items: center; gap: 4px; }
.tb-icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-2);
  position: relative;
  transition: all 0.12s;
}
.tb-icon-btn:hover { background: var(--surface-3); color: var(--text); }
.tb-icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}
.tb-toggle {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 8px; color: var(--text-2);
  transition: all 0.12s; flex-shrink: 0;
}
.tb-toggle:hover { background: var(--surface-3); color: var(--text); }
.tb-divider { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }
.tb-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  transition: all 0.12s;
  cursor: pointer;
}
.tb-profile:hover { background: var(--surface-3); }
.tb-profile-meta { line-height: 1.15; text-align: right; }
.tb-profile-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tb-profile-role { font-size: 11px; color: var(--text-3); }
.tb-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: grid; place-items: center;
  color: white; font-size: 11px; font-weight: 700;
}
.tb-live {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3);
  white-space: nowrap;
}
.tb-live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  animation: pulse 2s infinite; flex-shrink: 0;
}

/* ─── Page header ───────────────────────────────────────────────────────── */
.page-h {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.page-h-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 4px;
}
.page-h-sub { color: var(--text-3); font-size: 13px; }
.page-h-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.page-h-left {}
.crumb {
  font-size: 12px; color: var(--text-3); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.crumb a:hover { color: var(--text); }

/* Legacy page header aliases */
.page-header { margin-bottom: 22px; }
.page-header-row { display: flex; justify-content: space-between; align-items: center; }
.page-title { font-size: 23px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.page-subtitle { font-size: 13px; color: var(--text-3); margin-top: 3px; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all 0.12s;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-700); border-color: var(--accent-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger {
  background: var(--danger); color: white; border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-icon { padding: 7px; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-lg { padding: 10px 16px; font-size: 14px; }

/* ─── Cards & panels ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-2);
  gap: 12px;
}
.card-h-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-h-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-b { padding: 18px; }
.card-b-flush { padding: 0; }

/* ─── KPI tiles ─────────────────────────────────────────────────────────── */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { font-size: 12px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-val { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; color: var(--text); line-height: 1; }
.kpi-val .unit { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.kpi-delta { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-spark { position: absolute; right: 14px; bottom: 14px; opacity: 0.7; pointer-events: none; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 10px;
}

/* ─── Pills / badges ────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-accent { background: var(--accent-50); color: var(--accent); }

/* ─── Avatar ────────────────────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  color: white;
  flex-shrink: 0;
  position: relative;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }
.avatar .status {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--surface);
}
.avatar .status.away { background: var(--warning); }
.avatar .status.off { background: var(--text-3); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more {
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
}

/* ─── Tables ────────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-2);
  color: var(--text);
  vertical-align: middle;
}
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tbody tr.selected td { background: var(--accent-50); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }

/* ─── Form controls ─────────────────────────────────────────────────────── */
.field {
  display: block;
}
.field-label { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; display: block; }
.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all 0.12s;
  -webkit-appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}
.input:disabled, .select:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.input-group {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.input-group .input { border: 0; border-radius: 0; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }

.seg {
  display: inline-flex;
  background: var(--surface-3);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: 6px;
  transition: all 0.12s;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ─── Tabs ──────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs button {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.12s;
  display: flex; align-items: center; gap: 6px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tabs .count {
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.tabs button.active .count { background: var(--accent-50); color: var(--accent); }

/* ─── Live dot ─────────────────────────────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.6); }
  50% { box-shadow: 0 0 0 5px rgba(22,163,74,0); }
}

/* ─── Heatmap ──────────────────────────────────────────────────────────── */
.heatmap { display: grid; gap: 3px; }
.heatmap .cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-3);
  position: relative;
  transition: transform 0.1s;
}
.heatmap .cell:hover { transform: scale(1.15); z-index: 2; outline: 2px solid var(--accent); }
.heatmap-cell {
  height: 12px; border-radius: 3px; background: var(--surface-3);
  transition: transform 0.1s;
}
.heatmap-cell:hover { transform: scale(1.2); z-index: 2; outline: 2px solid var(--accent); }

/* ─── Drawer ───────────────────────────────────────────────────────────── */
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(15, 18, 38, 0.45);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  opacity: 0;
}
.drawer-scrim.open {
  display: block;
  animation: scrimIn 0.2s forwards;
}
@keyframes scrimIn { to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 580px; max-width: calc(100vw - 40px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(15, 18, 38, 0.12), -2px 0 8px rgba(15, 18, 38, 0.05);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer.open {
  transform: translateX(0);
}
@keyframes drawerIn { to { transform: translateX(0); } }
.drawer-h {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
}
.drawer-tabs {
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.drawer-b { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-f {
  padding: 12px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  flex-shrink: 0; background: var(--surface-2);
}

/* ─── Animated fade ─────────────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: slideUp 0.24s ease-out; }

/* ─── Grid helpers ──────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* ─── Utilities ─────────────────────────────────────────────────────────── */
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-3); }
.text-soft { color: var(--text-2); }
.font-mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.divider-v { width: 1px; background: var(--border); align-self: stretch; }
.shrink-0 { flex-shrink: 0; }

/* ─── Animated bars ─────────────────────────────────────────────────────── */
.bar { transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

/* ─────────────────────────────────────────────────────────────────────────
   Legacy compat — backward-compatible classes for existing pages
   ───────────────────────────────────────────────────────────────────────── */

/* Modal */
.modal {
  display: none; position: fixed; z-index: 1000;
  inset: 0; align-items: center; justify-content: center;
  background: rgba(15,18,38,0.55); backdrop-filter: blur(6px);
}
.modal[style*="flex"], .modal[style*="block"] { display: flex !important; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.modal-content {
  background: var(--surface); border-radius: var(--r-xl);
  width: 90%; max-width: 520px;
  box-shadow: 0 32px 64px -12px rgba(15,18,38,0.22), 0 8px 24px rgba(15,18,38,0.08);
  animation: modalIn 0.24s cubic-bezier(0.16,1,0.3,1);
  position: relative;
  display: flex; flex-direction: column;
  max-height: 90vh; overflow: hidden;
}
.modal-content.modal-wide { max-width: 780px; }
.modal-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); flex: 1; letter-spacing: -0.01em; }
.modal-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; font-weight: 400; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--surface-3); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.12s; flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-bd { flex: 1; overflow-y: auto; padding: 24px; }
.modal-ft {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0; background: var(--surface-2);
}
/* Legacy close button */
.close {
  position: absolute; top: 18px; right: 20px;
  font-size: 22px; color: var(--text-3); cursor: pointer; line-height: 1;
}
.close:hover { color: var(--text); }

/* Form group / control */
.form-group { margin-bottom: 16px; }
.form-group label, .field-label, .form-group > label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
.form-control, .form-group input[type="text"],
.form-group input[type="email"], .form-group input[type="tel"],
.form-group input[type="number"], .form-group input[type="date"],
.form-group input[type="time"], .form-group input[type="datetime-local"],
.form-group input[type="password"], .form-group input[type="file"],
.form-group select, .form-group textarea, .form-group input[type="month"] {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px; font-size: 13px; font-family: var(--font-sans);
  color: var(--text); background: var(--surface); outline: none;
  transition: all 0.12s; -webkit-appearance: none;
}
.form-control:focus,
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50);
}
.form-control:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.form-group input[type="checkbox"] { width: auto; margin-right: 6px; accent-color: var(--accent); }

/* Legacy badges */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-gray    { background: var(--surface-3);  color: var(--text-2); }
.badge-purple  { background: #ede9fe;           color: #5b21b6; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow 0.2s, transform 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon-box {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.stat-card.total   .stat-icon-box { background: var(--accent-50); }
.stat-card.present .stat-icon-box { background: var(--success-bg); }
.stat-card.absent  .stat-icon-box { background: var(--danger-bg); }
.stat-card.late    .stat-icon-box { background: var(--warning-bg); }
.stat-info {}
.stat-label { font-size: 11.5px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.stat-sub   { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.stat-icon  { font-size: 22px; margin-left: auto; }

/* Data table */
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
  background: var(--surface-2);
}
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-2);
  font-size: 13px; color: var(--text); vertical-align: middle;
}
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.attendance-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.attendance-table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.attendance-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-2); font-size: 13px; color: var(--text); vertical-align: middle; }
.attendance-table tr:hover td { background: var(--surface-2); }
.table-loading { text-align: center; padding: 32px; color: var(--text-3); font-size: 13.5px; }

/* Employee info cell */
.employee-info    { display: flex; align-items: center; gap: 10px; }
.employee-avatar  {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 11px;
}
.employee-details { display: flex; flex-direction: column; }
.employee-name    { font-weight: 600; color: var(--text); font-size: 13px; }
.employee-id      { font-size: 11.5px; color: var(--text-3); }

/* Action buttons */
.action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.12s;
}
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.action-btn.primary  { background: var(--accent); color: white; border-color: var(--accent); }
.action-btn.primary:hover { background: var(--accent-700); }
.action-btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.action-btn.secondary:hover { background: var(--surface-3); }
.action-btn.success  { background: var(--success); color: white; }
.action-btn.danger   { background: var(--danger);  color: white; }
.btn-xs { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: none; border-radius: 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all 0.12s; }
.btn-xs-success { background: var(--success-bg); color: var(--success-text); }
.btn-xs-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.btn-xs-info    { background: var(--info-bg);    color: var(--info-text); }

/* Legacy tab aliases */
.tab-bar { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1.5px solid var(--border); }
.tab-btn {
  padding: 9px 18px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1.5px;
  transition: all 0.15s; cursor: pointer;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Toast notifications */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 380px;
  background: var(--slate-900); color: white;
  padding: 12px 16px; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  pointer-events: all; animation: toastIn 0.25s ease;
}
.toast.hide { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; transform: translateY(0); } to { opacity:0; transform: translateY(10px); } }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--info); }
.toast-icon    { font-size: 16px; flex-shrink: 0; }

/* Confirm dialog */
#confirm-overlay {
  position: fixed; inset: 0; background: rgba(15,18,38,0.55);
  backdrop-filter: blur(6px); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.confirm-box {
  background: var(--surface); border-radius: var(--r-xl);
  max-width: 380px; width: 90%;
  box-shadow: 0 32px 64px -12px rgba(15,18,38,0.22), 0 8px 24px rgba(15,18,38,0.08);
  animation: modalIn 0.24s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
}
.confirm-box h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; margin-top: 0; }
.confirm-box p  { font-size: 13.5px; color: var(--text-2); line-height: 1.5; margin-bottom: 0; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Login page */
body.login-page {
  display: flex; align-items: stretch; min-height: 100vh;
  background: var(--sidebar-bg); padding: 0;
}
.login-split { display: flex; width: 100%; min-height: 100vh; }
.login-left {
  flex: 1; background: linear-gradient(145deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  display: flex; flex-direction: column; justify-content: center;
  padding: 60px; position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 70%, rgba(99,102,241,0.25) 0%, transparent 60%);
}
.login-left > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 60px; }
.login-brand-icon { width: 52px; height: 52px; background: rgba(255,255,255,0.15); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.login-brand-name { font-size: 26px; font-weight: 800; color: white; letter-spacing: -0.5px; }
.login-headline { font-size: 38px; font-weight: 800; color: white; line-height: 1.15; letter-spacing: -0.8px; margin-bottom: 18px; }
.login-sub      { font-size: 15px; color: rgba(255,255,255,0.65); line-height: 1.6; margin-bottom: 48px; max-width: 360px; }
.login-features { display: flex; flex-direction: column; gap: 16px; }
.login-feature  { display: flex; align-items: center; gap: 14px; color: rgba(255,255,255,0.8); font-size: 14px; }
.login-feature-icon { width: 38px; height: 38px; background: rgba(255,255,255,0.12); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.login-right { width: 460px; background: white; display: flex; flex-direction: column; justify-content: center; padding: 60px 52px; }
.login-right-header { margin-bottom: 36px; }
.login-right-header h1 { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.login-right-header p  { font-size: 14px; color: var(--text-3); margin-top: 6px; }
.login-error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fecaca; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.login-btn   { width: 100%; padding: 12px; font-size: 15px; border-radius: 8px; }
.login-footer { margin-top: 28px; text-align: center; font-size: 12px; color: var(--text-3); }
@media (max-width: 860px) { .login-left { display: none; } .login-right { width: 100%; padding: 40px 28px; } }

/* Connection status / device */
.connection-status { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.15); padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.connected    { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,0.2); animation: pulse 2s infinite; }
.status-dot.disconnected { background: var(--text-3); }
.device-status { background: linear-gradient(135deg, var(--accent-700) 0%, #5b21b6 100%); border-radius: var(--r-lg); padding: 20px; color: white; text-align: center; }

/* Stack bar */
.stack-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.stack-bar-seg { transition: width 0.5s; }

/* Activity items */
.activity-item { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border-2); align-items: flex-start; }
.activity-time { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); flex-shrink: 0; }
.activity-text { font-size: 13px; color: var(--text); }

/* Attendance calendar */
.att-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.att-cal-title  { font-size: 15px; font-weight: 700; color: var(--text); }
.att-cal-nav    { display: flex; gap: 6px; }
.att-cal-nav button {
  width: 30px; height: 30px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); cursor: pointer;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; font-size: 14px;
}
.att-cal-nav button:hover { background: var(--surface-3); }
.att-cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.att-cal-dow  { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 4px 0; text-transform: uppercase; }
.att-cal-day  {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px; font-weight: 500; color: var(--text-3);
  cursor: default; transition: all 0.12s;
}
.att-cal-day.other-month { opacity: 0.25; }
.att-cal-day.today   { font-weight: 700; box-shadow: 0 0 0 2px var(--accent); }
.att-cal-day.weekend { color: var(--text-3); }
.att-cal-day.holiday { background: #ede9fe; color: #5b21b6; }
.att-cal-day.present { background: var(--success-bg); color: var(--success); }
.att-cal-day.late    { background: var(--warning-bg); color: var(--warning); }
.att-cal-day.absent  { background: var(--danger-bg);  color: var(--danger); }
.att-cal-day.on-leave{ background: var(--info-bg);    color: var(--info); }

/* Announcement cards */
.announcement-card {
  background: var(--surface); border-radius: var(--r-md); padding: 14px 16px;
  border-left: 3px solid var(--accent); border: 1px solid var(--border);
  border-left-width: 3px; margin-bottom: 10px;
}
.announcement-card.birthday { border-left-color: var(--warning); }
.announcement-card.festival { border-left-color: var(--success); }
.announcement-card.urgent   { border-left-color: var(--danger); }

/* Page crumb alias */
.page-crumb {
  font-size: 12px; color: var(--text-3); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}

/* Live label */
.liveLabel, .live-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
}

/* Sb-logout */
.sb-logout {
  width: 100%; padding: 8px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: rgba(239,68,68,0.1); color: #fca5a5;
  transition: background 0.15s; text-align: left;
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.sb-logout:hover { background: rgba(239,68,68,0.2); color: #fee2e2; }

/* Card header alias */
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 12px; border-bottom: 1px solid var(--border-2);
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }

/* Filter row */
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row .form-control, .filter-row .input, .filter-row .select { width: auto; }

/* Status badge */
.status-badge { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.status-badge.present  { background: var(--success-bg); color: var(--success); }
.status-badge.absent   { background: var(--danger-bg);  color: var(--danger); }
.status-badge.late     { background: var(--warning-bg); color: var(--warning); }
