/* Layout: app shell — sidebar on wide screens, bottom tab bar on phones. Cab-dashboard feel: navy chassis, safety-orange controls, gauge-style numbers. */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --ink: #18213a;
  --ink-2: #4c5672;
  --ink-3: #7c86a2;
  --line: #d9dfea;
  --navy: #1f2a44;
  --navy-ink: #ffffff;
  --accent: #e8742a;
  --accent-ink: #ffffff;
  --accent-soft: #fde9dc;
  --good: #1b7f4b;
  --good-bg: #dcf3e6;
  --warn: #8a5a00;
  --warn-bg: #fff1c7;
  --bad: #b3261e;
  --bad-bg: #fde0dd;
  --map-land: #e3e8f1;
  --map-line: #b9c3d6;
  --shadow: 0 1px 2px rgba(24, 33, 58, 0.06), 0 4px 14px rgba(24, 33, 58, 0.06);
  --font-display: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1424; --surface: #171e33; --surface-2: #1d2540; --ink: #e9edf6; --ink-2: #b5bdd3; --ink-3: #8790aa;
    --line: #2b3554; --navy: #0b1020; --navy-ink: #e9edf6; --accent: #f08a45; --accent-ink: #1a0f06; --accent-soft: #3a2616;
    --good: #5fd391; --good-bg: #133524; --warn: #f2c14e; --warn-bg: #3a2e0f; --bad: #ff8a80; --bad-bg: #3d1714;
    --map-land: #1f2842; --map-line: #34406a; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1424; --surface: #171e33; --surface-2: #1d2540; --ink: #e9edf6; --ink-2: #b5bdd3; --ink-3: #8790aa;
  --line: #2b3554; --navy: #0b1020; --navy-ink: #e9edf6; --accent: #f08a45; --accent-ink: #1a0f06; --accent-soft: #3a2616;
  --good: #5fd391; --good-bg: #133524; --warn: #f2c14e; --warn-bg: #3a2e0f; --bad: #ff8a80; --bad-bg: #3d1714;
  --map-land: #1f2842; --map-line: #34406a; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td, .stat-value { font-variant-numeric: tabular-nums; }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--navy); color: var(--navy-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: 0.02em; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.05; letter-spacing: 0.01em; }
