body.admin #app { max-width: 1000px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.tabs button { width: auto; margin: 0; padding: 10px 16px; border-radius: 99px; background: var(--surface-2); color: var(--ink); font-size: 14px; }
.tabs button[aria-current=page] { background: var(--accent); color: var(--accent-ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.tile { background: var(--surface); border-radius: 16px; padding: 14px; } .tile span { display: block; color: var(--muted); font-size: 13px; }
.tile b { display: block; font: 800 26px var(--font); letter-spacing: -0.02em; margin-top: 2px; } .tile.warn b { color: var(--warn); } .tile.good b { color: var(--accent); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; margin-top: 10px; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars div i { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); font-style: normal; }
.filters { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; } .filters > * { flex: 1; min-width: 140px; }
.filters select, .filters input { margin: 0; }
.row2 { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.item { background: var(--surface); border-radius: 14px; padding: 12px 14px; margin: 8px 0; width: 100%; text-align: left; color: var(--ink); font-weight: 500; }
button.item { cursor: pointer; margin: 8px 0; }
.item b { font-weight: 700; } .kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.quote { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 6px 0; font-size: 14px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .inline input { width: auto; flex: 1; min-width: 120px; margin: 0; } .inline button { width: auto; margin: 0; padding: 12px 18px; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

.lab-frames { display: grid; grid-template-columns: 1fr; gap: 10px; }
.lab-frames.wide { grid-template-columns: 1fr 1fr; }
.lab-frame { width: 100%; height: 70vh; min-height: 420px; border: 2px solid var(--line, #ccc); border-radius: 10px; background: #fff; }
.lab-sum { white-space: pre-wrap; }
label.check { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-weight: 400; }
label.check input { width: auto; margin: 0; }

/* the AI spark bubble and its slide-over */
.ai-wrap { display: inline-flex; align-items: center; gap: 6px; }
.ai-spark { width: 46px !important; height: 46px; padding: 0 !important; margin: 0 !important; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #ffd27a, #ff9a3c 45%, #ff4e3a 100%); color: #fff; display: grid; place-items: center; box-shadow: 0 0 16px 4px rgba(255, 140, 50, .7), inset 0 0 8px rgba(255, 255, 255, .35); animation: aiglow 2.6s ease-in-out infinite; }
.ai-spark svg { filter: drop-shadow(0 0 3px rgba(255, 255, 255, .8)); }
@keyframes aiglow { 50% { box-shadow: 0 0 30px 10px rgba(255, 140, 50, .95), inset 0 0 10px rgba(255, 255, 255, .5); transform: scale(1.05); } }
.ai-pill { display: inline-flex; align-items: center; overflow: hidden; max-width: 0; opacity: 0; transition: max-width .25s, opacity .25s; border-radius: 99px; background: var(--surface-2); }
.ai-pill.open { max-width: 90px; opacity: 1; }
.ai-glass { width: 46px !important; height: 46px; padding: 0 !important; margin: 0 !important; border-radius: 50%; background: transparent; color: var(--ink); display: grid; place-items: center; }
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--bg); border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 50; box-shadow: -10px 0 30px rgba(0,0,0,.5); animation: aislide .2s ease-out; }
@keyframes aislide { from { transform: translateX(40px); opacity: 0; } }
.ai-list { flex: 1; overflow-y: auto; }
.ai-turn { margin-bottom: 14px; } .ai-q { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; font-weight: 600; } .ai-a { padding: 8px 4px; white-space: pre-wrap; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .ai-spark, .ai-panel { animation: none; } }

/* the menu: Overview, Map, then grouped */
.tabs button.grp { display: inline-flex; align-items: center; gap: 6px; }
.tabs .caret { font-size: 11px; opacity: .8; }
.tabs.sub { margin: 2px 0 4px; padding: 8px; background: var(--surface); border-radius: 16px; }
.tabs.sub button { background: transparent; } .tabs.sub button[aria-current=page] { background: var(--accent); }
/* header */
body.admin .row2:first-child { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
/* show-password eye */
.pwwrap { position: relative; display: block; } .pwwrap input { padding-right: 52px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px !important; height: 40px; margin: 0 !important; padding: 0 !important; background: transparent; color: var(--muted); display: grid; place-items: center; border-radius: 50%; }
.eye.on { color: var(--accent); }

/* 0.8.0: top line, account menu, four-button menu */
.topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.topline .wordmark.small { white-space: nowrap; margin: 0; text-align: left; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.inline.nowrap { flex-wrap: nowrap; gap: 10px; flex: 0 0 auto; }
.acct-wrap { position: relative; display: inline-block; }
.acct { width: 46px !important; height: 46px; padding: 0 !important; margin: 0 !important; border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; }
.acct-menu { position: absolute; right: 0; top: 54px; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; z-index: 60; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.acct-menu[hidden] { display: none; }
.acct-menu button { display: block; width: 100%; margin: 0; text-align: left; background: transparent; color: var(--ink); padding: 12px 14px; border-radius: 10px; font-size: 16px; }
.acct-menu button:active { background: var(--surface-2); }
.ai-spark { width: 52px !important; height: 52px; } .ai-glass { width: 52px !important; height: 52px; }
.tabs.main { flex-wrap: nowrap; gap: 6px; } .tabs.main button { flex: 1 1 0; min-width: 0; padding: 12px 4px; font-size: 15px; white-space: nowrap; }
.tabs.sub { flex-wrap: wrap; } .tabs.sub button { flex: 0 1 auto; padding: 10px 16px; }

/* 0.8.0: the map fills the screen; everything else floats over it */
.mapbox-box { position: relative; height: calc(100dvh - 170px); min-height: 420px; border-radius: 16px; overflow: hidden; background: #0b0b0b; margin-top: 8px; }
.mapbox-box:fullscreen { height: 100dvh; border-radius: 0; margin: 0; } .mapbox-box:-webkit-full-screen { height: 100dvh; border-radius: 0; margin: 0; }
.map-el { position: absolute; inset: 0; }
.map-ai { position: absolute; top: 12px; left: 12px; z-index: 5; display: none; }
.mapbox-box:fullscreen .map-ai:not([hidden]) { display: block; } .mapbox-box:-webkit-full-screen .map-ai:not([hidden]) { display: block; }
.map-legend { position: absolute; top: 12px; left: 12px; z-index: 4; background: rgba(0,0,0,.65); border-radius: 12px; padding: 8px 10px; font-size: 12px; line-height: 1.7; backdrop-filter: blur(4px); }
.map-legend[hidden], .map-search[hidden], .map-ai[hidden], .map-card[hidden], .layers-panel[hidden] { display: none !important; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; }
.map-bottom { position: absolute; left: 12px; right: 12px; bottom: 38px; z-index: 5; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.map-bottom > * { pointer-events: auto; }
.layers-btn { position: relative; width: 46px !important; height: 46px; margin: 0 !important; padding: 0 !important; border-radius: 50%; background: rgba(20,20,20,.92); color: var(--ink); border: 1px solid var(--line); display: grid; place-items: center; }
.layers-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #ff9a3c; color: #1a1005; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-sizing: border-box; }
.layers-count[hidden] { display: none; }
.sim-strip { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.sim-strip[hidden] { display: none !important; }
.sim-row { display: flex; gap: 10px; }
.sim-row label { flex: 1; min-width: 0; }
.sim-strip label, .sim-card label { display: block; font-size: 13px; color: var(--muted); margin: 6px 0; }
.sim-strip input, .sim-card input[type=number], .sim-card select { width: 100%; box-sizing: border-box; margin: 4px 0 0; }
.sim-card input[type=range] { width: 100%; }
.sim-msg { font-size: 13px; margin: 6px 2px; white-space: pre-line; }
.sim-card { margin-bottom: 14px; }
.map-search { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 420px; background: rgba(20,20,20,.92); border: 1px solid var(--line); border-radius: 99px; padding: 0 14px; color: var(--muted); }
.map-search input { flex: 1; margin: 0; background: transparent; border: 0; padding: 12px 0; color: var(--ink); min-width: 0; }
.layers-panel { background: rgba(20,20,20,.96); border: 1px solid var(--line); border-radius: 16px; padding: 12px; max-width: 360px; }
.lp-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 6px 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip { width: auto !important; margin: 0 !important; padding: 9px 14px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 600; border: 1px solid transparent; }
.chip[aria-pressed=true] { background: rgba(255, 140, 50, .18); color: #ffb26b; border-color: #ff9a3c; }
.map-card { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 6; background: rgba(20,20,20,.97); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; max-width: 420px; margin: 0 auto; max-height: 55%; overflow-y: auto; }
.map-card .kv { margin: 8px 0; }

.tabs.main button { font-size: 14px; gap: 3px; } .tabs.main .caret { font-size: 9px; margin-left: 2px; }
.map-legend { font-size: 11px; line-height: 1.6; padding: 6px 9px; }

/* 0.8.1: Mapbox's own stylesheet sets .mapboxgl-map { position: relative }, which collapsed the map to zero height. Win that fight. */
.mapbox-box > .map-el { position: absolute !important; inset: 0; width: 100%; height: 100%; }
.map-err { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%); z-index: 7; background: rgba(40, 10, 10, .95); border: 1px solid var(--warn); border-radius: 14px; padding: 14px; color: var(--ink); text-align: center; }
.ai-spark { width: 44px !important; height: 44px; } .ai-glass { width: 44px !important; height: 44px; }

/* 0.8.2: key bottom left (small), Layers bottom right, search along the bottom */
.map-row { display: flex; align-items: flex-end; justify-content: space-between; width: 100%; gap: 10px; }
.map-legend { position: static !important; font-size: 10.5px; line-height: 1.5; padding: 5px 8px; }
.map-legend i { width: 8px; height: 8px; margin-right: 5px; }
.layers-wrap { position: relative; margin-left: auto; }
.layers-wrap .layers-panel { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(340px, calc(100vw - 48px)); }
.map-bottom { align-items: stretch; }
.map-search { max-width: none; }
/* the page's own button style (full width, 8px margins, green) was pushing Mapbox's little (i) credit button half out of its circle */
.mapboxgl-ctrl button { margin: 0 !important; padding: 0 !important; border-radius: 0; }
.mapboxgl-ctrl button.mapboxgl-ctrl-attrib-button { width: 24px !important; height: 24px !important; border-radius: 50% !important; }
.mapboxgl-ctrl-group button { width: 29px !important; height: 29px !important; background-color: transparent; }
.layers-wrap { z-index: 3; } .map-legend { position: relative !important; z-index: 1; }
.layers-panel { max-height: 58vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 0.9.1: top buttons size to their own word; real sliding switches; collapsible admin cards */
.tabs.main button { flex: 1 1 auto; padding: 12px 10px; justify-content: center; text-align: center; display: inline-flex; align-items: center; }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; font-weight: 400; border-bottom: 1px solid var(--line); cursor: pointer; }
.sw-row > span:first-child { flex: 1; min-width: 0; }
.switch { position: relative; flex: none; width: 50px; height: 30px; }
.switch input { position: absolute; inset: 0; width: 100% !important; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .knob { position: absolute; inset: 0; border-radius: 99px; background: #3a3a3a; transition: background .15s; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .knob { background: #06c167; }
.switch input:checked + .knob::after { transform: translateX(20px); }
.switch input:focus-visible + .knob { outline: 2px solid #ffb26b; outline-offset: 2px; }
.sw-sub { padding: 8px 0 10px 12px; border-bottom: 1px solid var(--line); } .sw-sub[hidden] { display: none; }
.sw-sub label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.sw-sub input { width: 90px; margin: 0; }
.acard { padding: 0; overflow: hidden; }
.acard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 0; padding: 14px; background: transparent; color: var(--ink); text-align: left; border-radius: 0; font-size: 16px; }
.acard-name { font-weight: 700; min-width: 0; }
.acard-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; flex: none; }
.acard-head .caret { transition: transform .15s; } .acard-head[aria-expanded=true] .caret { transform: rotate(180deg); }
.acard-body { padding: 0 14px 14px; } .acard-body[hidden] { display: none; }
.tag.on { color: #06c167; } .tag.off { color: #ff6b6b; }

/* 0.9.2: the AI mic */
.ai-pill.open { max-width: 150px; }
.ai-form { align-items: center; }
.ai-form input { flex: 1; min-width: 0; }
.ai-mic { width: 46px !important; height: 46px; flex: none; margin: 0 !important; padding: 0 !important; border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; }
.ai-mic.live { background: #ff6a1a; color: #fff; animation: micpulse 1.1s infinite; }
@keyframes micpulse { 0% { box-shadow: 0 0 0 0 rgba(255,106,26,.6); } 100% { box-shadow: 0 0 0 16px rgba(255,106,26,0); } }
.ai-speak { border-bottom: 0; padding: 4px 2px; font-size: 14px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .ai-mic.live { animation: none; } }
