/* Switchboard admin. Plazza's dark design tokens (support-hub's tokens.generated.css). */
:root {
  color-scheme: dark;
  --bg: #0A0A0A;
  --surface: #171717;
  --surface-2: #1F1F1F;
  --surface-3: #262626;
  --border: #2A2A2A;
  --border-strong: #3A3A3A;
  --text: #FAFAFA;
  --text-2: #D4D4D4;
  --text-3: #A3A3A3;
  --text-4: #737373;
  --brand: #FF0090;
  --brand-hover: #FF57AF;
  --brand-text: #FF57AF;
  --brand-subtle: #40001F;
  --brand-subtle-2: #66003A;
  --success: #22C55E;
  --success-text: #86EFAC;
  --success-subtle: #052E16;
  --info: #3B82F6;
  --info-text: #93C5FD;
  --info-subtle: #172554;
  --warning: #F97316;
  --warning-text: #FDBA74;
  --warning-subtle: #431407;
  --danger: #EF4444;
  --danger-text: #FCA5A5;
  --danger-subtle: #450A0A;
  --violet: #A78BFA;
  --amber: #F59E0B;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { color: var(--brand-hover); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.faint { color: var(--text-4); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Shell */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 20px;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; font-size: 15px; }
/* icon.svg: its corners are rx 9 of 32, so 6px at 22px, which the glow follows. */
.brand-mark { display: block; width: 22px; height: 22px; border-radius: 6px; box-shadow: 0 0 18px rgba(255, 0, 144, 0.45); }
.env { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 99px; background: var(--warning-subtle); color: var(--warning-text); }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text-3); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: var(--text); background: var(--surface-3); }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-subtle); color: var(--brand-text); display: grid; place-items: center; font-weight: 650; font-size: 12px; }
.view { flex: 1; min-height: 0; position: relative; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-3); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--danger-text); border-color: #5a1a1a; background: transparent; }
.btn.danger:hover { background: var(--danger-subtle); }
.btn.on { background: var(--brand-subtle); border-color: var(--brand-subtle-2); color: var(--brand-text); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; }
.input, select.input, textarea.input {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text); min-width: 0;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 0, 144, 0.18); }
select.input { padding-right: 28px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border-strong); }
.seg button { border: 0; background: transparent; color: var(--text-3); height: 26px; padding: 0 12px; border-radius: 6px; cursor: pointer; font-weight: 550; font-size: 12.5px; }
.seg button:hover { color: var(--text); }
.seg button:disabled { cursor: not-allowed; }
.seg button:disabled:not(.active) { color: var(--text-3); opacity: .45; }
.seg button.active { background: var(--surface-3); color: var(--text); }
.seg button.active.mode-live { background: var(--brand); color: #fff; }
.seg button.active.mode-shadow { background: var(--info-subtle); color: var(--info-text); }
.switch { position: relative; width: 36px; height: 20px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform .15s; }
.switch.on { background: var(--brand); border-color: var(--brand); }
.switch.on::after { transform: translateX(16px); background: #fff; }

/* Pills and badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 550; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--brand-subtle); color: var(--brand-text); }
.pill.shadow { background: var(--info-subtle); color: var(--info-text); }
.pill.off { background: var(--surface-3); color: var(--text-3); }
.pill.good { background: var(--success-subtle); color: var(--success-text); }
.pill.warn { background: var(--warning-subtle); color: var(--warning-text); }
.pill.bad { background: var(--danger-subtle); color: var(--danger-text); }
.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-3); text-transform: lowercase; }
.badge.store { background: var(--brand-subtle); color: var(--brand-text); }
.badge.global { background: var(--info-subtle); color: var(--info-text); }

/* Sign-in */
.signin { height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(800px 400px at 50% 0%, rgba(255, 0, 144, 0.10), transparent 70%), var(--bg); }
.signin-card { width: 100%; max-width: 380px; padding: 32px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.signin-card h1 { font-size: 22px; letter-spacing: -0.02em; margin: 18px 0 6px; }
.signin-card p { margin: 0 0 22px; color: var(--text-3); }
.signin-card .btn { width: 100%; }
.signin-card form { display: grid; gap: 10px; margin-top: 14px; }
.signin-card .error { margin-top: 16px; padding: 10px 12px; border-radius: 8px; background: var(--danger-subtle); color: var(--danger-text); font-size: 13px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-4); font-size: 12px; margin: 18px 0 4px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Map view */
.map { position: absolute; inset: 0; background: #0c0c0c; }
.panel {
  position: absolute; z-index: 2; background: rgba(23, 23, 23, 0.94); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.side { top: 12px; left: 12px; bottom: 12px; width: 372px; display: flex; flex-direction: column; overflow: hidden; }
.side-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.store-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.store-title h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { padding: 8px 10px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); }
.stat b { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--text-3); }
.stat.alert b { color: var(--danger-text); }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--text-3); padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 550; }
.tabs button.active { background: var(--surface-3); color: var(--text); }
.list { flex: 1; overflow-y: auto; padding: 8px; }
.item { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: start; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.item:hover { background: var(--surface-2); }
.item.selected { background: var(--brand-subtle); }
.item > div { min-width: 0; }
.item .swatch { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; }
.item .swatch.drop { background: #FFFFFF; }
.item .swatch.drop.ring { background: transparent; border: 2.5px solid #FFFFFF; }
.item .swatch.drop.late { background: var(--danger); }
.item .swatch.drop.ring.late { background: transparent; border-color: var(--danger); }
.item .swatch.drop.door { background: #FACC15; }
.item .swatch.drop.ring.door { background: transparent; border-color: #FACC15; }
/* A rider given orders they have not accepted: in a dashed ring, flashing as
   on the map (icons.js, flashUnaccepted), unless the system asks for less
   motion, when only the ring shows. */
.item .swatch.wait { outline: 1.5px dashed #FFFFFF; outline-offset: 2px; }
@keyframes flash { 50% { opacity: 0.2; } }
@media (prefers-reduced-motion: no-preference) {
  .flash { animation: flash 1.2s ease-in-out infinite; }
}
.item .swatch.drop.refunded { background: #737373; }
.item .swatch.drop.ring.refunded { background: transparent; border-color: #737373; }
.item .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .right { text-align: right; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.item .right b { color: var(--text); font-weight: 600; }
.late { color: var(--danger-text) !important; }
.soon { color: var(--warning-text) !important; }
.notes { padding: 8px 12px; display: grid; gap: 6px; }
.note { font-size: 12px; padding: 8px 10px; border-radius: 8px; background: var(--warning-subtle); color: var(--warning-text); }
.note::first-letter { text-transform: uppercase; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-4); font-size: 13px; }
.side-foot { padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-4); display: flex; justify-content: space-between; }

/* Above the legend, which it meets on a narrow window. */
.detail { top: 12px; right: 12px; width: 380px; max-height: calc(100% - 24px); display: flex; flex-direction: column; overflow: hidden; z-index: 3; }
.detail-head { padding: 14px 14px 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.detail-head h3 { margin: 0; font-size: 15px; }
.detail-body { overflow-y: auto; padding: 12px 16px 16px; }
.store-card { width: 330px; }
.store-card .store-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.store-card .store-title h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-card .swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.store-card .detail-body { display: grid; gap: 12px; }
.btn.wide { width: 100%; justify-content: center; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-4); font-weight: 650; margin: 18px 0 8px; }
.plan-text { padding: 10px 12px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 12px 18px; font-size: 12.5px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 15px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.first::before { background: var(--brand); }
.timeline .when { color: var(--text-4); font-size: 11.5px; }

.legend { left: 396px; bottom: 12px; padding: 10px 12px; font-size: 12px; display: grid; grid-template-columns: auto auto; gap: 4px 18px; }
.legend .group, .legend .wide { grid-column: 1 / -1; }
.legend .icons { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.legend img { height: 20px; width: auto; }
.legend .icons .row { gap: 5px; }
.legend .wide { max-width: 360px; white-space: normal; margin-top: 2px; }
.legend .row { gap: 7px; flex-wrap: nowrap; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend i.area { width: 16px; height: 11px; border-radius: 3px; border: 1.5px solid rgba(255, 0, 144, 0.6); background: rgba(255, 0, 144, 0.07); }
.legend i.area.milk-run { border-style: dashed; background: transparent; }
.legend .group { color: var(--text-4); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }
/* A click folds the legend to a small tab, and a click on the tab opens it
   again (icons.js, collapsibleLegend). */
.legend { cursor: pointer; }
.legend:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Ink on the pink, not white: 5.3:1 against white's 3.7:1, at this size. */
.legend.collapsed { display: flex; align-items: center; gap: 6px; padding: 6px 11px; font-weight: 650; color: var(--bg);
  background: var(--brand); border-color: var(--brand); }
.legend.collapsed > * { display: none; }
.legend.collapsed::before { content: "Legend"; }
.legend.collapsed::after { content: "▴"; font-size: 10px; opacity: 0.8; }
.legend.collapsed:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.legend.collapsed:focus-visible { outline-color: #fff; }
.dryrun-bar { left: 50%; transform: translateX(-50%); top: 12px; padding: 8px 10px 8px 14px; display: flex; align-items: center; gap: 12px; font-size: 13px; border-color: var(--brand-subtle-2); }

.maplibregl-popup-content { background: var(--surface) !important; color: var(--text); border: 1px solid var(--border); border-radius: 10px !important; padding: 8px 10px !important; font: 12.5px/1.4 var(--font); box-shadow: var(--shadow) !important; }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-ctrl-attrib { background: rgba(10, 10, 10, 0.7) !important; color: var(--text-4) !important; }
.maplibregl-ctrl-attrib a { color: var(--text-3) !important; }
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--border); }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }

/* Pages (settings, health) */
.page { height: 100%; overflow-y: auto; }
.page-inner { max-width: 1120px; margin: 0 auto; padding: 24px 24px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-3); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric { padding: 16px; }
.metric .label { font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.metric .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.metric .foot { font-size: 12px; color: var(--text-4); margin-top: 4px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
/* Tables you can sort and filter (table.js): a heading sorts its column; a
   funnel beside one opens its filter. */
.table.sorts th.sortable { padding: 0; vertical-align: bottom; }
.table.sorts td { padding: 10px; }
.table.sorts td:first-child { padding-left: 14px; }
.table .th-wrap { display: flex; align-items: flex-end; }
.table .th-sort { display: flex; align-items: flex-end; gap: 5px; flex: 1; min-width: 0; padding: 10px; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.table.sorts th:first-child .th-sort { padding-left: 14px; }
.table .th-sort:hover { color: var(--text); }
.table .th-sort:focus-visible, .table .th-filter:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 4px; }
.table .th-sort .arrow { flex: none; font-size: 10px; color: var(--text-4); }
.table th[aria-sort] .th-sort { color: var(--text); }
.table th[aria-sort] .arrow { color: var(--brand-text); }
.table .th-filter { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: 0 4px 6px -4px; padding: 0; border: 0;
  border-radius: 5px; background: none; color: var(--text-4); cursor: pointer; }
.table .th-filter:hover, .table .th-filter[aria-expanded="true"] { color: var(--text); background: var(--surface-3); }
.table .th-filter.on { color: var(--brand-text); }
.icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.table .th-filter.on .icon.funnel { fill: currentColor; }
.table .table-empty { color: var(--text-4); text-align: center; }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 6px 14px 10px; font-size: 12px; color: var(--text-3); }

/* A column's filter, under its funnel: the column's values to tick, a search
   that narrows them, Select all, and Cancel or Ok. */
.col-filter { position: fixed; z-index: 40; width: 340px; max-width: calc(100vw - 16px); padding: 14px 14px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cf-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.cf-search { display: flex; gap: 6px; min-width: 0; }
.cf-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-3); cursor: text; }
.cf-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 0, 144, 0.18); }
.cf-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font-size: 13px; }
.cf-op { flex: none; height: 26px; max-width: 118px; padding: 0 4px; border: 0; border-radius: 6px; background: none; color: var(--text-3);
  font-size: 12px; cursor: pointer; }
.cf-op:hover, .cf-op:focus-visible { color: var(--text); background: var(--surface-3); outline: 0; }
.cf-case { flex: none; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-3);
  color: var(--text-3); font-size: 13px; font-weight: 650; cursor: pointer; }
.cf-case:hover { color: var(--text); }
.cf-case.on { color: var(--brand-text); border-color: var(--brand-subtle-2); background: var(--brand-subtle); }
.cf-list { max-height: 196px; overflow-y: auto; display: grid; gap: 1px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cf-item { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.cf-item:hover { background: var(--surface-3); color: var(--text); }
.cf-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-filter input[type=checkbox] { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.cf-empty { padding: 10px 4px; font-size: 12.5px; color: var(--text-4); }
.cf-all { display: flex; align-items: flex-start; gap: 10px; padding: 2px 4px; cursor: pointer; }
.cf-all input { margin-top: 2px !important; }
.cf-all-name { font-size: 13px; font-weight: 600; color: var(--text-2); }
.cf-all-note { font-size: 12px; color: var(--text-4); }
.cf-foot { display: flex; align-items: center; gap: 6px; }
/* A number column's filter: at least (≥) and at most (≤). */
.col-filter.range { width: 300px; }
.cf-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-bound { display: flex; align-items: center; gap: 6px; min-width: 0; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg); cursor: text; }
.cf-bound:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 0, 144, 0.18); }
.cf-sign { flex: none; font-size: 14px; font-weight: 650; color: var(--brand-text); }
.cf-unit { flex: none; font-size: 12px; color: var(--text-4); }
.cf-bound .cf-input { -moz-appearance: textfield; }
.cf-bound .cf-input::-webkit-outer-spin-button, .cf-bound .cf-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cf-note { font-size: 12px; color: var(--text-4); }
.cf-spacer { flex: 1; }

.settings-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.group-card { margin-bottom: 14px; overflow: hidden; }
.group-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: baseline; gap: 12px; }
.group-head h2 { margin: 0; font-size: 14px; font-family: var(--mono); font-weight: 600; }
.group-head p { margin: 0; color: var(--text-3); font-size: 12.5px; }
.subgroup { padding: 10px 18px 2px; font-family: var(--mono); font-size: 12px; color: var(--text-4); }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting.changed { background: linear-gradient(90deg, rgba(255, 0, 144, 0.08), transparent 60%); box-shadow: inset 3px 0 0 var(--brand); }
.setting .name { font-family: var(--mono); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setting .desc { margin-top: 5px; color: var(--text-3); font-size: 12.5px; white-space: pre-wrap; }
.setting .desc.clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.setting .more { font-size: 12px; color: var(--text-4); cursor: pointer; margin-top: 2px; display: inline-block; }
.setting .more:hover { color: var(--text-2); }
.setting .control { display: grid; gap: 6px; align-content: start; }
.setting .control .input { width: 100%; }
.setting .control .hint { font-size: 11.5px; color: var(--text-4); }
/* A list setting whose order matters (fleets.order): a numbered row per item,
   dragged or moved with its arrows; the item that must lead stays put. */
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.order-row { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px 0 6px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border-strong); cursor: grab; }
.order-row.pinned { cursor: default; border-style: dashed; }
.order-row.over { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 0, 144, 0.18); }
.order-row .order-n { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3); font-size: 11px; font-weight: 700; }
.order-row .order-name { font-family: var(--mono); font-size: 12.5px; flex: 1; min-width: 0; }
.order-row .order-tools { display: flex; gap: 0; }
.order-row .hint { padding-right: 6px; }
.btn.icon { width: 26px; padding: 0; justify-content: center; }
/* A list setting whose order does not matter (fleets.third_party.for): a box
   to tick for each choice. */
.ticks { display: flex; flex-wrap: wrap; gap: 6px; }
.tick { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 9px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg); font-family: var(--mono); font-size: 12.5px; cursor: pointer; }
.tick:has(input:checked) { border-color: var(--brand-subtle-2); background: var(--brand-subtle); color: var(--brand-text); }
.tick input { margin: 0; accent-color: var(--brand); }
.savebar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }

