/* Layout: two shells in one page — a 390px device frame for field staff,
   a rail + canvas console for the office. Palette taken from the Vibha Kumar
   Chit brand (forest green, warm gold, cream), density tuned for dashboards. */

:root {
  --cream: #F3F6F1;
  --surface: #FFFFFF;
  --surface-2: #FAFCF8;
  --surface-3: #EDF2EB;
  --line: #DBE4DA;
  --line-strong: #BFCFBE;
  --fg: #0C231C;
  --fg-2: #4C665C;
  --fg-3: #6E8779;

  --pri: #0B3328;
  --pri-2: #16523F;
  --pri-fg: #F4F9F3;
  --acc: #E4BE63;
  --acc-2: #C9A345;
  --acc-fg: #231709;

  --good: #15774A;   --good-bg: #E3F1E7;
  --warn: #8E6206;   --warn-bg: #F8EFD8;
  --bad:  #AE2A30;   --bad-bg:  #FAE6E5;
  --info: #1C5B86;   --info-bg: #E2EDF5;
  --muted-bg: #E9EEE7;

  --map-land: #EAF0E6; --map-grain: rgba(11,51,40,.04); --map-hill: #DCE7D2;
  --map-water: #C2DBDD; --map-casing: #FFFFFF; --map-hw: #DCC68E;
  --map-ar: #EAE4D4; --map-st: #F5F3EB; --map-rail: #A7B7A4;
  --zone-fill: rgba(21,119,74,.10); --zone-line: rgba(11,51,40,.42);
  --zone-fill-on: rgba(228,190,99,.26); --zone-line-on: #A8832C;
  --zone-chip: #0B3328; --zone-chip-fg: #F4F9F3;
  --trail: #2A6FA8; --trail-glow: rgba(42,111,168,.22);
  --stop-fill: #E4BE63; --stop-line: #8E6206; --stop-fg: #231709;
  --halo: rgba(228,190,99,.30);
  --pin-me: #C9A345; --pin-emp: #0B3328; --pin-lead: #2A6FA8; --pin-alert: #AE2A30;
  --dot-good: #15774A; --dot-warn: #C08A0C; --dot-bad: #AE2A30;
  --dot-info: #2A6FA8; --dot-muted: #8A9D8F;

  --f-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --f-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r1: 8px; --r2: 12px; --r3: 16px; --r4: 22px;
  --sh-1: 0 1px 2px rgba(12,35,28,.06), 0 1px 1px rgba(12,35,28,.04);
  --sh-2: 0 4px 16px rgba(12,35,28,.08), 0 1px 3px rgba(12,35,28,.06);
  --sh-3: 0 18px 48px rgba(6,32,26,.22);
  --t: 180ms cubic-bezier(.3,.7,.4,1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cream: #07130F; --surface: #0D1F19; --surface-2: #112620; --surface-3: #163026;
    --line: #1F3A2F; --line-strong: #2E4E3F;
    --fg: #E9F2EB; --fg-2: #A3B9AB; --fg-3: #87A092;
    --pri: #1C5F45; --pri-2: #28795A; --pri-fg: #EAF4EC;
    --acc: #E4BE63; --acc-2: #CFA94B; --acc-fg: #1A1105;
    --good: #58C98C; --good-bg: #0F3324; --warn: #E8B74A; --warn-bg: #33270B;
    --bad: #F08A8A; --bad-bg: #3A1618; --info: #7FBDEA; --info-bg: #0F2A3D;
    --muted-bg: #17302A;
    --map-land: #0A1A15; --map-grain: rgba(255,255,255,.03); --map-hill: #10251C;
    --map-water: #10303A; --map-casing: #050E0B; --map-hw: #4D4228;
    --map-ar: #273228; --map-st: #1B2721; --map-rail: #2F4639;
    --zone-fill: rgba(60,190,125,.11); --zone-line: rgba(168,206,183,.48);
    --zone-fill-on: rgba(228,190,99,.17); --zone-line-on: #E4BE63;
    --zone-chip: #16382A; --zone-chip-fg: #E9F2EB;
    --trail: #6FB6E8; --trail-glow: rgba(111,182,232,.18);
    --stop-fill: #E4BE63; --stop-line: #8E6206; --stop-fg: #1A1105;
    --halo: rgba(228,190,99,.26);
    --pin-me: #E4BE63; --pin-emp: #58C98C; --pin-lead: #6FB6E8; --pin-alert: #F08A8A;
    --dot-good: #58C98C; --dot-warn: #E8B74A; --dot-bad: #F08A8A;
    --dot-info: #6FB6E8; --dot-muted: #728C7C;
    --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 4px 18px rgba(0,0,0,.45);
    --sh-3: 0 20px 56px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --cream: #07130F; --surface: #0D1F19; --surface-2: #112620; --surface-3: #163026;
  --line: #1F3A2F; --line-strong: #2E4E3F;
  --fg: #E9F2EB; --fg-2: #A3B9AB; --fg-3: #87A092;
  --pri: #1C5F45; --pri-2: #28795A; --pri-fg: #EAF4EC;
  --acc: #E4BE63; --acc-2: #CFA94B; --acc-fg: #1A1105;
  --good: #58C98C; --good-bg: #0F3324; --warn: #E8B74A; --warn-bg: #33270B;
  --bad: #F08A8A; --bad-bg: #3A1618; --info: #7FBDEA; --info-bg: #0F2A3D;
  --muted-bg: #17302A;
  --map-land: #0A1A15; --map-grain: rgba(255,255,255,.03); --map-hill: #10251C;
  --map-water: #10303A; --map-casing: #050E0B; --map-hw: #4D4228;
  --map-ar: #273228; --map-st: #1B2721; --map-rail: #2F4639;
  --zone-fill: rgba(60,190,125,.11); --zone-line: rgba(168,206,183,.48);
  --zone-fill-on: rgba(228,190,99,.17); --zone-line-on: #E4BE63;
  --zone-chip: #16382A; --zone-chip-fg: #E9F2EB;
  --trail: #6FB6E8; --trail-glow: rgba(111,182,232,.18);
  --stop-fill: #E4BE63; --stop-line: #8E6206; --stop-fg: #1A1105;
  --halo: rgba(228,190,99,.26);
  --pin-me: #E4BE63; --pin-emp: #58C98C; --pin-lead: #6FB6E8; --pin-alert: #F08A8A;
  --dot-good: #58C98C; --dot-warn: #E8B74A; --dot-bad: #F08A8A;
  --dot-info: #6FB6E8; --dot-muted: #728C7C;
  --sh-1: 0 1px 2px rgba(0,0,0,.4); --sh-2: 0 4px 18px rgba(0,0,0,.45);
  --sh-3: 0 20px 56px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--fg);
  font-family: var(--f-ui); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 60; background: var(--pri);
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--pri-2); }
:focus-visible { outline: 3px solid var(--acc-2); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .88em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3);
}
.muted { color: var(--fg-2); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.display { font-family: var(--f-display); font-weight: 500; letter-spacing: -.015em; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: var(--s4) 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.stack { display: flex; flex-direction: column; }
.wrap { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.ic.sm { width: 16px; height: 16px; stroke-width: 1.9; }
svg.ic.lg { width: 26px; height: 26px; stroke-width: 1.6; }

/* --------------------------------------------------------------- chrome */

.chrome {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--pri); color: var(--pri-fg);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.chromeIn {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.lock { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lockMark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--acc); color: var(--acc-fg);
  display: grid; place-items: center;
  font-family: var(--f-display); font-size: 17px; font-weight: 600;
}
.lockName { font-family: var(--f-display); font-size: 16px; line-height: 1.15; }
.lockSub { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; opacity: .72; }
.seg {
  display: flex; gap: 3px; padding: 3px; border-radius: 999px;
  background: rgba(255,255,255,.1);
}
.seg button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
  min-height: 34px; transition: background var(--t), color var(--t);
}
.seg button:hover { background: rgba(255,255,255,.12); }
.seg button[aria-pressed="true"] { background: var(--acc); color: var(--acc-fg); font-weight: 600; }
.chromeTag {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28);
  opacity: .9;
}
.ghostBtn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2);
  color: inherit; font-size: 13px; transition: background var(--t);
}
.ghostBtn:hover { background: rgba(255,255,255,.18); }

