/* ============================================================
   HR World — Design System
   Modern SaaS admin. Shared across all 6 screens.
   Every page links to ../styles.css and copies the shell
   from pages/_shell.html verbatim so the frame is identical.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --primary:      #4f46e5;
  --primary-hover:#4338ca;
  --primary-soft: #eef2ff;   /* indigo-50 wash for active nav / accents */

  --bg:      #f5f6fa;
  --card:    #ffffff;
  --ink:     #0f172a;
  --muted:   #556070;
  --border:  #e5e7eb;

  --success: #16a34a;
  --success-ink: #166534; /* WCAG-AA green for text on white / light-green */
  --danger-ink:  #b91c1c; /* WCAG-AA red for text on light-red */
  --warning: #f59e0b;
  --danger:  #dc2626;
  --info:    #0ea5e9;

  --success-soft: #dcfce7;
  --warning-soft: #fef3c7;
  --danger-soft:  #fee2e2;
  --info-soft:    #e0f2fe;
  --neutral-soft: #f1f5f9;

  --radius:    16px;   /* rounded-2xl cards */
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow:    0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .10);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);

  /* 8px spacing scale */
  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px;

  --sidebar-w: 240px;
  --topbar-h:  64px;
  --content-max: 1200px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          Helvetica, Arial, sans-serif;
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: #ddd6fe; color: var(--ink); }

/* Numbers align nicely in tables / KPIs */
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { min-height: 100%; }

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--s3) var(--s2);
  z-index: 60;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--s1) var(--s2);
  margin-bottom: var(--s2);
}
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, .35);
  flex: none;
}
.brand-name {
  font-weight: 800; font-size: 17px; letter-spacing: -.2px;
  color: var(--ink);
}
.brand-name span { color: var(--primary); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  padding: var(--s2) var(--s1) 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--s1) 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 20px; height: 20px; flex: none; }
.nav-item:hover { background: var(--neutral-soft); color: var(--ink); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -16px;
  top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item .nav-count {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  background: var(--neutral-soft); color: var(--muted);
  padding: 2px 8px; border-radius: var(--radius-pill);
}
.nav-item.active .nav-count { background: #fff; color: var(--primary); }

.nav-bottom { margin-top: auto; padding-top: var(--s2); }

/* ---------- Top bar ---------- */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s4);
  z-index: 50;
}
.topbar .page-title { margin-right: auto; }
.hamburger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-sm);
  place-items: center;
}
.hamburger svg { width: 20px; height: 20px; color: var(--ink); }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  width: 260px;
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.searchbox:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.searchbox svg { width: 16px; height: 16px; flex: none; }
.searchbox input {
  border: 0; outline: 0; background: transparent;
  font-size: 14px; color: var(--ink); width: 100%;
}
.searchbox input::placeholder { color: var(--muted); }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: background .15s;
}
.icon-btn:hover { background: var(--neutral-soft); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--card);
}

.user {
  display: flex; align-items: center; gap: 10px;
  padding-left: var(--s1);
}
.user-meta { line-height: 1.2; }
.user-name { font-weight: 700; font-size: 13px; }
.user-role { font-size: 12px; color: var(--muted); }

/* ---------- Content area ---------- */
.content {
  flex: 1;
  padding: var(--s4);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ---------- Bottom nav (mobile only) ---------- */
.bottomnav { display: none; }

/* ============================================================
   TYPOGRAPHY / HEADERS
   ============================================================ */
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s2); flex-wrap: wrap;
  margin-bottom: var(--s3);
}
.welcome h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  margin-bottom: 4px;
}
.welcome h1 .wave { display: inline-block; }
.welcome p { color: var(--muted); font-size: 14px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s2);
}
.section-title { font-size: 16px; font-weight: 700; }
.section-link { color: var(--primary); font-weight: 600; font-size: 13px; }
.section-link:hover { color: var(--primary-hover); }

