/* =========================================================================
   Movement Tracker — design system
   Minimal/Swiss base · tracking-blue + indigo brand · per-metric accents
   (used on icon chips, sparklines, pills) · compact cards · purposeful motion.
   Data colours: single-hue blue for magnitude, orange = stops, green = start,
   red = end, slate = no data.
   ========================================================================= */
:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Bengali", sans-serif;
  --font-display: "Playfair Display", "Georgia", "Times New Roman", serif;
  --name-grad: linear-gradient(95deg, #1e3a8a 0%, #4338ca 45%, #9333ea 75%, #db2777 100%);

  --page: #f4f6fb;
  --mesh-1: rgba(79, 70, 229, .10);
  --mesh-2: rgba(14, 165, 233, .10);
  --mesh-3: rgba(249, 115, 22, .05);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --glass: rgba(255, 255, 255, .76);
  --border: #e5e9f2;
  --border-strong: #d3d9e6;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #5b6b81;   /* 4.8:1 on every light surface (was #64748b: 4.2-4.4, below AA for small text) */
  --grid: #eef1f6;
  --axis: #cfd6e3;

  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #eaf1ff;
  /* white text sits on this: every stop keeps >= 5:1 (the lighter #3b82f6/#8b5cf6 stops were 3.7-4.2) */
  --brand-grad: linear-gradient(135deg, #2563eb 0%, #4f46e5 60%, #7c3aed 100%);
  --on-brand: #ffffff;
  --accent: var(--brand);            /* alias used by charts */
  --accent-strong: var(--brand-strong);
  --accent-soft: var(--brand-soft);

  /* metric accents (icon chips, sparklines, pills) */
  --blue: #2563eb;    --blue-soft: #e8f0fe;
  --indigo: #4f46e5;  --indigo-soft: #eceafd;
  --teal: #0d9488;    --teal-soft: #dff4f1;
  --violet: #7c3aed;  --violet-soft: #f1eafe;
  --amber: #d97706;   --amber-soft: #fdf1dc;
  --rose: #e11d48;    --rose-soft: #fde7ec;
  --cyan: #0891b2;    --cyan-soft: #ddf3f8;
  --emerald: #059669; --emerald-soft: #dcf5ea;
  --orange: #ea580c;  --orange-soft: #fdebdf;  --orange-text: #9a3412;
  --slate: #64748b;   --slate-soft: #eef2f7;

  --c-stop: #f97316;
  --c-stop-2: #ea580c;
  --c-start: #10b981;
  --c-end: #ef4444;
  --c-gap: #94a3b8;

  --good: #16a34a; --good-text: #15803d;
  --warning: #f59e0b; --warning-text: #92400e;

  /* categorical trio for small multi-series marks (district split); validated all-pairs incl. colour-blind */
  --cat-1: #2563eb; --cat-2: #0d9488; --cat-3: #d97706;
  /* marker fills that carry white text (>= 5:1) */
  --mk-stop-a: #f97316; --mk-stop-b: #c2410c;
  --mk-start-a: #059669; --mk-start-b: #047857;
  --mk-end-a: #dc2626; --mk-end-b: #b91c1c;
  --serious: #f97316;
  --critical: #dc2626;

  /* sequential ramp (low → high), one hue */
  /* lowest heat class starts at #93c5fd so light-activity areas don't vanish into "no activity" */
  --seq-1: #dbeafe; --seq-2: #93c5fd; --seq-3: #60a5fa; --seq-4: #3b82f6; --seq-5: #2563eb; --seq-6: #1d4ed8; --seq-7: #1e3a8a;

  --r-lg: 16px;
  --r: 12px;
  --r-sm: 9px;
  --r-xs: 7px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-hover: 0 2px 4px rgba(15, 23, 42, .05), 0 16px 32px -14px rgba(15, 23, 42, .22);
  --shadow-pop: 0 24px 60px -18px rgba(15, 23, 42, .35), 0 2px 6px rgba(15, 23, 42, .06);
  --ring: 0 0 0 3px rgba(37, 99, 235, .22);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --topbar-h: 60px;
  --foot-h: 46px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #050505; --mesh-1: rgba(99, 102, 241, .10); --mesh-2: rgba(236, 72, 153, .06); --mesh-3: rgba(249, 115, 22, .04);
    --surface: #121212; --surface-2: #181818; --surface-3: #232323; --glass: rgba(14, 14, 14, .76);
    --border: rgba(255, 255, 255, .10); --border-strong: rgba(255, 255, 255, .18);
    --text: #f2f2f2; --text-2: #b8b8b8; --muted: #9a9a9a; --grid: rgba(255, 255, 255, .07); --axis: rgba(255, 255, 255, .22);
    --brand: #3b82f6; --brand-strong: #7fb0ff; --brand-soft: rgba(59, 130, 246, .16);
    --blue: #60a5fa; --blue-soft: rgba(96, 165, 250, .15); --indigo: #818cf8; --indigo-soft: rgba(129, 140, 248, .15);
    --teal: #2dd4bf; --teal-soft: rgba(45, 212, 191, .13); --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .15);
    --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .13); --rose: #fb7185; --rose-soft: rgba(251, 113, 133, .14);
    --cyan: #22d3ee; --cyan-soft: rgba(34, 211, 238, .13); --emerald: #34d399; --emerald-soft: rgba(52, 211, 153, .13);
    --orange: #fb923c; --orange-soft: rgba(251, 146, 60, .14); --slate: #94a3b8; --slate-soft: rgba(148, 163, 184, .14);
    --good-text: #4ade80; --warning-text: #fbbf24; --orange-text: #fdba74;
    --cat-1: #3987e5; --cat-2: #199e70; --cat-3: #c98500;
    --name-grad: linear-gradient(95deg, #bfdbfe 0%, #a5b4fc 40%, #d8b4fe 72%, #f9a8d4 100%);
    --seq-1: #172554; --seq-2: #1e3a8a; --seq-3: #1d4ed8; --seq-4: #2563eb; --seq-5: #3b82f6; --seq-6: #60a5fa; --seq-7: #bfdbfe;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 36px -14px rgba(0, 0, 0, .7);
    --shadow-pop: 0 24px 60px -18px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .08);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #050505; --mesh-1: rgba(99, 102, 241, .10); --mesh-2: rgba(236, 72, 153, .06); --mesh-3: rgba(249, 115, 22, .04);
  --surface: #121212; --surface-2: #181818; --surface-3: #232323; --glass: rgba(14, 14, 14, .76);
  --border: rgba(255, 255, 255, .10); --border-strong: rgba(255, 255, 255, .18);
  --text: #f2f2f2; --text-2: #b8b8b8; --muted: #9a9a9a; --grid: rgba(255, 255, 255, .07); --axis: rgba(255, 255, 255, .22);
  --brand: #3b82f6; --brand-strong: #7fb0ff; --brand-soft: rgba(59, 130, 246, .16);
  --blue: #60a5fa; --blue-soft: rgba(96, 165, 250, .15); --indigo: #818cf8; --indigo-soft: rgba(129, 140, 248, .15);
  --teal: #2dd4bf; --teal-soft: rgba(45, 212, 191, .13); --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .15);
  --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .13); --rose: #fb7185; --rose-soft: rgba(251, 113, 133, .14);
  --cyan: #22d3ee; --cyan-soft: rgba(34, 211, 238, .13); --emerald: #34d399; --emerald-soft: rgba(52, 211, 153, .13);
  --orange: #fb923c; --orange-soft: rgba(251, 146, 60, .14); --slate: #94a3b8; --slate-soft: rgba(148, 163, 184, .14);
  --good-text: #4ade80; --warning-text: #fbbf24; --orange-text: #fdba74;
  --cat-1: #3987e5; --cat-2: #199e70; --cat-3: #c98500;
  --name-grad: linear-gradient(95deg, #bfdbfe 0%, #a5b4fc 40%, #d8b4fe 72%, #f9a8d4 100%);
  --seq-1: #172554; --seq-2: #1e3a8a; --seq-3: #1d4ed8; --seq-4: #2563eb; --seq-5: #3b82f6; --seq-6: #60a5fa; --seq-7: #bfdbfe;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 36px -14px rgba(0, 0, 0, .7);
  --shadow-pop: 0 24px 60px -18px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .08);
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 13.5px/1.5 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  display: flex; flex-direction: column; min-height: 100vh; min-width: 1024px;
}
.bg-mesh { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 420px at 8% -8%, var(--mesh-1), transparent 62%),
    radial-gradient(800px 380px at 96% -6%, var(--mesh-2), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, var(--mesh-3), transparent 60%); }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h2 { font-size: 14px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; }
code { font: 11.5px ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; color: var(--text-2); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, .table td, .kpi-value { font-variant-numeric: tabular-nums; }
.ico { width: 18px; height: 18px; flex: none; fill: currentColor; }
button { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: rgba(59, 130, 246, .22); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ------------------------------------------------------------------ motion primitives */
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); } 70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* staggered entrance: JS sets --i on each child and adds .enter to the view */
.enter > *, .stagger > * { animation: rise .5s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
.kpis.stagger > * { animation-delay: calc(var(--i, 0) * 55ms); }

/* ------------------------------------------------------------------ buttons */
.btn { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 10px;
  border: 1px solid transparent; background: none; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 13px;
  transition: background .18s var(--ease), color .18s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease), border-color .18s; }
.btn:active { transform: scale(.97); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-primary { background: var(--brand-grad); color: var(--on-brand); box-shadow: 0 1px 2px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover { box-shadow: 0 6px 18px -6px rgba(79, 70, 229, .6), inset 0 1px 0 rgba(255, 255, 255, .2); filter: brightness(1.05); }
.btn-icon { width: 34px; padding: 0; justify-content: center; color: var(--text-2); }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-link { color: var(--brand); padding: 0 6px; height: 26px; font-weight: 650; font-size: 12.5px; border-radius: 7px; }
.btn-link:hover { background: var(--brand-soft); }
.btn-outline { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .38; cursor: default; pointer-events: none; }

/* ------------------------------------------------------------------ header */
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 18px; padding: 0 18px;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1000; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-logo { width: 38px; height: 38px; display: block; filter: drop-shadow(0 4px 10px rgba(99, 102, 241, .35)); transition: transform .3s var(--spring); }
.brand:hover .brand-logo { transform: rotate(-6deg) scale(1.06); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-grad); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .65), inset 0 1px 0 rgba(255, 255, 255, .25); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 14.5px; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; }

