/* ---------- Theme tokens ----------
 * Design direction (DESIGN-UPDATE §9): off-white / black / red, flat icons,
 * soft-shadow rounded cards, glass modals. Light is the primary/default theme;
 * dark is a retuned blue-black/grey (navy dropped). Radius + semantic accents
 * that don't change by theme live in the shared :root below. */
:root {
  /* shape */
  --radius-card: 18px;
  --radius-btn: 10px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  /* semantic accents (theme-invariant) */
  --accent: #CC0000;
  --accent-hover: #E11212;
  --money-pos: #16A34A;     /* money in / positive */
  --warn: #D97706;          /* amber — flags / warnings */
}
:root[data-theme="light"] {
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #F6F5F1;
  --surface-3: #FBFAF7;     /* faint tint (card footers, kanban wells) */
  --sidebar: #FFFFFF;
  --text: #15161A;
  --text-muted: #7c7d82;
  --text-faint: #9a9b9f;
  --border: #EAE8E2;
  --hairline: #F1EFE9;      /* inner row dividers */
  --accent-tint: #FBEAEA;   /* red wash — active nav, flag chips */
  --accent-badge: #F7D5D5;  /* nav count badge fill */
  --amber-tint: #FDF3E0;
  --amber-text: #B45309;
  --money-tint: #EAF6EE;
  --danger: #CC0000;
  --success: #16A34A;
  --input-bg: #FFFFFF;
  --row-hover: #FAF9F5;
  --shadow: 0 1px 3px rgba(20,22,26,0.05);
  --shadow-lift: 0 6px 18px rgba(20,22,26,0.10);
  --glass: rgba(255,255,255,0.82);
}
:root[data-theme="dark"] {
  --bg: #141519;
  --surface: #1C1E24;
  --surface-2: #191B20;
  --surface-3: #22242B;
  --sidebar: #121317;
  --text: #F4F3EF;
  --text-muted: #9a9b9f;
  --text-faint: #7c7d82;
  --border: #2A2C33;
  --hairline: #24262D;
  --accent-tint: rgba(204,0,0,0.14);
  --accent-badge: rgba(204,0,0,0.22);
  --amber-tint: rgba(217,119,6,0.16);
  --amber-text: #E7A44A;
  --money-tint: rgba(22,163,74,0.16);
  --danger: #FF6B6B;
  --success: #4ADE80;
  --input-bg: #101116;
  --row-hover: #23252c;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lift: 0 8px 24px rgba(0,0,0,0.5);
  --glass: rgba(28,30,36,0.82);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* ---------- Logo / brand row ---------- */
.logo-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  padding: 0;
}
.logo-img-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  flex: none;
}
.logo-img-wrap.small { width: 44px; height: 44px; border-radius: 8px; }
.logo-img-wrap img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.logo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.logo-img-wrap.small .logo-fallback { font-size: 16px; }
.brand-text { line-height: 1.15; min-width: 0; }
.logo-text {
  margin: 0;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.logo-sub {
  margin: 0;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--row-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Forms ---------- */
label {
  display: block;
  margin-bottom: 12px;
}
label > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row > label { margin-bottom: 12px; }

.form-msg {
  margin: 8px 0 0;
  min-height: 18px;
  font-size: 13px;
}
.form-msg.ok { color: var(--success); }
.form-msg.error { color: var(--danger); }
.error-msg {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Login screen ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-form { margin-top: 16px; }
.login-form .btn { width: 100%; margin-top: 8px; }

/* ---------- Specials page ---------- */
.specials-body {
  min-height: 100vh;
  padding: 20px;
}
.specials-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto 20px;
}
.specials-main {
  max-width: 600px;
  margin: 0 auto;
}
.form-card { padding: 24px; }

/* ---------- Suggestion dropdown ---------- */
.suggestions {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
}
.suggestion {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover { background: var(--row-hover); }
.suggestion.empty { color: var(--text-muted); cursor: default; }
.muted { color: var(--text-muted); font-size: 12px; }

/* ---------- App layout (admin) ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 262px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 0 6px 20px;
  margin-bottom: 8px;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: #4a4b50;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  user-select: none;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-tint); color: var(--accent); }
.nav-item .icon,
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item .nav-label { flex: 1; text-align: left; }
:root[data-theme="dark"] .nav-item { color: var(--text-muted); }
.nav-group { margin-top: 14px; }
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 8px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  user-select: none;
}
.nav-group-label .chevron { margin-left: auto; transition: transform 0.2s; }
.nav-group.open .chevron { transform: rotate(90deg); }
.nav-sub {
  display: none;
  flex-direction: column;
  padding-left: 16px;
  margin-top: 2px;
  gap: 2px;
}
.nav-group.open .nav-sub { display: flex; }

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.loc-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-elev, rgba(255,255,255,0.04));
  margin-bottom: 4px;
}
.loc-filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}
.loc-filter-label .icon { width: 14px; height: 14px; }
.loc-filter select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: inherit;
  font-size: 13px;
}

.main {
  padding: clamp(20px, 3vw, 34px) clamp(16px, 3.5vw, 40px) 48px;
  overflow-x: hidden;
}
.main > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0;
  font-size: clamp(21px, 2.6vw, 27px);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.page-header .subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  min-height: 100px;
  display: flex;
  flex-direction: column;
}
.stat .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
  color: var(--text-faint);
}
.stat .value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: auto;
  padding-top: 10px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--surface-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge.open { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge.closed { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge.paid { background: rgba(204, 0, 0, 0.15); color: var(--accent); }
.badge.unpaid { background: rgba(255, 77, 77, 0.15); color: var(--danger); }
.badge.active { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge.inactive { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge.warn { background: var(--amber-tint); color: var(--amber-text); }

/* Pay-period status — its own semantics (open = active/amber, paid = done/green),
 * distinct from the payment 'paid' badge which is brand-red. */
.badge.period-open { background: var(--amber-tint); color: var(--amber-text); }
.badge.period-closed { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.badge.period-paid { background: var(--money-tint); color: var(--success); }

/* Estimated (manifest) vs actual (OpenForce) stop numbers driving pay. */
.chip-est, .chip-actual {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
  white-space: nowrap;
}
.chip-est { background: var(--amber-tint); color: var(--amber-text); }
.chip-actual { background: var(--money-tint); color: var(--success); }
.wv-est-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Reconcile — negative-margin drivers get a subtle red wash so they stand out.
 * Reused by the Gate Directory to flag codes that need review (broken/stale). */
.rc-flag td { background: var(--accent-tint); }
.rc-flag td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* Gate Directory */
.gate-code { font-family: ui-monospace, Menlo, monospace; font-size: 14px; font-weight: 700; letter-spacing: 0.3px; }
.gate-actions { white-space: nowrap; display: flex; gap: 6px; }

/* HR applicant Kanban (styled preview — live data in the pre-screening app) */
.hr-kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 14px; }
.hr-col { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 14px; padding: 14px; }
.hr-col-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hr-col-head .t { font-size: 12.5px; font-weight: 800; }
.hr-col-head .c { background: var(--border); color: var(--text-muted); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.hr-chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 10px 11px; margin-bottom: 9px; }
.hr-chip:last-child { margin-bottom: 0; }
.hr-chip .nm { font-size: 13px; font-weight: 600; }
.hr-chip .rf { font-size: 11px; color: var(--text-faint); }
.hr-deptchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.hr-deptchip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.hr-deptchip b { color: var(--accent); }

/* Flag status (P2-7): semantic, dedicated — no longer reuses payment badges. */
.badge.flag-open       { background: rgba(251, 191, 36, 0.16); color: #FBBF24; }   /* amber — needs attention */
.badge.flag-in-review  { background: rgba(122, 162, 255, 0.16); color: #7aa2ff; }  /* blue — in progress */
.badge.flag-resolved   { background: rgba(74, 222, 128, 0.15); color: var(--success); } /* green — done */

/* Roster status (zone-manager home) */
.badge.roster-active           { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.badge.roster-new-hire         { background: rgba(122, 162, 255, 0.16); color: #7aa2ff; }
.badge.roster-planning-replace { background: rgba(251, 191, 36, 0.16); color: #FBBF24; }
.badge.roster-planning-fire    { background: rgba(255, 77, 77, 0.15); color: var(--danger); }

/* Compliance status pills (zone-manager home) */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill-ok  { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.pill-bad { background: rgba(255, 77, 77, 0.15); color: var(--danger); }
.pill-na  { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* =====================================================================
 * Design-update foundation (DESIGN-UPDATE §9) — reusable primitives the
 * new role-home screens are built from: avatar chips, KPI cards with
 * sparklines, launcher tiles, and the glass slide-in side panel.
 * =================================================================== */

/* Colored-initial avatar (staff photos deferred — see users.photoUrl) */
.ft-av {
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: none;
  width: 38px;
  height: 38px;
  font-size: 13px;
}
.ft-av-sm { width: 32px; height: 32px; font-size: 11px; }
.ft-av-lg { width: 46px; height: 46px; font-size: 17px; }

/* KPI strip — big-number cards with an optional inline sparkline */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
}
.kpi .kpi-label {
  font-size: 10.5px;
  letter-spacing: 0.11em;
  color: var(--text-faint);
  font-weight: 700;
  text-transform: uppercase;
}
.kpi .kpi-row { display: flex; align-items: flex-end; gap: 10px; margin-top: auto; }
.kpi .kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-faint); font-weight: 600; margin-bottom: 3px; }
.kpi .kpi-spark { flex: 1; margin-bottom: 2px; display: flex; }

/* Icon chip — flat SVG on a tinted rounded square (card/section headers) */
.icon-chip {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-tint);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.icon-chip svg { width: 18px; height: 18px; }

/* Launcher tiles ("Jump to" grid on the ops home) */
.launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.launch-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 20px;
  border-radius: var(--radius-card);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  font: inherit;
  color: inherit;
}
.launch-tile:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.launch-tile .tile-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-tint);
  color: var(--accent);
}
.launch-tile .tile-icon svg { width: 22px; height: 22px; }
.launch-tile .tile-title { font-size: 15px; font-weight: 700; margin-top: 14px; }
.launch-tile .tile-sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

/* Role-home shared pieces — section/card heads and avatar list rows. */
.ft-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.ft-section-head h2 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: 0.01em; }
.ft-section-meta { font-size: 12px; color: var(--text-faint); }
.ft-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.ft-card-head h2, .ft-card-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.ft-card-meta { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-faint); }
.ft-card-meta.accent { color: var(--accent); }

.ft-list { display: flex; flex-direction: column; }
.ft-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 0;
  border: none;
  border-top: 1px solid var(--hairline);
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
}
.ft-list .ft-row:first-child, .ft-row.first { border-top: none; }
button.ft-row { cursor: pointer; }
button.ft-row:hover { background: var(--row-hover); }
.ft-row-main { flex: 1; min-width: 0; }
.ft-row-name { font-size: 14px; font-weight: 600; }
.ft-row-sub { font-size: 12px; color: var(--text-faint); }
.ft-row-status { font-size: 11.5px; font-weight: 700; flex: none; }
.ft-tag { font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; padding: 5px 10px; border-radius: 7px; background: var(--accent-tint); color: var(--accent); flex: none; white-space: nowrap; }
.ft-tag.amber { background: var(--amber-tint); color: var(--amber-text); }
.ft-col { display: flex; flex-direction: column; gap: 20px; }
.ft-empty { font-size: 13px; color: var(--text-faint); padding: 8px 0; }

/* Specials "Log a special" hero */
.sp-hero { display: flex; flex-direction: column; align-items: flex-start; }
.sp-hero-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(204, 0, 0, 0.22);
}
.sp-hero-icon svg { width: 26px; height: 26px; }
.sp-hero h2 { margin: 20px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.sp-hero p { margin: 9px 0 22px; font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
.sp-amt { font-size: 14.5px; font-weight: 800; color: var(--money-pos); flex: none; }
.sp-date { width: 52px; flex: none; font-size: 11.5px; font-weight: 700; color: var(--text-faint); }

/* Zone-manager myself card bits */
.zh-standing { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; }
.zh-standing.good { background: var(--money-tint); }
.zh-standing.risk { background: var(--accent-tint); }
.zh-metrics { display: flex; gap: 26px; margin-top: 16px; }
.zh-metrics .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 700; }
.zh-metrics .val { font-size: 22px; font-weight: 800; margin-top: 2px; }
.zh-unlinked { text-align: center; padding: 48px 30px; border-style: dashed; max-width: 520px; margin: 10px auto; }
.zh-unlinked .icon-chip { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px; background: var(--amber-tint); color: var(--amber-text); }
.zh-unlinked .icon-chip svg { width: 26px; height: 26px; }
/* Zone roster "hired by them / us" toggle */
.ztabs { display: flex; gap: 9px; margin-bottom: 4px; }
.ztab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
}
.ztab.active { background: var(--text); color: #fff; border-color: var(--text); }
.ztab .cnt { background: rgba(0,0,0,.08); padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.ztab.active .cnt { background: rgba(255,255,255,.2); }
.ztab .paidon { background: var(--accent); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; }

/* Dispatcher "Log who worked" tap-toggle + WhatsApp/contact pills. */
.dh-mark {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  flex: none;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.dh-mark:hover { border-color: var(--text-faint); }
.dh-mark.on { background: var(--money-tint); color: var(--success); border-color: #bfe3ca; }
.dh-mark.locked { cursor: default; background: transparent; border-color: transparent; color: var(--success); }
.dh-wa {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--money-tint); color: var(--success);
  border: 1px solid #cdebd6; border-radius: 9px;
  padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; flex: none;
  text-decoration: none;
}
.dh-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 2px; margin-top: 6px; border-top: 1px solid var(--hairline);
}
.dh-foot .cnt { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.dh-logged { font-size: 12px; color: var(--success); font-weight: 700; background: var(--money-tint); padding: 5px 11px; border-radius: 999px; }
.dh-map-placeholder {
  height: 150px; border-radius: 14px; border: 1px solid var(--border);
  background-image: repeating-linear-gradient(135deg, var(--surface-2) 0 11px, var(--surface-3) 11px 22px);
  display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--text-faint);
}

/* Glass slide-in side panel (replaces modals for detail views) */
.ft-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.28);
  z-index: 220;
  animation: ftFadeIn 0.2s ease;
}
.ft-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  z-index: 221;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-left: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: -20px 0 50px rgba(20, 22, 26, 0.16);
  padding: 26px;
  overflow-y: auto;
  animation: ftPanelIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ft-panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.ft-panel-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  font-weight: 700;
  text-transform: uppercase;
}
.ft-panel h3 { margin: 6px 0 0; font-size: 21px; font-weight: 800; }
.ft-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--glass);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.ft-panel-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--hairline);
  border-radius: 14px;
}
:root[data-theme="dark"] .ft-panel-row { background: rgba(255, 255, 255, 0.05); }
.ft-panel-row .k { font-size: 13px; color: var(--text-muted); }
.ft-panel-row .v { font-size: 13.5px; font-weight: 700; text-align: right; }

