/* Nucleus Pest Path — calm deep green/teal + white. Phone first. */
:root {
  color-scheme: light;
  --brand: #0d5c4f; --brand-2: #127a67; --brand-3: #e3f1ec; --brand-ink: #ffffff;
  --accent: #c47f00;
  --bg: #f4f8f6; --surface: #ffffff; --surface-2: #eef4f1; --line: #d5e2dc; --line-2: #e6eeea;
  --ink: #10201b; --ink-2: #44554f; --ink-3: #6b7a74;
  --good: #0f7a3d; --good-bg: #e2f4e8; --warn: #9a5b00; --warn-bg: #fdf1dc; --bad: #b42318; --bad-bg: #fde8e6; --info-bg: #e7f0fb; --info: #1d4f91;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --chart-grid: #e3e9e6; --chart-surface: #fcfcfb;
  --radius: 12px; --radius-s: 8px; --shadow: 0 1px 2px rgba(16,32,27,.06), 0 4px 14px rgba(16,32,27,.06);
  --tap: 44px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #3fb59a; --brand-2: #5cc8ae; --brand-3: #17322b; --brand-ink: #062019;
    --bg: #0f1614; --surface: #17201d; --surface-2: #1d2925; --line: #2c3b36; --line-2: #24312c;
    --ink: #e9f1ee; --ink-2: #b9c7c2; --ink-3: #8fa09a;
    --good: #5fd08f; --good-bg: #173326; --warn: #f2b74f; --warn-bg: #352812; --bad: #ff8a80; --bad-bg: #3a1c1a; --info-bg: #182a40; --info: #9cc3f5;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --chart-grid: #2a3632; --chart-surface: #1a1a19;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] { color-scheme: dark; --brand: #3fb59a; --brand-2: #5cc8ae; --brand-3: #17322b; --brand-ink: #062019; --bg: #0f1614; --surface: #17201d; --surface-2: #1d2925; --line: #2c3b36; --line-2: #24312c; --ink: #e9f1ee; --ink-2: #b9c7c2; --ink-3: #8fa09a; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --chart-grid: #2a3632; --chart-surface: #1a1a19; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); overflow-x: hidden; }
a { color: var(--brand-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--ink-3); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn.big { min-height: 56px; font-size: 17px; padding: 0 22px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label { display: block; font-weight: 600; font-size: 14px; color: var(--ink-2); margin: 0 0 4px; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 16px var(--font); }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); vertical-align: middle; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; }
.chip-toggle input { width: 18px; height: 18px; }
.chip-toggle:has(input:checked) { background: var(--brand-3); border-color: var(--brand-2); }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 58px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; letter-spacing: -.01em; }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand .sub { font-weight: 600; color: var(--ink-3); font-size: 13px; display: block; margin-top: -2px; }
.co-badge { display: flex; align-items: center; gap: 8px; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line); min-width: 0; }
.co-badge img { height: 44px; width: 44px; object-fit: contain; border-radius: 6px; background: #fff; }
.co-badge span { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.topbar .spacer { flex: 1; }
.topnav { display: flex; gap: 2px; }
.topnav a { padding: 8px 10px; white-space: nowrap; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; }
.topnav a.active { background: var(--brand-3); color: var(--brand); }
.bottomnav { display: none; }
.dev-chip { font-size: 12px; font-weight: 700; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
main { max-width: 1480px; margin: 0 auto; padding: 18px 16px 90px; }
@media (max-width: 900px) {
  .topnav { display: none; }
  .co-badge span { max-width: 38vw; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-decoration: none; gap: 2px; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--brand); }
  main { padding: 14px 16px 96px; }
}
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

/* ---------- cards, tiles, badges ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.tile .v { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.tile .d { font-size: 13px; font-weight: 600; }
.tile .d.better { color: var(--good); } .tile .d.worse { color: var(--bad); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-weight: 600; margin-bottom: 12px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.bad { background: var(--bad-bg); color: var(--bad); } .notice.good { background: var(--good-bg); color: var(--good); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* ---------- toast, modal ---------- */
#toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 84px; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(10,20,17,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: min(560px, 100vw); max-height: 90vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 16px 24px; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 16px; } }

/* ---------- sign-in ---------- */
.signin { max-width: 400px; margin: 8vh auto 0; }
.signin .brand { justify-content: center; font-size: 1.3rem; margin-bottom: 18px; }
.signin .brand svg { width: 44px; height: 44px; }

/* ---------- month board ---------- */
.board-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .board-wrap { grid-template-columns: 1fr; } }
.board { overflow-x: auto; }
.board table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; }
.board th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; padding: 8px; font-size: 14px; text-align: left; border-bottom: 1px solid var(--line); }
.board td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 6px; vertical-align: top; background: var(--surface); }
.board td.date { width: 96px; font-weight: 700; font-size: 14px; background: var(--surface-2); }
.board td.date .dow { display: block; color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.board td.date.weekend { opacity: .7; }
.cell { min-height: 54px; border-radius: 8px; padding: 2px; transition: background .15s; }
.cell.drop { background: var(--brand-3); outline: 2px dashed var(--brand-2); }
.cell-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.cell-head a { font-weight: 700; color: var(--ink); text-decoration: none; }
.cell-head .over { color: var(--bad); font-weight: 700; }
.fill { height: 4px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.fill > i { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; }
.fill > i.hot { background: var(--accent); }
.stopchip { display: flex; align-items: center; gap: 4px; padding: 3px 6px; margin: 2px 0; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12.5px; cursor: grab; user-select: none; min-height: 28px; }
.stopchip:hover { border-color: var(--brand-2); }
.stopchip .n { font-weight: 800; color: var(--ink-3); min-width: 14px; }
.stopchip .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stopchip .lock { font-size: 11px; }
.stopchip.done { opacity: .55; text-decoration: line-through; }
.stopchip.dragging { opacity: .4; }
.stopchip.insert-before { box-shadow: 0 -3px 0 var(--brand-2); }
.side-list .stopchip { background: var(--warn-bg); }
.daylist .day { border-top: 1px solid var(--line); padding: 10px 0; }

/* ---------- day route ---------- */
.route-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .route-wrap { grid-template-columns: 1fr; } }
.mapbox { position: relative; height: 520px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 1000px) { .mapbox { height: 300px; } }
.map-note { position: absolute; z-index: 500; left: 8px; bottom: 8px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); }
.svgmap { width: 100%; height: 100%; display: block; }
.stop { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: start; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stop .num { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.stop .t { font-weight: 800; }
.stop .addr { color: var(--ink-2); font-size: 14px; }
.stop .svc { font-size: 13.5px; color: var(--ink-3); }
.stop .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-content: flex-start; max-width: 230px; }
@media (max-width: 640px) { .stop { grid-template-columns: 40px 1fr; } .stop .acts { grid-column: 1 / -1; max-width: none; justify-content: flex-start; } }
.leg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 12px 6px 28px; font-size: 13.5px; color: var(--ink-2); border-left: 3px dotted var(--line); margin-left: 28px; }
.leg .tr { color: var(--warn); font-weight: 700; }
.places { width: 100%; }
.place { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.place .nm { flex: 1; }

/* ---------- today (tech) ---------- */
.today { max-width: 640px; margin: 0 auto; }
.next { border: 2px solid var(--brand-2); }
.next .who { font-size: 1.35rem; font-weight: 800; }
.next .eta { font-size: 15px; font-weight: 700; color: var(--brand); }
.info-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.big-actions .btn { width: 100%; }
.big-actions .full { grid-column: 1 / -1; }
.queue-bar { position: sticky; top: 58px; z-index: 5; }
.mini-stop { display: flex; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line-2); }
.mini-stop .n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; }
.mini-stop.done .n { background: var(--good-bg); color: var(--good); }
.mini-stop.skipped .n { background: var(--warn-bg); color: var(--warn); }
.mini-stop .nm { flex: 1; min-width: 0; }

