/* NTRIP Live Map. From the reviewed MockUp app.css (VRSteam Design System v2.0 tokens in vrs-tokens.css); live-app
   additions at the end. Only map-specific colours (--map-*) and presence colours (--p*) are added here, per theme. */
:root {
  --top-h: 52px; --panel-w: 408px; --tab-h: 56px;
  --map-land: #f4f2ee; --map-nb: #e6e4df; --map-water: #aecbe4; --map-river: #9ec1e0; --map-urban: #e8e3dc;
  --map-road: #ffffff; --map-road-case: #c9c3ba; --map-hwy: #f7d39c; --map-hwy-case: #d39a4c; --map-border: #9a8f99;
  --map-field: #e7eedc; --map-field-2: #eef1e2; --map-bldg: #ddd6cc; --map-label: #3e4650; --map-halo: rgba(255,255,255,.92);
  --map-grid: rgba(0,0,0,.05);
  --p1: #6a3fd1; --p2: #b0216b; --p3: #8a5a2b; --p4: #4f5b93;
  --rover: #1d4ed8; --rover-soft: rgba(29,78,216,.16);
  --shadow: 0 2px 10px rgba(16,24,40,.14);
}
[data-theme="night"] {
  --map-land: #24364a; --map-nb: #151c24; --map-water: #0b2131; --map-river: #1f4660; --map-urban: #1f2a36;
  --map-road: #3a4553; --map-road-case: #0d131a; --map-hwy: #7a6338; --map-hwy-case: #2a2416; --map-border: #6b6474;
  --map-field: #1a2620; --map-field-2: #1c2823; --map-bldg: #2b3542; --map-label: #c4ccd6; --map-halo: rgba(11,16,22,.9);
  --map-grid: rgba(255,255,255,.04);
  --p1: #b79cff; --p2: #ff8cc6; --p3: #d9a66b; --p4: #a9b4e8;
  --rover: #8ab4ff; --rover-soft: rgba(138,180,255,.16);
  --shadow: 0 2px 12px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--app); color: var(--text); font-family: var(--font-ui); font-size: var(--fs-body); line-height: 1.45; -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent-text); }