@keyframes ftPanelIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes ftFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Nav badge count (P2-8): work awaiting the user on a nav item */
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-badge);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* Section divider heading (role home screens) */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 22px 0 10px; }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: var(--row-hover); }

/* Payroll pipeline stepper (P1-4) */
.pipeline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.pl-track { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pl-step { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px; }
.pl-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 999px;
  font-size: 12px; font-weight: 700; flex: 0 0 auto;
  background: rgba(148, 163, 184, 0.18); color: var(--text-muted);
  border: 1px solid transparent;
}
.pl-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.pl-arrow { color: var(--text-muted); opacity: 0.5; font-size: 14px; }
/* completed steps */
.pl-step.done .pl-num { background: rgba(74, 222, 128, 0.18); color: var(--success); }
.pl-step.done .pl-label { color: var(--text); }
/* the step you're on now */
.pl-step.current .pl-num { background: var(--accent); color: #fff; }
.pl-step.current .pl-label { color: var(--text); }
/* paid step partially complete (some drivers paid, not all) */
.pl-step.partial .pl-num { background: rgba(251, 191, 36, 0.2); color: #FBBF24; }
.pl-caption { margin: 10px 0 0; font-size: 12.5px; }
@media (max-width: 768px) {
  .pl-arrow { display: none; }
  .pl-track { gap: 4px 10px; }
}

.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid var(--border);
}

/* Driver board grid */
.board-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.board-table { width: 100%; min-width: 720px; }
.board-table th, .board-table td {
  text-align: center;
  white-space: nowrap;
}
.board-table th.day { width: 100px; }
.board-table td.driver-cell {
  text-align: left;
  font-weight: 600;
  border-left: 4px solid transparent;
}
.board-cell {
  cursor: pointer;
  min-width: 80px;
}
.board-cell:hover { background: var(--row-hover); }
.board-cell .stops { font-weight: 700; }
.board-cell .pkgs { color: var(--text-muted); font-size: 12px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal h3 { margin-top: 0; }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Slide-up panel (mobile-friendly) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  z-index: 201;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease-out;
  box-shadow: var(--shadow);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet h3 {
  margin: 0 0 4px;
}
.sheet .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.summary-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.summary-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.summary-list li:last-child { border-bottom: none; }
.summary-list li.wv-editable {
  cursor: pointer;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
  transition: background 0.12s ease;
}
.summary-list li.wv-editable:hover,
.summary-list li.wv-editable:active { background: var(--surface-2, rgba(127,127,127,0.12)); }
.summary-list li.wv-editable .label::after {
  content: " ✎";
  opacity: 0.45;
  font-size: 12px;
}
.summary-list .label { color: var(--text-muted); }
.summary-list .value { font-variant-numeric: tabular-nums; }
.summary-list .deduction { color: var(--danger); }
.summary-list .total {
  font-weight: 800;
  font-size: 18px;
  border-top: 2px solid var(--border);
  margin-top: 6px;
  padding-top: 12px;
}

/* Weekly View quick-add (bonus / deduction) — compact single-line rows */
.wv-quickadd-group { display: flex; flex-direction: column; gap: 8px; }
.wv-quickadd {
  display: flex;
  gap: 8px;
  align-items: center;
}
.wv-quickadd input {
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
}
.wv-quickadd input[type="text"] { flex: 1; }
.wv-quickadd input[type="number"] { width: 110px; flex: 0 0 auto; }
.wv-quickadd .btn { flex: 0 0 auto; white-space: nowrap; }

/* Weekly View totals row */
.wv-total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: var(--row-hover);
}

/* Days with no manifest submission (0 stops & 0 pkgs) — faded "not worked" rows */
.wv-not-worked td { opacity: 0.4; font-style: italic; }
.wv-not-worked td:first-child { font-style: normal; }
.wv-not-worked-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Weekly View inline-editable cells — ghost until hover/focus so the table
 * reads cleanly instead of a grid of input boxes. */
.wv-cell {
  width: 84px;
  padding: 7px 9px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin: 0;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
}
.wv-cell:hover { border-color: var(--border); background: var(--surface); }
.wv-cell:focus { border-color: var(--accent); background: var(--surface); }

/* Weekly pay card — driver identity header + total-owed highlight. */
.wv-pay-head { display: flex; align-items: center; gap: 13px; margin-bottom: 8px; }
.wv-pay-id { flex: 1; min-width: 0; }
.wv-pay-id .nm { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.wv-pay-id .cd { font-size: 12.5px; color: var(--text-faint); font-weight: 600; }
.wv-pay-owed { text-align: right; flex: none; }
.wv-pay-owed .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); font-weight: 700; }
.wv-pay-owed .amt { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.wv-adjust-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); font-weight: 700; margin: 4px 0 2px; }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  padding: 0 4px;
  margin-left: 6px;
  cursor: pointer;
  text-decoration: underline;
}
.btn-link:hover { color: var(--accent-hover); }

