/* SmartProbe dashboard (Cloudflare).
   Look: a field instrument, a sibling of the lab's Methane Atlas (AIMNET) rather than a copy of it.
   Slate surfaces, one deep-teal accent, IBM Plex Sans with Plex Mono for every reading (fonts served
   from /vendor/fonts, see scripts/build.mjs). Sensor 1 is always blue and sensor 2 always orange;
   status colours (green / amber / grey, red for "sensors disagree") always come with a word.
   Light and dark themes: html[data-theme] is set before the page draws by /app/theme.js. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/vendor/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/vendor/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url("/vendor/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/vendor/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/vendor/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --rail-w: 72px; --topbar-h: 56px; --inspector-w: 360px;
  --radius: 12px; --radius-sm: 8px;
  --brand: #0f766e;
  --good: #0ca30c; --late: #e09a00; --offline: #8a94a3; --warn: #d03b3b;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
:root, :root[data-theme="light"] {
  color-scheme: light;
  --page: #eff2f5; --surface: #ffffff; --surface-2: #f4f6f8; --surface-3: #e7ecf0;
  --border: rgba(20, 32, 43, 0.10); --border-strong: rgba(20, 32, 43, 0.22);
  --ink: #14202b; --ink-2: #3c4a58; --ink-3: #5a6878;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-text: #0f766e; --accent-soft: rgba(15, 118, 110, 0.10);
  --s1: #2a78d6; --s2: #eb6834;
  --good-text: #0b7a0b; --late-text: #8a5a00; --warn-text: #b42323; --offline-text: #4b5563;
  --overlay: rgba(255, 255, 255, 0.90);
  --shadow: 0 8px 24px rgba(20, 32, 43, 0.10); --shadow-sm: 0 1px 2px rgba(20, 32, 43, 0.08);
  --night: rgba(36, 52, 71, 0.16);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1015; --surface: #121920; --surface-2: #18212a; --surface-3: #212c37;
  --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.17);
  --ink: #e4ebf1; --ink-2: #b6c2ce; --ink-3: #8796a5;
  --accent: #2dd4bf; --accent-ink: #042f2b; --accent-text: #5eead4; --accent-soft: rgba(45, 212, 191, 0.12);
  --s1: #3987e5; --s2: #d95926;
  --good-text: #4ade80; --late-text: #fbbf24; --warn-text: #f87171; --offline-text: #b6c2ce;
  --overlay: rgba(18, 25, 32, 0.90);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --night: rgba(148, 163, 184, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-underline-offset: 2px; }
h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.015em; }
h2 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
h3 { margin: 0; font-size: 17px; font-weight: 600; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); } .small { font-size: 12px; }
.hint { margin: 6px 0 0; color: var(--ink-3); font-size: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.error { position: fixed; z-index: 2500; left: 50%; top: calc(var(--topbar-h) + 12px); transform: translateX(-50%);
  margin: 0; max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--warn) 16%, var(--surface)); color: var(--warn-text); font-weight: 500; }

/* ---------- icons (masks, so they take the text colour) ---------- */
.icon { display: inline-block; width: 18px; height: 18px; flex: none; background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon-map { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z%27/%3E%3Cpath d=%27M9 4v14M15 6v14%27/%3E%3C/svg%3E"); }
.icon-fleet { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M3 10l4-3 4 2 4-4 6 3%27/%3E%3Cpath d=%27M3 20l4-3 4 2 4-4 6 3%27/%3E%3C/svg%3E"); }
.icon-theme { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2712%27 cy=%2712%27 r=%279%27/%3E%3Cpath d=%27M12 3a9 9 0 0 0 0 18z%27 fill=%27black%27/%3E%3C/svg%3E"); }
.icon-help { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2712%27 cy=%2712%27 r=%279%27/%3E%3Cpath d=%27M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6V14%27/%3E%3Cpath d=%27M12 17.5h.01%27/%3E%3C/svg%3E"); }
.icon-logout { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M15 4h3a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-3%27/%3E%3Cpath d=%27M10 16l-4-4 4-4%27/%3E%3Cpath d=%27M6 12h10%27/%3E%3C/svg%3E"); }
.icon-search { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2711%27 cy=%2711%27 r=%277%27/%3E%3Cpath d=%27m20 20-3.5-3.5%27/%3E%3C/svg%3E"); }
.icon-layers { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27m12 3 9 5-9 5-9-5 9-5z%27/%3E%3Cpath d=%27m3 13 9 5 9-5%27/%3E%3C/svg%3E"); }
.icon-reset { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M3 12a9 9 0 1 0 3-6.7L3 8%27/%3E%3Cpath d=%27M3 3v5h5%27/%3E%3C/svg%3E"); }
.icon-close { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M6 6l12 12M18 6 6 18%27/%3E%3C/svg%3E"); }
.icon-arrow { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M5 12h14%27/%3E%3Cpath d=%27m13 6 6 6-6 6%27/%3E%3C/svg%3E"); }
.icon-sun { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2712%27 cy=%2712%27 r=%274%27/%3E%3Cpath d=%27M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4%27/%3E%3C/svg%3E"); }
.icon-check { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27m5 12 5 5 9-10%27/%3E%3C/svg%3E"); }
.icon-alert { --i: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M12 3 2 20h20L12 3z%27/%3E%3Cpath d=%27M12 10v4M12 17h.01%27/%3E%3C/svg%3E"); }

/* ---------- logo: a probe body with its two sensors ---------- */
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); display: inline-flex;
  align-items: center; justify-content: center; gap: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.logo i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; }
.logo-s1 { background: #2a78d6; } .logo-s2 { background: #eb6834; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.rail { grid-row: 1 / 3; grid-column: 1; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 11px 0 12px; background: var(--surface); border-right: 1px solid var(--border); z-index: 1200; }
.rail-logo { display: grid; place-items: center; margin-bottom: 6px; }
.rail-nav, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail-bottom { margin-top: auto; }
.rail-item { position: relative; width: 58px; padding: 8px 0 6px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; border-radius: 10px; color: var(--ink-3); text-decoration: none;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.rail-item:hover { background: var(--surface-2); color: var(--ink); }
.rail-item.is-active { color: var(--accent-text); background: var(--accent-soft); }
.rail-item.is-active::before { content: ""; position: absolute; left: -7px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 3px; background: var(--accent); }
.rail-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-3);
  display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.rail-btn:hover { background: var(--surface-2); color: var(--ink); }

.topbar { grid-row: 1; grid-column: 2; display: flex; align-items: center; gap: 16px; min-width: 0;
  padding: 0 16px 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1100; }
.title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.app-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.app-sub { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finder { position: relative; margin-left: auto; width: min(340px, 38vw); }
.finder > .icon { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none; }
.finder input { width: 100%; min-height: 36px; padding: 0 12px 0 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); }
.finder input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }
.finder-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow); z-index: 2000; }
.finder-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; }
.finder-list li[aria-selected="true"], .finder-list li:hover { background: var(--accent-soft); }
.finder-list .sub { color: var(--ink-3); font-size: 12px; }
.finder-list .none { color: var(--ink-3); cursor: default; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.updated { color: var(--ink-3); font: 12px var(--font-mono); white-space: nowrap; }
.badge { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text);
  font-size: 12px; font-weight: 600; }
.badge:empty { display: none; }

.page-area { grid-row: 2; grid-column: 2; min-height: 0; min-width: 0; }
.view { display: grid; grid-template-columns: minmax(0, 1fr) var(--inspector-w); height: 100%; min-height: 0; }
.view-main { min-width: 0; min-height: 0; }
.scroll { overflow: auto; }
.content { max-width: 1240px; margin: 0 auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 13px; }
.crumbs a { color: var(--ink-3); } .crumbs a:hover { color: var(--accent-text); }

/* ---------- inspector (right panel) ---------- */
.inspector { min-height: 0; overflow: auto; background: var(--surface); border-left: 1px solid var(--border); }
.insp-section { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sec-extra { color: var(--ink-3); font-size: 12px; }
.field-label { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.select { width: 100%; min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  min-width: 0; box-shadow: var(--shadow-sm); }
.card-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }
.card-title h2 { margin: 0; }
.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.cards > .card { flex: 1 1 300px; }
.chart { width: 100%; }

/* ---------- segmented controls, chips, checks (buttons with aria-pressed, made by common.js chips()) ---------- */
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3);
  width: fit-content; max-width: 100%; }
.seg-item { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); font-weight: 500; white-space: nowrap; cursor: pointer; }
.seg-item:hover { color: var(--ink); }
.seg-item[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* status tiles on the map's side panel; they are also the status filter */
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); text-align: left; cursor: pointer; }
.stat-tile:hover { border-color: var(--border-strong); }
.stat-tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.stat-n { font-size: 22px; font-weight: 500; line-height: 1.1; }
.stat-l { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12px; font-weight: 500; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-online { background: var(--good); } .dot-late { background: var(--late); }
.dot-offline, .dot-never { background: var(--offline); }
.dot-ring { background: transparent; border: 2.5px solid var(--warn); width: 11px; height: 11px; }
.warn-mark { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--warn); flex: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 600; white-space: nowrap; }
.pill-online { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good-text); }
.pill-late { background: color-mix(in srgb, var(--late) 18%, transparent); color: var(--late-text); }
.pill-offline, .pill-never { background: color-mix(in srgb, var(--offline) 20%, transparent); color: var(--offline-text); }
.pill-warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn-text); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.icon-btn { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3);
  display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- map page ---------- */
.map-stage { position: relative; min-height: 0; min-width: 0; background: var(--surface-3); }
#map { position: absolute; inset: 0; background: var(--surface-3); font-family: var(--font-sans); }
.float { position: absolute; z-index: 800; }
.float-tl { top: 14px; left: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.float-tr { top: 14px; right: 14px; }
.float-bl { left: 14px; bottom: 24px; }
.float-row { display: flex; gap: 6px; }
.fbtn { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--overlay); color: var(--ink); font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(8px); }
.fbtn .icon { width: 16px; height: 16px; }
.fbtn:hover, .fbtn[aria-expanded="true"] { border-color: var(--border-strong); background: var(--surface); }
.card-float, .popover { background: var(--overlay); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(10px); padding: 12px 14px; }
.popover { display: flex; flex-direction: column; gap: 8px; min-width: 230px; }
.legend { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.conditions { width: 250px; display: flex; flex-direction: column; gap: 8px; }
.cond-head { display: flex; align-items: center; gap: 6px; color: var(--late-text); }
.cond-head .icon { width: 16px; height: 16px; }
.cond-main { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cond-t { font-size: 26px; font-weight: 500; }
.cond-where { color: var(--ink-3); font-size: 12px; text-align: right; }
.cond-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cond-grid > span { display: flex; flex-direction: column; font-size: 11px; color: var(--ink-3); }
.cond-grid b { font-size: 13px; font-weight: 500; color: var(--ink); }

/* dark theme: darken the OpenStreetMap tiles (no keyless dark tile server is left), soften the terrain */
:root[data-theme="dark"] .basemap-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.55); }
:root[data-theme="dark"] .basemap-terrain .leaflet-tile-pane { filter: brightness(0.75) saturate(0.8); }

/* pins and clusters (divIcons from map.js) */
.pin-wrap { background: none; border: 0; }
.pin { display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); transition: transform 0.15s var(--ease); }
.pin-online { background: var(--good); } .pin-late { background: var(--late); }
.pin-offline, .pin-never { background: var(--offline); }
.pin-warn { box-shadow: 0 0 0 3px var(--warn), 0 1px 4px rgba(0, 0, 0, 0.35); }
.pin-sel { border-color: var(--accent); border-width: 4px; }
.pin-wrap:hover .pin { transform: scale(1.15); }
.pin-label.leaflet-tooltip { background: var(--overlay); color: var(--ink); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); font: 600 12px var(--font-sans); padding: 2px 7px; border-radius: 6px; }
.pin-label.leaflet-tooltip::before { display: none; }
.leaflet-tooltip { font-family: var(--font-sans); }
.sp-cluster { border-radius: 50%; border: 3px solid #fff; color: #fff; font: 600 15px var(--font-mono);
  display: grid; place-items: center; box-shadow: 0 0 0 6px color-mix(in srgb, var(--ink) 14%, transparent); }
.sp-cluster.has-warn { box-shadow: 0 0 0 4px var(--warn); }
.leaflet-control-zoom a { background: var(--overlay) !important; color: var(--ink) !important; border-color: var(--border) !important; }
.leaflet-control-attribution { background: var(--overlay) !important; color: var(--ink-3) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }

/* probe card in the side panel */
.detail { background: linear-gradient(var(--accent-soft), transparent 70%); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.readouts { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.readout { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 6px; align-items: baseline;
  padding: 7px 10px; border-top: 1px solid var(--border); }
.readout-head { border-top: 0; background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--ink-3); }
.readout-head span { display: inline-flex; align-items: center; gap: 5px; }
.readout-head span:not(:first-child) { justify-content: flex-end; }
.readout-label { color: var(--ink-2); font-size: 13px; }
.readout-unit { margin-left: 5px; color: var(--ink-3); font-size: 11px; }
.readout-v, .readout-d { text-align: right; font-size: 13px; }
.readout-d { color: var(--ink-3); }
.readout-d.is-out, td.is-out { color: var(--warn-text); font-weight: 600; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex: none; }
.sw-s1 { background: var(--s1); } .sw-s2 { background: var(--s2); }
.sw-line { width: 16px; height: 3px; border-radius: 2px; }
.sw-night { width: 14px; height: 10px; background: var(--night); }
.detail-spark { display: flex; flex-direction: column; gap: 4px; }
.spark { width: 88px; height: 30px; flex: none; }
.spark-both { width: 100%; height: 48px; }
.spark-empty { color: var(--ink-3); font-size: 11px; display: inline-flex; align-items: center; }
.spark .s1 { stroke: var(--s1); } .spark .s2 { stroke: var(--s2); }

/* probe list */
.probe-list { display: flex; flex-direction: column; margin: 0 -10px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) 88px auto; gap: 10px; align-items: center; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.row:hover { background: var(--surface-2); }
.row.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.row-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-id { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.row-sub { color: var(--ink-3); font-size: 12px; }
.row-now { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; font-size: 13px; white-space: nowrap; }

/* ---------- probe page ---------- */
.head-card { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
.head-main { flex: 1 1 280px; display: flex; flex-direction: column; gap: 6px; }
.head-main p { margin: 0; }
.head-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-readouts { flex: 1 1 420px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 8px 12px; border-radius: 10px; margin: 0 0 14px; }
.verdict .icon { width: 16px; height: 16px; }
.verdict.is-ok { background: color-mix(in srgb, var(--good) 13%, transparent); color: var(--good-text); }
.verdict.is-warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn-text); }
.numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.numbers > div { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.big { font-size: 19px; font-weight: 500; }
.dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; font-size: 13px; }
.dl dt { color: var(--ink-3); } .dl dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.mini-map { height: 180px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.mini-map .leaflet-control-attribution { font-size: 9px; }

/* ---------- sign-in page ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at top, var(--accent-soft), transparent 60%), var(--page); }
.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand b { font-size: 20px; letter-spacing: -0.01em; }
.login p { margin: 0; color: var(--ink-2); }
.login label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.login input { min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.login .btn { min-height: 44px; }
.login .msg { color: var(--warn-text); background: color-mix(in srgb, var(--warn) 12%, transparent); padding: 8px 10px; border-radius: 8px; }

/* ---------- guided tour (tour.js) ---------- */
.tour-spot { position: fixed; z-index: 3000; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 9999px rgba(5, 10, 15, 0.55); transition: all 0.25s var(--ease); }
.tour-card { position: fixed; z-index: 3001; width: min(340px, calc(100vw - 32px)); background: var(--surface);
  color: var(--ink); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px 14px;
  transition: top 0.25s var(--ease), left 0.25s var(--ease); }
.tour-card h3 { font-size: 16px; margin: 4px 0 6px; }
.tour-card p { margin: 0; color: var(--ink-2); }
.tour-step { font: 11px var(--font-mono); color: var(--ink-3); letter-spacing: 0.04em; }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-actions .grow { flex: 1; }
.tour-skip { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 6px 4px; font-weight: 600; }
.tour-skip:hover { color: var(--ink); }
.tour-dots { display: flex; justify-content: center; gap: 5px; margin-top: 12px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--border-strong); }
.tour-dots i.on { width: 16px; background: var(--accent); }

/* ---------- phones and narrow windows ---------- */
@media (max-width: 1100px) {
  :root { --inspector-w: 320px; }
}
@media (max-width: 860px) {
  .shell { display: block; height: auto; min-height: 100vh; padding-bottom: 64px; }
  .rail { position: fixed; left: 0; right: 0; bottom: 0; height: 60px; flex-direction: row; justify-content: space-around;
    padding: 0 8px; border-right: 0; border-top: 1px solid var(--border); }
  .rail-logo { display: none; }
  .rail-nav, .rail-bottom { flex-direction: row; margin: 0; }
  .rail-item { width: 64px; padding: 6px 0 4px; }
  .rail-item.is-active::before { left: 18px; right: 18px; top: -1px; bottom: auto; width: auto; height: 3px; }
  .topbar { position: sticky; top: 0; height: 56px; padding: 0 12px; gap: 10px; }
  .app-sub, .updated, .badge { display: none; }
  .finder { width: auto; flex: 1; max-width: 300px; }
  .view { display: flex; flex-direction: column; height: auto; }
  .map-stage { height: 58vh; min-height: 340px; }
  .inspector { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .scroll { overflow: visible; }
  .content { padding: 16px 16px 24px; }
  .float-bl { display: none; }
  .conditions { width: 200px; }
  .cond-grid { display: none; }
}
@media (max-width: 480px) {
  .conditions { display: none; }
  .readout { grid-template-columns: minmax(0, 1.1fr) repeat(3, minmax(0, 1fr)); padding: 7px 8px; }
  .head-readouts { flex-basis: 100%; }
  .seg { flex-wrap: nowrap; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, .tour-spot, .tour-card { transition: none !important; }
}