/* ---------------------------------------------------------------- login */

.login {
  min-height: calc(100vh - 120px);
  display: grid; grid-template-columns: 1.05fr .95fr; align-items: stretch;
}
.loginArt {
  background: var(--pri); color: var(--pri-fg); position: relative; overflow: hidden;
  padding-block: clamp(40px, 7vw, 76px);
  padding-left: max(32px, env(safe-area-inset-left, 0px));
  padding-right: 32px;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--s6);
}
.loginArt::after {
  content: ""; position: absolute; inset: auto -120px -180px auto;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(228,190,99,.22), transparent 62%);
}
.loginArt h1 {
  font-family: var(--f-display); font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 400; line-height: 1.06; max-width: 15ch;
}
.loginArt h1 em { font-style: italic; color: var(--acc); }
.loginLede { max-width: 42ch; color: rgba(244,249,243,.8); font-size: 15px; }
.loginStats { display: flex; gap: var(--s5); flex-wrap: wrap; position: relative; }
.loginStat { min-width: 92px; }
.loginStat b { display: block; font-family: var(--f-display); font-size: 26px; font-weight: 500; }
.loginStat span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.loginPanel {
  background: var(--cream);
  padding-block: clamp(32px, 6vw, 64px);
  padding-left: 32px;
  padding-right: max(32px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: var(--s4); justify-content: center;
}
.credGrid { display: grid; gap: var(--s3); }
.cred {
  display: flex; gap: var(--s3); align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3);
  padding: var(--s4); cursor: pointer; box-shadow: var(--sh-1);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.cred:hover { border-color: var(--pri-2); box-shadow: var(--sh-2); transform: translateY(-1px); }
.credIcon {
  width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--pri-2);
}
.cred[data-role="admin"] .credIcon { background: var(--pri); color: var(--acc); }
.cred[data-role="dev"] .credIcon { background: var(--muted-bg); color: var(--fg-2); }
.credName { font-weight: 600; font-size: 15px; }
.credRole { font-size: 12.5px; color: var(--fg-2); }
.credKeys { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); margin-top: 3px; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; min-height: 0; }
  .loginArt { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .loginPanel { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* ---------------------------------------------------------------- phone */

.deviceStage {
  display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 320px);
  gap: var(--s6); justify-content: center; align-items: start;
  padding-block: var(--s6);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.device {
  width: 390px; max-width: 100%; height: 788px;
  background: #0A1510; border-radius: 42px; padding: 11px;
  box-shadow: var(--sh-3), 0 0 0 1.5px rgba(255,255,255,.07) inset;
  position: sticky; top: 92px;
}
.screen {
  position: relative; height: 100%; border-radius: 32px; overflow: hidden;
  background: var(--cream); display: flex; flex-direction: column;
}
.notch {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 104px; height: 22px; border-radius: 999px; background: #0A1510; z-index: 6;
}
.statusbar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 9px 20px 2px; font-size: 11.5px; font-weight: 600;
  background: var(--pri); color: var(--pri-fg);
}
.statusbar .bars { display: inline-flex; flex-direction: row; gap: 2px; align-items: flex-end; height: 12px; flex: none; }
.statusbar .bars i { display: block; width: 3px; flex: none; background: currentColor; border-radius: 1px; }
.appbar {
  flex: none; background: var(--pri); color: var(--pri-fg);
  padding: 8px 16px 14px; display: flex; align-items: center; gap: var(--s3);
}
.appbar h2 { font-size: 17px; font-weight: 600; }
.appbar .sub { font-size: 11.5px; opacity: .75; }
.appbarBtn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08); display: grid; place-items: center; cursor: pointer; flex: none;
}
.appbarBtn:hover { background: rgba(255,255,255,.18); }
.screenBody {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--s4) var(--s4) 18px; display: flex; flex-direction: column; gap: var(--s3);
}
.bottomNav {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px 8px;
}
.navItem {
  border: 0; background: transparent; cursor: pointer; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--fg-3); font-size: 10.5px; font-weight: 500; border-radius: 10px;
  transition: color var(--t), background var(--t);
}
.navItem:hover { background: var(--surface-3); }
.navItem[aria-current="page"] { color: var(--pri-2); font-weight: 600; }
.navItem[aria-current="page"] svg { stroke-width: 2.1; }
.navDot { width: 5px; height: 5px; border-radius: 50%; background: var(--bad); position: absolute; margin: -16px 0 0 14px; }
.navItem span.pos { position: relative; }