/* Filter tabs */
.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
  width: max-content;
  margin-bottom: 16px;
}
.tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* Misc */
.flex { display: flex; }
.between { justify-content: space-between; }
.center-items { align-items: center; }
.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.danger { color: var(--danger); }
.success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.bold { font-weight: 700; }
.big { font-size: 20px; }
.hidden { display: none !important; }

/* Filter bar — compact, inline controls (no stacked uppercase labels). */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.toolbar > label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
}
.toolbar > label > span {
  display: inline;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}
.toolbar select, .toolbar input {
  width: auto;
  min-width: 200px;
  padding: 10px 13px;
  border-radius: var(--radius-btn);
  font-weight: 600;
}
/* Checkbox filter (e.g. "Worked this period only") reads as a pill toggle. */
.toolbar label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 9px 14px;
  cursor: pointer;
}
.toolbar label.inline input[type="checkbox"] {
  width: auto;
  min-width: 0;
  accent-color: var(--accent);
}

/* Hamburger trigger + drawer backdrop — hidden on desktop, shown ≤768px. */
.nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 250;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.55);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Mobile */
@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  /* Full sidebar becomes a left drawer that slides in — grouped nav (Payroll)
     and the footer (sign out / theme / language) are all reachable now. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: 280px;
    max-width: 82vw;
    height: 100vh;
    padding: 16px 12px;
    overflow-y: auto;
    flex-direction: column;
    border-right: 1px solid var(--border);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.6);
  }
  /* Everything inside the drawer is visible (no more stripped bottom bar). */
  .sidebar-header { display: block; }
  .sidebar-nav { flex-direction: column; overflow-x: visible; gap: 4px; }
  .nav-group { display: block; }
  .sidebar-footer { display: flex; }

  .nav-toggle { display: inline-flex; }
  .nav-backdrop { display: block; }
  .nav-backdrop.show { opacity: 1; }

  .main { padding: 66px 16px 40px; }   /* clear the fixed hamburger up top */
  .row { grid-template-columns: 1fr; }
  .toolbar select, .toolbar input { width: 100%; }
  .lang-toggle { top: 16px; }

  /* P2-9: modals become full-width bottom sheets on phones */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-up 0.25s ease;
  }
  /* Leaflet map: shorter on small screens (inline default is 460px) */
  #map-canvas { height: 320px !important; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