button { font: inherit; color: inherit; }
:focus-visible { outline: var(--border-thick) solid var(--accent); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-s { width: 16px; height: 16px; } .ic-l { width: 24px; height: 24px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: var(--fs-control); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: var(--fs-small); } .nowrap { white-space: nowrap; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top { position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 30; display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); background: var(--surface); border-bottom: var(--border) solid var(--line); }
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--text); min-width: 0; flex: 0 1 auto; overflow: hidden; }
.brand img { width: 32px; height: 32px; border-radius: 6px; flex: none; }
.brand b { font-size: var(--fs-title); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.live { display: inline-flex; align-items: center; gap: 6px; height: var(--badge-h); padding: 0 var(--space-2) 0 7px; border-radius: var(--radius-pill); border: var(--border) solid var(--ok-edge); background: var(--ok-soft); color: var(--ok-text); font-size: var(--fs-small); font-weight: 600; white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.nav { display: flex; gap: 2px; margin-left: var(--space-4); }
.nav a { display: inline-flex; align-items: center; gap: 6px; height: var(--row); padding: 0 var(--space-3); border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: var(--fs-control); font-weight: 600; }
.nav a:hover { background: var(--raised); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.seg { display: inline-flex; border: var(--border) solid var(--line-strong); border-radius: var(--radius); overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--field); color: var(--text); font-size: var(--fs-control); height: var(--row-s); min-width: 40px; padding: 0 var(--space-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.seg button + button { border-left: var(--border) solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.seg.full { display: flex; } .seg.full button { flex: 1; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: var(--row); height: var(--row); border: var(--border) solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); cursor: pointer; padding: 0; flex: none; }
.iconbtn:hover { background: var(--raised); border-color: var(--line); }
.userbtn { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--row); padding: 0 var(--space-2) 0 4px; border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--field); cursor: pointer; font-size: var(--fs-control); }
.av { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: var(--fs-small); font-weight: 700; flex: none; }
.av.p1 { background: var(--p1); } .av.p2 { background: var(--p2); } .av.p3 { background: var(--p3); } .av.p4 { background: var(--p4); }
[data-theme="night"] .av.p1, [data-theme="night"] .av.p2, [data-theme="night"] .av.p3, [data-theme="night"] .av.p4 { color: #000; }
:root:not([data-theme="night"]) .av.p1, :root:not([data-theme="night"]) .av.p2, :root:not([data-theme="night"]) .av.p3, :root:not([data-theme="night"]) .av.p4 { color: #fff; }
.menu { position: absolute; right: var(--space-4); top: calc(var(--top-h) - 4px); width: 248px; background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: var(--space-1); z-index: 40; }
.menu .who { padding: var(--space-2) var(--space-3); border-bottom: var(--border) solid var(--line); margin-bottom: var(--space-1); }
.menu a { display: flex; align-items: center; gap: var(--space-2); height: var(--row); padding: 0 var(--space-2); border-radius: var(--radius-s); color: var(--text); text-decoration: none; font-size: var(--fs-control); }
.menu a:hover, .menu a.on { background: var(--accent-soft); }

/* ---------- buttons, pills, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--row); min-width: var(--button-min-w); padding: 0 var(--space-3); border-radius: var(--radius); border: var(--border) solid var(--line-strong); background: var(--field); color: var(--text); font-size: var(--fs-control); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn .ic { width: 16px; height: 16px; }
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.sm { height: var(--row-s); padding: 0 var(--space-2); min-width: 0; font-size: var(--fs-small); }
.btn.lg { height: var(--row-touch); font-size: var(--fs-body); }
.pill, .chip { display: inline-flex; align-items: center; gap: 5px; height: var(--badge-h); padding: 0 var(--space-2) 0 6px; border-radius: var(--radius-pill); border: var(--border) solid var(--line-strong); background: var(--raised); color: var(--text); font-size: var(--fs-small); font-weight: 600; white-space: nowrap; line-height: 1; }
.pill .ic, .chip .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.s-ok { background: var(--ok-soft); border-color: var(--ok-edge); color: var(--ok-text); }
.s-warn { background: var(--warn-soft); border-color: var(--warn-edge); color: var(--warn-text); }
.s-danger { background: var(--danger-soft); border-color: var(--danger-edge); color: var(--danger-text); }
.s-info { background: var(--info-soft); border-color: var(--info-edge); color: var(--info-text); }
.s-off { background: var(--raised); border-color: var(--line-strong); color: var(--muted); }
.sys { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-s); border: var(--border) solid var(--line-strong); background: var(--field); font-size: var(--fs-caption); font-weight: 600; letter-spacing: .3px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.type { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--radius-s); font-size: var(--fs-caption); font-weight: 700; letter-spacing: .2px; border: var(--border) solid var(--line-strong); color: var(--muted); background: var(--field); white-space: nowrap; }
.type .ic { width: 12px; height: 12px; stroke-width: 2.2; }
.type.vrs { border-color: var(--info-edge); color: var(--info-text); background: var(--info-soft); }

/* ---------- layout ---------- */
.main { position: fixed; inset: var(--top-h) 0 0 0; display: grid; grid-template-columns: var(--panel-w) 1fr; }
.main.nopanel { grid-template-columns: 1fr; }
.main.wide { grid-template-columns: 1fr 440px; }
.panel { background: var(--surface); border-right: var(--border) solid var(--line); overflow-y: auto; overflow-x: hidden; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); scrollbar-width: thin; }
.main.wide .panel { border-right: 0; border-left: var(--border) solid var(--line); order: 2; }
.mapwrap { position: relative; overflow: hidden; background: var(--map-water); }
.mapwrap > svg.map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sec { font-size: var(--fs-section); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: var(--space-2); margin: 0; }
html[lang="th"] .sec { text-transform: none; letter-spacing: .2px; font-size: var(--fs-small); }
.sec .spacer + * { text-transform: none; letter-spacing: 0; }
h1.h { font-size: var(--fs-title); font-weight: 600; margin: 0; display: flex; align-items: center; gap: var(--space-2); }
h2.h { font-size: var(--fs-dialog-question); font-weight: 600; margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.card { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-l); }
.card.pad { padding: var(--space-3) var(--space-4); }
.card.raised { background: var(--raised); }
.card.info { background: var(--info-soft); border-color: var(--info-edge); }
.card.okc { background: var(--ok-soft); border-color: var(--ok-edge); }
.card-h { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: var(--border) solid var(--line); }
.card-b { padding: var(--space-3) var(--space-4); }
.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; align-items: center; gap: var(--space-2); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--space-2); }
.kpi { border: var(--border) solid var(--line); border-radius: var(--radius-l); padding: var(--space-2) var(--space-3); background: var(--surface); min-width: 0; }
.kpi-l { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-small); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-l .ic { width: 16px; height: 16px; }
.kpi-v { font-size: 24px; font-weight: 600; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-v small { font-size: var(--fs-body); color: var(--muted); font-weight: 400; }
.kpi-s { font-size: var(--fs-small); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s.warn { color: var(--warn-text); font-weight: 600; white-space: normal; }
.kv { display: grid; grid-template-columns: 128px 1fr; column-gap: var(--space-3); row-gap: 6px; align-items: baseline; margin: 0; }
html[lang="th"] .kv { grid-template-columns: 140px 1fr; }
.kv dt { color: var(--muted); font-size: var(--fs-control); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; }
.kv dd.r { text-align: right; }
.field { display: flex; align-items: center; gap: var(--space-2); height: var(--row); border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--field); padding: 0 var(--space-2); color: var(--muted); }
.field input, .field span.v { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-control); outline: none; min-width: 0; }
.field input::placeholder { color: var(--muted); }
.lbl { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.hint { font-size: var(--fs-hint); color: var(--muted); margin: 0; }
.note { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--fs-control); }
.note .ic { width: 18px; height: 18px; color: var(--info-text); margin-top: 1px; }
.divider { height: 1px; background: var(--line); margin: 0; border: 0; }

/* base list */
.blist { display: flex; flex-direction: column; }
.brow { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-2); padding: 10px var(--space-3); border-bottom: var(--border) solid var(--line); text-decoration: none; color: var(--text); cursor: pointer; }
.brow:last-child { border-bottom: 0; }
.brow:hover { background: var(--raised); }
.brow.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.brow .mp { font-family: var(--font-mono); font-size: var(--fs-control); font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.brow .mp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .pl { color: var(--muted); font-size: var(--fs-small); grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .rt { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; justify-content: center; }
.brow .d { font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.uptime { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; height: 22px; }
.uptime i { border-radius: 2px; background: var(--ok); }
.uptime i.w { background: repeating-linear-gradient(45deg, var(--warn) 0 3px, color-mix(in srgb, var(--warn) 55%, transparent) 3px 6px); }
.uptime i.d { background: repeating-linear-gradient(-45deg, var(--danger) 0 2px, transparent 2px 4px), var(--danger-soft); outline: 1px solid var(--danger-edge); outline-offset: -1px; }
.uptime.mini { height: 12px; gap: 1px; }
.axis { display: flex; justify-content: space-between; font-size: var(--fs-caption); color: var(--muted); margin-top: 4px; }

/* map overlays */
.ov { position: absolute; z-index: 5; }
.mapctl { display: flex; flex-direction: column; background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mapctl button { width: 36px; height: 36px; border: 0; background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.mapctl button + button { border-top: var(--border) solid var(--line); }
.mapctl button:hover { background: var(--raised); }
.mapctl button.txt { font-size: var(--fs-small); font-weight: 700; }
.mapctl.row { flex-direction: row; }
.mapctl.row button + button { border-top: 0; border-left: var(--border) solid var(--line); }
.mapctl.row button { width: auto; padding: 0 var(--space-3); font-size: var(--fs-control); font-weight: 600; gap: 6px; }
.mapctl.row button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.floatcard { background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.legend { padding: var(--space-2) var(--space-3); font-size: var(--fs-small); display: grid; grid-template-columns: 22px 1fr; column-gap: var(--space-2); row-gap: 5px; align-items: center; }
.legend svg { width: 22px; height: 22px; }
.legend .t { font-weight: 700; grid-column: 1 / -1; font-size: var(--fs-small); color: var(--muted); }
.scale { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-caption); color: var(--map-label); font-weight: 600; text-shadow: 0 0 3px var(--map-halo), 0 0 3px var(--map-halo); }
.scale i { display: block; height: 6px; border: 2px solid var(--map-label); border-top: 0; }
.attr { font-size: 10px; color: var(--map-label); background: var(--map-halo); padding: 1px 6px; border-radius: 3px; }
.inset { width: 176px; height: 290px; overflow: hidden; }
.inset svg { width: 100%; height: 100%; display: block; }
.inset-t { position: absolute; left: 8px; top: 6px; font-size: var(--fs-caption); font-weight: 700; color: var(--muted); }

/* map svg text */
svg.map text, .inset text { font-family: var(--font-ui); paint-order: stroke; stroke: var(--map-halo); stroke-width: 3.5px; stroke-linejoin: round; }
.lab-city { font-size: 12px; fill: var(--map-label); font-weight: 600; }
.lab-city.big { font-size: 14px; font-weight: 700; }
.lab-sea { font-size: 13px; fill: color-mix(in srgb, var(--map-label) 85%, var(--map-water)); font-style: italic; letter-spacing: 2px; stroke-width: 0; }
.lab-nb { font-size: 13px; fill: color-mix(in srgb, var(--map-label) 85%, var(--map-nb)); letter-spacing: 3px; font-weight: 600; stroke-width: 0; }
.lab-road { font-size: 10.5px; fill: var(--map-label); }
.lab-base { font-family: var(--font-mono) !important; font-size: 12px; font-weight: 700; fill: var(--text); }
.lab-base-s { font-size: 11px; fill: var(--muted); font-weight: 600; }
.lab-rover { font-family: var(--font-mono) !important; font-size: 11px; font-weight: 600; fill: var(--text); }
.lab-cl { font-size: 11.5px; font-weight: 700; fill: var(--rover); }
.lab-ring { font-size: 10.5px; font-weight: 700; }
.lab-obj { font-size: 12px; font-weight: 700; fill: var(--text); }
.lab-meas { font-size: 12.5px; font-weight: 700; fill: var(--text); }

/* tools */
.toolbar { display: flex; flex-direction: column; gap: 2px; padding: 4px; background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.toolbar button { width: 40px; height: 40px; border: var(--border) solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; position: relative; }
.toolbar button:hover { background: var(--raised); }
.toolbar button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.toolbar hr { border: 0; height: 1px; background: var(--line); margin: 3px 4px; }
.tip { position: absolute; left: 50px; white-space: nowrap; background: var(--text); color: var(--surface); font-size: var(--fs-small); padding: 4px 8px; border-radius: var(--radius-s); font-weight: 600; pointer-events: none; }
.presence { display: flex; align-items: center; gap: var(--space-2); padding: 4px 4px 4px var(--space-3); }
.avs { display: flex; }
.avs .av { width: 30px; height: 30px; border: 2px solid var(--surface); margin-left: -6px; font-size: var(--fs-control); }
.avs .av:first-child { margin-left: 0; }
.wsw { display: flex; flex-direction: column; gap: 2px; }
.wsitem { display: grid; grid-template-columns: 24px 1fr auto; gap: var(--space-2); align-items: center; min-height: 40px; padding: 4px var(--space-2); border-radius: var(--radius); cursor: pointer; border: var(--border) solid transparent; }
.wsitem:hover { background: var(--raised); }
.wsitem.on { background: var(--accent-soft); border-color: var(--accent); }
.wsitem .n { font-weight: 600; font-size: var(--fs-control); }
.wsitem .s { font-size: var(--fs-small); color: var(--muted); }
.objrow { display: grid; grid-template-columns: 22px 1fr auto; gap: var(--space-2); align-items: center; padding: 6px var(--space-2); border-radius: var(--radius); font-size: var(--fs-control); }
.objrow.on { background: var(--accent-soft); }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); color: var(--warn-text); font-weight: 600; }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-2); font-size: var(--fs-control); }
.comment .av { width: 28px; height: 28px; }
.comment .m { color: var(--muted); font-size: var(--fs-small); }
.prog { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-control); }
.tbl th { text-align: left; font-size: var(--fs-small); color: var(--muted); font-weight: 600; padding: 6px var(--space-2); border-bottom: var(--border) solid var(--line); background: var(--raised); }
.tbl td { padding: 8px var(--space-2); border-bottom: var(--border) solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .c { text-align: center; } .tbl .r { text-align: right; }
.check { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: var(--radius-s); border: var(--border-thick) solid var(--line-strong); background: var(--field); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check .ic { width: 14px; height: 14px; stroke-width: 3; }
.switch { display: inline-flex; width: 36px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); }
.switch.on { background: var(--accent); } .switch.on::after { left: 18px; }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(8,12,18,.45); z-index: 50; display: flex; align-items: center; justify-content: center; }
.dialog { width: 480px; max-width: calc(100vw - 24px); background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius-l); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.dialog .card-h { padding: var(--space-4); }
.dialog .card-b { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.dialog .foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: var(--border) solid var(--line); background: var(--raised); border-radius: 0 0 var(--radius-l) var(--radius-l); }
.dialog .foot .btn { min-width: var(--dialog-button-w); }
.emailchip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 8px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-control); font-weight: 600; }