.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
}

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.grid { display: grid; gap: var(--s3); }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s2);
  margin-bottom: var(--s3);
}
.cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s3); }
.cols-2e { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.cols-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; align-items: center; gap: var(--s2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s3);
}
.card.tight { padding: var(--s2); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2); margin-bottom: var(--s3);
}
.card-title { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   KPI TILE
   ============================================================ */
.kpi { position: relative; }
.kpi-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.kpi-ico {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.kpi-ico svg { width: 20px; height: 20px; }
.kpi-ico.green { background: var(--success-soft); color: var(--success-ink); }
.kpi-ico.amber { background: var(--warning-soft); color: #b45309; }
.kpi-ico.red   { background: var(--danger-soft);  color: var(--danger); }
.kpi-ico.blue  { background: var(--info-soft);    color: #0369a1; }

.kpi-value {
  font-size: 28px; font-weight: 800; letter-spacing: -.6px;
  line-height: 1.1;
}
.kpi-value small { font-size: 16px; font-weight: 700; color: var(--muted); }
.kpi-label { color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: 500; }

/* trend chip up/down */
.trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: var(--radius-pill);
}
.trend svg { width: 13px; height: 13px; }
.trend.up   { color: var(--success-ink); background: var(--success-soft); }
.trend.down { color: var(--danger-ink);  background: var(--danger-soft); }
.trend.flat { color: var(--muted);   background: var(--neutral-soft); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--neutral-soft); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .30);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--neutral-soft); color: var(--ink); }
.btn-danger { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  text-align: left;
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted);
  padding: 0 var(--s2) 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 14px var(--s2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 700; }