/* ---------- import ---------- */
.drop-zone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 36px 16px; text-align: center; background: var(--surface); cursor: pointer; }
.drop-zone.over { border-color: var(--brand-2); background: var(--brand-3); }
.map-table td { vertical-align: middle; }
.map-table select { min-height: 38px; padding: 4px 8px; font-size: 14px; }
.map-table .sample { color: var(--ink-3); font-size: 13px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 12px; background: var(--line-2); border-radius: 12px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-2); width: 0; transition: width .2s; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.steps span { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-3); font-size: 13px; font-weight: 700; }
.steps span.on { background: var(--brand); color: var(--brand-ink); }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis text, .chart text { fill: var(--ink-3); font: 12px var(--font); }
.chart .lbl { fill: var(--ink); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; }
.tip { position: fixed; z-index: 120; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* ---------- list rows ---------- */
.row-list .row { display: flex; gap: 10px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.row-list .row:hover { background: var(--surface-2); }
.row-list .row .main { flex: 1; min-width: 0; }
.row-list .row .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-list .row .main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wizard-steps { counter-reset: s; }
.offline-banner { background: var(--warn-bg); color: var(--warn); font-weight: 700; text-align: center; padding: 6px; font-size: 14px; }

/* ---------- phone polish ---------- */
.brand > span { white-space: nowrap; }
.big-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.big-actions .btn { white-space: normal; min-width: 0; text-align: center; line-height: 1.2; }
.today .page-head { flex-wrap: nowrap; }
.today .page-head > div { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .dev-chip { display: none; }
  .topbar { gap: 8px; }
  .co-badge { padding-left: 8px; margin-left: 2px; }
  .co-badge img { height: 32px; width: 32px; }
  .page-head h1 { font-size: 1.3rem; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