/* Dialogs and toasts */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 16px; }
.dialog { width: 100%; max-width: 520px; max-height: 85vh; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); }
.dialog.wide { max-width: 760px; }
.dialog-head { padding: 18px 20px 6px; }
.dialog-head h3 { margin: 0; font-size: 16px; }
.dialog-body { padding: 8px 20px 18px; color: var(--text-2); display: grid; gap: 12px; }
.dialog-foot { padding: 12px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.diff { display: grid; gap: 6px; font-family: var(--mono); font-size: 12px; }
/* The setting's name takes the room it needs; a long value (a list) wraps
   beside it rather than running over it. */
.diff div { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px; padding: 6px 8px; background: var(--bg); border-radius: 6px; }
.diff div > span:last-child { text-align: right; overflow-wrap: anywhere; }
.diff .from { color: var(--danger-text); text-decoration: line-through; opacity: 0.8; }
.diff .to { color: var(--success-text); }
.history-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 13px; max-width: 420px; }
.toast.error { background: var(--danger-subtle); border-color: #5a1a1a; color: var(--danger-text); }
.toast.ok { border-color: var(--brand-subtle-2); }
.loading { padding: 40px; text-align: center; color: var(--text-4); }

.nav a, .who .email { white-space: nowrap; }

@media (max-width: 1000px) {
  .who .email { display: none; }
}

@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 8px; height: auto; flex-wrap: wrap; }
  .topbar .spacer { display: none; }
  .brand span:not(.brand-mark), .env, .who .pill, .who .email, .who .avatar { display: none; }
  .nav a { padding: 6px 8px; }
  .topbar select.input { flex: none; width: 124px; padding-left: 8px; }
  .who .btn { padding: 0 4px; }
  .side { width: auto; right: 12px; bottom: auto; max-height: 48%; }
  .detail { width: auto; left: 12px; top: auto; bottom: 12px; max-height: 50%; }
  .legend { display: none; }
  .setting { grid-template-columns: 1fr; }
  .page-inner { padding: 16px 16px 120px; }
}
.m0 { margin: 0; }
.mt { margin-top: 10px; }
.badge.tag { margin-left: 6px; text-transform: none; }