/* stakeout */
.so { display: flex; flex-direction: column; gap: var(--space-3); }
.so-arrow { position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 300px; margin: 0 auto; }
.so-arrow svg { width: 100%; height: 100%; }
.so-dist { text-align: center; font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.so-dist small { font-size: 18px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.so-sub { text-align: center; color: var(--muted); font-size: var(--fs-control); }
.deltas { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.delta { border: var(--border) solid var(--line); border-radius: var(--radius-l); padding: var(--space-2); text-align: center; background: var(--raised); }
.delta .l { font-size: var(--fs-small); color: var(--muted); font-weight: 600; }
.delta .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta .h { font-size: var(--fs-caption); color: var(--muted); }
.arrived { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-l); background: var(--ok-soft); border: var(--border-thick) solid var(--ok-edge); color: var(--ok-text); }
.arrived b { font-size: 20px; }

/* TV */
.tv { position: fixed; inset: 0; display: grid; grid-template-columns: 560px 1fr; grid-template-rows: 88px 1fr 64px; background: var(--app); }
.tv-top { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-8); background: var(--surface); border-bottom: var(--border) solid var(--line); }
.tv-top img { width: 52px; height: 52px; border-radius: 10px; }
.tv-top b { font-size: 32px; font-weight: 600; }
.tv-clock { font-size: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tv-side { padding: var(--space-6) var(--space-8); display: flex; flex-direction: column; gap: var(--space-4); overflow: hidden; }
.tv-kpi { background: var(--surface); border: var(--border) solid var(--line); border-radius: 12px; padding: var(--space-4) var(--space-6); }
.tv-kpi .kpi-l { font-size: 20px; } .tv-kpi .kpi-l .ic { width: 24px; height: 24px; }
.tv-kpi .kpi-v { font-size: 64px; } .tv-kpi .kpi-v small { font-size: 28px; }
.tv-kpi .kpi-s { font-size: 18px; }
.tv-map { position: relative; overflow: hidden; background: var(--map-water); border-left: var(--border) solid var(--line); }
.tv-map svg.map { position: absolute; inset: 0; width: 100%; height: 100%; }
.tv-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-8); background: var(--surface); border-top: var(--border) solid var(--line); font-size: 18px; overflow: hidden; white-space: nowrap; }
.tv-foot .mono { font-size: 15px !important; }
.tv-foot .pill { height: 30px; font-size: 16px; padding: 0 12px 0 8px; border-radius: 15px; } .tv-foot .pill .ic { width: 18px; height: 18px; }