.tabs { position: relative; display: flex; gap: 2px; padding: 4px; margin: 0 auto; background: var(--surface-3); border-radius: 12px;
  overflow-x: auto; scrollbar-width: none; flex: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tab-ink { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 9px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 2px 8px -2px rgba(15, 23, 42, .12);
  transition: transform .38s var(--ease-out), width .38s var(--ease-out); z-index: 0; }
.tab { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px; border: 0; background: none;
  cursor: pointer; color: var(--text-2); font-weight: 650; font-size: 13px; border-radius: 9px; white-space: nowrap; transition: color .2s var(--ease); }
.tab .ico { width: 16px; height: 16px; opacity: .8; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand); }
.tab[aria-selected="true"] .ico { opacity: 1; }
.tab-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--amber-soft); color: var(--warning-text);
  font-size: 10.5px; display: inline-grid; place-items: center; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.corp { display: flex; align-items: center; flex: none; padding-left: 16px; margin-left: 6px; border-left: 1px solid var(--border); height: 30px; }
.corp-logo { height: 26px; width: auto; transition: transform .3s var(--ease), filter .3s; }
.corp:hover .corp-logo { transform: translateY(-1px); filter: drop-shadow(0 4px 10px rgba(16, 163, 74, .25)); }
.ico-sun { display: none; }
:root[data-theme="dark"] .ico-sun { display: block; }
:root[data-theme="dark"] .ico-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ico-sun { display: block; } :root:not([data-theme="light"]) .ico-moon { display: none; } }

/* popovers & menus */
.menu-wrap { position: relative; margin-left: 6px; }
.menu, .pop { transform-origin: top right; animation: pop-in .2s var(--ease-out); }
.menu { position: absolute; right: 0; top: 42px; min-width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; z-index: 1200; }
.menu-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px 4px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; font-weight: 550; transition: background .15s; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); }
.menu .mi { width: 8px; height: 8px; border-radius: 3px; background: var(--c); flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }

/* ------------------------------------------------------------------ filter bar */
.filterbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 18px;
  background: var(--glass); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border); position: sticky; top: var(--topbar-h); z-index: 999; }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-xs); color: var(--muted); }
.date-range .ico { width: 16px; height: 16px; }
.date-range input[type="date"] { border: 0; height: 30px; padding: 0 4px; background: none; font-weight: 600; font-size: 12.5px; color: var(--text); box-shadow: none; }
input[type="date"], select, .input {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; transition: border-color .15s, box-shadow .15s; }
select:hover, .input:hover { border-color: var(--brand); }
select:focus, .input:focus, input[type="date"]:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.chips { display: flex; gap: 4px; padding: 3px; background: var(--surface-3); border-radius: 11px; }
.chip { height: 30px; padding: 0 11px; border-radius: 8px; border: 0; background: none; cursor: pointer; font-size: 12px; font-weight: 650; color: var(--text-2);
  transition: background .18s var(--ease), color .18s, box-shadow .18s; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.dataset-info { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; }
.file-pill { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); padding: 4px 4px 4px 10px; border-radius: 20px; max-width: 380px; box-shadow: var(--shadow-xs); }
.file-pill .dotlive { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); flex: none; }
.file-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill button { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 11px; color: var(--muted); display: grid; place-items: center; transition: background .15s, color .15s; }
.file-pill button:hover { background: var(--rose-soft); color: var(--rose); }

/* combobox */
.combo { position: relative; }
.combo-btn { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 10px 0 5px; min-width: 250px; max-width: 360px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.combo-btn:hover { border-color: var(--brand); }
.combo-btn:disabled { cursor: default; }
.combo-btn:disabled:hover { border-color: var(--border); }
.combo-btn:disabled .chev { display: none; }
.combo-stack { display: flex; flex-direction: column; min-width: 0; flex: 1; text-align: left; line-height: 1.15; }
.combo-cap { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.combo-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .005em; }
.combo-text .cid { font-family: var(--font); font-size: 11.5px; font-weight: 650; color: var(--muted); margin-left: 6px; }
.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s var(--ease); }
.combo-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.avatar { width: 30px; height: 30px; border-radius: 9px; background: var(--av, var(--brand-grad)); color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; flex: none; letter-spacing: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; }
.combo-pop { position: absolute; top: 46px; left: 0; width: 360px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-pop); z-index: 1200; padding: 8px; transform-origin: top left; }
.combo-pop input { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); font: inherit; }
.combo-pop input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.combo-pop ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 340px; overflow: auto; }
.combo-pop li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; transition: background .12s; }
.combo-pop li:hover, .combo-pop li.focus { background: var(--surface-3); }
.combo-pop li[aria-selected="true"] { background: var(--brand-soft); }
.combo-pop li .meta { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.combo-pop li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.combo-pop li .id { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------------ layout */
main { flex: 1 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h) - var(--filterbar-h, 0px)); }
.view { padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 1680px; margin: 0 auto; }
/* Overview uses the whole window width on any desktop screen; spacing scales gently with it */
.view-overview { max-width: none; padding: clamp(14px, 1.1vw, 24px) clamp(16px, 1.4vw, 32px) 28px; gap: clamp(12px, .9vw, 20px); }
.view-overview .grid-2 { gap: clamp(12px, .9vw, 20px); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.card-pill { font-size: 11px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 14px; }

/* ------------------------------------------------------------------ upload (landing) */
.view-upload { flex: 1; justify-content: center; padding: 34px 32px 40px; max-width: 1320px; gap: 26px; }
.up-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: 44px; align-items: center; }
.up-left > * { animation: rise .6s var(--ease-out) backwards; }
.up-left > :nth-child(2) { animation-delay: .06s; } .up-left > :nth-child(3) { animation-delay: .12s; }
.up-left > :nth-child(4) { animation-delay: .18s; } .up-left > :nth-child(6) { animation-delay: .26s; } .up-left > :nth-child(7) { animation-delay: .32s; }

.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 8px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--text-2); box-shadow: var(--shadow-xs); margin-bottom: 16px; }
.hero-badge .spark { width: 18px; height: 18px; color: var(--violet); animation: twinkle 2.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.82) rotate(18deg); opacity: .75; } }
.up-left h1 { font-size: clamp(30px, 3.3vw, 46px); font-weight: 800; letter-spacing: -.04em; line-height: 1.08; }
.grad-text { background: linear-gradient(90deg, #2563eb, #7c3aed 55%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .grad-text { background-image: linear-gradient(90deg, #60a5fa, #a78bfa 55%, #f472b6); }
.lead { color: var(--text-2); font-size: 15px; line-height: 1.65; max-width: 560px; margin: 16px 0 22px; }
.app-pill { display: inline-block; padding: 0 8px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px; white-space: nowrap; }
.app-pill.alt { background: var(--violet-soft); color: var(--violet); }

.dropzone { position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 18px 18px 18px; border-radius: 18px; cursor: pointer; overflow: hidden;
  background: var(--surface); border: 1.5px dashed var(--border-strong); box-shadow: var(--shadow);
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease), background .25s; }
.dropzone::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(139, 92, 246, .10) 50%, transparent 70%);
  background-size: 250% 100%; animation: sheen 3.6s ease-in-out infinite; pointer-events: none; }
@keyframes sheen { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }
.dropzone:hover, .dropzone.over { border-color: var(--brand); border-style: solid; transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.dropzone.over { background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface)); transform: scale(1.01); }
.dz-orb { position: relative; width: 52px; height: 52px; border-radius: 16px; flex: none; display: grid; place-items: center; color: #fff; background: var(--brand-grad);
  box-shadow: 0 10px 22px -10px rgba(99, 102, 241, .8); }
.dz-orb::after { content: ""; position: absolute; inset: -6px; border-radius: 20px; border: 2px solid rgba(99, 102, 241, .35); animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.dz-orb svg { width: 24px; height: 24px; transition: transform .3s var(--spring); }
.dropzone:hover .dz-orb svg { transform: translateY(-3px); }
.dz-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dz-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.dz-sub { color: var(--muted); font-size: 12.5px; }
.dz-btn { flex: none; height: 38px; padding: 0 16px; border-radius: 11px; display: inline-flex; align-items: center; font-weight: 700; font-size: 13px;
  background: var(--text); color: var(--surface); transition: transform .2s var(--ease), box-shadow .2s; }
.dropzone:hover .dz-btn { transform: translateX(2px); box-shadow: 0 8px 18px -8px rgba(15, 23, 42, .6); }
.upload-error { margin-top: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--rose-soft); border: 1px solid color-mix(in srgb, var(--rose) 35%, transparent); text-align: left; animation: rise .3s var(--ease-out); }

.steps { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; position: relative; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border);
  animation: rise .5s var(--ease-out) backwards; animation-delay: calc(.35s + var(--i) * 90ms); }
