/* Geospatial & Location Intelligence System — styles */
:root {
  --bg: #eef0ec;
  --panel: #ffffff;
  --panel-2: #f6f7f4;
  --ink: #15191d;
  --muted: #69717a;
  --line: #dcdfd8;
  --accent: #2362dd;          /* TM One Ultramarine */
  --accent-soft: #e3ecfc;
  --orange: #e8590c;          /* kept for meaning: MET orange-level warnings */
  --accent-ink: #ffffff;
  --ok: #2b8a3e;
  --warn: #c98a12;
  --bad: #d6336c;
  --android: #2b8a3e;
  --apple: #3b5bdb;
  --other: #7b6f63;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 6px 18px rgba(20, 24, 28, .06);
  --radius: 10px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1012;
    --panel: #161a1e;
    --panel-2: #1c2126;
    --ink: #e6eaed;
    --muted: #8b949c;
    --line: #272d33;
    --accent: #5b8def;
    --accent-soft: #172443;
    --orange: #ff8a3d;
    --ok: #51cf66;
    --warn: #fcc419;
    --bad: #ff6b9a;
    --android: #51cf66;
    --apple: #748ffc;
    --other: #a99f94;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: inherit; }
.mono, code { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  height: 52px; display: flex; align-items: center; gap: 18px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: relative; z-index: 1100;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand-mark {
  font: 600 11px/1 var(--mono); letter-spacing: .08em; color: var(--accent-ink);
  background: var(--accent); padding: 6px 7px; border-radius: 6px;
}
.brand-mark.big { font-size: 15px; padding: 9px 11px; display: inline-block; margin-bottom: 12px; }
.brand-logo { display: block; flex: none; width: 30px; height: 30px; border-radius: 7px; }
.brand-logo.big { width: 64px; height: 64px; border-radius: 15px; margin-bottom: 12px; box-shadow: var(--shadow); }
/* name beside the logo, on two lines: "Geospatial & Location" / "Intelligence System" */
.brand-name { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; min-width: 0; }
.brand-name .bn-1 { font-size: 13.5px; font-weight: 700; }
.brand-name .bn-2 { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.auth-brand .brand-logo.big { width: 56px; height: 56px; border-radius: 14px; margin: 0; }
.auth-card h1.brand-name { margin: 0; }
.auth-card h1.brand-name .bn-1 { font-size: 18px; }
.auth-card h1.brand-name .bn-2 { font-size: 15px; margin-top: 2px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs a {
  text-decoration: none; padding: 7px 12px; border-radius: 7px; color: var(--muted);
  font-weight: 500; white-space: nowrap;
}
.tabs a:hover { background: var(--panel-2); color: var(--ink); }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.who .clock { font: 500 12.5px var(--mono); color: var(--muted); }
.who .user { font-weight: 500; }

/* ---------- layout ---------- */
.main { height: calc(100vh - 52px); height: calc(100dvh - 52px); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100%; }
.split.left { grid-template-columns: 380px minmax(0, 1fr); }
.page-plot .split.left { grid-template-columns: 460px minmax(0, 1fr); }
.map { width: 100%; height: 100%; background: var(--panel-2); }
.side {
  background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.split.left .side { border-left: 0; border-right: 1px solid var(--line); }
.side-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.section h2 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center;
}
.page-scroll { height: 100%; overflow-y: auto; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 13px var(--sans); padding: 7px 12px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.wide { width: 100%; padding: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }

input, select, textarea {
  font: 13px var(--sans); color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%;
}
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 12px; color: var(--muted); }
label > input, label > select { margin-top: 4px; }
input[type="color"] { padding: 2px; height: 32px; width: 44px; }

.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink); user-select: none; }
.switch input { appearance: none; width: 30px; height: 17px; border-radius: 9px; background: var(--line); position: relative; padding: 0; border: 0; flex: none; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(13px); }
.switch input:focus { outline-offset: 2px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { font: 500 12px var(--sans); background: var(--panel); color: var(--muted); border: 0; padding: 6px 10px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg-row { gap: 10px 14px; align-items: flex-end; }
.seg-grp { display: flex; flex-direction: column; gap: 4px; }
.seg-cap { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.stat b { display: block; font: 500 20px/1.2 var(--mono); }
.stat span { font-size: 11px; color: var(--muted); }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center;
}
.feed li:hover { background: var(--panel-2); }
.feed li.sel { background: var(--accent-soft); }
.feed li.fresh { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.feed .dot { width: 9px; height: 9px; border-radius: 50%; grid-row: span 2; }
.feed .caller { font: 500 13px var(--mono); }
.feed .time { font: 12px var(--mono); color: var(--muted); text-align: right; }
.feed .meta { font-size: 12px; color: var(--muted); grid-column: 2 / 4; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.tag { display: inline-block; font: 500 10.5px/1 var(--mono); padding: 3px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tag.android { color: var(--android); }
.tag.apple { color: var(--apple); }
.acc-good { color: var(--ok); } .acc-mid { color: var(--warn); } .acc-bad { color: var(--bad); }

/* ---------- map markers ---------- */
/* absolute, like every map marker: 'relative' put markers in the page flow, so pins at the same spot were
   pushed down under each other in a column instead of overlapping */
.pin { position: absolute; }
.pin i {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: var(--c, var(--other)); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.pin b { display: none; }
.pin.latest i { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.pin.latest b {
  display: block; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: var(--c, var(--accent)); animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3.2); opacity: 0; } }
.numpin {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.numpin span { transform: rotate(45deg); font: 600 11px var(--mono); color: #fff; }
.searchpin i { background: var(--accent); width: 16px; height: 16px; margin: -8px 0 0 -8px; }

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; font: 13px/1.45 var(--sans); min-width: 220px; }
/* capped to the map's height in app.js; scrolls inside, finger scrolling vertical only */
.leaflet-popup-content.gli-pop-fit { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding-right: 2px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop h4 { margin: 0 0 6px; font: 600 14px var(--mono); }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 8px; font-size: 12px; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; font-family: var(--mono); word-break: normal; overflow-wrap: anywhere; }
.pop .row { gap: 6px; }
.leaflet-control-layers { background: var(--panel); color: var(--ink); border-radius: 8px !important; }
.leaflet-control-layers-expanded { padding: 8px 12px; font: 13px var(--sans); }
.leaflet-tooltip.plot-label { background: var(--panel); color: var(--ink); border: 1px solid var(--line); font: 12px var(--sans); box-shadow: var(--shadow); }
.leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--panel-2); }
.leaflet-control-scale-line { background: rgba(255,255,255,.75); }

/* ---------- table ---------- */
.toolbar { padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1.3fr 1.3fr 1fr auto; gap: 10px; align-items: end; }
.logs-map { height: clamp(420px, 66vh, 900px); }
.pager-nums { gap: 4px; flex-wrap: wrap; }
.pager-nums .btn.disabled { pointer-events: none; opacity: .4; }
.pager-gap { padding: 0 2px; }
.logs-resize { height: 12px; cursor: ns-resize; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); background: var(--panel); touch-action: none; user-select: none; }
.logs-resize span { width: 44px; height: 4px; border-radius: 2px; background: var(--line); }
.logs-resize:hover span, .logs-resize.drag span { background: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--panel); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2);
  position: sticky; top: 0; white-space: nowrap;
}
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.data td.wrap { white-space: normal; min-width: 160px; }
table.data tbody tr:hover { background: var(--panel-2); }
table.data tbody tr.sel { background: var(--accent-soft); }
table.data .num { font-family: var(--mono); font-size: 12.5px; }
table.data td.actions { text-align: right; }
.raw { background: var(--panel-2); font: 12px/1.5 var(--mono); padding: 10px 12px; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; margin: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 10px; flex-wrap: wrap; }

/* ---------- geospatial / plot ---------- */
.results { list-style: none; margin: 0; padding: 0; }
.results li { padding: 9px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.results li:hover { background: var(--panel-2); }
.results .r-name { font-weight: 500; }
.results .r-addr { font-size: 12px; color: var(--muted); }
.results .r-meta { display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-word; }
.poi-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.poi-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.poi-list li:hover { color: var(--accent); }

.pts { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pts th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px; font-weight: 600; }
.pts td { padding: 3px 4px; vertical-align: middle; }
.pts td input { padding: 5px 6px; font-family: var(--mono); font-size: 12px; }
.pts td.ll { width: 96px; }
.pts td.n { font: 600 11px var(--mono); color: var(--muted); width: 22px; text-align: right; }
.pts td.d { font: 11px var(--mono); color: var(--muted); white-space: nowrap; width: 58px; text-align: right; }
.pts button.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 4px; }
.pts button.x:hover { color: var(--bad); }
.pts tr.sel td { background: var(--accent-soft); }
.set-list { list-style: none; margin: 0; padding: 0; }
.set-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.set-list li .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.set-list li .nm { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-list li .nm:hover { color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.errlist { font: 12px var(--mono); color: var(--bad); margin: 6px 0 0; }
.map-wrap { position: relative; height: 100%; }
.map-badge {
  position: absolute; left: 12px; bottom: 26px; z-index: 900; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font: 12px var(--mono); box-shadow: var(--shadow); pointer-events: none;
}
.map-wrap.adding .map { cursor: crosshair; }

/* ---------- toast & auth ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--panel); padding: 9px 14px; border-radius: 8px; font-size: 13px;
  transition: all .2s; z-index: 3000; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.alert { background: var(--accent); color: var(--accent-ink); }
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; max-width: 360px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 4px; font-size: 19px; }
.auth-card p { margin: 0 0 18px; }
.auth-card label { margin-bottom: 12px; }
.notice { padding: 9px 11px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; }
.notice.err { background: #fde2e7; color: #a61e4d; }
.notice.ok { background: #d3f9d8; color: #2b8a3e; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .brand .brand-name { display: none; }
  .who .clock, .who .user { display: none; }
  .split, .split.left { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
  .split.left .side { order: 2; border-right: 0; }
  .side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .side-scroll { overflow: visible; }
  .main { height: auto; min-height: calc(100vh - 52px); }
  .page-scroll { height: auto; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .q { grid-column: 1 / -1; }
}
.tabs .t-short { display: none; }
.signout svg { display: none; }
.who .who-set { display: none; padding: 6px 7px; }
.who .who-set.on { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 480px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .tabs a { padding: 7px 8px; }
  .tabs .t-full { display: none; }
  .tabs .t-short { display: inline; }
  /* Settings moves next to Sign out as a gear, so the five main tabs still fit a phone */
  .tabs a[href="settings"] { display: none; }
  .who .who-set { display: inline-flex; }
  .who .signout { display: none; }   /* Sign out is on the Settings page on phones */
  .signout .so-txt { display: none; }
  .signout svg { display: block; }
  .signout { padding: 7px 8px; }
  .filters { grid-template-columns: 1fr; }
}

/* ---------- 3D / street-level modal ---------- */
.modal-open { overflow: hidden; }
.modal-back {
  position: fixed; inset: 0; z-index: 2500; background: rgba(10, 12, 14, .55);
  display: grid; place-items: stretch; padding: 24px;
}
.modal {
  background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  overflow: hidden; min-height: 0; border: 1px solid var(--line);
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; min-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-tools { gap: 8px; }
.modal-body { position: relative; flex: 1; min-height: 0; background: #0d1012; }
.modal-stage { position: absolute; inset: 0; }
.modal-msg {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  background: var(--panel-2); color: var(--ink); font-size: 14px; line-height: 1.6; z-index: 5;
}
.modal-msg a { color: var(--accent); }
.street-strip {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 6; display: flex; gap: 6px; flex-wrap: wrap;
  pointer-events: none;
}
.street-strip .btn { pointer-events: auto; box-shadow: var(--shadow); }
.mapboxgl-popup-content { background: var(--panel); color: var(--ink); border-radius: 8px; box-shadow: var(--shadow); padding: 10px 12px; }
.mapboxgl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
@media (max-width: 700px) {
  .modal-back { padding: 0; }
  .modal { border-radius: 0; }
  .modal-head h3 { flex-basis: 100%; }
}

/* ---------- route planner / navigation ---------- */
.route-grid { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; background: var(--panel); }
.route-map-wrap { position: relative; min-height: 0; }
.route-map { position: absolute; inset: 0; }
.route-side { order: 2; border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; background: var(--panel); }
.route-side .section:last-child { border-bottom: 0; }
.picking .route-map { cursor: crosshair; }
.route-end { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.end-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--mono); color: #fff; margin-top: 1px; }
.end-dot.a { background: #2b8a3e; } .end-dot.b { background: var(--accent); } .end-dot.via { background: #868e96; }
.end-lbl { font-weight: 500; line-height: 1.35; word-break: break-word; }
.end-btns { margin-top: 6px; gap: 6px; }
.results.small li { padding: 7px 4px; font-size: 12.5px; border-bottom: 1px dashed var(--line); }
.route-cards { display: grid; gap: 6px; }
.route-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; text-align: left;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 9px 11px; cursor: pointer; font: inherit;
}
.route-card.on { border-color: var(--accent); background: var(--accent-soft); }
.rc-time { font: 600 18px var(--mono); }
.rc-meta { font-size: 12.5px; color: var(--muted); }
.rc-typ { grid-column: 1 / -1; font-size: 11.5px; color: var(--warn); }
.steps { margin: 0; padding: 0 0 0 20px; font-size: 13px; }
.steps li { padding: 6px 2px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.steps li span:first-child { display: block; }
.steps li .mono { font-size: 11.5px; }
.steps li.cur { background: var(--accent-soft); }
.resp-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.resp-list li { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.resp-list li:hover { background: var(--panel-2); }
.resp-list li.on { background: var(--accent-soft); }
.resp-list li .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.resp-list li .mono { text-align: right; font-size: 12px; white-space: nowrap; }
.me-dot i {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: #1c7ed6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(28, 126, 214, .25), 0 1px 4px rgba(0,0,0,.4);
}
.nav-banner {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 900; background: #1f6f3a; color: #fff;
  border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center;
}
.nb-dist { font: 600 22px var(--mono); white-space: nowrap; }
.nb-text { font-size: 15px; font-weight: 500; line-height: 1.3; }
.nav-foot {
  position: absolute; left: 12px; right: 12px; bottom: 22px; z-index: 900; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.nf-main { font: 14px var(--mono); }
.nf-main b { font-size: 17px; }
@media (max-width: 800px) {
  .route-grid { grid-template-columns: 1fr; grid-template-rows: 48% 52%; }
  .route-side { border-left: 0; border-top: 1px solid var(--line); }
  .navigating .route-grid { grid-template-rows: 1fr 0; }
  .navigating .route-side { display: none; }
}
.nf-gps { font-size: 11.5px; color: var(--warn); }
.route-end[hidden] { display: none; }
.btn[hidden] { display: none; }
.modal-tools:empty { display: none; }
@media (max-width: 700px) {
  .modal-head h3 { flex: 1 1 0; flex-basis: 0; min-width: 0; }
  .modal-head .modal-x { order: 2; }
  .modal-head .modal-tools:not(:empty) { order: 3; flex-basis: 100%; }
}
/* while navigating, the instruction banner takes the top of the map: hide the map buttons it would cover */
.navigating .route-map .leaflet-control-zoom,
.navigating .route-map .leaflet-control-layers,
.navigating .route-map .gli-layers { display: none; }
.nb-text { word-break: break-word; }
/* 3D navigation overlay */
.route-map { z-index: 0; }
.nav3d { position: absolute; inset: 0; z-index: 1; background: #0d1012; }
.nav3d-box { width: 100%; height: 100%; }
.nav-arrow { width: 40px; height: 40px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.nav3d .mapboxgl-ctrl-bottom-left, .nav3d .mapboxgl-ctrl-bottom-right { bottom: 78px; }

/* ---------- search-as-you-type ---------- */
.ac-wrap { position: relative; min-width: 0; }
.ac-wrap > input { width: 100%; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1500; list-style: none; margin: 0; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow);
  max-height: 340px; overflow-y: auto; min-width: 240px;
}
.ac-list li { padding: 7px 9px; border-radius: 6px; cursor: pointer; display: grid; gap: 1px; }
.ac-list li.on, .ac-list li[data-i]:hover { background: var(--accent-soft); }
.ac-name { font-weight: 500; font-size: 13px; }
.ac-addr { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-meta { display: flex; gap: 4px; margin-top: 2px; }
.ac-meta:empty { display: none; }
.ac-err { font-size: 12px; color: var(--bad); cursor: default; }

/* ---------- TomTom incidents ---------- */
.tt-inc-btn { font: 600 15px/30px var(--sans) !important; text-align: center; color: #e8590c !important; }
.tt-inc {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--sans); color: #fff;
  background: #868e96; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
.tt-inc.sev1 { background: #f59f00; } .tt-inc.sev2 { background: #e8590c; } .tt-inc.sev3 { background: #c92a2a; } .tt-inc.sev4 { background: #212529; }
.cmp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }

/* ---------- map-style picker ---------- */
.gli-layers { position: relative; font: 13px var(--sans); }
.gli-layers-btn { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px 0 9px; max-width: 280px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  font: 500 13px var(--sans); cursor: pointer; }
.gli-layers-btn:hover { background: var(--panel-2); }
.gli-layers-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.gli-layers-btn svg { flex: none; }
.gli-layers-cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gli-layers-panel { position: absolute; top: 40px; right: 0; width: 300px; max-width: calc(100vw - 72px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px 12px; }
.gli-layers-panel[hidden] { display: none; }
.gli-layers-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.gli-layers-x { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }
.gli-layers-x:hover { color: var(--ink); }
.gli-layers-tabs { display: flex; width: 100%; margin-bottom: 10px; }
.gli-layers-tabs button { flex: 1; padding: 7px 6px; font-size: 13px; }
.gli-layers-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gli-tile { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; background: none; border: 0; color: var(--ink); cursor: pointer; font: 12px/1.25 var(--sans); text-align: center; }
.gli-thumb { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; border: 2px solid var(--line);
  background: repeating-linear-gradient(45deg, var(--panel-2) 0 6px, var(--bg) 6px 12px); transition: border-color .12s, transform .12s; }
.gli-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gli-tile:hover .gli-thumb { border-color: var(--muted); }
.gli-tile.on .gli-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gli-tile.on .gli-tile-name { color: var(--accent); font-weight: 600; }
.gli-tile:focus-visible { outline: none; }
.gli-tile:focus-visible .gli-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.gli-layers-ov { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 9px; }
.gli-layers-ov .gli-layers-sub:not(:first-child) { margin-top: 4px; }
.gli-layers-panel > .gli-layers-sub { margin-bottom: 7px; }
.gli-ov-ic { width: 20px; text-align: center; font-size: 14px; flex: none; }
.gli-layers-btn b { font-weight: 600; }
.gli-layers-cur { color: var(--muted); font-weight: 400; }
.gli-layers-btn[aria-expanded="true"] .gli-layers-cur { color: inherit; }
.gli-layers-n { flex: none; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  font: 600 11px/19px var(--mono); text-align: center; }
.gli-layers-n[hidden] { display: none; }
.gli-layers-sub { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 600px) {
  .gli-layers-prov { display: none; }
  .gli-layers-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .gli-tile { font-size: 11px; }
  .gli-thumb { aspect-ratio: 1; }
}
.leaflet-top:has(.gli-layers-panel:not([hidden])) { z-index: 1001; }

/* ---------- MET weather warnings (Live AML + Explore) ---------- */
.wx-lang button { padding: 4px 8px; font-size: 11px; }
#wx-count.wx-count { display: inline-block; margin-left: 4px; padding: 2px 6px; border-radius: 9px; background: var(--warn); color: #15191d; font: 600 10.5px/1.2 var(--mono); letter-spacing: 0; }
.page-live .wx-section .wx-list { max-height: 210px; overflow-y: auto; }
.wx-list { display: flex; flex-direction: column; gap: 6px; }
.wx-item { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 7px; background: var(--panel-2); }
.wx-item.lv2 { border-left-color: var(--orange); }
.wx-item.lv3 { border-left-color: var(--bad); }
.wx-item summary { list-style: none; cursor: pointer; padding: 7px 9px; display: flex; flex-direction: column; gap: 4px; }
.wx-item summary::-webkit-details-marker { display: none; }
.wx-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wx-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.wx-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font: 11.5px var(--mono); color: var(--muted); }
.wx-item .tag.wx-hit { color: var(--bad); border-color: currentColor; }
.wx-body { padding: 0 9px 9px; font-size: 12.5px; }
.wx-body p { margin: 6px 0 0; white-space: pre-line; }
.wx-body .wx-sub { font-weight: 500; }
.wx-body .wx-ins { font-weight: 500; color: var(--ink); }
.wx-body .muted { font-size: 11.5px; }
.wx-none { margin: 0; font-size: 13px; color: var(--muted); }
.wx-none.ok::before { content: "✓ "; color: var(--ok); }
.wx-src { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.wx-err { color: var(--bad); }
.wx-area:empty { display: none; }
.wx-area { margin-top: 10px; }
.wx-area-head { font-size: 12.5px; padding: 7px 9px; border-radius: 7px; background: var(--panel-2); color: var(--muted); margin-bottom: 6px; }
.wx-area-head.ok { color: var(--ok); }
.wx-area-head.alert { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange); font-weight: 500; }
.wx-area-head b { color: inherit; }
.nf-src { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.nf-src b { color: var(--ink); font-weight: 600; }

/* ---------- Plot Points: on phones / small tablets the panel is a left drawer over a full-screen map ---------- */
.drawer-head, .drawer-btn, .drawer-back { display: none; }
@media (max-width: 900px) {
  .page-plot .main { height: calc(100vh - 52px); height: calc(100dvh - 52px); }
  .page-plot .split.left { grid-template-columns: 1fr; grid-template-rows: 1fr; height: 100%; }
  .page-plot .split.left .side {
    position: fixed; top: 52px; left: 0; bottom: 0; width: min(88vw, 420px); z-index: 1200;
    border: 0; border-right: 1px solid var(--line); box-shadow: 8px 0 28px rgba(0,0,0,.22);
    transform: translateX(-104%); transition: transform .22s ease; overflow: hidden; visibility: hidden;
  }
  .page-plot.drawer-open .split.left .side { transform: none; visibility: visible; }
  .page-plot .side-scroll { overflow-y: auto; overscroll-behavior: contain; }
  .page-plot .drawer-head {
    display: flex; align-items: center; justify-content: space-between; flex: none;
    padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); font-size: 15px;
  }
  .drawer-x { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; width: 40px; height: 36px; cursor: pointer; border-radius: 8px; }
  .drawer-x:hover { background: var(--panel-2); color: var(--ink); }
  .page-plot .drawer-back { display: block; position: fixed; inset: 52px 0 0 0; z-index: 1150; background: rgba(10,14,20,.38);
    opacity: 0; pointer-events: none; transition: opacity .22s; }
  .page-plot.drawer-open .drawer-back { opacity: 1; pointer-events: auto; }
  .page-plot .drawer-btn {
    display: flex; align-items: center; gap: 7px; position: absolute; top: 10px; left: 56px; z-index: 1000; height: 36px; padding: 0 12px 0 10px;
    background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 9px; box-shadow: var(--shadow);
    font: 600 13.5px var(--sans); cursor: pointer;
  }
  .drawer-n { background: rgba(255,255,255,.22); border-radius: 9px; padding: 1px 7px; font: 600 11.5px var(--mono); }
  .page-plot .map-badge { display: none; }
  .pts td.n { cursor: pointer; color: var(--accent); text-decoration: underline dotted; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .page-plot .split.left .side, .page-plot .drawer-back { transition: none; }
}

/* ---------- hazard layers: wind canvas + info box ---------- */
.wind-canvas { position: absolute; left: 0; top: 0; z-index: 450; pointer-events: none; }
.hz-info { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow);
  padding: 8px 10px; font: 12px/1.35 var(--sans); max-width: 270px; margin-bottom: 4px !important; }
.hz-info[hidden] { display: none; }
.hz-info hr { border: 0; border-top: 1px solid var(--line); margin: 7px 0; }
.hz-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hz-days { width: auto; padding: 2px 4px; font-size: 11.5px; }
.hz-key { display: flex; flex-wrap: wrap; gap: 3px 8px; margin-top: 5px; font: 11px var(--mono); align-items: center; }
.hz-key i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.15); }
.hz-src { margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.hz-err { color: var(--bad); }
.pop-note { margin: 0 0 8px; font-size: 11.5px; color: var(--muted); }
.sel-fire-show { font-family: var(--sans); color: var(--accent); white-space: nowrap; }
@media (max-width: 600px) { .hz-info { max-width: 220px; font-size: 11.5px; } .hz-src { display: none; } }

/* ---------- KKM POZ hospitals ---------- */
.poz-pin span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #fff; box-sizing: border-box;
  border: 2.5px solid var(--c); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.poz-pin svg { width: 16px; height: 16px; display: block; }
.poz-h { display: inline-block; vertical-align: -5px; margin-right: 6px; }
.poz-h span { width: 20px; height: 20px; }
.poz-h svg { width: 13px; height: 13px; }

/* ---------- NG999 agency stations (JBPM, APM, APMM, PDRM) ---------- */
.ag-pin-i { display: inline-grid; place-items: center; border-radius: 50%; background: var(--c); box-sizing: border-box;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); flex: none; }
.ag-pin-i svg { width: 80%; height: 80%; display: block; }
.ag-h { display: inline-block; vertical-align: -4px; margin-right: 6px; }
.ag-row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.ag-row .muted { margin-left: auto; padding-left: 8px; }
.ag-near { margin: 0; padding: 0; list-style: none; font-family: var(--sans); }
.ag-near li { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 5px; }
.ag-near li .ag-pin-i { margin-top: 1px; }
.ag-near a { color: var(--accent); margin-left: 4px; }
.poz-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }
.poz-legend { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow);
  padding: 8px 10px; font: 12px/1.35 var(--sans); margin-bottom: 4px !important; }
.poz-groups { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; }
.poz-groups label { display: flex; align-items: center; gap: 3px; cursor: pointer; font-size: 11.5px; }
.poz-groups input { width: auto; margin: 0 2px 0 0; }
.poz-near { margin: 0; padding-left: 18px; font-family: var(--sans); }
.poz-near li { margin-bottom: 4px; }
.poz-near a { color: var(--accent); margin-left: 4px; }
@media (max-width: 600px) { .poz-legend .hz-src { display: none; } }
.cmp-row + .cmp-row { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ---------- TM SmartMap address (Explore, AML popups) ---------- */
.sm-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 3px; font: 11.5px var(--mono); color: var(--muted); }
.sm-area { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.kv dd.sm-dd { font-family: var(--sans); }
.pop dd[data-sm], .pop dd[data-near-poz], .pop dd[data-near-fire] { word-break: normal; overflow-wrap: anywhere; }

/* ======================================================================
   Map-first layout (option C) — html.ui-c, screens wider than 900 px.
   Full-screen map; navigation is a floating icon rail on the left; the
   page's panel floats over the map as a rounded card. Phones keep the
   classic stacked layout. Switch with the Layout button (remembered).
   ====================================================================== */
.tabs .t-ico { display: none; }
.ui-toggle svg { flex: none; }
@media (max-width: 900px) { .ui-toggle { display: none; } }

@media (min-width: 901px) {
  html.ui-c {
    --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --rail: 64px;          /* rail width */
    --gap: 16px;           /* space between floating things and the screen edge */
    --float-shadow: 0 10px 32px rgba(15, 27, 45, .16), 0 2px 6px rgba(15, 27, 45, .06);
    --float-radius: 20px;
  }
  @media (prefers-color-scheme: dark) {
    html.ui-c:not([data-theme="light"]) { --float-shadow: 0 10px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35); }
  }

  /* ---- rail ---- */
  .ui-c .topbar {
    position: fixed; top: var(--gap); left: var(--gap); width: var(--rail); height: auto;
    max-height: calc(100vh - 2 * var(--gap));
    flex-direction: column; align-items: center; gap: 6px; padding: 10px 0;
    border: 0; border-radius: var(--float-radius); box-shadow: var(--float-shadow); z-index: 1100;
  }
  .ui-c .brand { padding: 0; margin-bottom: 6px; }
  .ui-c .brand-name { display: none; }
  .ui-c .brand-logo { width: 42px; height: 42px; border-radius: 12px; }
  .ui-c .tabs { flex: none; flex-direction: column; gap: 6px; overflow: visible; }
  .ui-c .tabs a {
    position: relative; width: 44px; height: 44px; padding: 0; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
  }
  .ui-c .tabs .t-ico { display: block; }
  .ui-c .tabs .t-full, .ui-c .tabs .t-short { display: none; }
  /* name pops out to the right on hover / keyboard focus */
  .ui-c .tabs a::after {
    content: attr(title); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%);
    background: var(--ink); color: var(--panel); font: 600 12.5px var(--sans); white-space: nowrap;
    padding: 6px 10px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
  }
  .ui-c .tabs a:hover::after, .ui-c .tabs a:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
  .ui-c .who {
    flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); width: 44px;
  }
  .ui-c .who .clock, .ui-c .who .user, .ui-c .who .so-txt, .ui-c .ui-toggle-txt { display: none; }
  .ui-c .who .signout svg { display: block; }
  .ui-c .who .btn { width: 44px; height: 40px; padding: 0; border-radius: 12px; color: var(--muted); }
  .ui-c .who .btn:hover { color: var(--ink); }

  /* ---- full-screen map with floating panel ---- */
  .ui-c .main { height: 100vh; height: 100dvh; }
  .ui-c .split, .ui-c .split.left, .ui-c .page-plot .split.left { display: block; position: relative; height: 100%; }
  .ui-c .map-wrap { position: absolute; inset: 0; }
  .ui-c .side {
    position: absolute; z-index: 1000; top: var(--gap); width: 380px;
    max-height: calc(100% - 2 * var(--gap));
    border: 0; border-radius: var(--float-radius); box-shadow: var(--float-shadow);
  }
  .ui-c .split:not(.left) .side { right: var(--gap); }
  .ui-c .split.left .side { left: calc(2 * var(--gap) + var(--rail)); border-right: 0; }
  .ui-c .page-plot .split.left .side { width: 460px; }
  .ui-c .side .section:last-child { border-bottom: 0; }
  .ui-c .section h2 { font-weight: 700; }

  /* map controls and badge move clear of the rail and the panel (16 px everywhere) */
  .ui-c .split .leaflet-top .leaflet-control { margin-top: var(--gap); }
  .ui-c .split .leaflet-left .leaflet-control { margin-left: var(--gap); }
  .ui-c .split .leaflet-right .leaflet-control { margin-right: var(--gap); }
  .ui-c .split .leaflet-left { left: calc(var(--gap) + var(--rail)); }
  .ui-c .split.left .leaflet-left { left: calc(2 * var(--gap) + var(--rail) + 380px); }
  .ui-c .page-plot .split.left .leaflet-left { left: calc(2 * var(--gap) + var(--rail) + 460px); }
  .ui-c .split:not(.left) .leaflet-right { right: calc(var(--gap) + 380px); }
  .ui-c .map-badge { left: calc(2 * var(--gap) + var(--rail)); bottom: 30px; border: 0; border-radius: 10px; }
  .ui-c .split.left .map-badge { left: calc(3 * var(--gap) + var(--rail) + 380px); }
  .ui-c .page-plot .split.left .map-badge { left: calc(3 * var(--gap) + var(--rail) + 460px); }

  /* ---- softer controls ---- */
  .ui-c .btn { border-radius: 10px; }
  .ui-c input, .ui-c select, .ui-c textarea { border-radius: 10px; }
  .ui-c .seg { border-radius: 10px; }
  .ui-c .leaflet-bar, .ui-c .leaflet-bar a:first-child, .ui-c .leaflet-bar a:last-child { border-radius: 12px; }
  .ui-c .leaflet-bar { border: 0 !important; box-shadow: var(--float-shadow); overflow: hidden; }
  .ui-c .leaflet-popup-content-wrapper { border-radius: 16px; box-shadow: var(--float-shadow); }

  /* ---- table pages (History Logs, Requests): content beside the rail ---- */
  .ui-c .page-scroll { padding-left: calc(2 * var(--gap) + var(--rail)); }
}

/* ---------- Layout menu ---------- */
.page-head { display: none; }
.ui-menu {
  position: fixed; z-index: 3000; width: 300px; padding: 6px; border-radius: 14px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(15, 27, 45, .22), 0 2px 6px rgba(15, 27, 45, .08);
}
.ui-menu-h { padding: 8px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ui-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: 13px var(--sans); min-height: 44px;
}
.ui-menu button:hover { background: var(--panel-2); }
.ui-menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ui-menu button[aria-checked="true"] { background: var(--accent-soft); }
.ui-menu-t { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.ui-menu-t b { font-weight: 600; }
.ui-menu-t span { font-size: 12px; color: var(--muted); }
.ui-menu-on { color: var(--accent); font-weight: 700; }
/* little layout pictures: s = navigation, i = map, b = panel */
.ui-thumb { position: relative; flex: none; width: 56px; height: 40px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.ui-thumb > * { position: absolute; display: block; }
.ui-thumb-classic { background: #e3ebf3; }
.ui-thumb-classic s { left: 0; right: 0; top: 0; height: 7px; background: #ffffff; border-bottom: 1px solid #d5dde8; }
.ui-thumb-classic b { right: 0; top: 7px; bottom: 0; width: 17px; background: #ffffff; border-left: 1px solid #d5dde8; }
.ui-thumb-mapfirst { background: #d7e4f0; }
.ui-thumb-mapfirst s { left: 3px; top: 3px; width: 7px; height: 22px; border-radius: 3px; background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ui-thumb-mapfirst b { right: 3px; top: 3px; bottom: 3px; width: 16px; border-radius: 3px; background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ui-thumb-command { background: #0a101d; border-color: #24324f; }
.ui-thumb-command s { left: 0; right: 0; top: 0; height: 7px; background: #16213a; }
.ui-thumb-command i { left: 3px; top: 10px; right: 22px; bottom: 3px; border-radius: 3px; background: #1a2a52; }
.ui-thumb-command b { right: 3px; top: 10px; bottom: 3px; width: 16px; border-radius: 3px; background: #16213a; }
.ui-thumb-corporate { background: #f3f5f9; }
.ui-thumb-corporate s { left: 0; top: 0; bottom: 0; width: 13px; background: #ffffff; border-right: 1px solid #d5dde8; }
.ui-thumb-corporate i { left: 16px; top: 10px; right: 20px; bottom: 3px; border-radius: 3px; background: #d7e4f0; }
.ui-thumb-corporate b { right: 3px; top: 10px; bottom: 3px; width: 14px; border-radius: 3px; background: #ffffff; border: 1px solid #d5dde8; }

/* ======================================================================
   Command Centre (option A) — html.ui-a: dark operations colours on every
   screen size; on wide screens the map and panel become rounded cards.
   ====================================================================== */
:root.ui-a {
  --bg: #0a101d; --panel: #111a2e; --panel-2: #16213a; --ink: #e6ecf5; --muted: #8e9bb5; --line: #1f2c47;
  --accent: #4c84ff; --accent-soft: #1a2a52; --accent-ink: #ffffff; --orange: #ff8a3d;
  --ok: #3dd68c; --warn: #ffc46b; --bad: #ff6b8a; --android: #3dd68c; --apple: #6e9bff; --other: #a99f94;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
.ui-a .topbar { background: #0d1526; border-bottom-color: #1b2740; }
.ui-a .tabs a.active { background: #18264a; color: #ffffff; box-shadow: inset 0 -2px 0 var(--accent); }
.ui-a .stat { border: 1px solid var(--line); }
.ui-a .leaflet-control-scale-line { background: rgba(17, 26, 46, .8); color: var(--ink); border-color: var(--muted); }
@media (min-width: 901px) {
  .ui-a .topbar { height: 60px; padding: 0 20px; }
  .ui-a .main { height: calc(100vh - 60px); height: calc(100dvh - 60px); padding: 16px; }
  .ui-a .split { gap: 16px; }
  .ui-a .map-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
  .ui-a .side, .ui-a .split.left .side { border: 1px solid var(--line); border-radius: 14px; }
  .ui-a .page-scroll { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
}

/* ======================================================================
   Corporate (option B) — html.ui-b: light colours and Inter on every
   screen size; on wide screens a left sidebar replaces the top tabs, the
   page gets a title, and the map and panel sit in cards.
   ====================================================================== */
:root.ui-b {
  --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f6f8fb; --ink: #172033; --muted: #5b6678; --line: #e3e8f0;
  --accent: #2362dd; --accent-soft: #eaf0fd; --accent-ink: #ffffff; --orange: #e8590c;
  --ok: #1e7a4c; --warn: #b7791f; --bad: #c2255c; --android: #1e7a4c; --apple: #2362dd; --other: #7b6f63;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 6px 18px rgba(20, 30, 50, .06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (min-width: 901px) {
  .ui-b .topbar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 232px; height: auto;
    flex-direction: column; align-items: stretch; gap: 22px; padding: 20px 14px;
    border-bottom: 0; border-right: 1px solid var(--line);
  }
  .ui-b .brand { padding: 0 6px; align-items: center; }
  .ui-b .brand-logo { width: 36px; height: 36px; border-radius: 10px; }
  .ui-b .brand-name { white-space: normal; line-height: 1.25; }
  .ui-b .tabs { flex: none; flex-direction: column; gap: 2px; overflow: visible; }
  .ui-b .tabs::before { content: "Menu"; padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .ui-b .tabs a { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 10px; border-radius: 8px; color: #384357; }
  .ui-b .tabs a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .ui-b .tabs .t-ico { display: block; flex: none; }
  .ui-b .tabs .t-short { display: none; }
  .ui-b .who {
    margin-top: auto; flex-direction: column; align-items: stretch; gap: 6px; white-space: normal;
    padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
  }
  .ui-b .who .clock { font-size: 12px; }
  .ui-b .who .btn { justify-content: flex-start; width: 100%; height: 36px; }
  .ui-b .who .signout svg { display: block; }
  .ui-b .main {
    margin-left: 232px; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
    gap: 14px; padding: 18px 24px 24px;
  }
  .ui-b .page-head { display: flex; flex-direction: column; gap: 2px; flex: none; }
  .ui-b .page-head .crumb { font-size: 13px; color: var(--muted); }
  .ui-b .page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
  .ui-b .split { flex: 1; min-height: 0; height: auto; gap: 16px; grid-template-rows: minmax(0, 1fr); }
  .ui-b .map-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
  .ui-b .side, .ui-b .split.left .side { border: 1px solid var(--line); border-radius: 14px; }
  .ui-b .page-scroll { flex: 1; min-height: 0; height: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
}

/* ---------- measuring tools (ruler, radius circles) ---------- */
.ms-ctl a { display: flex !important; align-items: center; justify-content: center; color: var(--ink); }
.ms-ctl a.on { background: var(--accent) !important; color: var(--accent-ink) !important; }
.leaflet-container.ms-on, .leaflet-container.ms-on .leaflet-interactive { cursor: crosshair; }
.ms-panel {
  position: absolute; z-index: 1001; top: 12px; left: 50%; transform: translateX(-50%);
  width: min(340px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto;
  background: var(--panel); color: var(--ink); border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 10px 32px rgba(15, 27, 45, .2), 0 2px 6px rgba(15, 27, 45, .08); font: 13px/1.4 var(--sans);
}
.ms-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ms-head b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ms-x { width: 36px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; border-radius: 8px; cursor: pointer; }
.ms-x:hover { background: var(--panel-2); color: var(--ink); }
.ms-total { font: 600 26px/1.2 var(--mono); }
.ms-hint { margin: 6px 0 10px; font-size: 12px; color: var(--muted); }
.ms-r { font-size: 12px; color: var(--muted); }
.ms-r .row { margin-top: 4px; gap: 6px; }
.ms-r input { width: 110px; font: 600 15px var(--mono); }
.ms-r .row span { color: var(--ink); font-weight: 600; }
.ms-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ms-presets .btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.ms-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ms-list > li { border-bottom: 1px solid var(--line); padding: 6px 0; }
.ms-row { display: flex; align-items: center; gap: 8px; }
.ms-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ms-name { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 6px 0; color: var(--ink); font: 600 13px var(--sans); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-list > li.sel .ms-name { color: var(--accent); }
.ms-count { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.ms-del { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 18px; border-radius: 8px; cursor: pointer; }
.ms-del:hover { background: var(--panel-2); color: var(--bad); }
.ms-in { margin: 4px 0 2px; padding-left: 36px; font-size: 12.5px; }
.ms-in li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.ms-in li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-center span { display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--c); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: move; }
.ms-tag { pointer-events: none; }
.ms-tag span {
  position: absolute; transform: translate(-50%, -100%); margin-top: -4px; white-space: nowrap;
  background: var(--c); color: #fff; font: 600 12px var(--sans); padding: 3px 8px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.ms-vertex i { display: block; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid #212529; box-sizing: border-box; }
.ms-vertex span {
  position: absolute; left: 14px; top: -6px; white-space: nowrap; background: #212529; color: #fff;
  font: 600 11.5px var(--mono); padding: 2px 6px; border-radius: 6px;
}

/* ---------- AMAP cell lookup (Explore) ---------- */
.cl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.cl-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.cl-grid input, .cl-grid select { width: 100%; }
.cl-btns { display: flex; gap: 6px; align-items: flex-end; }
.cl-out { margin-top: 8px; font-size: 12.5px; }
.cl-prev { grid-column: 1 / -1; font-size: 11.5px; line-height: 1.5; }
.cl-prev:empty { display: none; }
.cl-str { margin-bottom: 6px; }
.cl-str-out { margin: 0 0 10px; padding: 6px 8px; background: var(--panel-2); border-radius: 7px; }
.cl-out:empty { display: none; }
.cl-pin span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid #7048e8;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); font-size: 14px; }

/* ---------- AMAP base map (its own JS map under the Leaflet panes) ---------- */
.gli-amap-base { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.gli-amap-err { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 360px; z-index: 1; line-height: 1.45; padding: 10px 12px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; font: 12.5px/1.4 var(--sans); text-align: center; }
.gli-thumb { position: relative; }
.gli-swatch { position: absolute; left: 6px; bottom: 5px; font: 700 10px/1 var(--sans); letter-spacing: .04em; color: rgba(255,255,255,.85);
  mix-blend-mode: difference; }

/* AMAP 3D navigation: our own arrow over the AMAP map (positioned from AMAP's screen coordinates) */
.nav3d-box .am-arrow { position: absolute; left: 0; top: 0; z-index: 200; pointer-events: none; will-change: transform; }

/* ---------- My location (button + blue dot) ---------- */
.loc-ctl a.busy { color: var(--accent) !important; animation: loc-pulse 1s ease-in-out infinite; }
@keyframes loc-pulse { 50% { opacity: .35; } }
.my-loc span { display: block; width: 20px; height: 20px; border-radius: 50%; background: #1c7ed6; border: 3px solid #fff; box-sizing: border-box;
  box-shadow: 0 0 0 2px rgba(28,126,214,.35), 0 1px 4px rgba(0,0,0,.4); }

/* ---------- Analytics (bulk AML EDR + ANI/ALI logs) ---------- */
.an { padding-bottom: 24px; }
.an-bar { flex-wrap: wrap; gap: 8px 12px; align-items: center; position: sticky; top: 0; z-index: 5; }
.an-bar label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.an-bar input, .an-bar select { width: auto; }
.an-range { font-size: 12px; margin-left: auto; }
.an-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 14px 16px 0; }
.an-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.an-tile span { display: block; font-size: 11.5px; color: var(--muted); }
.an-tile b { display: block; font: 600 22px/1.25 var(--sans); margin: 2px 0; }
.an-tile small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px 16px 0; }
.an-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.an-card.an-wide { grid-column: 1 / -1; }
section.an-card.an-wide:not(.an-grid *) { margin: 12px 16px 0; }
.an-card h3 { margin: 0 0 8px; font-size: 13.5px; } .an-card h3 .muted { font-weight: 400; font-size: 12px; }
.an-card h4 { margin: 0 0 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.an-tr { margin-bottom: 6px; }
.an-chart { height: 170px; } .an-chart.sm { height: 120px; }
.an-bars { display: flex; align-items: stretch; gap: 2px; height: calc(100% - 4px); }
.an-bars.dense { height: calc(100% - 18px); gap: 1px; }
.an-b { flex: 1; display: flex; flex-direction: column; min-width: 0; cursor: default; }
.an-bv { height: 16px; font: 600 11px/16px var(--sans); text-align: center; color: var(--ink); white-space: nowrap; }
.an-bb { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.an-bb i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.an-b:hover .an-bb i { filter: brightness(1.15); }
.an-bl { height: 18px; font-size: 10.5px; line-height: 18px; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.an-note { margin: 8px 0 0; font-size: 12px; line-height: 1.45; }
.an-empty { color: var(--muted); font-size: 12.5px; margin: 30px 0; text-align: center; }
.an-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.an-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.a, .an-rbar i.a { background: var(--accent); } .sw.b, .an-rbar i.b { background: #adb5bd; }
.an-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 8px; align-items: center; margin: 5px 0; font-size: 12px; }
.an-rk { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-rbar { height: 12px; } .an-rbar > span { display: flex; gap: 2px; height: 100%; }
.an-rbar i { display: block; height: 100%; border-radius: 3px; min-width: 0; }
.an-rv { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; text-align: right; }
table.data.an-t { font-size: 12px; } table.data.an-t td, table.data.an-t th { padding: 5px 8px; } table.data.an-t .r { text-align: right; }
.an-days { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.an-maprow { flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.an-search { margin-left: auto; gap: 6px; } .an-search input { width: 210px; }
.an-map { height: 460px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.an-cellpin span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #fff; border: 2px solid #868e96; font-size: 12px; }
#an-sres { margin-top: 10px; font-size: 12.5px; }
.an-store { display: grid; gap: 4px; font-size: 12.5px; margin-bottom: 10px; }
.an-sbar { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.an-sbar i { display: block; height: 100%; background: var(--accent); } .an-sbar i.hi { background: var(--bad, #e03131); }
.an-setup { max-width: 760px; margin: 24px auto; background: var(--panel); border-radius: 10px; }
.an-setup pre { background: var(--panel-2); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; }
.an-tip { position: fixed; left: 0; top: 0; z-index: 5000; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); padding: 6px 9px; font: 12px/1.4 var(--sans); max-width: 260px; }
@media (max-width: 1100px) { .an-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .an-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .an-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 12px 0; } .an-grid { grid-template-columns: 1fr; padding: 12px 12px 0; }
  section.an-card.an-wide:not(.an-grid *) { margin: 12px 12px 0; } .an-days { grid-template-columns: 1fr; }
  .an-search { margin-left: 0; width: 100%; } .an-search input { flex: 1; width: auto; } .an-map { height: 360px; } .an-range { margin-left: 0; }
}

.an-clear { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.an-clear select { width: auto; }

.an-caller { width: 150px !important; }
.an-callerbar { margin: 12px 16px 0; padding: 8px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--ink); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.an-callerbar[hidden] { display: none; }
@media (max-width: 700px) { .an-callerbar { margin: 12px 12px 0; } }

/* Analytics Points view: one marker per place */
.an-pt i { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-sizing: border-box; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.an-pt.many b { display: block; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff; box-sizing: border-box; text-align: center;
  font: 700 11px/1 var(--sans); box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.an-ptpop .table-wrap { max-height: 220px; overflow: auto; margin: 6px 0 8px; }

/* movement: arrows pointing the direction of travel */
.an-pt.mv span { display: block; width: 100%; height: 100%; color: var(--accent); filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.an-pt.mv svg { display: block; fill: currentColor; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.an-pt.mv.sms svg { fill: #fff; stroke: var(--accent); stroke-width: 2.5; }
.an-arr { vertical-align: -2px; color: var(--accent); }
td.an-mv { white-space: nowrap; }

.an-bad { margin-top: 6px; font-size: 11.5px; display: grid; gap: 6px; }
.an-bad[hidden] { display: none; }
.an-bad code { display: block; white-space: pre-wrap; word-break: break-all; background: var(--panel-2); padding: 4px 6px; border-radius: 5px; font-size: 11px; }

/* Live AML: the bubble / arrow holding the newest record pulses like the newest pin */
.an-pt.newest { overflow: visible; }
.an-pt.many.newest b, .an-pt.mv.newest span { position: relative; }
.an-pt.many.newest::before, .an-pt.mv.newest::before { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--accent); animation: pulse 1.6s ease-out infinite; pointer-events: none; z-index: -1; }

/* ---------- Settings ---------- */
.st { padding: 0 16px 32px; }
.st-nav { position: sticky; top: 0; z-index: 5; margin: 12px 0 4px; box-shadow: 0 0 0 6px var(--bg); background: var(--panel); }
.st-sec { padding-top: 14px; }
.st-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.st-head h2 { margin: 0; font-size: 17px; } .st-head h2 .muted { font-weight: 400; font-size: 14px; margin-left: 4px; }
.st-head .btn, .st-saved { margin-left: auto; font-size: 12px; }
/* signed-in row on the Settings page (Sign out lives here on phones) */
.st-me { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 13px; }
.st-me .btn { margin-left: auto; }
.st-intro { max-width: 860px; margin: 6px 0 12px; line-height: 1.5; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.st-card header { display: flex; align-items: baseline; gap: 8px; }
.st-card header h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.st-dash { margin-left: auto; font-size: 12px; color: var(--accent); text-decoration: none; white-space: nowrap; }
.st-dash:hover { text-decoration: underline; }
.st-sub { margin: 2px 0 10px; font-size: 12px; }
.st-pill { font: 600 10.5px/1 var(--sans); padding: 4px 7px; border-radius: 10px; letter-spacing: .02em; }
.st-pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.st-pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.st-pill.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.st-pill.off { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.st-rows { display: grid; gap: 9px; margin-bottom: 12px; }
.st-u { display: grid; grid-template-columns: 1fr auto 44px; gap: 3px 10px; align-items: center; font-size: 12.5px; }
.st-u.nolim { grid-template-columns: 1fr auto; }
.st-ul { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-uv { font-family: var(--mono); font-size: 12px; white-space: nowrap; text-align: right; }
.st-uv b { font-weight: 500; color: var(--ink); }
.st-ubar { grid-column: 1 / 3; height: 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.st-ubar i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 0; }
.st-ubar.warn i { background: var(--warn); } .st-ubar.bad i { background: var(--bad); }
.st-up { grid-row: 1 / 3; grid-column: 3; text-align: right; font: 600 12px var(--sans); color: var(--ink); }
.st-up.warn { color: var(--warn); } .st-up.bad { color: var(--bad); }
.st-i { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line); font: italic 600 9.5px/1 serif; color: var(--muted); vertical-align: 1px; cursor: help; }
.st-spark { display: flex; align-items: flex-end; gap: 2px; height: 46px; border-bottom: 1px solid var(--line); }
.st-sb { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.st-sb i { display: block; width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .8; }
.st-sb:hover i { opacity: 1; }
.st-nospark { font-size: 12px; color: var(--muted); margin: 0; padding: 14px 0; border-top: 1px dashed var(--line); text-align: center; }
table.data.st-t { font-size: 12.5px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table.data.st-t td, table.data.st-t th { padding: 7px 10px; }
.st-k { font: 11px var(--mono); margin-left: 6px; }
.st-groups { columns: 3 340px; column-gap: 12px; }
.st-group { margin: 0 0 12px; padding: 0 14px 10px; break-inside: avoid; display: block; width: 100%; box-sizing: border-box; }
/* group title inside the box (a floated legend leaves the fieldset border) */
.st-group legend { float: left; width: 100%; padding: 12px 0 8px; margin: 0; font: 600 13.5px var(--sans); color: var(--ink); border-bottom: 1px solid var(--line); }
.st-group legend + * { clear: both; }
.st-p { padding: 9px 0; border-bottom: 1px solid var(--line); }
.st-p:last-child { border-bottom: 0; }
.st-p > label { font-size: 12.5px; color: var(--ink); font-weight: 500; margin-bottom: 5px; }
.st-p.changed > label::after { content: "changed here"; margin-left: 8px; font: 600 10px var(--sans); color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 8px; }
.st-pin { display: flex; gap: 8px; align-items: center; }
.st-pin input:not([type=checkbox]), .st-pin select { max-width: 260px; }
.st-was { color: var(--ink); }
.st-limits { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.st-limits summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.st-limits table.data.st-t { border: 0; }
.st-lim { width: 120px; }
/* Save bar: sits quietly at the end of the form; with unsaved changes it floats at the bottom of the screen as a card */
.st-savebar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; font-size: 12.5px; }
.st-savebar .st-dirty { margin-right: auto; font-weight: 600; color: var(--ink); }
.st-savebar.dirty { position: sticky; bottom: 14px; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 10px 12px 10px 16px; }
.st-savebar.dirty .st-dirty::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
@media (max-width: 700px) { .st-savebar.dirty { bottom: 8px; flex-wrap: wrap; } .st-savebar #st-msg { flex-basis: 100%; order: 5; } }
.st-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0 0; font-size: 13px; max-width: 760px; }
.st-dl dt { color: var(--muted); } .st-dl dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-word; }
@media (max-width: 700px) {
  .st { padding: 0 12px 28px; }
  .st-nav { display: flex; overflow-x: auto; } .st-nav button { white-space: nowrap; flex: 1; }
  .st-cards { grid-template-columns: 1fr; } .st-groups { columns: 1; }
  .st-pin input:not([type=checkbox]), .st-pin select { max-width: none; }
  .st-dl { grid-template-columns: 1fr; gap: 2px; } .st-dl dd { margin-bottom: 8px; }
}

/* Route traffic colours legend */
.cong-hint { line-height: 1.7; }
.cong-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; margin-left: 6px; vertical-align: middle; }
.cong-legend span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cong-legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
/* phones/tablets: the window scrolls, so let the Settings tab bar stick to the window (an overflow box would trap it) */
@media (max-width: 900px) { .page-scroll.st { overflow: visible; } }

/* Settings → Accounts */
.acc-me { margin: 10px 0 12px; max-width: 760px; }
.acc-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.acc-av { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 600 16px var(--sans); flex: none; }
.acc-who { flex: 1; min-width: 180px; line-height: 1.6; }
.acc-card .acc-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td.acc-acts { white-space: nowrap; text-align: right; } td.acc-acts .btn + .btn { margin-left: 4px; }
.acc-role.admin { color: var(--accent); border-color: currentColor; }
.acc-role.viewer { font-style: italic; }
.acc-st { font-size: 12px; font-weight: 500; } .acc-st.on { color: var(--ok); } .acc-st.off { color: var(--bad); }
table.data.acc-t { width: 100%; }
.acc-t tr.acc-off td:not(:last-child) { opacity: .55; }
.acc-dlg { border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.acc-dlg::backdrop { background: rgba(10, 12, 14, .5); }
.acc-dlg h3 { margin: 0 0 12px; font-size: 15px; }
.acc-dlg label { margin-bottom: 10px; } .acc-dlg label input, .acc-dlg label select { width: 100%; box-sizing: border-box; }
.acc-dlg .notice { margin: 4px 0 10px; }
.acc-pwtools { display: flex; align-items: center; gap: 6px; margin: -2px 0 8px; } .acc-pwtools .hint { margin: 0 auto 0 0; }
.acc-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (max-width: 700px) {
  .acc-t td.acc-acts { white-space: normal; }
  .acc-t th:nth-child(5), .acc-t td:nth-child(5) { display: none; }
}

/* Viewer role: controls that change data are hidden (the server refuses them too) */
.role-viewer .w-only { display: none !important; }

/* Aircraft layer (OpenSky) */
.air-ic { background: none; border: 0; }
.air-ic svg { display: block; fill: currentColor; stroke: #fff; stroke-width: 1.1px; paint-order: stroke; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); transition: transform .4s; }
.air-ic.gnd svg { opacity: .7; }
.air-ic.emg::before { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid #e03131; animation: pulse 1.6s ease-out infinite; pointer-events: none; }
.air-ic.emg svg { stroke-width: 1.6px; }
.leaflet-tooltip.air-lbl { background: rgba(255,255,255,.85); border: 0; box-shadow: none; padding: 0 4px; font: 600 10.5px var(--mono); color: #1f2328; }
.leaflet-tooltip.air-lbl::before { display: none; }
.air-emg { background: #ffe3e3; color: #c92a2a; border-radius: 6px; padding: 4px 8px; margin: 4px 0 6px; font-weight: 600; font-size: 12px; }

/* Sign-in pages: links under the form, two-step code box */
.auth-links { margin: 14px 0 0 !important; font-size: 13px; text-align: center; line-height: 1.7; }
.auth-links a { color: var(--accent); }
input.mfa-code { font: 600 20px var(--mono); letter-spacing: .18em; text-align: center; }
.auth-card .notice { margin-bottom: 12px; }

/* Two-step setup (mfa.js) */
.mfa-steps { margin: 0 0 10px; padding-left: 20px; font-size: 13px; line-height: 1.55; }
.mfa-steps li { margin-bottom: 8px; }
.mfa-qr { width: 184px; height: 184px; margin: 10px 0 6px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.mfa-qr svg { width: 100%; height: 100%; display: block; }
.mfa-key { font-size: 12.5px; margin: 4px 0; } .mfa-key summary { cursor: pointer; color: var(--accent); }
.mfa-key code { display: inline-block; margin: 6px 4px 4px 0; padding: 3px 6px; background: var(--panel-2, rgba(127,127,127,.12)); border-radius: 5px; word-break: break-all; }
.mfa-confirm { display: flex; gap: 8px; margin-bottom: 10px; } .mfa-confirm input { flex: 1; min-width: 0; }
.mfa-ok { color: var(--ok); font-weight: 600; margin-bottom: 8px; }
.mfa-p { font-size: 13px; line-height: 1.5; margin: 0 0 10px; }
.mfa-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; font-size: 14.5px; letter-spacing: .04em; margin-bottom: 8px; }
.mfa-row { gap: 6px; margin-bottom: 10px; }
.mfa-check { display: flex !important; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0 12px; }
.mfa-check input { width: auto; }

/* Accounts: two-step card, email status, dialogs */
.acc-me .acc-card + .acc-card { margin-top: 8px; }
.acc-mfa .acc-who b { font-weight: 600; }
.acc-note { margin: 8px 0 0; }
.acc-mail { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; margin-top: 8px; padding: 9px 12px 9px 14px; border-radius: 10px; font-size: 12.5px; background: rgba(47,158,68,.08); border: 1px solid rgba(47,158,68,.25); }
.acc-mail.off { background: rgba(240,140,0,.08); border-color: rgba(240,140,0,.3); }
.acc-mail code { font-size: 11.5px; }
.acc-2s { font-size: 11.5px; color: var(--muted); } .acc-2s.on { color: var(--ok); } .acc-2s.need { color: var(--warn, #e67700); font-weight: 600; }
.acc-em { font-size: 11.5px; }
.acc-side { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; margin: 4px 0 8px; }
.acc-or { text-align: center; font-size: 11.5px; color: var(--muted); margin: 6px 0 8px; text-transform: uppercase; letter-spacing: .06em; }
.acc-seg { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 10px; font-size: 13px; }
.acc-seg label { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; } .acc-seg input { width: auto; }
.acc-dlg { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.acc-panel .mfa-qr { margin-left: 0; }
.acc-dlg .mfa-check input, .acc-dlg .acc-seg input { width: auto; flex: none; }

/* Plot Points: connect by straight line or by road */
.plot-path { margin-top: 10px; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }
.plot-path select { width: auto; padding: 5px 8px; font-size: 12.5px; }
.plot-road { margin: 8px 0 0; font-size: 12.5px; }
table.pts td.d { line-height: 1.25; }

/* ---------- Explore on phones / small tablets: the map stays put, only the panel below it scrolls ---------- */
@media (max-width: 900px) {
  .page-geo .main { height: calc(100vh - 52px); height: calc(100dvh - 52px); min-height: 0; overflow: hidden; }
  .page-geo .split.left { height: 100%; grid-template-rows: 45vh minmax(0, 1fr); grid-template-rows: 45dvh minmax(0, 1fr); }
  .page-geo .split.left .side { overflow: hidden; min-height: 0; }
  .page-geo .side-scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

/* Analytics: average day by hour */
.an-hhead { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.an-hhead h3 { margin: 0; }
.an-chart.an-hours { height: 220px; }
.an-bars.hours { gap: 3px; }
.an-bars.hours .an-bb i { opacity: .75; }
.an-bars.hours .an-b.peak .an-bb i { opacity: 1; }
.an-bars.hours .an-bl { overflow: visible; }
@media (max-width: 700px) { .an-chart.an-hours { height: 180px; } .an-bars.hours { gap: 1px; } .an-bars.hours .an-bv { font-size: 10px; } }
.an-bars.hours .an-b.dim .an-bb i { opacity: .3; }
.an-bars.hours .an-b.sel .an-bb i { opacity: 1; background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft, rgba(35,98,221,.25)); }
.an-bars.hours .an-b.sel .an-bl { color: var(--accent); font-weight: 600; }
.an-hchip { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--accent-soft, rgba(35,98,221,.12)); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.an-hchip[hidden] { display: none; }

/* Agency boundaries */
.bnd-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.bnd-dot.lg { width: 12px; height: 12px; }
.gli-ov-ic .bnd-dot { margin: 0; }
.leaflet-tooltip.bnd-tip { font-weight: 600; }
dd.bnd-dd { font-family: var(--sans); }
.bnd-res { display: flex; align-items: baseline; gap: 2px 6px; flex-wrap: wrap; line-height: 1.45; }
.bnd-res + .bnd-res { margin-top: 3px; }
.bnd-res .bnd-ln { color: var(--muted); font-size: 11.5px; }
.bnd-res .bnd-dot { width: 8px; height: 8px; margin: 0; align-self: center; }
.bnd-warn { color: var(--warn, #e67700); font-size: 11.5px; }
.bnd-sum { padding: 8px 10px; border-radius: 8px; background: rgba(127,127,127,.08); font-size: 12.5px; margin-bottom: 10px; }
.bnd-colour { display: flex !important; align-items: center; gap: 10px; }
.acc-dlg .bnd-colour input[type=color] { width: 46px; height: 30px; padding: 2px; flex: none; }
.bnd-prevwrap { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-top: 4px; }
.bnd-prev { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12px; max-height: 120px; overflow: auto; }
.bnd-prev span { background: rgba(127,127,127,.1); border-radius: 6px; padding: 2px 7px; }
.bnd-prev i { font-style: normal; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.bnd-t td.bnd-file { width: 22%; min-width: 160px; max-width: 280px; white-space: normal; font-size: 12px; }
.bnd-t .bnd-fname { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.bnd-t td.bnd-lname { white-space: normal; min-width: 180px; }
.bnd-t td { vertical-align: top; }
.bnd-t td.acc-acts { vertical-align: middle; }
table.data.bnd-t { width: 100%; }

/* Boundary editor (boundary-edit) */
.bed-back { font-size: 12.5px; color: var(--accent); text-decoration: none; }
.bed-title { display: flex !important; justify-content: flex-start !important; align-items: center; gap: 2px; font-size: 16px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--ink) !important; margin: 8px 0 4px !important; }
.bed-status { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.bed-dirty { color: var(--warn, #e67700); }
.bed-save, .bed-tools, .bed-actions { gap: 6px; flex-wrap: wrap; }
.bed-tools .btn.on, .bed-actions .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bed-toggles { margin-top: 10px; }
.bed-help { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; }
.bed-sel { background: rgba(35,98,221,.05); }
.bed-sel label { display: block; margin-bottom: 8px; font-size: 12.5px; }
.bed-sel label input, #bed-q { width: 100%; box-sizing: border-box; }
.bed-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 46vh; overflow: auto; font-size: 13px; }
.bed-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.bed-list li:hover { background: rgba(127,127,127,.08); }
.bed-list li.on { background: var(--accent-soft, rgba(35,98,221,.12)); color: var(--accent); font-weight: 600; }
.bed-list li i { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.bed .marker-icon, .bed .marker-icon-middle { border-color: #fff !important; }

/* Weather at a location (wx.js) */
dd.wx-dd { font-family: var(--sans); line-height: 1.5; word-break: normal; overflow-wrap: normal; }
.wx-b { white-space: nowrap; }
.wx-line { display: block; }
.wx-cond { font-weight: 600; }
.wx-s1 { color: var(--warn, #e67700); }
.wx-s2 { color: #e03131; font-weight: 600; }
.wx-src { display: block; font-size: 11px; }
.wx-sep { color: var(--muted); }
.hz-play { padding: 1px 8px !important; min-width: 0; }

/* ---------- Live caller video panel (assets/video.js) ---------- */
.vid-panel { position: fixed; right: 16px; bottom: 16px; z-index: 2500; width: 400px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); color: var(--ink, inherit);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); font: 13px var(--sans); }
.vid-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.vid-panel header b { font: 600 14px var(--sans); }
.vid-body { padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.vid-body p { margin: 0; }
.vid-mode { padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); line-height: 1.4; }
.vid-mode.els { background: var(--accent-soft); border-color: var(--accent); }
.vid-f { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.vid-f input { font: 14px var(--mono); }
.vid-ch { align-self: flex-start; }
.vid-status { display: flex; align-items: center; gap: 10px; }
.vid-pill { font: 700 11px var(--sans); letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.vid-pill.st-opened { background: #fff4d6; border-color: #e0b44a; color: #7a5300; }
.vid-pill.st-live { background: #d92d20; border-color: #d92d20; color: #fff; animation: vid-blink 1.4s infinite; }
.vid-pill.st-stopped, .vid-pill.st-expired { background: #fde8e6; border-color: #e5a29b; color: #8a1c12; }
@keyframes vid-blink { 50% { opacity: .55; } }
.vid-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12px; }
.vid-dl dt { color: var(--muted); }
.vid-dl dd { margin: 0; overflow-wrap: anywhere; }
.vid-link { font-family: var(--mono); }
.vid-msg { display: flex; flex-direction: column; gap: 6px; }
.vid-msg textarea { width: 100%; font: 12px var(--mono); resize: vertical; }
.vid-view { position: relative; background: #000; border-radius: 8px; min-height: 120px; display: grid; place-items: center; text-align: center; padding: 0; overflow: hidden; }
.vid-view .muted { padding: 16px; color: #9aa4ad; }
.vid-view video { width: 100%; height: 300px; object-fit: contain; display: block; background: #000; }
.vid-view:fullscreen video { height: 100%; }
.vid-gps { position: absolute; left: 8px; bottom: 8px; font: 11px var(--mono); color: #fff; background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 4px; }
.vid-gps:empty { display: none; }
@media (max-width: 640px) {
  .vid-panel { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 75vh; }
  .vid-view video { height: 240px; }
}

/* ---------- AI call summary (assets/ai.js) ---------- */
.ai-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font: 13px/1.45 var(--sans); }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ai-head b { font: 600 13px var(--sans); }
.ai-lang button { padding: 2px 8px; font-size: 11px; }
.ai-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.ai-meta { font-size: 11px; margin: 8px 0 6px; }
.ai-wait { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); }
.btn .ai-spin { width: 11px; height: 11px; display: inline-block; vertical-align: -1px; }
.ai-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
/* location assessment in the AI box: GLIS's own calculation */
.ai-assess { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.ai-assess .ai-score { display: flex; flex-direction: column; align-items: center; min-width: 62px; }
.ai-assess .ai-score b { font: 700 22px/1 var(--sans); }
.ai-assess .ai-score small { font-size: 9.5px; text-align: center; color: var(--muted); line-height: 1.2; margin-top: 3px; }
.ai-assess .ai-verdict { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ai-assess .ai-verdict small { font-size: 11px; color: var(--muted); }
.ai-assess details { font-size: 11.5px; }
.ai-assess details summary { cursor: pointer; color: var(--accent); }
.ai-assess ul { margin: 4px 0 0; padding-left: 16px; }
.ai-assess.lv-high { border-color: #2e9e5b; background: #eaf7ef; } .ai-assess.lv-high .ai-score b { color: #1e7a44; }
.ai-assess.lv-medium { border-color: #e0b44a; background: #fff7e3; } .ai-assess.lv-medium .ai-score b { color: #8a5d00; }
.ai-assess.lv-low { border-color: #e5a29b; background: #fdeeec; } .ai-assess.lv-low .ai-score b { color: #a3261a; }
html[data-layout="command"] .ai-assess.lv-high, html[data-layout="command"] .ai-assess.lv-medium, html[data-layout="command"] .ai-assess.lv-low { background: transparent; }

/* =====================================================================================
   Phones and small tablets (≤ 900 px): bottom tab bar on every page, and on Explore and
   Live AML the side panel becomes a bottom sheet over a full-height map (assets/sheet.js).
   ===================================================================================== */
.ph-title, .sheet-top, .sheet-acts, .sheet-float, .sheet-near { display: none; }
@media (max-width: 900px) {
  :root { --tabbar: 60px; --tabbar-all: calc(60px + env(safe-area-inset-bottom, 0px)); }

  /* top bar: logo, page name, settings */
  .topbar { gap: 12px; }
  .ph-title { display: block; flex: 1; min-width: 0; font: 600 16px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .who { margin-left: auto; }
  .who .who-set { display: inline-flex; }

  /* bottom tabs */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300; height: var(--tabbar-all);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; overflow: visible;
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(20, 24, 28, .05);
  }
  .tabs a, .ui-a .tabs a.active { position: relative; display: grid; justify-items: center; align-content: center; gap: 4px; padding: 0;
    border-radius: 0; background: none; box-shadow: none; color: var(--muted); font: 500 11px/1 var(--sans); }
  .tabs a:hover { background: none; }
  .tabs a .t-ico { display: block; width: 22px; height: 22px; }
  .tabs a .t-full { display: none; }
  .tabs a .t-short { display: block; }
  .tabs a.active { color: var(--accent); font-weight: 600; background: none; }
  .tabs a.active::before { content: ""; position: absolute; top: 6px; left: 50%; width: 56px; height: 30px; margin-left: -28px;
    border-radius: 15px; background: var(--accent-soft); z-index: -1; }
  .tabs a[href="settings"] { display: none; }
  body { padding-bottom: var(--tabbar-all); }
  .toast { bottom: calc(var(--tabbar-all) + 14px); }

  /* Plot keeps its drawer, now above the tab bar */
  .page-plot .main { height: calc(100vh - 52px - var(--tabbar-all)); height: calc(100dvh - 52px - var(--tabbar-all)); }
  .page-plot .split.left .side { bottom: var(--tabbar-all); }
  .page-plot .drawer-back { bottom: var(--tabbar-all); }

  /* ---------- bottom sheet pages ---------- */
  .page-geo .main, .page-live .main { height: calc(100vh - 52px - var(--tabbar-all)); height: calc(100dvh - 52px - var(--tabbar-all)); min-height: 0; overflow: hidden; }
  .split.sheet-on, .split.sheet-on.left { display: block; position: relative; height: 100%; overflow: hidden; }
  .split.sheet-on .map-wrap { position: absolute; left: 0; right: 0; top: 0; height: 100%; z-index: 0; }
  .split.sheet-on .map-wrap::after { content: ""; position: absolute; inset: 0; z-index: 1001; background: rgba(10, 12, 14, .38);
    opacity: 0; pointer-events: none; transition: opacity .25s; }
  .split.sheet-dim .map-wrap::after { opacity: 1; }
  .split.sheet-on .map-badge { display: none; }
  .split.sheet-on .side, .page-geo .split.sheet-on .side {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column;
    border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(20, 24, 28, .14);
    overflow: hidden; overscroll-behavior: contain; touch-action: none;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1); will-change: transform;
  }
  .split.sheet-on .side.sheet-full { overflow-y: auto; touch-action: pan-y; }
  .split.sheet-drag .side { transition: none; }
  .split.sheet-on .side > * { flex: none; }
  .split.sheet-on .side-scroll, .page-geo .split.sheet-on .side-scroll { overflow: visible; flex: none; }
  .split.sheet-on .side .section { border-bottom: 1px solid var(--line); }

  /* handle + one line */
  .split.sheet-on .sheet-top { display: block; position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 0 16px; touch-action: none; }
  .sheet-grab { display: grid; place-items: center; width: 100%; height: 22px; padding: 0; border: 0; background: none; cursor: grab; }
  .sheet-grab i { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  .sheet-peek { display: flex; align-items: center; gap: 12px; padding: 2px 0 12px; }
  .sheet-txt { flex: 1; min-width: 0; cursor: pointer; }
  .sheet-title { display: flex; align-items: center; gap: 8px; font: 600 16px/1.3 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheet-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheet-go[hidden] { display: none; }
  .sheet-go { flex: none; height: 40px; padding: 0 15px; border: 0; border-radius: 20px; background: var(--accent); color: var(--accent-ink);
    display: inline-flex; align-items: center; gap: 6px; font: 600 14px var(--sans); cursor: pointer; }
  .sheet-sk { display: inline-block; width: 70%; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--panel-2) 25%, var(--line) 50%, var(--panel-2) 75%);
    background-size: 200% 100%; animation: sheet-sk 1.1s linear infinite; }
  @keyframes sheet-sk { from { background-position: 200% 0; } to { background-position: 0 0; } }
  .sheet-live { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: sheet-live 1.6s infinite; }
  @keyframes sheet-live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

  /* round quick actions */
  .split.sheet-on .sheet-acts:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 4px; padding: 4px 12px 14px; border-bottom: 1px solid var(--line); }
  .sheet-act { border: 0; background: none; display: grid; justify-items: center; gap: 6px; padding: 0; font: 500 12px var(--sans); color: var(--ink); cursor: pointer; }
  .sheet-act span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); transition: transform .12s; }
  .sheet-act:active span { transform: scale(.92); }
  .sheet-act.on span { background: var(--accent); color: var(--accent-ink); }

  /* Explore: the selected point and its tools come first */
  .split.sheet-on[data-sheet="explore"] .side-scroll { display: flex; flex-direction: column; }
  .split.sheet-on[data-sheet="explore"] #sel { order: -2; }
  .split.sheet-on[data-sheet="explore"] #tools { order: -1; }
  /* Live AML: the calls come right after the overview */
  .split.sheet-on[data-sheet="live"] .sheet-top { order: -10; }
  .split.sheet-on[data-sheet="live"] .sheet-acts { order: -9; }
  .split.sheet-on[data-sheet="live"] .sh-feedhead { order: -8; }
  .split.sheet-on[data-sheet="live"] .sh-feed { order: -7; }
  .split.sheet-on[data-sheet="live"] .sh-overview { order: -6; }
  .split.sheet-on[data-sheet="live"] .sh-overview h2 .row { display: none; }   /* Fit / 3D / Refresh are quick actions now */
}
/* ---------- the mockup look on Explore / Live AML phones ---------- */
@media (max-width: 900px) {
  /* no top bar: the map runs to the top, with a floating search bar */
  /* (the bottom tabs live inside the top bar, so it is flattened rather than hidden) */
  .page-geo .topbar, .page-live .topbar { height: 0; padding: 0; border: 0; overflow: visible; }
  .page-geo .topbar > :not(.tabs), .page-live .topbar > :not(.tabs) { display: none; }
  .page-geo .main, .page-live .main { height: calc(100vh - var(--tabbar-all)); height: calc(100dvh - var(--tabbar-all)); }
  .split.sheet-on .sheet-float { display: block; position: absolute; left: 0; right: 0; top: 0; z-index: 1; pointer-events: none;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 0; }
  .sheet-float > * { pointer-events: auto; }
  .sf-row { display: flex; gap: 8px; }
  .sf-search { flex: 1; min-width: 0; height: 46px; border-radius: 23px; background: var(--panel); box-shadow: 0 2px 6px rgba(20,24,28,.12), 0 8px 20px rgba(20,24,28,.10);
    display: flex; align-items: center; gap: 10px; padding: 0 16px; color: var(--muted); }
  .sf-search { position: relative; padding: 0 6px 0 16px; }
  .sf-slot { flex: 1; min-width: 0; display: flex; align-self: stretch; }
  .sf-slot .ac-wrap { position: static; flex: 1; min-width: 0; display: flex; }
  .sf-search input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; padding: 0; height: 100%; font: 15px var(--sans); color: var(--ink); box-shadow: none; outline: 0; border-radius: 0; }
  .sf-search input:focus { box-shadow: none; }
  /* suggestions drop down under the whole bar */
  .sf-search .ac-list { left: 0; right: 0; top: calc(100% + 8px); max-height: 55vh; overflow-y: auto; border: 0; border-radius: 16px; padding: 6px;
    background: var(--panel); box-shadow: 0 2px 6px rgba(20,24,28,.12), 0 12px 28px rgba(20,24,28,.16); z-index: 5; }
  .sf-search .ac-list li { padding: 10px 12px; border-radius: 10px; }
  .sf-search .ac-name { font-size: 14px; }
  .sheet-float:focus-within { z-index: 4; }
  /* provider: short label + our own menu */
  .sf-prov { flex: none; height: 32px; padding: 0 8px 0 11px; border: 0; border-radius: 16px; background: var(--panel-2); color: var(--ink);
    display: inline-flex; align-items: center; gap: 3px; font: 600 12.5px var(--sans); cursor: pointer; }
  .sf-prov[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
  .sf-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 6; min-width: 230px; padding: 6px; border-radius: 16px; background: var(--panel);
    box-shadow: 0 2px 6px rgba(20,24,28,.12), 0 12px 28px rgba(20,24,28,.16); display: grid; gap: 2px; }
  .sf-menu[hidden] { display: none; }
  .sf-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none;
    text-align: left; color: var(--ink); cursor: pointer; }
  .sf-menu button > span { flex: 1; display: grid; gap: 1px; }
  .sf-menu b { font: 500 14px var(--sans); }
  .sf-menu small { font-size: 12px; color: var(--muted); }
  .sf-menu svg { color: var(--accent); visibility: hidden; flex: none; }
  .sf-menu button[aria-checked="true"] { background: var(--accent-soft); }
  .sf-menu button[aria-checked="true"] svg { visibility: visible; }
  .sf-menu button:active { background: var(--panel-2); }
  .split.sheet-on[data-sheet="explore"] #prov { display: none; }
  .sf-search input::placeholder { color: var(--muted); }
  .sf-search:focus-within { box-shadow: 0 0 0 2px var(--accent), 0 8px 20px rgba(20,24,28,.10); }
  .sf-round { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--panel); color: var(--ink);
    box-shadow: 0 2px 6px rgba(20,24,28,.12), 0 8px 20px rgba(20,24,28,.10); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
  .sf-n { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 600 10.5px/18px var(--sans); }
  .sf-chips { display: flex; gap: 8px; margin: 10px -12px 0 0; padding: 0 12px 6px 0; overflow-x: auto; scrollbar-width: none; }
  .sf-chips::-webkit-scrollbar { display: none; }
  .sf-chip { flex: none; height: 32px; padding: 0 12px; border-radius: 16px; border: 0; background: var(--panel); color: var(--ink);
    box-shadow: 0 2px 6px rgba(20,24,28,.12); display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--sans); cursor: pointer; }
  .sf-chip i { width: 8px; height: 8px; border-radius: 50%; }
  .sf-chip.on { background: var(--accent); color: var(--accent-ink); }
  .sf-chip.on i { box-shadow: 0 0 0 2px #fff; }

  /* map buttons: zoom + my location bottom-right, measuring bottom-left; Layers opens from the floating button */
  .split.sheet-on .leaflet-top.leaflet-left { top: auto; left: auto; bottom: 30px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
  .split.sheet-on .leaflet-bottom.leaflet-left { bottom: 30px; }
  .split.sheet-on .leaflet-left .leaflet-control { margin: 0; float: none; clear: none; }
  .split.sheet-on .leaflet-bottom.leaflet-left .leaflet-control { margin: 0 0 0 12px; }
  .split.sheet-on .leaflet-bar { border: 0; border-radius: 23px; overflow: hidden; box-shadow: 0 2px 6px rgba(20,24,28,.12), 0 8px 20px rgba(20,24,28,.10); }
  .split.sheet-on .leaflet-bar a, .split.sheet-on .leaflet-bar button { width: 46px; height: 44px; line-height: 44px; border-radius: 0 !important; background: var(--panel); color: var(--ink); }
  .split.sheet-on .leaflet-top.leaflet-right { top: calc(66px + env(safe-area-inset-top, 0px)); }
  .split.sheet-on[data-sheet="explore"] .leaflet-top.leaflet-right { top: calc(108px + env(safe-area-inset-top, 0px)); }
  .split.sheet-on .gli-layers-btn { display: none; }
  .split.sheet-on .leaflet-bottom.leaflet-right { bottom: 16px; }
  .split.sheet-on .leaflet-control-scale { display: none; }

  /* sheet content as cards */
  .split.sheet-on .side .section { padding: 14px 16px; }
  .split.sheet-on .side .section h2 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
  .split.sheet-on .side .section h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: auto; font-size: 11.5px; }
  .split.sheet-on #sel .kv { background: var(--panel-2); border-radius: 14px; padding: 12px 14px; gap: 6px 12px; }
  .split.sheet-on #sel > .row { display: none; }   /* Route / Copy / 3D … are the round buttons now */
  .split.sheet-on #sel .sheet-moved, .split.sheet-on #sel-ag, .split.sheet-on #sel-poz { display: none; }
  .split.sheet-on[data-sheet="explore"] #search-form { display: none; }   /* the floating bar searches */
  .split.sheet-on.sheet-searching[data-sheet="explore"] .side-scroll > .section:first-child, .split.sheet-on.sheet-searching #results { order: -5; }
  .split.sheet-on.sheet-searching .sheet-near, .split.sheet-on.sheet-searching .sheet-acts { display: none !important; }

  .split.sheet-on .sheet-near:not([hidden]) { display: block; }
  .sn-list { list-style: none; margin: 0; padding: 0; }
  .sn-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
  .sn-list li + li { border-top: 1px solid var(--line); }
  .sn-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; flex: none; }
  .sn-ic > * { margin: 0 !important; }
  .sn-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .sn-t b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sn-t small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sn-d { text-align: right; font: 500 13px var(--mono); white-space: nowrap; }
  .sn-d small { display: block; font: 400 11.5px var(--sans); color: var(--muted); }
  .sn-go { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--accent); display: grid; place-items: center; flex: none; cursor: pointer; }

  /* Live AML call list */
  .split.sheet-on .feed li { padding: 11px 16px; }
  .split.sheet-on .feed li.sel { background: var(--accent-soft); }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .split.sheet-on .side, .split.sheet-on .map-wrap::after { transition: none; }
  .sheet-sk, .sheet-live { animation: none; }
}
/* AI summary on Analytics */
.an-ai { margin: 0 0 14px; }
.an-ai-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.an-ai-head h3 { margin: 0; }
.an-ai-tools { display: flex; align-items: center; gap: 8px; }
.an-ai .ai-text { white-space: pre-wrap; font: 13.5px/1.55 var(--sans); max-width: 900px; }