/* success form message (some views use .success; keep parity with .ok) */
.form-msg.success { color: var(--success); }

/* ---------- Setup / onboarding wizard (setup.js) ---------- */
.wiz-steps {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px;
  list-style: none; padding: 0;
}
.wiz-step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); color: var(--text-muted);
  background: var(--card-bg);
}
.wiz-step .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 12px; background: var(--border); color: var(--text);
}
.wiz-step.active { border-color: var(--accent); color: var(--accent); }
.wiz-step.active .n { background: var(--accent); color: #fff; }
.wiz-step.done { color: var(--success); border-color: var(--success); }
.wiz-step.done .n { background: var(--success); color: #fff; }
.wiz-actions {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}
.wiz-rate-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; align-items: end;
}
.seed-review .col-head {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 10px 0;
}
.seed-review .col-body { margin: 0 0 6px; }
.seed-danger-box {
  border: 1px solid var(--danger); border-radius: 10px;
  padding: 14px; margin-top: 12px; background: rgba(255, 77, 77, 0.05);
}
.seed-danger-box input[type="text"] { max-width: 220px; letter-spacing: .18em; }
@media (max-width: 640px) { .wiz-rate-grid { grid-template-columns: 1fr; } }

/* Print (for generate report) */
@media print {
  .sidebar, .page-header .btn, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .table-wrap { box-shadow: none; border-color: #ccc; }
  .main { padding: 0; }
}