.st-n { width: 24px; height: 24px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--brand); background: var(--brand-soft); }
.steps li:nth-child(2) .st-n { color: var(--violet); background: var(--violet-soft); }
.steps li:nth-child(3) .st-n { color: #db2777; background: var(--rose-soft); }
.steps b { display: block; font-size: 12.5px; font-weight: 750; }
.steps small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.up-stats { display: flex; gap: 26px; margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border-strong); }
.up-stats div { display: flex; flex-direction: column; }
.up-stats b { font-size: 22px; font-weight: 800; letter-spacing: -.03em; background: var(--name-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.up-stats span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* animated preview card */
.up-right { position: relative; animation: rise .8s var(--ease-out) .15s backwards; }
.up-right::before { content: ""; position: absolute; inset: 8% -4% -6% 6%; background: radial-gradient(closest-side, rgba(139, 92, 246, .22), transparent); filter: blur(20px); z-index: -1; }
.pv-card { border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); overflow: hidden; transform: perspective(1400px) rotateY(-5deg) rotateX(2deg);
  transition: transform .6s var(--ease-out); }
.pv-card:hover { transform: perspective(1400px) rotateY(0) rotateX(0); }
.pv-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.pv-head b { font-weight: 750; }
.pv-sub { color: var(--muted); font-size: 11.5px; }
.pv-live { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); animation: live 1.8s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .55); } 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }
.pv-win { margin-left: auto; display: flex; gap: 5px; }
.pv-win i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.pv-stage { position: relative; aspect-ratio: 560 / 340; background: linear-gradient(180deg, var(--surface-2), var(--surface)); overflow: hidden; }
.pv-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pv-gridline { stroke: var(--grid); stroke-width: 1; }
.pv-contour { fill: none; stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 5; opacity: .7; }
.pv-cells path { fill: var(--f); stroke: var(--surface); stroke-width: 2; opacity: 0; animation: cell 3.2s var(--ease-out) infinite alternate; animation-delay: calc(.4s + var(--i) * .22s); }
@keyframes cell { 0% { opacity: 0; } 25%, 100% { opacity: .55; } }
.pv-glow { animation: breathe 4s ease-in-out infinite; transform-origin: 300px 175px; }
@keyframes breathe { 0%, 100% { opacity: .6; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.06); } }
.pv-route-casing { fill: none; stroke: var(--surface); stroke-width: 9; stroke-linecap: round; opacity: .9; }
.pv-route { fill: none; stroke: url(#pvRouteGrad); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3s var(--ease-out) .3s forwards; }
.pv-stop { opacity: 0; transform-box: fill-box; transform-origin: center; animation: pop .5s var(--spring) forwards; animation-delay: var(--d); }
.pv-stop circle { fill: var(--mk-stop-b); stroke: #fff; stroke-width: 3; }
.pv-stop.start circle { fill: var(--mk-start-a); }
.pv-stop.end circle { fill: var(--mk-end-a); }
.pv-stop text { fill: #fff; font: 800 11px var(--font); text-anchor: middle; }
.pv-car { opacity: 0; animation: fade .4s ease 3.2s forwards; }
.pv-car-dot { fill: #fff; stroke: #4f46e5; stroke-width: 3; }
.pv-car-ring { fill: rgba(99, 102, 241, .18); stroke: rgba(99, 102, 241, .45); stroke-width: 1.5; animation: carpulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes carpulse { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
.pv-scan { position: absolute; top: 0; bottom: 0; left: 0; width: 90px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, .10) 60%, rgba(99, 102, 241, .22) 96%, transparent); border-right: 1px solid rgba(99, 102, 241, .35);
  animation: scan 5.5s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes scan { 0% { left: -90px; } 100% { left: 100%; } }
.pv-chip { position: absolute; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 6px; border-radius: 12px; font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--shadow-hover); white-space: nowrap;
  opacity: 0; animation: chip-in .55s var(--spring) forwards, bob 5s ease-in-out infinite; animation-delay: var(--d), calc(var(--d) + .6s); }
.pv-chip i { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.pv-chip i svg { width: 13px; height: 13px; }
.pv-chip.c1 { left: 4%; top: 7%; }
.pv-chip.c2 { right: 5%; top: 30%; }
.pv-chip.c3 { right: 7%; bottom: 7%; }
.pv-chip.c4 { left: 6%; bottom: 36%; }
@keyframes chip-in { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
.pipeline { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--border); font-size: 11.5px; font-weight: 700; color: var(--muted); }
.pipeline span { padding: 4px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap;
  animation: step 5s ease-in-out infinite; animation-delay: calc(var(--i) * 1s); }
.pipeline em { flex: 1; min-width: 8px; height: 2px; border-radius: 1px; background: linear-gradient(90deg, var(--border-strong) 0 40%, var(--brand) 50%, var(--border-strong) 60% 100%);
  background-size: 300% 100%; animation: flow 1.6s linear infinite; }
@keyframes step { 0%, 22% { color: var(--brand); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent); }
  30%, 100% { color: var(--muted); background: var(--surface-2); border-color: var(--border); box-shadow: none; } }
@keyframes flow { from { background-position: 100% 0; } to { background-position: 0 0; } }

.upload-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: left; animation: rise .6s var(--ease-out) .4s backwards; }
.fact { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px 14px; box-shadow: var(--shadow-xs);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.fact:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.fact-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--cs); color: var(--c); display: grid; place-items: center; flex: none; }
.fact-ico svg { width: 18px; height: 18px; }
.fact h3 { margin-bottom: 4px; }
.fact p { margin: 3px 0 0; color: var(--text-2); }
.fact code { display: inline-block; margin: 2px 2px 0 0; }

/* ------------------------------------------------------------------ KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px 10px;
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--c) 35%, var(--border)); }
.kpi > * { position: relative; z-index: 1; }
/* ambient glow in the card's own colour, drifting slowly in the top-right corner; each card is out of phase */
.kpi::before { content: ""; position: absolute; z-index: 0; top: -78px; right: -64px; width: 170px; height: 170px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 26%, transparent), color-mix(in srgb, var(--c) 8%, transparent) 60%, transparent);
  opacity: .8; transition: opacity .4s var(--ease), filter .4s var(--ease);
  animation: kpi-aura 11s ease-in-out infinite alternate; animation-delay: calc(var(--i, 0) * -1.7s); }
@keyframes kpi-aura { 0% { transform: translate(0, 0) scale(1); } 45% { transform: translate(-30px, 18px) scale(1.18); } 100% { transform: translate(-10px, 34px) scale(.92); } }
.kpi:hover::before { opacity: 1; filter: saturate(1.5) brightness(1.05); }
/* one light sweep across the card on hover */
.kpi::after { content: ""; position: absolute; z-index: 2; inset: 0; pointer-events: none; transform: translateX(-130%);
  background: linear-gradient(105deg, transparent 30%, var(--kpi-sheen) 50%, transparent 70%); }
.kpi:hover::after { transform: translateX(130%); transition: transform 1s var(--ease-out); }
:root { --kpi-sheen: rgba(255, 255, 255, .6); }
:root[data-theme="dark"] { --kpi-sheen: rgba(255, 255, 255, .07); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --kpi-sheen: rgba(255, 255, 255, .07); } }
.kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi-ico { width: 26px; height: 26px; border-radius: 8px; background: var(--cs); color: var(--c); display: grid; place-items: center; flex: none;
  transition: transform .45s var(--spring, cubic-bezier(.34, 1.56, .64, 1)), background .3s, color .3s, box-shadow .3s; }