/* 3D */
.v3d { position: absolute; inset: 0; }
.v3d svg { width: 100%; height: 100%; display: block; }

/* ================= PHONE ================= */
body.phone { --top-h: 56px; }
.phone .top { padding: 0 var(--space-2) 0 var(--space-3); gap: var(--space-2); }
.phone .brand b { font-size: 16px; }
.phone .brand img { width: 30px; height: 30px; }
.phone .iconbtn { width: 44px; height: 44px; }
.phone .tbtn { min-width: 44px; height: 44px; padding: 0 6px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--field); font-size: var(--fs-control); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.phone .live { padding: 0 6px; }
.pmap { position: fixed; left: 0; right: 0; top: var(--top-h); bottom: 0; overflow: hidden; background: var(--map-water); }
.pmap > svg.map { position: absolute; inset: 0; width: 100%; height: 100%; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: var(--border) solid var(--line-strong); border-radius: 14px 14px 0 0; box-shadow: 0 -4px 18px rgba(0,0,0,.18); padding: 0 var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--space-3); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sheet.withtabs { bottom: var(--tab-h); border-radius: 14px 14px 0 0; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.phone .btn { height: var(--row-touch); font-size: var(--fs-body); }
.phone .btn.sm { height: 36px; }
.phone .field { height: var(--row-touch); }
.phone .seg button { height: 40px; min-width: 44px; }
.phone .kpi { padding: 6px var(--space-2); }
.phone .kpi-v { font-size: 20px; }
.phone .kpi-l { font-size: var(--fs-caption); }
.phone .brow { padding: 10px var(--space-1); min-height: 56px; }
.phone .mapctl button { width: 44px; height: 44px; }
.phone .kv { grid-template-columns: 112px 1fr; }
html[lang="th"] .phone .kv, html[lang="th"] body.phone .kv { grid-template-columns: 120px 1fr; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); z-index: 25; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: var(--border) solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: var(--fs-caption); font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--accent-text); }
.tabs a[aria-current="page"] .ic { stroke-width: 2.2; }
.ptool { position: fixed; left: 0; right: 0; z-index: 22; display: flex; gap: 4px; overflow: hidden; padding: 6px var(--space-2); background: var(--surface); border-top: var(--border) solid var(--line); }
.ptool button { flex: none; width: 48px; height: 48px; border-radius: var(--radius); border: var(--border) solid transparent; background: transparent; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 10px; font-weight: 600; color: var(--text); padding: 0; }
.ptool button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.pchip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow); font-size: var(--fs-control); font-weight: 600; white-space: nowrap; }
.fullsheet { position: fixed; inset: var(--top-h) 0 0 0; z-index: 26; background: var(--surface); display: flex; flex-direction: column; padding: var(--space-3) var(--space-4) var(--space-4); gap: var(--space-3); }
.phone .so-arrow { max-width: 236px; }
.phone .so-dist { font-size: 48px; }
.thumbbar { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.thumbbar .btn { height: 56px; font-size: 16px; }
.thumbbar .btn.span { grid-column: 1 / -1; }

.mlist { display: flex; flex-direction: column; }
.mrow { display: grid; grid-template-columns: 32px 1fr auto; gap: 4px var(--space-2); align-items: center; padding: 10px var(--space-3); border-bottom: var(--border) solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow .av { width: 32px; height: 32px; font-size: var(--fs-control); position: relative; }
.mrow .nm { font-weight: 600; font-size: var(--fs-control); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .em { font-size: var(--fs-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .on { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); color: var(--ok-text); font-weight: 600; }
.mrow .on i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.mrow .off { font-size: var(--fs-small); color: var(--muted); }
.chan { display: grid; grid-template-columns: 24px 1fr auto; gap: 2px var(--space-2); align-items: start; }
.chan .pill { justify-self: start; margin-top: 4px; }
.phone .mrow { padding: 8px var(--space-1); }

/* ===== review round 1 additions ===== */
.sheet > *, .panel > *, .fullsheet > * { flex-shrink: 0; }
.grabzone { height: 28px; display: flex; align-items: center; justify-content: center; flex: none; margin-bottom: -8px; cursor: grab; position: relative; }
.grabzone::after { content: ""; position: absolute; left: 50%; top: -8px; width: 120px; height: 44px; transform: translateX(-50%); }
.grabzone.tight { height: 18px; margin: 0; }
.seg > a { display: flex; text-decoration: none; }
.seg > a + a > button { border-left: var(--border) solid var(--line-strong); }
.seg > a > button { height: 100%; }
.ic-xs { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; stroke-width: 2.2; }
.s-txt-warn { color: var(--warn-text); font-weight: 600; } .s-txt-danger { color: var(--danger-text); font-weight: 600; } .s-txt-ok { color: var(--ok-text); font-weight: 600; }
html[lang="th"] .lab-sea, html[lang="th"] .lab-nb { letter-spacing: 0; font-style: normal; }
.lab-badge { font-size: 10.5px; font-weight: 700; fill: var(--surface); stroke-width: 0 !important; }
.lab-count { font-size: 12px; font-weight: 700; fill: var(--surface); stroke-width: 0 !important; }
.lab-you { font-size: 13px; font-weight: 700; fill: var(--accent-text); }
.lab-vrs { font-family: var(--font-mono) !important; font-size: 11px; font-weight: 700; fill: var(--info-text); stroke-width: 0 !important; }
.lab-pill { font-size: 12.5px; font-weight: 700; fill: var(--on-accent); stroke-width: 0 !important; }
.lab-pilltext { font-family: var(--font-mono) !important; font-size: 12px; font-weight: 700; fill: var(--text); stroke-width: 0 !important; }
.lab-tag { font-size: 11.5px; font-weight: 700; fill: var(--text); stroke-width: 0 !important; }
.lab-inv { font-size: 12px; font-weight: 700; fill: var(--surface); stroke-width: 0 !important; }
.lab-cur { font-size: 12px; font-weight: 700; fill: #fff; stroke-width: 0 !important; }
[data-theme="night"] .lab-cur { fill: #000; }
svg text.ax { font-size: 10.5px; fill: var(--muted); font-family: var(--font-ui); }
.mbtn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; border-top: var(--border) solid var(--line); background: var(--surface); }
.mbtn.txt { font-size: var(--fs-small); font-weight: 700; }
.phone .mbtn { width: 44px; height: 44px; }
.legend { display: block; padding: 4px var(--space-2) var(--space-2); }
.lg-h { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 32px; border: 0; background: transparent; color: var(--text); font-weight: 700; font-size: var(--fs-small); padding: 0 4px; cursor: pointer; }
.lg-b { display: grid; grid-template-columns: 22px 1fr; column-gap: var(--space-2); row-gap: 5px; align-items: center; padding: 0 4px; font-size: var(--fs-small); }
.lg-b svg { width: 22px; height: 22px; }
.lg-sw { display: flex; align-items: center; gap: 8px; justify-content: space-between; cursor: pointer; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: var(--ok); }
.sw.w { background: repeating-linear-gradient(45deg, var(--warn) 0 3px, color-mix(in srgb, var(--warn) 55%, transparent) 3px 6px); }
.sw.d { background: repeating-linear-gradient(-45deg, var(--danger) 0 2px, transparent 2px 4px), var(--danger-soft); outline: 1px solid var(--danger-edge); outline-offset: -1px; }
.actions { position: sticky; bottom: calc(-1 * var(--space-4)); background: var(--surface); border-top: var(--border) solid var(--line); padding: var(--space-2) var(--space-4) var(--space-4); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin: 0 calc(-1 * var(--space-4)); }
/* coordinates */
.cardgroup { display: flex; flex-direction: column; }
.cardgroup > .card:first-child { border-radius: var(--radius-l) var(--radius-l) 0 0; }
.cardgroup > .card + .card { border-top: 0; border-radius: 0 0 var(--radius-l) var(--radius-l); box-shadow: inset 3px 0 0 var(--accent); }
.cgrid { display: grid; grid-template-columns: 128px 1fr 18px; column-gap: var(--space-2); row-gap: 6px; align-items: baseline; margin: 0; }
html[lang="th"] .cgrid { grid-template-columns: 136px 1fr 18px; }
.cgrid dt { color: var(--muted); font-size: var(--fs-control); }
.cgrid dd { margin: 0; }
.cgrid .cv { font-family: var(--font-mono); font-size: var(--fs-control); text-align: right; font-variant-numeric: tabular-nums; }
.cgrid .cv .sub { display: block; color: var(--muted); }
.cgrid .cu { font-family: var(--font-mono); font-size: var(--fs-control); color: var(--muted); }
.zseg { display: flex; flex-direction: column; align-items: stretch; }
.zauto { display: grid; grid-template-columns: 1fr 0 1fr; font-size: var(--fs-caption); color: var(--accent-text); font-weight: 700; text-align: center; margin-top: 2px; }
.warnrow { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius); background: var(--warn-soft); border: var(--border) solid var(--warn-edge); color: var(--warn-text); font-size: var(--fs-small); font-weight: 600; }
.warnrow .ic { width: 18px; height: 18px; flex: none; }
.split { display: inline-flex; } .split .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); } .split .btn + .btn { border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; padding: 0 6px; min-width: 0; }
.popmenu { position: absolute; z-index: 30; min-width: 220px; background: var(--surface); border: var(--border) solid var(--line-strong); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; }
.popmenu a { display: grid; grid-template-columns: 20px 1fr; column-gap: 8px; align-items: center; min-height: 36px; padding: 4px 8px; border-radius: var(--radius-s); color: var(--text); text-decoration: none; font-size: var(--fs-control); }
.popmenu a span { grid-column: 2; }
.popmenu a.on, .popmenu a:hover { background: var(--accent-soft); }
.popmenu a.danger { color: var(--danger-text); }
.phone .popmenu a { min-height: 44px; }
.toast { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-l); background: var(--text); color: var(--surface); font-size: var(--fs-control); font-weight: 600; box-shadow: var(--shadow); white-space: nowrap; }
.toast .ic { width: 16px; height: 16px; }
.rrow { display: grid; grid-template-columns: 20px auto 1fr 16px; gap: 8px; align-items: center; min-height: 48px; padding: 6px var(--space-3); border-bottom: var(--border) solid var(--line); color: var(--text); text-decoration: none; }
.rrow:last-child { border-bottom: 0; }
.rrow .rst { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.swrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
.swrow .swt { display: block; font-size: var(--fs-control); font-weight: 600; }
/* alerts */
.chan { display: grid; grid-template-columns: 24px 1fr auto; gap: 2px var(--space-2); align-items: start; }
.chan .pill { justify-self: start; margin-top: 4px; }
.atbl th, .atbl td { padding: 4px 6px; }
.atbl th.gsep, .atbl td.gsep { border-left: var(--border) solid var(--line-strong); }
.atbl tr.hl td { background: var(--accent-soft); }
.cb { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius); cursor: pointer; position: relative; }
.cb input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.cb:focus-within { outline: var(--border-thick) solid var(--accent); }
.phone .cb { width: 44px; height: 44px; }
.qrrow { display: flex; gap: 12px; align-items: center; border-top: var(--border) solid var(--line); }
.qr { padding: 6px; background: #fff; border-radius: var(--radius); flex: none; } .qr svg { display: block; fill: #000; }
/* tools */
.locktag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); color: var(--text); font-weight: 600; white-space: nowrap; }
.locktag .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.locktag.stale { color: var(--muted); }
.dot.p1 { background: var(--p1); } .dot.p2 { background: var(--p2); } .dot.p3 { background: var(--p3); } .dot.p4 { background: var(--p4); }
.stalebox { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin: 2px 4px 4px 34px; padding: 6px 8px; border-radius: var(--radius); background: var(--raised); }
.pchip.saving { height: 36px; } .saving b { font-weight: 700; }
.capb { padding: 8px 12px; display: flex; align-items: center; gap: 12px; min-width: 440px; }
.capb.float { background: var(--warn-soft); border-color: var(--warn-edge); color: var(--warn-text); }
.phone .capb { min-width: 0; }
.chipbtn { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px; border: var(--border) solid var(--line-strong); background: var(--field); color: var(--text); font-size: var(--fs-small); font-weight: 600; cursor: pointer; white-space: nowrap; }
.phone .chipbtn { height: 36px; border-radius: 18px; }
.editchip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: var(--fs-small); font-weight: 700; margin-left: 4px; }
.lockban { display: flex; gap: 10px; padding: 10px var(--space-4); background: var(--raised); border-bottom: var(--border) solid var(--line); box-shadow: inset 3px 0 0 var(--p1); font-size: var(--fs-control); }
.field[aria-disabled="true"] { background: var(--raised); }
.field[aria-disabled="true"] .v { color: var(--muted); }
.qgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; font-family: var(--font-mono); font-size: var(--fs-small); }
.cfield { padding-right: 0; } .cfield .iconbtn { color: var(--muted); }
.hlist { display: flex; flex-direction: column; }
.hrow { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 8px var(--space-4); border-bottom: var(--border) solid var(--line); }
.hrow:last-child { border-bottom: 0; }
.hrow .av { width: 28px; height: 28px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.tbl-a { display: contents; }
.ptool { position: fixed; left: 0; right: 0; z-index: 22; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 4px var(--space-2); background: var(--surface); border-top: var(--border) solid var(--line); }
.ptb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border-radius: var(--radius); border: var(--border) solid transparent; color: var(--text); text-decoration: none; font-size: var(--fs-caption); font-weight: 600; }
html[lang="th"] .ptb { font-size: 12px; }
.ptb[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.moregrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.moreit { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 12px; border: var(--border) solid var(--line); border-radius: var(--radius-l); background: var(--field); color: var(--text); font-size: var(--fs-body); font-weight: 600; }
.scrim.bottom { align-items: flex-end; }
.psheet { width: 100%; background: var(--surface); border-radius: 14px 14px 0 0; padding: 0 var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); max-height: 92vh; overflow-y: auto; }
.psheet > a:not(.btn) { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: var(--fs-body); }
.psheet > a.on { background: var(--accent-soft); }
.psheet .who { padding: 4px 8px 8px; border-bottom: var(--border) solid var(--line); }
/* team */
.chipin { height: auto !important; min-height: 36px; flex-wrap: wrap; padding: 4px 8px; gap: 4px; }
.emailchip { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 0 0 10px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-control); font-weight: 600; }
.emailchip button { width: 28px; height: 28px; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; padding: 0; cursor: pointer; }
.phone .emailchip { height: 36px; border-radius: 18px; } .phone .emailchip button { width: 32px; height: 32px; }
.ownerpill { display: inline-flex; align-items: center; justify-content: center; width: 116px; height: 32px; border-radius: var(--radius); background: var(--raised); border: var(--border) solid var(--line); font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
.rolesel { width: 116px; height: 32px; }
.phone .ownerpill, .phone .rolesel { height: 44px; }
/* stakeout */
.navb { width: 44px; min-width: 44px; height: 44px; padding: 0; }
.iconbtn.on, .iconbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.fr { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.fr > div { display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: var(--radius-l); background: var(--accent-soft); color: var(--accent-text); }
.fr span { font-size: var(--fs-small); font-weight: 600; } .fr b { font-size: 22px; font-variant-numeric: tabular-nums; }
.delta .v { font-size: 22px; }
.delta .h { font-size: 13px; font-weight: 600; color: var(--text); }
.phone .delta .v { font-size: 26px; } .phone .delta .h { font-size: 14px; }
.floatban { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-l); background: var(--warn-soft); border: var(--border-thick) solid var(--warn-edge); color: var(--warn-text); }
.sobtns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.sobtns .span, .thumbbar .span { grid-column: 1 / -1; }
.btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.trow { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px var(--space-3); border-bottom: var(--border) solid var(--line); }
.trow:last-child { border-bottom: 0; } .trow.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.so-ph { gap: 8px !important; padding-top: 8px !important; }
.so-ph .so { gap: 8px; }
.so-ph .so-arrow { max-width: 196px; }
.so-ph .so-dist { font-size: 40px; }
.so-ph .thumbbar { margin-top: auto; }
.so-ph .thumbbar .btn { height: 52px; }
.fullsheet.scroll { overflow-y: auto; }
.lrow { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.lrow .lt { font-size: var(--fs-control); font-weight: 600; }
.rampbar { height: 10px; border-radius: 5px; margin-top: 4px; }
/* TV */
.tv-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.tv-kpi { padding: var(--space-3) var(--space-4) !important; }
.tv-kpi .kpi-l { font-size: 18px !important; }
.tv-kpi .kpi-v { font-size: 52px !important; } .tv-kpi .kpi-v small { font-size: 22px !important; }
.tv-kpi .kpi-s { font-size: 17px !important; white-space: nowrap; }
.tv-kpi .ic-xs { width: 17px; height: 17px; }
.tv-legend .legend { background: var(--surface); border: var(--border) solid var(--line); border-radius: 12px; padding: 12px 16px; }
.tv-legend .lg-h { font-size: 18px; min-height: 36px; cursor: default; }
.tv-legend .lg-b { grid-template-columns: 28px 1fr; row-gap: 8px; font-size: 18px; }
.tv-legend .lg-b svg { width: 28px; height: 28px; }
.tv svg.map text { stroke-width: 5px; }
.tv svg.map .lab-city { font-size: 18px; } .tv svg.map .lab-city.big { font-size: 22px; }
.tv svg.map .lab-base { font-size: 18px; }
.tv svg.map .lab-rover, .tv svg.map .lab-cl { font-size: 16px; }
.tv svg.map .lab-sea, .tv svg.map .lab-nb { font-size: 18px; }
.tv svg.map .lab-count { font-size: 14px; }
.tv-inset-h { height: 44px; display: flex; align-items: center; padding: 0 16px; font-size: 20px; font-weight: 600; border-bottom: var(--border) solid var(--line); }
.tv-foot { gap: var(--space-6) !important; }
.tv-foot .pill { height: 34px !important; font-size: 18px !important; padding: 0 14px 0 10px !important; border-radius: 17px !important; }
.tvlive { height: 32px !important; font-size: 16px !important; padding: 0 12px 0 10px !important; border-radius: 16px !important; }
.tv-stale { left: 50%; top: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 10px; background: var(--warn-soft); border: 2px solid var(--warn-edge); color: var(--warn-text); font-size: 20px; font-weight: 700; }
.tv.stale .tv-map svg.map { opacity: .55; }
/* phone extras */
html[lang="th"] .phone .kpi-l, html[lang="th"] .tabs a { font-size: 12px; }
.phone .btn.sm { height: var(--row-touch); }
.phone .seg button { height: 44px; }
.phone .field { min-height: var(--row-touch); }
.phone .tbtn { color: var(--text); text-decoration: none; }

.userbtn, .userbtn:hover { text-decoration: none; color: var(--text); }
a.pchip { text-decoration: none; color: var(--text); }
.so-sub .chipbtn { height: 24px; font-size: var(--fs-small); }
.phone .so-sub .chipbtn { height: 32px; }

/* ===== live app (MapLibre + SVG overlay) ===== */
.mapslot { position: absolute; inset: 0; }
.mapview { position: absolute; inset: 0; }
.mapview .ml { position: absolute; inset: 0; }
.mapview svg.ovl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; overflow: hidden; }
.mapview svg.ovl .hit { pointer-events: auto; cursor: pointer; }
.maplibregl-canvas:focus { outline: none; }
.maperr { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); background: var(--map-nb); }
.mapwrap.stale svg.ovl, .pmap.stale svg.ovl { opacity: .55; }
.tv.stale .tv-map svg.ovl { opacity: .55; }
.stalewrap { left: 50%; top: 16px; transform: translateX(-50%); }
.stalebar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 10px; background: var(--warn-soft); border: 2px solid var(--warn-edge); color: var(--warn-text); box-shadow: var(--shadow); white-space: nowrap; }
.stalebar > span { display: flex; flex-direction: column; line-height: 1.25; }
.phone .stalewrap { top: 64px; left: 12px; right: 12px; transform: none; } .phone .stalebar { white-space: normal; }
.toastwrap { left: 50%; bottom: 44px; transform: translateX(-50%); }
.phone .toastwrap { bottom: 56px; max-width: calc(100vw - 24px); } .phone .toast { white-space: normal; }
.nav a[aria-disabled="true"], .tabs a[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.nav a[aria-disabled="true"]:hover { background: transparent; }
.menu a[aria-disabled="true"], .psheet > a[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.menu a[aria-disabled="true"]:hover { background: transparent; }
.soon { margin-left: auto; font-size: var(--fs-caption); font-weight: 600; color: var(--muted); border: var(--border) solid var(--line); border-radius: var(--radius-pill); padding: 0 6px; }
.mapctl button[disabled] { color: var(--muted); opacity: .55; cursor: not-allowed; }
.userbtn { color: var(--text); font: inherit; font-size: var(--fs-control); }
.uptime.pending { background: var(--raised); border-radius: 2px; }
.inset svg { cursor: pointer; }
.tbtn { color: var(--text); }
.tvexit { opacity: .25; } .tvexit:hover, .tvexit:focus-visible { opacity: 1; }
.tv-map .mapslot { position: absolute; inset: 0; }
.tv-kpis + * { margin-top: 0; }
.field input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* ===== release C (Tools, Team, Stakeout, view links) ===== */
.field select { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-control); outline: none; appearance: none; -webkit-appearance: none; cursor: pointer; }
.field select option { color: var(--text); background: var(--surface); }
.field:has(select) > .ic { pointer-events: none; margin-left: -28px; }
.field[aria-disabled="true"] { background: var(--raised); }
button.field { font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.btn.danger { color: var(--danger-text); }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.card.warn { background: var(--warn-soft); border-color: var(--warn-edge); }
.drawhint { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; max-width: min(760px, calc(100vw - 32px)); flex-wrap: wrap; }
.drawhint .small { flex: 1; min-width: 160px; }
.tlright { max-height: calc(100% - 100px); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; padding-bottom: 2px; }
.tlright > * { flex-shrink: 0; }
.mapview svg.ovl .hdl { cursor: grab; touch-action: none; }
.mapview svg.ovl .hdl:active { cursor: grabbing; }
.somap { position: absolute; inset: 0; overflow: hidden; }
.somap svg { display: block; width: 100%; height: 100%; }
.so-wrap { display: contents; }
.so-ph .so-arrow.somap-ph { max-width: none; aspect-ratio: auto; }
.so-ph .so-arrow.somap-ph svg { width: 100%; height: auto; border-radius: var(--radius-l); border: var(--border) solid var(--line); }
.viewlist { max-height: 40vh; overflow-y: auto; }
.phone .viewlist { max-height: 22vh; }
.main.nopanel { grid-template-columns: 1fr !important; }
.wsitem:focus-visible, .objrow:focus-visible, .trow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.objrow, .trow { cursor: pointer; } .objrow:hover { background: var(--raised); } .objrow.on:hover { background: var(--accent-soft); }
.ptool button.ptb { background: transparent; font: inherit; cursor: pointer; width: auto; height: auto; }
.ptool button.ptb[aria-pressed="true"] { background: var(--accent-soft); }
.moreit[disabled], .ptb[disabled], .toolbar button[disabled] { opacity: .45; cursor: not-allowed; }
label.btn input[type="file"] { display: none; }
.fullsheet > .so-wrap > .thumbbar:last-child { margin-top: auto; }

/* ---- release D: 3D view (MapLibre terrain) and Alerts ---- */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.lrow:focus-within .check { outline: var(--border-thick) solid var(--accent); outline-offset: 2px; }
.v3wrap { background: var(--map-nb); }
.v3wrap .maplibregl-canvas { outline: none; }
svg.map .lab-m3 { font-size: 12.5px; font-weight: 700; fill: var(--text); stroke-width: 0; }
.m3hint { height: auto; min-height: 36px; white-space: normal; max-width: 520px; padding: 6px 12px; font-weight: 600; }
.phone .m3hint { max-width: none; }
.v3wrap [data-slot="v3_bat"] .note { display: flex; align-items: center; gap: 8px; }
.alpanel { display: flex; flex-direction: column; gap: var(--space-3); }
.alpanel .hint { margin: 0; }
.lcode { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.lcode .code { font-family: var(--font-mono); font-size: 28px; font-weight: 700; letter-spacing: 4px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-control); }
.steps li { padding-left: 2px; }
.steps .row { margin-top: 4px; flex-wrap: wrap; gap: 6px; }
.atbl td.mp { min-width: 0; }
.atbl td.mp .row { flex-wrap: wrap; }
.atbl .rm { margin-left: auto; }
.al-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.al-add select { min-width: 0; flex: 1; height: 36px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--field); color: var(--text); padding: 0 8px; font: inherit; font-size: var(--fs-control); }
.phone .al-add select { height: 44px; }
.qfield { width: 92px; }
.savest { display: inline-flex; align-items: center; gap: 4px; }
.phone .alpanel .btn.sm { height: var(--row-touch, 44px); }
.phone .atbl th, .phone .atbl td { padding: 4px 2px; }
.phone .atbl td.mp, .phone .atbl th:first-child { padding-left: 8px; }
.phone .atbl .cb { width: 40px; height: 44px; }
.atbl td.mp .mono { white-space: nowrap; }