/* Analytics */
.subnav { margin-top: 4px; }
.page-notes { padding: 0 0 14px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin-bottom: 14px; }
.chart { padding: 14px 16px 12px; position: relative; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.chart-head h3 { margin: 0; font-size: 14px; }
.chart-head p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
section.card > .chart-head { padding: 14px 16px 0; }
.chart-body { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid { stroke: #262626; stroke-width: 1; }
.chart-svg .axis { stroke: #3A3A3A; stroke-width: 1; }
.chart-svg .tick { fill: #898781; font: 11px var(--font); }
.chart-svg .cross { stroke: #737373; stroke-width: 1; }
.chart-svg .hit { fill: transparent; outline: none; }
.chart-svg .ring { stroke: #171717; stroke-width: 2; }
.chart-tip { position: absolute; top: 4px; transform: translateX(-50%); pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; z-index: 3; }
.chart-tip .tip-label { color: var(--text-3); margin-bottom: 3px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip .tip-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip i, .legend-row i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); margin: 2px 0 6px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.chart-table { max-height: 260px; overflow: auto; }
.scroll-x { overflow-x: auto; }
@media (max-width: 760px) { .chart-grid { grid-template-columns: 1fr; } }

/* The trip being put together on the live map */
.plan-stop .seq { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-3); color: var(--text); font-size: 12px; font-weight: 700; }
.plan-stop .right.row { gap: 2px; }