.sideNotes { display: flex; flex-direction: column; gap: var(--s3); }

@media (max-width: 980px) {
  .deviceStage { grid-template-columns: minmax(0, 390px); }
}
@media (max-width: 720px) {
  .deviceStage { padding-block: 0; gap: 0; grid-template-columns: 1fr; }
  .device { width: 100%; height: calc(100vh - 118px); min-height: 540px; border-radius: 0; padding: 0; position: static; box-shadow: none; }
  .screen { border-radius: 0; }
  .notch { display: none; }
  .statusbar { display: none; }
  .sideNotes { padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); padding-block: var(--s4); }
}

/* -------------------------------------------------------------- console */

.console { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: var(--s4) var(--s3); display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto;
}
.railHead { padding: 4px var(--s3) var(--s3); }
.railItem {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; cursor: pointer; min-height: 44px;
  padding: 0 var(--s3); border-radius: 10px; color: var(--fg-2); font-size: 14px;
  transition: background var(--t), color var(--t);
}
.railItem:hover { background: var(--surface-3); color: var(--fg); }
.railItem[aria-current="page"] { background: var(--pri); color: var(--pri-fg); font-weight: 600; }
.railItem .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: var(--muted-bg); color: var(--fg-2);
}
.railItem[aria-current="page"] .count { background: rgba(255,255,255,.18); color: var(--pri-fg); }
.railItem.alert .count { background: var(--bad-bg); color: var(--bad); }
.main {
  min-width: 0;
  padding-block: var(--s5) var(--s6);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: var(--s4);
}
.pageHead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.pageHead h1 { font-family: var(--f-display); font-size: clamp(22px, 2.5vw, 30px); font-weight: 500; }
.pageHead .lede { color: var(--fg-2); font-size: 13.5px; margin-top: 2px; }