.brand-sub { font-size: 11.5px; opacity: 0.65; letter-spacing: 0.04em; text-transform: uppercase; }
.nav-group { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.5; padding: 14px 10px 4px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; color: inherit; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14.5px; opacity: 0.85; }
.nav-btn:hover { background: rgba(255, 255, 255, 0.07); opacity: 1; }
.nav-btn[aria-current="page"] { background: rgba(232, 116, 42, 0.18); color: #ffb98b; opacity: 1; font-weight: 600; }
.nav-btn .lock { margin-left: auto; opacity: 0.6; font-size: 12px; }
.main { min-width: 0; padding-block: 22px 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.1; margin: 2px 0 0; text-wrap: balance; letter-spacing: 0.005em; }
h2 { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin: 0; letter-spacing: 0.01em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 8px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink-3); }

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 11.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.1; }
.stat-sub { font-size: 12.5px; color: var(--ink-2); }
.neg { color: var(--bad); }
.pos { color: var(--good); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; padding: 10px 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14.5px; min-height: 42px; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn-dark { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: 13.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.input, select.input { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 9px 11px; min-height: 42px; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-plain { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.r, th.r { text-align: right; }
tr.total td { font-weight: 700; background: var(--surface-2); }
tbody tr:hover td { background: var(--surface-2); }

.verdict { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.verdict-take { background: var(--good-bg); color: var(--good); }
.verdict-neg { background: var(--warn-bg); color: var(--warn); }
.verdict-pass { background: var(--bad-bg); color: var(--bad); }
.verdict-word { font-family: var(--font-display); font-weight: 800; font-size: 34px; letter-spacing: 0.02em; line-height: 1; }

.map { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--surface-2); }
.map-land { fill: var(--map-land); stroke: var(--map-line); stroke-width: 1.5; }
.map-city { fill: var(--ink-3); }
.map-route { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.map-done { fill: none; stroke: var(--navy); stroke-width: 5; stroke-linecap: round; }
.map-label { font-size: 15px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; }
.leaflet-box { height: 340px; border-radius: 8px; overflow: hidden; }

.banner { border: 1px dashed var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); }
.banner b { color: var(--ink); }
.locked { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bar-chart { width: 100%; height: auto; display: block; }
.bar-chart text { fill: var(--ink-3); font-size: 12px; }
.bar-rev { fill: var(--navy); }
:root[data-theme="dark"] .bar-rev { fill: #6b7cb3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar-rev { fill: #6b7cb3; } }
.bar-profit { fill: var(--accent); }
.gridline { stroke: var(--line); stroke-width: 1; }

.plan-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }
.offer { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; border-color: var(--accent); background: var(--accent-soft); }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.price { font-family: var(--font-display); font-size: 36px; font-weight: 800; line-height: 1; }
.checklist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.checklist li::before { content: "✓"; color: var(--good); font-weight: 800; margin-right: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--navy-ink); }

.tabbar { display: none; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.more-tile { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 14px; cursor: pointer; box-shadow: var(--shadow); }
.more-tile svg { color: var(--accent); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); background: var(--navy); color: var(--navy-ink); padding: 10px 16px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); z-index: 50; }
.gps-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .gps-dot { animation: none; } }
.odometer { font-family: var(--font-display); font-weight: 800; font-size: 52px; line-height: 1; letter-spacing: 0.02em; }
.list-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }

@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding-block: 14px calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  h1 { font-size: 26px; }
  .stat-value { font-size: 24px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--navy); color: var(--navy-ink); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .tab { border: 0; background: transparent; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; padding: 6px 2px; border-radius: 8px; opacity: 0.75; cursor: pointer; }
  .tab[aria-current="page"] { color: #ffb98b; opacity: 1; font-weight: 700; }
  .mobile-brand { display: flex; }
}
@media (min-width: 861px) { .mobile-brand { display: none; } }
@media (max-width: 420px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .odometer { font-size: 44px; } }

.toast { display: flex; align-items: center; gap: 12px; }
.toast-action { border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 4px 12px; font-weight: 700; cursor: pointer; }
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(8, 12, 24, 0.66); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal { width: 100%; max-width: 560px; max-height: 100%; overflow: auto; }
.modal-wide { max-width: 860px; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow); }
.quick button.hot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.quick svg { width: 22px; height: 22px; }
.statusbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bell { position: relative; }
.bell .count { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.role-banner { background: var(--accent-soft); color: var(--ink); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.clickable tbody tr { cursor: pointer; }
.wizard-steps { display: flex; gap: 6px; margin-bottom: 14px; }
.wizard-steps span { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.wizard-steps span.on { background: var(--accent); }
.big-cpm { font-family: var(--font-display); font-size: 46px; font-weight: 800; line-height: 1; }
@media (max-width: 860px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Sign-in (live app) ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; max-width: 440px; margin: 0 auto; }
.auth-card { padding: 24px; }
.auth-brand { padding: 0 0 18px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.auth-title { font-family: var(--font-display, inherit); font-size: 24px; line-height: 1.15; margin: 0; display: flex; gap: 8px; align-items: center; }
.auth-code { font-size: 28px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-err { color: var(--bad); font-weight: 600; margin: 0; }
.auth-note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.btn-lg { padding: 13px 18px; font-size: 16px; justify-content: center; width: 100%; }
.sync-pill { font-size: 12px; }
.choose-plan { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.choose-plan .btn { white-space: nowrap; }
.faq { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; }
.faq p { margin: 8px 0 0; }
textarea.input { resize: vertical; min-height: 120px; font: inherit; }