.kpi:hover .kpi-ico { transform: translateY(-2px) rotate(-8deg) scale(1.08); background: var(--c); color: #fff; box-shadow: 0 6px 14px -6px var(--c); }

/* ---- KPI card motion: each icon acts out its metric, once as the cards arrive and again on hover */
.kpi-ico svg * { transform-box: view-box; transform-origin: 12px 12px; }
.kpi-ico > svg { transform-origin: 50% 50%; }
.kpi-ico > svg.ico-people { transform-origin: 40% 85%; }
.ico-days { animation: ico-flip .8s var(--ease-out) backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.kpi:hover .ico-days { animation: ico-flip-h .8s var(--ease-out); }
@keyframes ico-flip { from { transform: perspective(40px) rotateX(-360deg); } to { transform: perspective(40px) rotateX(0); } }
@keyframes ico-flip-h { from { transform: perspective(40px) rotateX(-360deg); } to { transform: perspective(40px) rotateX(0); } }

.ico-dist .trail { stroke-dasharray: 1; animation: ico-draw 1.1s var(--ease-out) backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.ico-dist .goal { transform-origin: 19px 5px; animation: ico-pop .5s var(--spring, ease-out) backwards; animation-delay: calc(1.4s + var(--i, 0) * 110ms); }
.kpi:hover .ico-dist .trail { animation: ico-draw-h 1s var(--ease-out); }
.kpi:hover .ico-dist .goal { animation: ico-pop-h .5s var(--spring, ease-out) .75s backwards; }
@keyframes ico-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ico-draw-h { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ico-pop { 0% { transform: scale(0); } 70% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes ico-pop-h { 0% { transform: scale(0); } 70% { transform: scale(1.5); } 100% { transform: scale(1); } }

.ico-time .hand { animation: ico-spin 1.2s var(--ease-out) backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.kpi:hover .ico-time .hand { animation: ico-spin-h 1.2s var(--ease-out); }
@keyframes ico-spin { from { transform: rotate(-360deg); } to { transform: rotate(0); } }
@keyframes ico-spin-h { from { transform: rotate(-360deg); } to { transform: rotate(0); } }

.ico-stop path, .ico-stop circle { animation: ico-drop .9s var(--ease-out) backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.ico-stop .shadow { transform-origin: 12px 21.5px; animation: ico-shadow .9s var(--ease-out) backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.kpi:hover .ico-stop path, .kpi:hover .ico-stop circle { animation: ico-drop-h .9s var(--ease-out); }
.kpi:hover .ico-stop .shadow { animation: ico-shadow-h .9s var(--ease-out); }
@keyframes ico-drop { 0% { transform: translateY(-9px); opacity: 0; } 40% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(-3px); } 80% { transform: translateY(0); } 90% { transform: translateY(-1px); } 100% { transform: none; } }
@keyframes ico-drop-h { 0% { transform: translateY(-9px); } 40% { transform: translateY(0); } 60% { transform: translateY(-3px); } 80% { transform: translateY(0); } 90% { transform: translateY(-1px); } 100% { transform: none; } }
@keyframes ico-shadow { 0% { transform: scale(.2); } 40% { transform: scale(1.2); } 60% { transform: scale(.8); } 100% { transform: scale(1); } }
@keyframes ico-shadow-h { 0% { transform: scale(.2); } 40% { transform: scale(1.2); } 60% { transform: scale(.8); } 100% { transform: scale(1); } }

.ico-area { animation: ico-unfold .9s var(--spring, ease-out) backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.kpi:hover .ico-area { animation: ico-unfold-h .9s var(--spring, ease-out); }
@keyframes ico-unfold { 0% { transform: scaleX(.25) skewY(-12deg); opacity: .3; } 60% { transform: scaleX(1.08) skewY(3deg); opacity: 1; } 100% { transform: none; } }
@keyframes ico-unfold-h { 0% { transform: scaleX(.25) skewY(-12deg); } 60% { transform: scaleX(1.08) skewY(3deg); } 100% { transform: none; } }

.ico-far .ring { opacity: 0; animation: ico-radar 1.6s ease-out 2 backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.kpi:hover .ico-far .ring { animation: ico-radar-h 1.4s ease-out infinite; }
@keyframes ico-radar { 0% { transform: scale(.35); opacity: .9; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes ico-radar-h { 0% { transform: scale(.35); opacity: .9; } 100% { transform: scale(1.55); opacity: 0; } }

.ico-people { animation: ico-wave 1s ease-in-out backwards; animation-delay: calc(.55s + var(--i, 0) * 110ms); }
.kpi:hover .ico-people { animation: ico-wave-h 1s ease-in-out; }
@keyframes ico-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 50% { transform: rotate(9deg); } 75% { transform: rotate(-5deg); } }
@keyframes ico-wave-h { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 50% { transform: rotate(9deg); } 75% { transform: rotate(-5deg); } }

@media (prefers-reduced-motion: reduce) {
  .kpi::before, .kpi-ico svg, .kpi-ico svg * { animation: none !important; }
  .kpi::after { display: none; }
  .ico-far .ring { opacity: 0; }
}
.kpi-ico .ico { width: 15px; height: 15px; }
.kpi-label { font-size: 11.5px; color: var(--text-2); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 23px; font-weight: 800; margin-top: 8px; letter-spacing: -.03em; line-height: 1.05; }
.kpi-value small { font-size: 12.5px; font-weight: 650; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-spark { display: block; width: 100%; height: 26px; margin-top: 6px; overflow: visible; }
.kpi-spark path.line { fill: none; stroke: var(--c); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease-out) .25s forwards; }
.kpi-spark path.area { fill: var(--c); opacity: .10; animation: fade-area .8s ease .5s backwards; }
@keyframes fade-area { from { opacity: 0; } to { opacity: .10; } }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; min-height: 220px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; font-family: var(--font); }
.chart .tick.weekend { opacity: .45; }
.chart .bar { cursor: pointer; transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y .8s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 18ms); transition: filter .2s, opacity .2s; }
.chart .bar-hit { fill: transparent; cursor: pointer; }
.chart .bar-track { fill: var(--bar-track); }
.chart .bar.peak { filter: drop-shadow(0 6px 10px var(--bar-glow)); }
.chart .bar.hover, .chart .bar.sel { filter: drop-shadow(0 6px 12px var(--bar-glow)) brightness(1.08) saturate(1.15); }
.chart.has-hover .bar:not(.hover) { opacity: .4; }
.chart .nodata { fill: var(--muted); opacity: .45; }
.chart .avg-line { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 2 4; stroke-linecap: round; opacity: .55; pointer-events: none; }
.chart .avg-label .n { fill: var(--text); font-weight: 800; }
.chart .avg-label { fill: var(--muted); font-size: 10px; font-weight: 700; font-family: var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.chart .peak-tag { animation: pop-in .4s var(--ease-out) .75s backwards; }
.chart .peak-tag rect { fill: var(--text); }
.chart .peak-tag text { fill: var(--surface); font-size: 10.5px; font-weight: 750; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart.has-hover .peak-tag { opacity: .25; transition: opacity .2s; }
.chart .range { transform-box: fill-box; transform-origin: 50% 0; animation: grow-y .8s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 18ms); transition: opacity .2s, filter .2s; cursor: pointer; }
.chart .range.peak { filter: drop-shadow(0 6px 10px var(--bar-glow)); }
.chart .range.hover { filter: drop-shadow(0 6px 12px var(--bar-glow)) brightness(1.08) saturate(1.15); }
.chart.has-hover .range:not(.hover) { opacity: .4; }
.no-anim, .no-anim * { animation: none !important; }
.chart .empty-msg { fill: var(--muted); font-size: 13px; font-family: var(--font); }

.hbar-list { display: flex; flex-direction: column; gap: 7px; }
.hbar { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; cursor: pointer; padding: 4px 6px; border-radius: 9px; transition: background .15s; animation: rise .45s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.hbar:hover { background: var(--surface-2); }
.hbar .rk { font-size: 11px; font-weight: 800; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.hbar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: 13px; }
.hbar .nm span { font-weight: 500; color: var(--muted); }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12px; font-weight: 600; }
.hbar .track { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--brand-grad); border-radius: 3px; transform-origin: left; animation: grow-x .8s var(--ease-out) backwards; animation-delay: calc(.1s + var(--i, 0) * 40ms); }

/* time split donut */
.split { display: flex; align-items: center; gap: 18px; min-height: 200px; }
.donut { width: 176px; height: 176px; flex: none; position: relative; }
.donut::before { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: radial-gradient(circle, var(--tw-halo), transparent 70%); pointer-events: none; }
.donut svg { position: relative; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut circle.seg { fill: none; stroke-width: 12; stroke-linecap: round; cursor: pointer; }
.donut circle.seg.whole { stroke-linecap: butt; }
.donut circle.seg.hover { stroke-width: 16; }
.donut.has-hover circle.seg:not(.hover) { opacity: .3; }
.donut circle.bg { fill: none; stroke: var(--surface-3); stroke-width: 12; opacity: .7; }
.donut circle.ticks { fill: none; stroke: var(--border-strong); stroke-width: 4; }
.donut .hatch-bg { fill: var(--surface); }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center > div { animation: fade .25s ease; max-width: 96px; }
.donut-center b { display: block; font-size: 25px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05;
  background: linear-gradient(135deg, var(--tw-stop-a), var(--tw-stop-b)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.donut-center span { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; line-height: 1.3; }
.split-legend { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.split-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 2px 10px; align-items: center; padding: 7px 9px; border-radius: 10px; cursor: default;
  transition: background .2s; animation: rise .45s var(--ease-out) backwards; animation-delay: calc(.2s + var(--i, 0) * 70ms); }
.split-row.hover { background: var(--surface-2); }
.split-row > i { width: 10px; height: 10px; border-radius: 50%; background: var(--sw); box-shadow: 0 0 0 3px var(--surface-3); }
.split-row .l { font-weight: 650; font-size: 13px; }
.split-row .v { font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.split-row .s { grid-column: 2 / -1; font-size: 11.5px; color: var(--muted); }
.split-row .sbar { grid-column: 2 / -1; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 3px; }
.split-row .sbar i { display: block; height: 100%; border-radius: 2px; background: var(--sw); transform-origin: left; animation: grow-x .9s var(--ease-out) backwards; animation-delay: calc(.35s + var(--i, 0) * 90ms); }

/* chart palette: bars shift blue -> indigo -> violet with height; time split in indigo/violet, cyan/blue, hatched grey */
:root { --bar-lo: #3b82f6; --bar-mid: #6366f1; --bar-hi: #a855f7; --bar-track: rgba(99, 102, 241, .07); --bar-glow: rgba(99, 102, 241, .38);
  --tw-stop-a: #4f46e5; --tw-stop-b: #9333ea; --tw-move-a: #0891b2; --tw-move-b: #3b82f6; --tw-gap: #94a3b8; --tw-halo: rgba(99, 102, 241, .10); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bar-lo: #3b82f6; --bar-mid: #818cf8; --bar-hi: #c084fc; --bar-track: rgba(255, 255, 255, .045); --bar-glow: rgba(129, 140, 248, .45);
    --tw-stop-a: #818cf8; --tw-stop-b: #c084fc; --tw-move-a: #22d3ee; --tw-move-b: #60a5fa; --tw-gap: #6b7280; --tw-halo: rgba(129, 140, 248, .10); }
}
:root[data-theme="dark"] { --bar-lo: #3b82f6; --bar-mid: #818cf8; --bar-hi: #c084fc; --bar-track: rgba(255, 255, 255, .045); --bar-glow: rgba(129, 140, 248, .45);
  --tw-stop-a: #818cf8; --tw-stop-b: #c084fc; --tw-move-a: #22d3ee; --tw-move-b: #60a5fa; --tw-gap: #6b7280; --tw-halo: rgba(129, 140, 248, .10); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: var(--r); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 11px; color: var(--muted); font-weight: 750; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; z-index: 1; transition: color .15s; }
.table th:hover { color: var(--text); }
.table th.r, .table td.r { text-align: right; }
.table th .sort { color: var(--brand); margin-left: 4px; font-size: 9px; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 260px; }
.table tbody tr { cursor: pointer; transition: background .15s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.table .seq { display: flex; flex-wrap: wrap; gap: 4px 3px; align-items: center; }
.table .seq .pill { padding: 1px 8px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; font-size: 11.5px; }
.table .seq .pill.pass { background: transparent; color: var(--muted); border: 1px dashed var(--border-strong); font-weight: 500; }
.table .seq .arr { color: var(--muted); font-size: 11px; }
.table .wd { color: var(--muted); font-size: 11.5px; }
.date-cell { display: flex; align-items: center; gap: 9px; }
.date-badge { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: none; }
.date-badge b { font-size: 13px; font-weight: 800; }
.date-badge span { font-size: 9px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.person-cell { display: flex; align-items: center; gap: 9px; }
.mini-bar { display: inline-block; vertical-align: middle; width: 54px; height: 5px; border-radius: 3px; background: var(--surface-3); margin-left: 8px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--brand-grad); border-radius: 3px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.warn { background: var(--amber-soft); color: var(--warning-text); }
.tag.warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }

/* ------------------------------------------------------------------ routes view */
.view-routes, .view-heatmap { flex-direction: row; padding: 0; gap: 0; flex: none; min-height: 0; max-width: none; height: calc(100vh - var(--topbar-h) - var(--filterbar-h, 61px)); }
.day-list-panel { width: 262px; flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px; }
.count-pill { font-size: 11px; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 2px 9px; border-radius: 12px; }
.day-list { overflow: auto; flex: 1; padding: 0 8px 12px; }
.day-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 2px 10px; width: 100%; text-align: left; border: 1px solid transparent; background: none;
  padding: 8px; border-radius: 12px; cursor: pointer; margin-bottom: 3px; transition: background .18s var(--ease), border-color .18s, transform .18s var(--ease);
  animation: rise .4s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 22ms); }
.day-item:hover { background: var(--surface-2); transform: translateX(2px); }
.day-item[aria-selected="true"] { background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 90%, transparent), color-mix(in srgb, var(--indigo-soft) 80%, transparent));
  border-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.day-item .dnum { grid-row: span 4; width: 40px; height: 44px; border-radius: 10px; background: var(--surface-3); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; transition: background .2s, color .2s; }
.day-item .dnum b { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.day-item .dnum span { font-size: 9.5px; font-weight: 750; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.day-item[aria-selected="true"] .dnum { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .7); }
.day-item[aria-selected="true"] .dnum span { color: rgba(255, 255, 255, .85); }
.day-item .d1 { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.day-item .d1 .km { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 800; font-size: 13.5px; letter-spacing: -.02em; }
.day-item .d1 .st { font-size: 11px; font-weight: 700; color: var(--orange-text); background: var(--orange-soft); padding: 0 7px; border-radius: 8px; white-space: nowrap; }
.day-item > * { min-width: 0; }
.day-item .d2 span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-item .d2 { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-item .who { font-size: 11.5px; color: var(--brand-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.day-item .mini { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 4px; overflow: hidden; }
.day-item .mini i { display: block; height: 100%; background: var(--brand-grad); border-radius: 2px; transform-origin: left; animation: grow-x .7s var(--ease-out) backwards; animation-delay: calc(.15s + var(--i, 0) * 22ms); }
.month-sep { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 10px 10px 6px; }

.map-col { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; }
.map { flex: 1; min-height: 320px; background: var(--surface-3); }
.map-overlay { position: absolute; z-index: 500; background: var(--glass); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop); animation: pop-in .35s var(--ease-out) backwards; }
.map-legend { left: 12px; bottom: 70px; padding: 9px 11px; font-size: 12px; max-width: calc(100% - 24px); }
.heat-legend { bottom: 26px; }
.map-legend .row { display: flex; align-items: center; gap: 8px; margin: 2px 0; color: var(--text-2); font-weight: 550; }
.map-legend .grad { width: 110px; height: 7px; border-radius: 4px; }
.map-legend .sw { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); flex: none; }
.map-legend .dash { width: 22px; border-top: 3px dashed var(--c-gap); }
.map-legend label { display: flex; align-items: center; gap: 7px; cursor: pointer; color: var(--text-2); margin-top: 5px; font-weight: 550; }
.map-legend input[type="checkbox"] { accent-color: var(--brand); }
.playback { position: absolute; z-index: 500; left: 50%; transform: translateX(-50%); bottom: 14px; display: flex; align-items: center; gap: 10px;
  background: var(--glass); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border: 1px solid var(--border); border-radius: 30px; padding: 6px 12px 6px 6px; box-shadow: var(--shadow-pop); width: min(520px, calc(100% - 300px)); }
.playback input[type="range"] { flex: 1; accent-color: var(--brand); min-width: 60px; }
.btn-play { border-radius: 50%; width: 36px; height: 36px; color: #fff; background: var(--brand-grad); box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .7); }
.btn-play:hover { color: #fff; background: var(--brand-grad); filter: brightness(1.08); }
.btn-play.playing { animation: pulse 1.6s infinite; }
.playback select { height: 28px; font-size: 12px; padding: 0 6px; border-radius: 8px; }
.play-time { font-variant-numeric: tabular-nums; font-weight: 750; min-width: 66px; text-align: center; }

.day-detail { width: 380px; flex: none; background: var(--surface); border-left: 1px solid var(--border); overflow: auto; }
.day-detail.swap > * { animation: rise .4s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 50ms); }
.dd-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 2; }
.dd-nav { display: flex; align-items: center; gap: 6px; }
.dd-nav h2 { flex: 1; font-size: 15.5px; font-weight: 800; }
.dd-nav .btn-icon { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 9px; font-size: 16px; }
.dd-who { font-size: 12.5px; color: var(--text-2); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.dd-sec { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dd-sec h3 { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.dd-sec h3 .muted { font-weight: 600; text-transform: none; letter-spacing: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.stat .l { font-size: 10.5px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: .04em; }
.stat .l i { width: 6px; height: 6px; border-radius: 2px; background: var(--c, var(--brand)); }
.stat .v { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -.02em; }
.area-seq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; }
.area-chip { display: inline-flex; flex-direction: column; padding: 5px 10px; border-radius: 10px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  cursor: pointer; line-height: 1.25; transition: transform .18s var(--ease), box-shadow .18s; animation: pop-in .35s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 40ms); }
.area-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.area-chip b { font-size: 12.5px; color: var(--brand-strong); }
.area-chip span { font-size: 10.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.area-chip.pass { background: var(--surface-2); border-style: dashed; border-color: var(--border-strong); }
.area-chip.pass b { color: var(--text-2); font-weight: 600; }
.area-seq .arr { color: var(--muted); font-size: 12px; }

.timeline { position: relative; height: 30px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.timeline .tl-seg { position: absolute; top: 0; bottom: 0; transform-origin: left; animation: grow-x .6s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 25ms); }
.timeline .tl-travel { top: 13px; bottom: 13px; background: var(--brand); border-radius: 2px; }
.timeline .tl-gap { top: 11px; bottom: 11px; background: repeating-linear-gradient(135deg, var(--c-gap) 0 3px, transparent 3px 6px); }
.timeline .tl-stop { top: 4px; bottom: 4px; background: linear-gradient(180deg, #fb923c, #ea580c); border-radius: 4px; box-shadow: 0 0 0 1px var(--surface); cursor: pointer; transition: filter .15s; }
.timeline .tl-stop:hover, .timeline .tl-stop.hl { filter: brightness(.85) saturate(1.25); }
.timeline .tl-now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); pointer-events: none; border-radius: 1px; }
.tl-axis { position: relative; height: 16px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.tl-axis span { position: absolute; transform: translateX(-50%); top: 3px; white-space: nowrap; }
.tl-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); margin-top: 6px; font-weight: 550; }
.tl-legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* itinerary (visits in order) */
.stop-list { list-style: none; margin: 0; padding: 0; position: relative; }
.stop-list::before { content: ""; position: absolute; left: 19px; top: 18px; bottom: 18px; width: 2px; background: linear-gradient(180deg, var(--c-start), var(--c-stop) 20%, var(--c-stop) 80%, var(--c-end)); opacity: .35; border-radius: 1px; }
.stop-item { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; padding: 8px 6px; border-radius: 12px; cursor: pointer; align-items: start;
  transition: background .15s, transform .18s var(--ease); animation: rise .4s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.stop-item:hover, .stop-item.hl { background: var(--surface-2); }
.stop-item.hl { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-stop) 40%, transparent); }
.stop-num { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, var(--mk-stop-a), var(--mk-stop-b)); color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; box-shadow: 0 0 0 3px var(--surface), 0 4px 10px -4px rgba(234, 88, 12, .7); }
.stop-num.start { background: linear-gradient(180deg, var(--mk-start-a), var(--mk-start-b)); box-shadow: 0 0 0 3px var(--surface), 0 4px 10px -4px rgba(5, 150, 105, .7); }
.stop-num.end { background: linear-gradient(180deg, var(--mk-end-a), var(--mk-end-b)); box-shadow: 0 0 0 3px var(--surface), 0 4px 10px -4px rgba(220, 38, 38, .7); }
.stop-main .t { font-weight: 750; font-variant-numeric: tabular-nums; font-size: 13px; }
.stop-main .p { font-size: 12px; color: var(--text-2); }
.stop-dur { font-size: 12px; font-weight: 800; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.stop-dur a { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 11px; margin-top: 3px; text-decoration: none; padding: 1px 7px; border-radius: 8px; background: var(--brand-soft); }
.stop-dur a:hover { background: var(--brand); color: #fff; }
.leg-row { position: relative; padding: 0 6px 0 44px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 550; min-height: 18px; animation: fade .4s backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.leg-row.gap { color: var(--rose); }
.empty { padding: 32px 16px; text-align: center; color: var(--text-2); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* leaflet markers & overlays */
.mk-stop { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, var(--mk-stop-a), var(--mk-stop-b)); color: #fff; font-weight: 800; font-size: 12px;
  display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 3px 10px -2px rgba(0, 0, 0, .4); font-family: var(--font);
  transition: transform .2s var(--spring), box-shadow .2s; animation: pop .45s var(--spring) backwards; animation-delay: var(--d, 0s); }
.mk-stop.hl { transform: scale(1.3); box-shadow: 0 0 0 5px rgba(249, 115, 22, .3), 0 3px 10px -2px rgba(0, 0, 0, .4); }
.mk-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 12px; color: #fff; font-weight: 750; font-size: 11.5px;
  border: 2px solid #fff; box-shadow: 0 3px 10px -2px rgba(0, 0, 0, .4); white-space: nowrap; font-family: var(--font); transform: translate(-50%, -50%); position: absolute;
  animation: fade .4s ease backwards; animation-delay: var(--d, 0s); }
.mk-pill.start { background: linear-gradient(180deg, var(--mk-start-a), var(--mk-start-b)); }
.mk-pill.end { background: linear-gradient(180deg, var(--mk-end-a), var(--mk-end-b)); }
.mk-arrow { width: 14px; height: 14px; }
.mk-arrow svg { width: 14px; height: 14px; display: block; filter: drop-shadow(0 0 1px rgba(255, 255, 255, .9)); animation: fade .3s backwards; animation-delay: var(--d, 0s); }
.mk-now { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; animation: pulse 1.4s infinite; }
.route-seg { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .35s linear forwards; }
.route-fade { animation: fade .5s ease backwards; }
.area-shape { transition: fill .5s var(--ease), fill-opacity .5s var(--ease), stroke-width .2s, stroke .2s; }
.leaflet-container { font-family: var(--font); background: var(--surface-3); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 12px 14px; font-size: 12.5px; line-height: 1.5; }
.leaflet-popup-content b { font-size: 13.5px; }
.leaflet-tooltip { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-family: var(--font); border-radius: 10px; padding: 7px 10px; font-size: 12px; }
.leaflet-bar { border: 1px solid var(--border) !important; border-radius: 10px !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--surface-3); }
.leaflet-control-layers { background: var(--surface); color: var(--text); border: 1px solid var(--border) !important; border-radius: 10px !important; box-shadow: var(--shadow) !important; }
.leaflet-control-layers-expanded { color: var(--text); padding: 8px 12px; font-family: var(--font); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--text-2); font-size: 10px; border-radius: 8px 0 0 0; }
.leaflet-control-attribution a { color: var(--text-2); }
.area-label { background: none; border: 0; box-shadow: none; padding: 0; font-weight: 800; font-size: 11px; color: var(--text); letter-spacing: -.01em;
  text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface), 0 0 4px var(--surface); }
.area-label::before { display: none; }
.leaflet-tooltip .tr { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.leaflet-tooltip .tr span:last-child { color: var(--text); font-weight: 700; }
.leaflet-heatmap-layer { pointer-events: none; }

/* ------------------------------------------------------------------ heatmap */
.heat-controls { top: 12px; left: 56px; display: flex; gap: 8px; align-items: center; padding: 6px; flex-wrap: wrap; right: auto; max-width: calc(100% - 120px); }
.heat-controls select { height: 30px; border-radius: 9px; font-weight: 600; font-size: 12.5px; }
.seg { position: relative; display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 0 11px; height: 26px; border-radius: 7px; cursor: pointer; font-weight: 650; font-size: 12.5px; color: var(--text-2); white-space: nowrap; transition: background .2s var(--ease), color .2s, box-shadow .2s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.heat-legend .scale { display: flex; gap: 2px; margin-top: 5px; }
.heat-legend .scale div { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; font-size: 10.5px; color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.heat-legend .scale i { display: block; width: 44px; height: 9px; transform-origin: left; animation: grow-x .5s var(--ease-out) backwards; }
.heat-legend .scale div:nth-child(2) i { animation-delay: .05s; } .heat-legend .scale div:nth-child(3) i { animation-delay: .1s; }
.heat-legend .scale div:nth-child(4) i { animation-delay: .15s; } .heat-legend .scale div:nth-child(5) i { animation-delay: .2s; } .heat-legend .scale div:nth-child(6) i { animation-delay: .25s; }
.heat-legend .scale div:first-child i { border-radius: 4px 0 0 4px; }
.heat-legend .scale div:last-child i { border-radius: 0 4px 4px 0; }
.heat-legend .title { font-weight: 750; color: var(--text); }
.heat-panel { width: 380px; flex: none; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.search-wrap { position: relative; margin: 0 14px 10px; }
.search-wrap .ico { position: absolute; left: 11px; top: 9px; width: 16px; height: 16px; color: var(--muted); }
.search-wrap .input { width: 100%; padding-left: 34px; }
.rank-list { overflow: auto; flex: 1; padding: 0 8px 12px; }
.rank-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 2px 9px; padding: 8px; border-radius: 12px; cursor: pointer; align-items: center;
  transition: background .15s, transform .18s var(--ease); animation: rise .4s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 25ms); }
.rank-item:hover, .rank-item.hl { background: var(--surface-2); transform: translateX(2px); }
.rank-item.sel { background: var(--brand-soft); }
.rank-item .rk { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; grid-row: span 3; align-self: start; }
.rank-item.top1 .rk { background: var(--brand-grad); color: #fff; }
.rank-item.top2 .rk { background: var(--blue-soft); color: var(--blue); }
.rank-item.top3 .rk { background: var(--indigo-soft); color: var(--indigo); }
.rank-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank-item .nm span { font-weight: 500; color: var(--muted); font-size: 12px; }
.rank-item .val { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px; text-align: right; }
.rank-item .bar { grid-column: 2 / -1; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.rank-item .bar i { display: block; height: 100%; background: var(--brand-grad); border-radius: 3px; transform-origin: left; animation: grow-x .7s var(--ease-out) backwards; animation-delay: calc(.1s + var(--i, 0) * 25ms); }
.rank-item .sub { grid-column: 2 / -1; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.area-detail { margin: 0 14px 12px; padding: 12px; border-radius: 14px; background: linear-gradient(160deg, var(--brand-soft), var(--surface-2) 70%); border: 1px solid var(--border);
  max-height: 45%; overflow: auto; flex: none; animation: pop-in .3s var(--ease-out); }
.area-detail h3 { font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.area-detail .kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0; }
.area-detail .kv div { font-size: 11px; color: var(--muted); font-weight: 650; background: var(--surface); padding: 6px 9px; border-radius: 9px; border: 1px solid var(--border); }
.area-detail .kv b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 800; }
.area-detail ul { list-style: none; padding: 0; margin: 0; }
.area-detail li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 12.5px; transition: background .12s; }
.area-detail li:hover { background: var(--surface); }
.area-detail li span { color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 650; }

/* ------------------------------------------------------------------ quality */
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.q-item { display: grid; grid-template-columns: 34px 1fr; gap: 1px 11px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2);
  transition: transform .2s var(--ease), box-shadow .2s; }
.q-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.q-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; grid-row: span 3; }
.q-ico svg { width: 17px; height: 17px; }
.q-ico.good { background: var(--emerald-soft); color: var(--good-text); }
.q-ico.warning { background: var(--amber-soft); color: var(--warning-text); }
.q-ico.info { background: var(--blue-soft); color: var(--blue); }
.q-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.q-lbl { font-weight: 700; font-size: 12.5px; }
.q-desc { font-size: 11.5px; color: var(--text-2); }
.kv-table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.kv-table td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv-table td:first-child { color: var(--muted); width: 45%; font-weight: 600; }

/* ------------------------------------------------------------------ dialog / overlays */
.dialog { border: 1px solid var(--border); border-radius: 20px; padding: 22px; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); }
.dialog[open] { animation: pop-in .28s var(--ease-out); }
.dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); animation: fade .25s ease; }
.dlg-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.dlg-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; flex: none; }
.dlg-ico svg { width: 20px; height: 20px; }
.dialog h2 { font-size: 17px; font-weight: 800; margin-bottom: 2px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 16px 0; }
.field span { display: flex; justify-content: space-between; font-weight: 650; }
.field b { color: var(--brand); font-variant-numeric: tabular-nums; background: var(--brand-soft); padding: 0 8px; border-radius: 8px; }
.field small { color: var(--muted); font-size: 12px; }
.field input[type="range"] { accent-color: var(--brand); }
.dialog-actions { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.spacer { flex: 1; }
.loading { position: fixed; inset: 0; z-index: 3000; background: color-mix(in srgb, var(--page) 60%, transparent); display: grid; place-items: center; backdrop-filter: blur(4px); animation: fade .2s ease; }
.loading-card { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-weight: 700; animation: pop-in .3s var(--ease-out); }
.spinner { width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 25%, #3b82f6 60%, #7c3aed); animation: spin .8s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 3000; background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-pop);
  font-weight: 600; max-width: calc(100vw - 32px); animation: toast-in .35s var(--spring); }
:root[data-theme="dark"] .toast { background: #e8edf7; color: #0f172a; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
.tip { position: fixed; z-index: 4000; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop); border-radius: 10px; padding: 8px 10px; font-size: 12px; max-width: 280px; }
.tip b { display: block; margin-bottom: 3px; font-size: 12.5px; }
.tip .tr { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tip .tr span:last-child { color: var(--text); font-weight: 700; }
.drop-overlay { position: fixed; inset: 0; z-index: 3500; background: color-mix(in srgb, var(--brand) 14%, transparent); border: 3px dashed var(--brand); display: grid; place-items: center;
  font-size: 20px; font-weight: 800; color: var(--brand-strong); pointer-events: none; backdrop-filter: blur(2px); animation: fade .15s ease; }
.drop-overlay div { background: var(--surface); padding: 14px 22px; border-radius: 16px; box-shadow: var(--shadow-pop); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1360px) {
  .top-actions .lbl { display: none; }
  .btn-primary#exportBtn { width: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 1280px) {
  .day-detail { width: 340px; }
  .heat-panel { width: 330px; }
  .playback { width: min(460px, calc(100% - 40px)); }
  .brand-sub { display: none; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .brand-text { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .view-routes { display: grid; grid-template-columns: 230px 1fr; grid-template-rows: 62vh auto; height: auto; }
  .day-list-panel { grid-row: 1 / 3; }
  .map-col { min-height: 62vh; }
  .day-detail { width: auto; border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .dd-head { position: static; }
  .view-heatmap { flex-direction: column; height: auto; }
  .view-heatmap .map-col { height: 65vh; flex: none; }
  .heat-panel { width: auto; border-left: 0; border-top: 1px solid var(--border); }
  .rank-list { max-height: 520px; }
}
/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .route-seg, .kpi-spark path.line, .pv-route { stroke-dashoffset: 0 !important; }
  .pv-cells path { opacity: .55 !important; }
  .pv-scan { display: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .bg-mesh, .topbar, .filterbar .chips, .top-actions, .playback, .heat-controls, .file-pill button { display: none !important; }
  body { background: #fff; }
  .filterbar { position: static; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .table-wrap { max-height: none; overflow: visible; }
  *, *::before, *::after { animation: none !important; }
}

/* KPI attendance strip (one bar per calendar day) */
.kpi-dots { display: flex; gap: 2px; height: 22px; margin-top: 8px; align-items: flex-end; }
.kpi-dots span { flex: 1; height: 100%; border-radius: 3px; background: var(--surface-3); transform-origin: bottom; animation: grow-y .5s var(--ease-out) backwards; animation-delay: calc(.2s + var(--i, 0) * 18ms); }
.kpi-dots span.on { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, var(--surface)), var(--c)); }

/* ------------------------------------------------------------------ overview hero (person header) */
.ov-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 22px;
  border-radius: 18px; border: 1px solid var(--border); box-shadow: var(--shadow);
  background:
    radial-gradient(600px 180px at 0% 0%, rgba(59, 130, 246, .12), transparent 70%),
    radial-gradient(520px 200px at 100% 100%, rgba(168, 85, 247, .12), transparent 70%),
    var(--surface); }
.ov-hero::after { content: ""; position: absolute; right: -30px; top: 50%; width: 190px; height: 190px; transform: translateY(-50%) rotate(-8deg);
  background: url("../img/logo.png") center / contain no-repeat; opacity: .07; pointer-events: none; }
.ov-id { display: flex; align-items: center; gap: 16px; min-width: 0; position: relative; z-index: 1; }
.avatar.xl { width: 58px; height: 58px; border-radius: 16px; font-size: 19px; box-shadow: 0 10px 24px -10px rgba(79, 70, 229, .6), inset 0 1px 0 rgba(255, 255, 255, .3); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { width: 40px; height: 40px; border-radius: 50%; font-size: 13px; box-shadow: 0 0 0 3px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -12px; }
.ov-eyebrow { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ov-eyebrow .live { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }
/* name set like the landing headline: Geist in ink, last word in the serif-italic accent (tokens from landing.css) */
.ov-name { font-family: var(--lp-display); font-weight: 600; font-size: 36px; line-height: 1.08; letter-spacing: -.045em; margin: 3px 0 9px; color: var(--lp-ink);
  padding-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.ov-name em { font-family: var(--lp-serif); font-style: italic; font-weight: 400; font-size: 1.1em; letter-spacing: -.01em; padding-right: .08em;
  background: var(--lp-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ov-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-weight: 650; color: var(--text-2); box-shadow: var(--shadow-xs); }
.meta-chip svg { width: 14px; height: 14px; color: var(--c, var(--brand)); }
.meta-chip b { color: var(--text); font-weight: 750; }
.ov-side { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 6px; min-width: 250px; max-width: 340px; }
.ov-side-title { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dist-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 650; }
.dist-row i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.dist-row span:last-child { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 700; }
.dist-bar { grid-column: 2 / -1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: -3px; }
.dist-bar i { display: block; height: 100%; border-radius: 2px; background: var(--c); transform-origin: left; animation: grow-x .8s var(--ease-out) .2s backwards; }

/* ------------------------------------------------------------------ ACI Motors brand touches */
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-block; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: inline-block; }
  :root:not([data-theme="light"]) .only-light { display: none; }
}


.spin-wrap { position: relative; width: 34px; height: 34px; flex: none; }
.spin-wrap .spinner { position: absolute; inset: 0; width: auto; height: auto; }
.spin-wrap img { position: absolute; inset: 6px; width: 22px; height: 22px; border-radius: 50%; animation: pulse-soft 1.6s ease-in-out infinite; }
@keyframes pulse-soft { 0%, 100% { transform: scale(1); } 50% { transform: scale(.9); } }

.app-foot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: var(--foot-h); flex: none; padding: 0 18px;
  font: 500 10.5px/1 ui-monospace, "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, monospace; color: var(--muted); letter-spacing: .05em;
  opacity: .45; transition: opacity .35s var(--ease); }
.app-foot:hover { opacity: 1; }
.app-foot::before { content: ""; width: 20px; height: 1.5px; border-radius: 2px; background: var(--brand-grad); opacity: .6; transition: width .4s var(--ease-out), opacity .3s; }
.app-foot:hover::before { width: 64px; opacity: 1; }
.app-foot .sym { color: var(--text-2); }
.app-foot .sep { opacity: .6; margin: 0 1px; }
.app-foot .author { color: var(--brand); font-weight: 650; padding-bottom: 2px; background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899) no-repeat 0 100% / 0 1.5px; transition: background-size .45s var(--ease-out); }
.app-foot:hover .author { background-size: 100% 1.5px; }

.print-head { display: none; }
@media print {
  .print-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 0 12px; margin: 0 18px 12px; border-bottom: 2px solid #0f172a; }
  .print-head div { text-align: right; display: flex; flex-direction: column; }
  .print-head b { font-family: var(--font-display); font-size: 20px; }
  .print-head span { font-size: 11px; color: #475569; }
  .print-head .only-dark { display: none !important; }
  .app-foot { display: flex !important; }
  .ov-hero::after { display: none; }
}

/* interactive dot grid behind the upload page (drawn by dotfield.js) */
.dot-field { position: fixed; inset: 0; z-index: -1; pointer-events: none; display: none; }
body[data-view="upload"] .dot-field { display: block; }
/* heatmap hover tooltip */
.heat-tip { pointer-events: none; }

.file-pill button.armed { background: var(--rose); color: #fff; }

/* labels of the drawn "Boundaries" background */
.leaflet-tooltip.base-label { display: none; background: none; border: 0; box-shadow: none; padding: 0; color: var(--muted); font: 600 10.5px var(--font); white-space: nowrap;
  text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface); }
.leaflet-tooltip.base-label::before { display: none; }
.leaflet-tooltip.base-dist { font-size: 12px; font-weight: 750; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; }
.z-dist .leaflet-tooltip.base-dist { display: block; }
.z-up .leaflet-tooltip.base-up { display: block; }
.z-up .leaflet-tooltip.base-dist { opacity: .55; }

/* ------------------------------------------------------------------ low-movement days (daily summary) */
:root { --mv-crit: #dc2626; --mv-crit-soft: rgba(220, 38, 38, .11); --mv-low: #f87171; --mv-low-soft: rgba(248, 113, 113, .09); --mv-low-text: #b91c1c; }
:root[data-theme="dark"] { --mv-crit: #f87171; --mv-crit-soft: rgba(248, 113, 113, .16); --mv-low: #fca5a5; --mv-low-soft: rgba(252, 165, 165, .09); --mv-low-text: #fca5a5; }
.table tbody tr.mv-crit { background: linear-gradient(90deg, var(--mv-crit-soft), transparent 70%); }
.table tbody tr.mv-low { background: linear-gradient(90deg, var(--mv-low-soft), transparent 60%); }
.table tbody tr.mv-crit td:first-child { box-shadow: inset 4px 0 0 var(--mv-crit); }
.table tbody tr.mv-low td:first-child { box-shadow: inset 3px 0 0 var(--mv-low); }
.table tbody tr.mv-crit:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--mv-crit) 18%, transparent), transparent 80%); }
.table tbody tr.mv-low:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--mv-low) 16%, transparent), transparent 75%); }
.table tbody tr.mv-crit:hover td:first-child { box-shadow: inset 4px 0 0 var(--mv-crit); }
.table tbody tr.mv-low:hover td:first-child { box-shadow: inset 3px 0 0 var(--mv-low); }
tr.mv-crit .date-badge { background: var(--mv-crit); color: #fff; }
tr.mv-crit .date-badge span { color: rgba(255, 255, 255, .85); }
tr.mv-low .date-badge { background: color-mix(in srgb, var(--mv-low) 22%, var(--surface)); color: var(--mv-crit); }
tr.mv-crit .mini-bar i { background: var(--mv-crit); }
tr.mv-low .mini-bar i { background: var(--mv-low); }
.mv-pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 5px; border-radius: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mv-pill svg { width: 12px; height: 12px; }
.mv-pill.crit { background: var(--mv-crit); color: #fff; box-shadow: 0 4px 12px -5px var(--mv-crit); }
.mv-pill.low { background: var(--mv-low-soft); color: var(--mv-low-text); border: 1px solid color-mix(in srgb, var(--mv-low) 45%, transparent); }
tr.mv-crit .mv-pill svg { animation: sink 1.8s ease-in-out infinite; }
@keyframes sink { 0%, 100% { transform: translateY(-1px); } 50% { transform: translateY(2px); } }

.mv-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mv-chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 6px 0 10px; border-radius: 15px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 12px; font-weight: 700; color: var(--text-2); cursor: pointer; transition: border-color .2s, background .2s, color .2s, transform .15s var(--ease); }
.mv-chip i { width: 9px; height: 9px; border-radius: 3px; }
.mv-chip.crit i { background: var(--mv-crit); }
.mv-chip.low i { background: var(--mv-low); }
.mv-chip b { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 11px; background: var(--surface-3); color: var(--text); font-variant-numeric: tabular-nums; }
.mv-chip:hover { transform: translateY(-1px); border-color: var(--mv-low); }
.mv-chip.crit.on { background: var(--mv-crit); border-color: var(--mv-crit); color: #fff; }
.mv-chip.low.on { background: var(--mv-low-soft); border-color: var(--mv-low); color: var(--mv-crit); }
.mv-chip.on b { background: rgba(255, 255, 255, .25); color: inherit; }
.mv-chip:disabled { opacity: .45; cursor: default; transform: none; }
.mv-clear { border: 0; background: none; color: var(--brand); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 0 6px; }
.mv-clear:hover { text-decoration: underline; }

/* small secondary figure beside a KPI value (e.g. total working hours) */
.kpi-value { display: flex; align-items: baseline; flex-wrap: wrap; }
.kpi-aside { margin-left: auto; align-self: center; font-size: 10.5px; font-weight: 650; letter-spacing: 0; color: var(--c); background: var(--cs);
  padding: 2px 7px; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi-aside b { font-weight: 800; }

/* ------------------------------------------------------------------ Day Routes list: low-movement days */
.day-item.mv-crit, .day-item.mv-low { position: relative; }
.day-item.mv-crit::before, .day-item.mv-low::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mv-crit); }
.day-item.mv-low::before { background: var(--mv-low); width: 2.5px; }
.day-item.mv-crit { background: linear-gradient(90deg, var(--mv-crit-soft), transparent 75%); }
.day-item.mv-low { background: linear-gradient(90deg, var(--mv-low-soft), transparent 70%); }
.day-item.mv-crit .dnum { background: var(--mv-crit); color: #fff; }
.day-item.mv-crit .dnum span { color: rgba(255, 255, 255, .85); }
.day-item.mv-low .dnum { background: color-mix(in srgb, var(--mv-low) 22%, var(--surface)); color: var(--mv-crit); }
.day-item.mv-crit .d1 .km, .day-item.mv-low .d1 .km { color: var(--mv-crit); }
.day-item.mv-crit .mini i { background: var(--mv-crit); }
.day-item.mv-low .mini i { background: var(--mv-low); }
.day-item.mv-crit[aria-selected="true"], .day-item.mv-low[aria-selected="true"] { border-color: color-mix(in srgb, var(--mv-crit) 45%, transparent); background: linear-gradient(135deg, var(--mv-crit-soft), var(--surface-2)); }
.day-item.mv-crit[aria-selected="true"] .dnum { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 6px 14px -6px rgba(220, 38, 38, .7); }
.day-item.mv-low[aria-selected="true"] .dnum { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; }
.day-item.mv-low[aria-selected="true"] .dnum span { color: rgba(255, 255, 255, .85); }

/* ------------------------------------------------------------------ data chip + hold-to-close */
.data-chip { position: relative; display: inline-flex; align-items: center; gap: 2px; height: 36px; padding: 3px 3px 3px 4px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); transition: border-color .2s, box-shadow .2s, transform .35s var(--ease), opacity .35s; }
.data-chip:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.data-chip.closing { transform: scale(.85) translateY(-4px); opacity: 0; }
.dc-main { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 8px; border: 0; background: none; border-radius: 14px; cursor: pointer; font: inherit; font-size: 12px; color: var(--text-2); max-width: 320px; }
.dc-main:hover { background: var(--surface-2); }
.dc-main .dotlive, .dc-head .dotlive { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); flex: none; }
.dc-main .dotlive { animation: live 2.4s infinite; }
.dc-label { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.dc-meta { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.dc-main .chev { width: 14px; height: 14px; color: var(--muted); transition: transform .2s var(--ease); }
.dc-main[aria-expanded="true"] .chev { transform: rotate(180deg); }

.hold-x { --p: 0; position: relative; width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center;
  transition: background .2s, color .2s, transform .2s var(--spring); touch-action: none; user-select: none; }
.hold-x .hx { width: 14px; height: 14px; position: relative; z-index: 1; transition: transform .2s var(--ease); }
.hold-x .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.hold-x .ring circle { fill: none; stroke-width: 3; }
.hold-x .ring .trk { stroke: transparent; transition: stroke .2s; }
.hold-x .ring .prg { stroke: var(--mv-crit); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p)); opacity: calc(var(--p) * 50); }
.hold-x.rewind .ring .prg { transition: stroke-dashoffset .3s var(--ease-out); }
.hold-x:hover { background: var(--rose-soft); color: var(--mv-crit); }
.hold-x:hover .ring .trk { stroke: color-mix(in srgb, var(--mv-crit) 18%, transparent); }
.hold-x.holding { transform: scale(1.12); background: color-mix(in srgb, var(--mv-crit) 12%, var(--surface)); color: var(--mv-crit); }
.hold-x.holding .hx { transform: rotate(calc(var(--p) * 90deg)) scale(calc(1 - var(--p) * .15)); }
.hold-x.done { background: var(--mv-crit); color: #fff; }
.hold-hint { position: absolute; right: 2px; top: calc(100% + 8px); padding: 4px 9px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 11px; font-weight: 700; white-space: nowrap;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 5; }
.hold-x:hover ~ .hold-hint, .hold-x:focus-visible ~ .hold-hint { opacity: 1; transform: none; }
.hold-x.holding ~ .hold-hint, .dc-pop:not([hidden]) ~ .hold-hint { opacity: 0; }

.dc-pop { position: absolute; right: 0; top: calc(100% + 10px); width: 330px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); z-index: 1200; }
.dc-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dc-head .muted { margin-left: auto; }
.dc-files { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow: auto; }
.dc-files li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.dc-files .fi { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.dc-files .fi svg { width: 13px; height: 13px; }
.dc-files .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.dc-files .fr { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dc-stats div { padding: 7px 9px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.dc-stats b { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dc-stats span { font-size: 10.5px; color: var(--muted); font-weight: 650; }
.dc-range { margin: 8px 0 12px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.hold-bar { --p: 0; position: relative; overflow: hidden; width: 100%; height: 40px; padding: 0; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--mv-crit) 35%, transparent);
  background: var(--rose-soft); color: var(--mv-crit); font: inherit; font-weight: 750; font-size: 13px; cursor: pointer; touch-action: none; user-select: none; transition: transform .15s var(--ease); }
.hold-bar .fill { position: absolute; inset: 0; background: linear-gradient(90deg, #ef4444, #dc2626); transform-origin: left; transform: scaleX(var(--p)); }
.hold-bar.rewind .fill { transition: transform .3s var(--ease-out); }
.hold-bar .txt { position: relative; display: flex; align-items: center; gap: 7px; justify-content: center; height: 100%; }
.hold-bar .txt.over { position: absolute; inset: 0; color: #fff; clip-path: inset(0 calc(100% - var(--p) * 100%) 0 0); }
.hold-bar.rewind .txt.over { transition: clip-path .3s var(--ease-out); }
.hold-bar .txt .hx { width: 14px; height: 14px; }
.hold-bar.holding { transform: scale(.985); }
.dc-note { margin: 8px 0 0; font-size: 11px; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ person selector without profile badges */
.combo-ico { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); transition: background .2s, color .2s; }
.combo-ico svg { width: 18px; height: 18px; display: block; }
.combo-ico.all svg { width: 21px; height: 21px; }
.combo-btn:hover .combo-ico { background: var(--brand); color: #fff; }
.combo-btn:hover .combo-ico.all svg path[fill] { fill: var(--brand); }
.combo-pop li { gap: 12px; padding: 8px 10px; }
.combo-pop .ul-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.combo-pop .ul-text .id { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.combo-pop li.all-row { margin-bottom: 4px; box-shadow: 0 1px 0 var(--border); border-radius: 9px 9px 4px 4px; }
.combo-pop li.all-row .nm { font-weight: 750; }
.combo-pop mark { background: color-mix(in srgb, var(--brand) 20%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.combo-pop .ck { width: 16px; height: 16px; color: var(--brand); flex: none; }
.dc-file { width: 15px; height: 15px; color: var(--muted); flex: none; }
.menu .mi-sub { margin-left: auto; padding-left: 12px; font-size: 11px; color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------------------ expected columns, shown as the CSV's own first line
   Quiet by default; on hover it brightens and the column names light up left to right. */
.csv-hint { display: flex; flex-direction: column; gap: 3px; margin: 10px 4px 0; opacity: .6; transition: opacity .3s var(--ease); animation: rise .6s var(--ease-out) .2s backwards; }
.csv-hint:hover { opacity: 1; }
.csv-row { display: inline-flex; align-items: baseline; flex-wrap: wrap; font: 500 11.5px/1.5 ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace; color: var(--text-2); }
.csv-row .ln { font-weight: 400; color: var(--muted); padding-right: 9px; margin-right: 9px; border-right: 1px solid var(--border-strong); }
.csv-row b { font-weight: 600; color: var(--text-2); transition: color .25s var(--ease); }
.csv-row i { font-style: normal; color: var(--muted); padding: 0 1px; }
.csv-hint:hover .csv-row b { color: var(--brand); }
.csv-row b:nth-of-type(2) { transition-delay: .04s; } .csv-row b:nth-of-type(3) { transition-delay: .08s; }
.csv-row b:nth-of-type(4) { transition-delay: .12s; } .csv-row b:nth-of-type(5) { transition-delay: .16s; } .csv-row b:nth-of-type(6) { transition-delay: .2s; }
.csv-note { padding-left: 27px; font-size: 11px; color: var(--muted); }
.csv-note b { font: 600 10.5px ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--text-2); }

/* ================================================================== Overview, alive
   Motion that comes from the data itself - no status dots. Everything is transform / opacity / dash-offset,
   and all of it stops under "reduce motion". */

/* KPI sparklines: a light pulse keeps flowing along each trend, cards out of step */
.kpi-spark path.pulse { fill: none; stroke: var(--c); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: .1 1.2; stroke-dashoffset: .1; opacity: 0;
  filter: drop-shadow(0 0 3px var(--c)); animation: spark-pulse 4.6s ease-in-out infinite; animation-delay: calc(1.8s + var(--i, 0) * .6s); }
@keyframes spark-pulse { 0% { stroke-dashoffset: .1; opacity: 0; } 8% { opacity: .95; } 66% { opacity: .95; } 74%, 100% { stroke-dashoffset: -1; opacity: 0; } }

/* charts: the dashed reference lines flow slowly */
.chart .avg-line { animation: dash-flow 2.4s linear infinite; }
@keyframes dash-flow { to { stroke-dashoffset: -12; } }

/* time split: a comet orbits the clock ring like a second hand */
.donut .orbit { transform-box: view-box; transform-origin: 90px 90px; animation: orbit 10s linear infinite; }
.donut circle.comet { fill: none; stroke: var(--tw-stop-b); stroke-width: 4; stroke-linecap: round; }
@keyframes orbit { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .kpi-spark path.pulse, .chart .avg-line, .donut .orbit { animation: none !important; }
  .kpi-spark path.pulse { display: none; }
}