.person { display: flex; align-items: center; gap: 12px; }
.person-name { font-weight: 600; color: var(--ink); }
.person-sub { font-size: 12px; color: var(--muted); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--neutral-soft); color: var(--muted);
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .9;
}
.badge.success { background: var(--success-soft); color: #15803d; }
.badge.warning { background: var(--warning-soft); color: #b45309; }
.badge.danger  { background: var(--danger-soft);  color: #b91c1c; }
.badge.info    { background: var(--info-soft);     color: #0369a1; }
.badge.neutral { background: var(--neutral-soft);  color: var(--muted); }
.badge.plain::before { display: none; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
  background: var(--primary);
  flex: none; user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
/* deterministic palette variants (assign per person) */
.avatar.c1 { background: linear-gradient(135deg,#6366f1,#4f46e5); }
.avatar.c2 { background: linear-gradient(135deg,#0ea5e9,#0369a1); }
.avatar.c3 { background: linear-gradient(135deg,#16a34a,#15803d); }
.avatar.c4 { background: linear-gradient(135deg,#f59e0b,#d97706); }
.avatar.c5 { background: linear-gradient(135deg,#ec4899,#be185d); }
.avatar.c6 { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.avatar.c7 { background: linear-gradient(135deg,#14b8a6,#0f766e); }
.avatar.c8 { background: linear-gradient(135deg,#f43f5e,#be123c); }

.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--card); margin-left: -10px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--neutral-soft); color: var(--muted);
  font-weight: 700; font-size: 12px;
  border: 2px solid var(--card); margin-left: -10px;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 8px; border-radius: var(--radius-pill);
  background: var(--neutral-soft); overflow: hidden; width: 100%;
}
.progress > span {
  display: block; height: 100%; border-radius: inherit;
  background: var(--primary);
  transition: width .4s ease;
}
.progress.green > span { background: var(--success); }
.progress.amber > span { background: var(--warning); }
.progress.red   > span { background: var(--danger); }
.progress.thin { height: 6px; }

/* ============================================================
   CHART — pure CSS vertical bars
   ============================================================ */
.chart-bars {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s2); height: 200px;
  padding-top: var(--s2);
}
.chart-bars .bar-col {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  height: 100%;
  justify-content: flex-end;
}
.chart-bars .bar-track {
  width: 100%;
  display: flex; align-items: flex-end; justify-content: center;
  flex: 1;
}
.chart-bars .bar {
  width: 60%; max-width: 34px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  position: relative;
  transition: filter .15s;
  min-height: 6px;
}
.chart-bars .bar:hover { filter: brightness(1.08); }
.chart-bars .bar.muted { background: linear-gradient(180deg,#e0e7ff,#c7d2fe); }
.chart-bars .bar-val {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.chart-bars .bar-label { font-size: 12px; color: var(--muted); font-weight: 600; }

.chart-legend {
  display: flex; gap: var(--s3); flex-wrap: wrap;
  margin-top: var(--s2);
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--primary); }
.legend-dot.muted { background: #c7d2fe; }
.legend-dot.green { background: var(--success); }
.legend-dot.red   { background: var(--danger); }

/* ============================================================
   CHIP (filter / tag pills)
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card); color: var(--muted);
  font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.chip:hover { border-color: #cbd5e1; color: var(--ink); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip svg { width: 15px; height: 15px; }

/* ============================================================
   LISTS — activity / performers / alerts
   ============================================================ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:first-child { padding-top: 0; }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14px; }
.list-item .li-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .li-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* small round icon token for activity feed */
.li-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.li-ico svg { width: 17px; height: 17px; }
.li-ico.green { background: var(--success-soft); color: var(--success-ink); }
.li-ico.amber { background: var(--warning-soft); color: #b45309; }
.li-ico.red   { background: var(--danger-soft);  color: var(--danger); }
.li-ico.blue  { background: var(--info-soft);     color: #0369a1; }

/* performer rank list */
.rank {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--muted);
  background: var(--neutral-soft);
}
.rank.gold   { background: #fef3c7; color: #b45309; }
.rank.silver { background: #f1f5f9; color: #475569; }
.rank.bronze { background: #ffedd5; color: #c2410c; }
.score {
  font-weight: 800; font-size: 15px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* money in/out mini summary */
.money-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.money-row:last-of-type { border-bottom: 0; }
.money-left { display: flex; align-items: center; gap: 12px; }
.money-amount { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.money-amount.pos { color: var(--success-ink); }
.money-amount.neg { color: var(--danger); }
.money-net {
  margin-top: var(--s2); padding-top: var(--s2);
  border-top: 2px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.money-net .label { font-weight: 700; }
.money-net .val { font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

/* alert / reminder card */
.alert-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}
.alert-item + .alert-item { margin-top: 10px; }
.alert-item .li-ico { width: 32px; height: 32px; }
.alert-item .a-title { font-weight: 600; font-size: 14px; }
.alert-item .a-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* generic helpers */
.muted { color: var(--muted); }
.mt1 { margin-top: var(--s1); } .mt2 { margin-top: var(--s2); } .mt3 { margin-top: var(--s3); }
.mb0 { margin-bottom: 0; } .mb2 { margin-bottom: var(--s2); } .mb3 { margin-bottom: var(--s3); }
.dot-sep { color: var(--border); padding: 0 6px; }
.right { margin-left: auto; }
.text-success { color: var(--success-ink); } .text-danger { color: var(--danger); }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--s2) 0; }

/* ============================================================
   PAYROLL — month selector, payslip preview, table footer
   (added by Payroll screen; reuses existing tokens only)
   ============================================================ */
/* month stepper (‹ July 2026 ›) */
.month-select {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 40px;
}
.month-arrow {
  width: 38px; height: 100%;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.month-arrow:hover { background: var(--neutral-soft); color: var(--ink); }
.month-arrow svg { width: 18px; height: 18px; }
.month-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 100%;
  font-weight: 700; font-size: 14px; color: var(--ink);
  white-space: nowrap;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.month-label svg { width: 16px; height: 16px; color: var(--primary); }

/* table footer total row */
.table tfoot td {
  padding: 16px var(--s2);
  border-top: 2px solid var(--border);
  font-variant-numeric: tabular-nums;
  background: #fafbff;
}
.table tfoot .strong { font-weight: 800; }

/* payslip card */
.payslip-head { display: flex; align-items: center; gap: 14px; }
.payslip-name { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.payslip-role { font-size: 13px; color: var(--ink); }
.payslip-role.muted { color: var(--muted); font-size: 12px; margin-top: 2px; }

.pay-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; font-size: 14px;
}
.pay-line > span:first-child { color: var(--muted); }
.pay-line > span:last-child { font-weight: 600; color: var(--ink); }
.pay-line.subtotal {
  margin-top: 4px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.pay-line.subtotal > span { color: var(--ink); font-weight: 700; }

.payslip-net {
  margin-top: var(--s2);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s2);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid #e0e7ff;
}
.pn-label { font-size: 13px; font-weight: 700; color: var(--primary); }
.pn-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pn-value {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  color: var(--primary); font-variant-numeric: tabular-nums;
}

/* ============================================================
   RESPONSIVE — tablet
   ============================================================ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cols-2, .cols-2e { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .searchbox { width: 180px; }
}

/* ============================================================
   RESPONSIVE — mobile (≤900px)
   sidebar → off-canvas drawer; bottom tab bar appears
   ============================================================ */
@media (max-width: 900px) {
  /* sidebar becomes a slide-in drawer toggled by hamburger */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    width: 260px;
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .scrim {
    position: fixed; inset: 0; background: rgba(15,23,42,.45);
    opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 55;
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }

  .main { margin-left: 0; }
  .hamburger { display: grid; }
  .searchbox { display: none; }

  .topbar { padding: 0 var(--s2); height: 60px; }
  .content {
    padding: var(--s2);
    padding-bottom: calc(72px + var(--s3)); /* clear bottom nav */
  }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s1); }
  .kpi { padding: var(--s2); }
  .kpi-value { font-size: 24px; }

  /* every multi-column layout collapses to one column */
  .cols-2, .cols-2e, .cols-3 { grid-template-columns: 1fr; gap: var(--s2); }

  .welcome h1 { font-size: 22px; }

  /* hide the desktop user meta text on small screens, keep avatar */
  .user-meta { display: none; }

  /* bottom nav */
  .bottomnav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: 64px;
    background: rgba(255,255,255,.94);
    backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--border);
    z-index: 60;
    padding: 0 4px;
    box-shadow: 0 -2px 12px rgba(15,23,42,.06);
  }
  .bottomnav a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 11px; font-weight: 600;
    padding: 8px 0;
    position: relative;
  }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--primary); }
  .bottomnav a.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary);
  }
}

/* very small phones (≤400px): single column KPIs stay 2-up but tighten */
@media (max-width: 380px) {
  .content { padding: 12px; padding-bottom: calc(72px + var(--s2)); }
  .card { padding: var(--s2); }
  .chart-bars { gap: 6px; }
  .kpi-value { font-size: 22px; }
}

/* ---------- Payroll: header controls wrap neatly on mobile ---------- */
@media (max-width: 900px) {
  /* the month selector + export/run buttons stack full-width, no overflow */
  .page-head > .row { width: 100%; flex-wrap: wrap; gap: var(--s1); }
  .page-head .month-select { flex: 1 1 100%; justify-content: space-between; }
  .page-head .month-select .month-label { flex: 1; justify-content: center; }
  .page-head > .row > .btn { flex: 1; }
  /* keep the payslip net value readable when it sits full-width */
  .payslip-net { padding: 14px; }
}

/* Grid children must be allowed to shrink below content width so an inner
   .table-wrap (overflow-x:auto) scrolls internally instead of widening the
   page — prevents any horizontal page scroll at 390px. */
.cols-2 > *, .cols-2e > *, .cols-3 > * { min-width: 0; }

/* ============================================================
   TOOLBAR — search + filter chips + actions above a table
   (reusable: Employees / Payroll / Attendance list screens)
   ============================================================ */
.toolbar {
  display: flex; align-items: center; gap: var(--s2);
  flex-wrap: wrap; margin-bottom: var(--s3);
}
.toolbar .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar .toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* a search field that lives inside content (not the topbar) */
.field-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px; min-width: 220px;
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.field-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field-search svg { width: 16px; height: 16px; flex: none; }
.field-search input { border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--ink); width: 100%; }
.field-search input::placeholder { color: var(--muted); }

/* ============================================================
   FORM — labelled inputs in a responsive grid
   (reusable: register worker, settings, edit record)
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s2) var(--s3);
}
.form-grid .col-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 12px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.field .hint { font-size: 12px; color: var(--muted); font-weight: 500; }
.input, .select {
  height: 42px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder { color: #94a3b8; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px; cursor: pointer;
}
.input-prefix { position: relative; }
.input-prefix > span {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
.input-prefix .input { padding-left: 26px; }
.form-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: var(--s3); padding-top: var(--s3);
  border-top: 1px solid var(--border);
}
.form-actions .spacer { margin-left: auto; }

/* reveal animation for the inline register panel */
.reveal { display: none; }
.reveal.open { display: block; animation: revealIn .22s ease; }
@keyframes revealIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   SEGMENTED TABS  (Overview / Attendance / Payroll / …)
   ============================================================ */
.seg {
  display: inline-flex; gap: 2px;
  background: var(--neutral-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.seg button {
  border: 0; background: transparent;
  padding: 7px 12px; border-radius: 8px;
  font-weight: 600; font-size: 13px; color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--card); color: var(--primary);
  box-shadow: var(--shadow);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: revealIn .18s ease; }

/* ============================================================
   SLIDE-IN DRAWER  (right-hand employee record preview)
   ============================================================ */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 70;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 92vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  z-index: 71;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3); border-bottom: 1px solid var(--border);
  background: var(--card);
}
.drawer-head .close {
  margin-left: auto;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card);
  display: grid; place-items: center; color: var(--ink);
}
.drawer-head .close:hover { background: var(--neutral-soft); }
.drawer-head .close svg { width: 18px; height: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s3); }

/* profile block inside the drawer */
.profile { display: flex; align-items: center; gap: var(--s2); }
.profile .avatar { width: 56px; height: 56px; font-size: 18px; }
.profile h3 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.profile .p-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* key/value facts grid */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.fact .k { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fact .v { font-weight: 600; font-size: 14px; margin-top: 3px; }
.fact.col-2 { grid-column: 1 / -1; }

/* simple stat pills used in record tabs */
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; text-align: center;
}
.mini-stat .n { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.mini-stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 600; }

/* document rows */
.doc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
}
.doc-row + .doc-row { margin-top: 10px; }
.doc-row .li-ico { width: 34px; height: 34px; }
.doc-row .d-name { font-weight: 600; font-size: 14px; }
.doc-row .d-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.doc-row .d-dl { margin-left: auto; color: var(--muted); }
.doc-row .d-dl:hover { color: var(--primary); }
.doc-row .d-dl svg { width: 18px; height: 18px; }

/* view-toggle (table vs grid) — icon buttons */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle button {
  width: 38px; height: 40px; display: grid; place-items: center;
  background: var(--card); border: 0; color: var(--muted);
  border-left: 1px solid var(--border);
}
.view-toggle button:first-child { border-left: 0; }
.view-toggle button.active { background: var(--primary-soft); color: var(--primary); }
.view-toggle button svg { width: 18px; height: 18px; }

/* clickable table rows */
.table tbody tr.clickable { cursor: pointer; }

/* payroll status cell: badge with hover-revealed per-row actions */
.pay-status-cell { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
.pay-status-cell .pay-badge { flex: 0 0 auto; }
.row-actions {
  display: inline-flex; align-items: center; gap: 4px;
  opacity: 0; transition: opacity .12s; pointer-events: none;
}
.table tbody tr:hover .row-actions,
.table tbody tr:focus-within .row-actions { opacity: 1; pointer-events: auto; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted);
  transition: background .12s, color .12s, border-color .12s;
}
.btn-icon:hover { background: var(--neutral-soft); color: var(--ink); border-color: #d9dbe3; }
.btn-icon:active { transform: translateY(1px); }
.btn-icon svg { width: 15px; height: 15px; }
/* touch devices have no hover: keep actions visible so HR can reach them */
@media (hover: none) { .row-actions { opacity: 1; pointer-events: auto; } }
/* live net readout inside the edit modal */
.pay-net-readout {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary-soft); border-radius: 12px; padding: 12px 16px;
  margin: 4px 0 14px;
}
.pay-net-readout .pnr-label { font-weight: 600; color: var(--ink); }
.pay-net-readout .pnr-value { font-size: 20px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.pay-net-readout.invalid { background: var(--danger-soft); }
.pay-net-readout.invalid .pnr-value { color: var(--danger); }

/* people grid (card view alternative to the table) */
.people-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.person-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: var(--s3); cursor: pointer;
  transition: box-shadow .15s, transform .05s, border-color .15s;
}
.person-card:hover { box-shadow: var(--shadow-md); border-color: #d9dbe3; }
.person-card:active { transform: translateY(1px); }
.person-card .pc-top { display: flex; align-items: center; gap: 12px; }
.person-card .pc-name { font-weight: 700; }
.person-card .pc-role { font-size: 12px; color: var(--muted); }
.person-card .pc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); }
.person-card .pc-salary { font-weight: 800; font-variant-numeric: tabular-nums; }

/* responsive tweaks for the new components */
@media (max-width: 1100px) {
  .people-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .people-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; max-width: 100%; }
  .toolbar .toolbar-right { margin-left: 0; width: 100%; }
  .field-search { min-width: 0; flex: 1; }
}
@media (max-width: 380px) {
  .facts { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .mini-stat { padding: 10px 6px; }
}

/* ============================================================
   STAR RATING  (Performance screen)
   inline text stars — gold filled, muted grey empty
   ============================================================ */
.stars {
  color: var(--warning);       /* gold filled stars */
  font-size: 14px;
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.stars .star-muted { color: var(--border); }   /* empty star */

/* Fix: allow grid/flex children (cards) to shrink so inner .table-wrap scrolls instead of overflowing the page on mobile */
.card, .cols-2 > *, .cols-2e > *, .cols-3 > *, .grid > *, .main, .content { min-width: 0; }