@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; }
  .rail {
    position: static; max-height: none; flex-direction: row; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line); gap: 6px; padding: 10px var(--s3);
  }
  .railHead { display: none; }
  .railItem { width: auto; white-space: nowrap; padding: 0 14px; }
  .railItem .count { margin-left: 6px; }
}

/* ----------------------------------------------------------- primitives */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3);
  padding: var(--s4); box-shadow: var(--sh-1);
}
.card.flat { box-shadow: none; }
.card.tight { padding: var(--s3); }
.card.pad0 { padding: 0; overflow: hidden; }
.cardHead { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.cardHead h3 { font-size: 14.5px; }
.grid { display: grid; gap: var(--s3); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); }
/* Inside the 390px device frame the auto-fit grids would collapse to one column. */
.screenBody .g2, .screenBody .g3, .screenBody .g4 { grid-template-columns: 1fr 1fr; }
.screenBody .g3 { grid-template-columns: repeat(3, 1fr); }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--s4); }
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; } }

.kpi { display: flex; flex-direction: column; gap: 3px; }
.kpi .v { font-family: var(--f-display); font-size: 30px; font-weight: 500; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .k { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; }
.kpi .d { font-size: 12.5px; color: var(--fg-2); }
.kpi.accentTop { border-top: 3px solid var(--acc); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--muted-bg); color: var(--fg-2);
}
.badge svg { width: 13px; height: 13px; stroke-width: 2.2; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.solid { background: var(--pri); color: var(--pri-fg); }
.badge.gold { background: var(--acc); color: var(--acc-fg); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.noDot::before { display: none; }

.chipRow { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg-2);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; min-height: 36px; transition: all var(--t);
}
.chip:hover { border-color: var(--pri-2); color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--pri); border-color: var(--pri); color: var(--pri-fg); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font-size: 14px; font-weight: 600; transition: background var(--t), border-color var(--t), opacity var(--t);
}
.btn:hover { background: var(--surface-3); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: var(--pri-fg); }
.btn.pri:hover { background: var(--pri-2); border-color: var(--pri-2); }
.btn.acc { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); }
.btn.acc:hover { background: var(--acc-2); border-color: var(--acc-2); }
.btn.danger { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.sm { min-height: 36px; padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--surface); }
.iconBtn {
  width: 44px; height: 44px; min-width: 44px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg-2);
  display: grid; place-items: center; transition: all var(--t);
}
.iconBtn:hover { background: var(--surface-3); color: var(--fg); }
.iconBtn.sm { width: 36px; height: 36px; min-width: 36px; border-radius: 9px; }

/* ------------------------------------------------------------- listings */

.list { display: flex; flex-direction: column; }
.item {
  display: flex; gap: var(--s3); align-items: center; width: 100%; text-align: left;
  padding: var(--s3); border: 0; border-bottom: 1px solid var(--line);
  background: transparent; cursor: pointer; transition: background var(--t);
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--surface-2); }
.item.static { cursor: default; }
.item.static:hover { background: transparent; }
.avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 13px; background: var(--surface-3); color: var(--pri-2);
  border: 1px solid var(--line);
}
.avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }
.avatar.gold { background: var(--acc); color: var(--acc-fg); border-color: var(--acc-2); }
.itemMain { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; }
.itemTitle { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itemSub { display: block; font-size: 12.5px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itemEnd { flex: none; text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.tblWrap { overflow-x: auto; border-radius: var(--r2); border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
table.tbl th {
  text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--fg-3); font-weight: 600; padding: 10px var(--s3); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.tbl td { padding: 10px var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.r, table.tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .who { display: flex; align-items: center; gap: 9px; }

/* ------------------------------------------------------------------ map */

.mapWrap {
  position: relative; border-radius: var(--r3); overflow: hidden;
  border: 1px solid var(--line); background: var(--map-land);
}
.mapWrap svg.map { display: block; width: 100%; height: 100%; }
.mapWrap.h-sm { height: 190px; }
.mapWrap.h-md { height: 300px; }
.mapWrap.h-lg { height: 480px; }
@media (max-width: 720px) { .mapWrap.h-lg { height: 340px; } }
text.mapPlace {
  font-family: var(--f-ui); font-size: 11px; font-weight: 600; fill: var(--fg-2);
  letter-spacing: .02em; paint-order: stroke; stroke: var(--map-land); stroke-width: 3px;
}
text.mapZoneLabel { font-family: var(--f-ui); font-size: 11.5px; font-weight: 600; fill: var(--zone-chip-fg); }
text.mapStop { font-family: var(--f-mono); font-size: 9.5px; font-weight: 600; fill: var(--stop-fg); }
text.mapPinText { font-family: var(--f-ui); font-size: 9px; font-weight: 700; fill: var(--pri); }
.mapOverlay {
  position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap;
  max-width: calc(100% - 20px);
}
.mapTag {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--fg-2);
  display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--sh-1);
}
.mapTag i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.mapTop { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.gpsPuck {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r2);
  box-shadow: var(--sh-2); padding: 10px var(--s3); font-size: 12px; max-width: 232px;
}
.gpsPuck .lbl { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; }
.dragPin { position: absolute; cursor: grab; touch-action: none; transform: translate(-50%, -100%); }
.dragPin:active { cursor: grabbing; }
.dragPin svg { width: 38px; height: 46px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }

/* ----------------------------------------------------------- attendance */

.punchWrap { display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.punch {
  width: 188px; height: 188px; border-radius: 50%; cursor: pointer; position: relative;
  border: 0; background: var(--pri); color: var(--pri-fg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 10px 30px rgba(11,51,40,.3); transition: transform var(--t), background var(--t);
}
.punch:hover { transform: scale(1.02); }
.punch:active { transform: scale(.985); }
.punch .pLabel { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.punch .pSub { font-size: 11.5px; opacity: .8; max-width: 130px; text-align: center; line-height: 1.3; }
.punch.out { background: var(--acc); color: var(--acc-fg); box-shadow: 0 10px 30px rgba(201,163,69,.35); }
.punch.blocked { background: var(--muted-bg); color: var(--fg-2); box-shadow: none; cursor: not-allowed; }
.punch.blocked:hover { transform: none; }
.punchRing {
  position: absolute; inset: -11px; border-radius: 50%; border: 2px solid var(--acc);
  opacity: .5; animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.96); opacity: .55 } 70% { transform: scale(1.1); opacity: 0 } 100% { opacity: 0 } }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calHead { font-size: 10px; text-align: center; color: var(--fg-3); font-weight: 600; letter-spacing: .05em; }
.calCell {
  aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--fg-2); border: 1px solid transparent;
}
.calCell.present { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.calCell.late { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.calCell.half { background: var(--warn-bg); color: var(--warn); }
.calCell.absent { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.calCell.leave { background: var(--info-bg); color: var(--info); }
.calCell.weekoff { background: transparent; color: var(--fg-3); opacity: .55; }
.calCell.pending { background: var(--surface); border: 1px dashed var(--line-strong); color: var(--fg-3); }
.calCell.today { outline: 2px solid var(--acc); outline-offset: 1px; }
.legendRow { display: flex; flex-wrap: wrap; gap: var(--s3); font-size: 11.5px; color: var(--fg-2); }
.legendRow span { display: inline-flex; align-items: center; gap: 5px; }
.legendRow i { width: 10px; height: 10px; border-radius: 3px; display: block; }

/* ---------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.field .hint { font-size: 11.5px; color: var(--fg-2); }
.field .err { font-size: 12px; color: var(--bad); font-weight: 600; display: flex; gap: 5px; align-items: center; }
input[type="text"], input[type="tel"], input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font: inherit; font-size: 14px; transition: border-color var(--t), box-shadow var(--t);
}
textarea { min-height: 76px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--fg-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pri-2); box-shadow: 0 0 0 3px rgba(22,82,63,.16);
}
input[aria-invalid="true"] { border-color: var(--bad); }
input[type="range"] { width: 100%; accent-color: var(--pri-2); min-height: 44px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; }
.switch input { appearance: none; width: 46px; height: 27px; border-radius: 999px; background: var(--line-strong);
  position: relative; cursor: pointer; flex: none; transition: background var(--t); margin: 0; }
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; transition: transform var(--t); box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked { background: var(--pri-2); }
.switch input:checked::after { transform: translateX(19px); }
.radioCards { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.radioCard {
  border: 1px solid var(--line-strong); border-radius: var(--r2); padding: 10px; cursor: pointer;
  text-align: center; font-size: 13px; font-weight: 600; background: var(--surface);
  min-height: 44px; transition: all var(--t); color: var(--fg-2);
}
.radioCard:hover { border-color: var(--pri-2); }
.radioCard[aria-pressed="true"] { border-color: var(--pri); background: var(--pri); color: var(--pri-fg); }
.schemePick {
  display: flex; gap: var(--s3); align-items: center; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s3); background: var(--surface);
  transition: all var(--t);
}
.schemePick:hover { border-color: var(--pri-2); }
.schemePick[aria-pressed="true"] { border-color: var(--pri); box-shadow: 0 0 0 2px rgba(22,82,63,.18); }
.schemePick .fit { margin-left: auto; }

/* --------------------------------------------------------------- charts */

.funnel { display: flex; flex-direction: column; gap: 7px; }
.fStep { display: grid; grid-template-columns: 96px minmax(0, 1fr) 54px; gap: var(--s3); align-items: center; font-size: 12.5px; }
.fBar { height: 26px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.fBar i { display: block; height: 100%; border-radius: 6px; background: var(--pri-2); }
.fStep.s-new i { background: #3F7FA8; }
.fStep.s-contacted i { background: #2E6B8C; }
.fStep.s-visited i { background: var(--acc-2); }
.fStep.s-documents i { background: #B08427; }
.fStep.s-enrolled i { background: var(--good); }
.fStep.s-lost i { background: var(--dot-bad); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.barRow { display: grid; grid-template-columns: 112px minmax(0, 1fr) 70px; gap: var(--s3); align-items: center; font-size: 13px; }
.barTrack { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.barTrack i { display: block; height: 100%; border-radius: 999px; background: var(--pri-2); }
.barTrack.gold i { background: var(--acc-2); }
.prog { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 999px; background: var(--good); }
.prog.warn i { background: var(--acc-2); }
.prog.bad i { background: var(--dot-bad); }

/* ------------------------------------------------------------- timeline */

.tl { display: flex; flex-direction: column; gap: 0; }
.tlItem { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: var(--s3); }
.tlRail { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tlDot {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--fg-2); border: 1px solid var(--line);
}
.tlDot.good { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.tlDot.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.tlDot.open { background: var(--surface); border-style: dashed; border-color: var(--line-strong); }
.tlLine { flex: 1 1 auto; width: 2px; background: var(--line); min-height: 14px; }
.tlBody { padding-bottom: var(--s4); min-width: 0; }
.tlWhen { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; }
.tlText { font-size: 13.5px; }

.steps { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--fg-3); font-weight: 600; }
.step i {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px;
  background: var(--surface-3); color: var(--fg-2); font-style: normal; border: 1px solid var(--line);
}
.step.on { color: var(--fg); }
.step.on i { background: var(--pri); color: var(--pri-fg); border-color: var(--pri); }
.step.done i { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.stepSep { width: 18px; height: 1px; background: var(--line-strong); }

/* --------------------------------------------------------- sheet, modal */

.scrim {
  position: fixed; inset: 0; z-index: 70; background: rgba(5,18,14,.58);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 140ms ease-out;
}
.scrim.center { align-items: center; padding: var(--s4); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  background: var(--surface); width: 100%; max-width: 440px;
  border-radius: var(--r4) var(--r4) 0 0; box-shadow: var(--sh-3);
  max-height: 88vh; display: flex; flex-direction: column;
  animation: rise 220ms cubic-bezier(.2,.8,.3,1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.modal {
  background: var(--surface); width: 100%; max-width: 720px; border-radius: var(--r3);
  box-shadow: var(--sh-3); max-height: 86vh; display: flex; flex-direction: column;
  animation: rise 200ms cubic-bezier(.2,.8,.3,1); border: 1px solid var(--line);
}
.modal.wide { max-width: 940px; }
@keyframes rise { from { transform: translateY(22px); opacity: .4 } to { transform: none; opacity: 1 } }
.sheetHead, .modalHead {
  flex: none; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4); border-bottom: 1px solid var(--line);
}
.sheetHead h3, .modalHead h3 { font-size: 16px; flex: 1 1 auto; min-width: 0; }
.sheetBody, .modalBody { overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.sheetFoot, .modalFoot {
  flex: none; display: flex; gap: var(--s2); padding: var(--s4); border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.sheetFoot .btn, .modalFoot .btn { flex: 1 1 auto; }
.sheetGrab { width: 38px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: 9px auto 0; }

.toasts {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: var(--s2); width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--pri); color: var(--pri-fg); border-radius: var(--r2); padding: 12px var(--s4);
  box-shadow: var(--sh-3); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start;
  animation: rise 180ms ease-out;
}
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast svg { flex: none; margin-top: 1px; }

.note {
  border-left: 3px solid var(--acc); background: var(--surface); border: 1px solid var(--line);
  border-left-width: 3px; border-radius: var(--r2); padding: var(--s3) var(--s4); font-size: 13px;
  color: var(--fg-2);
}
.note b { color: var(--fg); }
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--fg-2); font-size: 13.5px; }
.empty svg { width: 34px; height: 34px; stroke: var(--fg-3); margin-bottom: 10px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s3); font-size: 13px; align-items: baseline; }
.kv dt { color: var(--fg-2); }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.payRow { display: flex; justify-content: space-between; gap: var(--s3); font-size: 13.5px; padding: 6px 0; }
.payRow.total { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 15px; }
.payRow.minus span:last-child { color: var(--bad); }
.payRow span:last-child { font-variant-numeric: tabular-nums; }

.matrix { display: grid; gap: 3px; font-size: 10px; }
.matrixCell { height: 22px; border-radius: 4px; background: var(--surface-3); }
.matrixCell.present { background: var(--good); }
.matrixCell.late { background: var(--acc-2); }
.matrixCell.half { background: var(--warn-bg); border: 1px solid var(--warn); }
.matrixCell.absent { background: var(--dot-bad); }
.matrixCell.leave { background: var(--info-bg); border: 1px solid var(--info); }
.matrixCell.weekoff { background: transparent; border: 1px dashed var(--line); }
.matrixCell.pending { background: var(--surface); border: 1px dashed var(--bad); }

.scrubRow { display: flex; align-items: center; gap: var(--s3); }
.scrubRow input[type="range"] { flex: 1 1 auto; }

.flagRow {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.flagRow:last-child { border-bottom: 0; }

/* ------------------------------------------------------------ guided demo */

.tourLaunch {
  position: fixed; z-index: 80; cursor: pointer;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 9px; min-height: 48px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--acc-2);
  background: var(--acc); color: var(--acc-fg); font-size: 14px; font-weight: 600;
  box-shadow: var(--sh-3); transition: transform var(--t);
}
.tourLaunch:hover { transform: translateY(-1px); }
.tourCount {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: rgba(35,23,9,.16);
}
.tourPing {
  position: absolute; inset: -4px; border-radius: 999px; border: 2px solid var(--acc);
  opacity: .6; animation: pulse 2.8s ease-out infinite; pointer-events: none;
}

.tour {
  position: fixed; z-index: 80;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 32px));
  background: var(--pri); color: var(--pri-fg);
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--r3);
  box-shadow: var(--sh-3); overflow: hidden;
  animation: rise 220ms cubic-bezier(.2,.8,.3,1);
}
.tour.up { bottom: auto; top: calc(14px + env(safe-area-inset-top, 0px)); }
.tourBar {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px;
  background: rgba(0,0,0,.18);
}
.tourStep { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.tourTrack { flex: 1 1 auto; height: 4px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; }
.tourTrack i { display: block; height: 100%; border-radius: 999px; background: var(--acc); transition: width var(--t); }
.tourIcon {
  width: 32px; height: 32px; flex: none; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08);
  color: inherit; display: grid; place-items: center; transition: background var(--t);
}
.tourIcon:hover { background: rgba(255,255,255,.2); }
.tourBody { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 8px; }
.tourTitle { font-family: var(--f-display); font-size: 19px; font-weight: 500; line-height: 1.15; }
.tourText { font-size: 13.5px; line-height: 1.5; color: rgba(244,249,243,.86); }
.tourNotice {
  display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; font-weight: 500;
  color: var(--acc); border-top: 1px solid rgba(255,255,255,.12); padding-top: 10px;
}
.tourNotice svg { flex: none; margin-top: 2px; }
.tourFoot { display: flex; gap: var(--s2); padding: 12px 16px 16px; }
.tourFoot .btn { flex: 1 1 auto; }
.tourFoot .btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: var(--pri-fg); }
.tourFoot .btn.ghost:hover { background: rgba(255,255,255,.18); }
.tourFoot .btn.pri { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); }
.tourFoot .btn.pri:hover { background: var(--acc-2); border-color: var(--acc-2); }
.tour.min .tourBar { padding: 8px 8px 8px 14px; }

@media (max-width: 560px) {
  .tour { left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: auto; }
  .tourLaunch { left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; }
  .punchRing { display: none; }
}
