/* Synchron — styling. Dark "night ops" console: deep navy surfaces, cyan for
   structures/map furniture, amber for RF. Mobile-first; the panel is a
   full-screen sheet under 1024px and a fixed sidebar above it. */

/* ============================================================================
   Palette: BORG's cyberpunk tokens (BORG css/style.css `:root.dark-mode`) mapped
   onto Synchron's own token names, so every rule below re-colours without being
   rewritten. Values are byte-for-byte BORG's — see synchron-app skill § theme.
   Deliberately NO pinks: BORG's `--danger`/`--accent2`/`--violet` are muted clay
   and slate, and the base theme's pink radials were overridden the same way.
   The MAP itself stays neutral (no neon tint) — that was the owner's choice.
   ============================================================================ */
:root {
  --bg: #05050c;              /* page backdrop (BORG --dark) */
  --bg-2: #0a0a14;            /* base surface (--bg-base) */
  --panel: #0a0a14;
  --panel-2: #15132a;         /* --accent, gradient partner */
  --panel-3: #1a1836;         /* card fill (--card-bg) */
  --line: #1c1b30;            /* hairline (--border) */
  --line-2: #34324f;          /* card border (--card-border) */
  --text: #ece9fb;            /* --text-primary */
  --dim: #8b87ad;             /* --text-secondary */
  --dim-2: #6a7385;           /* muted slate (--violet / --accent2) */
  --accent: #00d9ff;          /* electric cyan (--primary) */
  --accent-deep: #00a8cc;     /* --primary-dark */
  --rf: #ffb700;              /* amber (--warning) */
  --ok: #00ffa3;              /* neon terminal green (--success) */
  --warn: #ffb700;
  --bad: #ff5252;             /* --critical-red */
  --danger: #9d7575;          /* muted clay, never crimson/pink */
  --danger-text: #c98f8f;
  --on-primary: #041018;
  --surface-1: rgba(100, 108, 125, .06);
  --surface-2: rgba(0, 217, 255, .03);
  --surface-focus: rgba(0, 217, 255, .10);
  --border-glow: #00d9ff;

  /* glows and shadows — literals from BORG (L138–144) */
  --glow-cyan: 0 0 6px rgba(0, 217, 255, .55), 0 0 18px rgba(0, 217, 255, .25);
  --glow-green: 0 0 6px rgba(0, 255, 163, .5), 0 0 16px rgba(0, 255, 163, .2);
  --glow-amber: 0 0 6px rgba(255, 183, 0, .5), 0 0 16px rgba(255, 183, 0, .22);
  --glow-slate: 0 0 10px rgba(100, 108, 125, .12);
  --shadow-1: 0 0 0 1px rgba(0, 217, 255, .25);
  --shadow-2: 0 0 22px rgba(0, 217, 255, .25);

  /* shape: buttons round 8px, everything else SQUARE (BORG's convention) */
  --btn-radius: 8px;
  --header-h: 52px;
  --nav-h: 55px;   /* matches the bottom nav's own height so the bands meet exactly */
  --radius: 0px;
  --radius-sm: 0px;
  --transition: all .18s ease;
  --font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-display: "Arial Black", "Arial", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-text-size-adjust: 100%; overscroll-behavior: none;
}

body { overflow: hidden; }
[hidden] { display: none !important; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h2 { font-size: 16px; margin: 0; letter-spacing: .02em; }
h3.sect {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent);
  margin: 16px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
h3.sect:first-child { margin-top: 4px; }

/* ---------------- boot ---------------- */
.boot {
  position: fixed; inset: 0; z-index: 90;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: radial-gradient(120% 90% at 50% 0%, #0b1a2e 0%, #05070d 65%);
  color: var(--accent);
}
.boot.active { display: flex; }
.boot b { letter-spacing: .35em; font-size: 15px; color: var(--text); }
.boot span { color: var(--dim); font-size: 12px; }
.boot-mark { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------------- header ---------------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 0 10px;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, #0a1120 0%, #070c16 100%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 7px; color: var(--accent); }
.brand-name { color: var(--text); font-weight: 700; letter-spacing: .22em; font-size: 12px; }
.hdr-project {
  color: var(--dim); font-size: 12px; max-width: 30vw; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; border-left: 1px solid var(--line); padding-left: 10px;
}
.hdr-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.build-stamp { color: var(--dim-2); font-size: 10px; font-family: var(--mono); white-space: nowrap; }
.hdr-extra { display: none; align-items: center; gap: 6px; }
#btnMore { display: inline-flex; }
.more-menu {
  position: absolute; top: calc(var(--header-h) + env(safe-area-inset-top, 0px) - 4px); right: 10px; z-index: 50;
  display: flex; flex-direction: column; min-width: 210px; padding: 6px;
  background: rgba(11, 18, 32, .98); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.more-menu button {
  text-align: left; padding: 11px 12px; border: none; background: transparent; color: var(--text);
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
}
.more-menu button:hover { background: var(--panel-3); }
.more-build { color: var(--dim-2); font-size: 10px; font-family: var(--mono); padding: 6px 12px 2px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; min-height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  cursor: pointer; font-weight: 600; transition: background .15s, border-color .15s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 7px 11px; min-height: 32px; font-size: 12px; }
.btn-primary { background: linear-gradient(180deg, #22d3ee 0%, #0e9cb8 100%); color: #04121a; border-color: #22d3ee; }
.btn-primary:hover { background: linear-gradient(180deg, #4be0f5 0%, #12a9c6 100%); }
.btn-secondary { background: var(--panel-3); border-color: var(--line-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-danger { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .45); color: #fecaca; }
.btn-danger:hover { background: rgba(239, 68, 68, .24); }
.btn[disabled] { opacity: .55; cursor: progress; }
.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--dim);
  width: 32px; height: 32px; border-radius: 7px; cursor: pointer; line-height: 1;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.file-btn { position: relative; overflow: hidden; }

/* ---------------- layout ---------------- */
.app-main {
  position: fixed; left: 0; right: 0;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); display: flex;
}
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #04070e; }

.panel {
  width: 100%; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-width: 0;
  /* A page, not a transient card: it lives in the band BETWEEN the header and the
     bottom nav so the chrome stays visible and tappable. */
  position: fixed; left: 0; right: 0;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 30; transform: translateY(100%);
  transition: transform .26s ease;
}
body.panel-open .panel { transform: translateY(0); }
body.panel-open #btnSheetToggle { opacity: 0; pointer-events: none; }
.panel-head {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.tab-btn {
  border: none; background: transparent; color: var(--dim); padding: 8px 10px;
  border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12px; white-space: nowrap;
}
.tab-btn.active { background: var(--panel-3); color: var(--accent); }
.tab-pane { display: none; overflow-y: auto; padding: 12px; flex: 1; -webkit-overflow-scrolling: touch; }
.tab-pane.active { display: block; }

.pane-actions { display: flex; gap: 8px; margin-bottom: 10px; }

/* ---------------- map furniture ---------------- */
.pick-bar {
  position: absolute; top: 12px; left: 50%; transform: translate(-50%, -140%);
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: rgba(11, 18, 32, .94); border: 1px solid var(--accent-deep);
  border-radius: 999px; box-shadow: var(--shadow-2); transition: transform .22s ease;
  font-size: 12px; z-index: 5;
}
.pick-bar.active { transform: translate(-50%, 0); }
.map-readout {
  position: absolute; left: 10px; bottom: 34px; z-index: 5;
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(7, 12, 22, .78); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 9px; font-family: var(--mono);
  font-size: 10.5px; color: var(--dim); pointer-events: none; backdrop-filter: blur(4px);
}
.map-readout span:last-child { color: var(--accent); }
.sheet-toggle {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  background: rgba(11, 18, 32, .92); border: 1px solid var(--line-2); color: var(--text);
  padding: 8px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-1);
}

/* tower pins (HTML markers over the GL canvas) */
.tower-pin { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.pin-dot {
  width: 13px; height: 13px; border-radius: 50%; background: var(--c, #22d3ee);
  border: 2px solid #04121a; box-shadow: 0 0 0 3px rgba(34, 211, 238, .25), 0 0 12px var(--c, #22d3ee);
  flex: 0 0 auto;
}
.pin-text {
  background: rgba(7, 12, 22, .86); border: 1px solid var(--line-2);
  border-left: 2px solid var(--c, #22d3ee); border-radius: 6px; padding: 2px 7px;
  font-size: 11px; line-height: 1.25; white-space: nowrap; box-shadow: var(--shadow-1);
}
.pin-text b { display: block; font-weight: 700; }
.pin-text span { color: var(--dim); font-size: 10px; font-family: var(--mono); }

/* ---------------- lists & cards ---------------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 11px; box-shadow: var(--shadow-1); transition: border-color .15s, background .15s;
}
.card.sel { border-color: var(--accent); background: var(--panel-3); }
.card.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%,100% { border-color: var(--line); } 40% { border-color: var(--accent); background: #14304a; } }
.card-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.card-head b { font-size: 13.5px; }
.card-head .spacer { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 8px currentColor; }
.chip {
  font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--panel-3);
  color: var(--dim); border: 1px solid var(--line-2); white-space: nowrap;
}
.kv { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.kv span { color: var(--dim); }
.kv b { font-weight: 600; text-align: right; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.radio-list { border-top: 1px dashed var(--line-2); margin: 4px 0 8px; padding-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.radio-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 3px 4px; border-radius: 6px; cursor: pointer; }
.radio-row:hover { background: var(--panel-3); }
.rr-name { font-weight: 600; }
.rr-meta { color: var(--dim); font-family: var(--mono); font-size: 10.5px; }
.tag { font-size: 9.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--dim); }
.tag-ok { color: var(--ok); border-color: rgba(52, 211, 153, .45); }
.empty-state {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 16px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--dim); background: rgba(16, 26, 46, .4);
}
.empty-state b { color: var(--text); }
.empty-state.ok { border-color: rgba(52, 211, 153, .35); }

/* ---------------- analysis ---------------- */
.findings-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 4px; }
.sev { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px; text-align: center; }
.sev b { display: block; font-size: 17px; }
.sev span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.sev-critical b { color: var(--bad); }
.sev-high b { color: #fb923c; }
.sev-medium b { color: var(--warn); }
.sev-low b { color: var(--ok); }
.finding { border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; background: var(--panel-2); }
.finding.sev-critical { border-left-color: var(--bad); }
.finding.sev-high { border-left-color: #fb923c; }
.finding.sev-medium { border-left-color: var(--warn); }
.finding.sev-low { border-left-color: var(--ok); }
.finding-head { display: flex; gap: 7px; align-items: center; margin-bottom: 4px; }
.finding-head b { font-size: 12.5px; }
.sev-pill { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; background: var(--panel-3); color: var(--dim); }
.finding-detail { font-size: 12px; color: var(--text); opacity: .9; }
.finding-meta { font-size: 10.5px; color: var(--dim-2); font-family: var(--mono); margin-top: 3px; }
.finding-advice { font-size: 11.5px; color: var(--accent); margin-top: 4px; }
.study { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; background: var(--panel-2); }
.study-head { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.progress-line { font-size: 11px; color: var(--accent); font-family: var(--mono); min-height: 14px; }
.chart { background: #060b14; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.profile-svg { width: 100%; height: 260px; display: block; }

/* ---------------- settings ---------------- */
.setting { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 11px; margin-bottom: 10px; background: var(--panel-2); }
.setting h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.field { display: block; margin-bottom: 8px; font-size: 11.5px; color: var(--dim); }
.field > span { display: block; margin-bottom: 3px; }
.field input[type=text], .field input[type=number], .field select, .field textarea {
  width: 100%; background: #060b14; border: 1px solid var(--line-2); border-radius: 7px;
  padding: 8px 9px; min-height: 36px; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field .val { color: var(--accent); font-family: var(--mono); font-size: 11px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 7px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.hint { font-size: 11px; color: var(--dim-2); margin: 6px 0; line-height: 1.4; }
.dim { color: var(--dim-2) !important; }
.calc { background: #060b14; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 10px; margin: 10px 0 12px; }
.calc > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.calc span { color: var(--dim); }
.calc b { color: var(--accent); font-family: var(--mono); }
.row-2 { display: flex; gap: 8px; }
.row-2 > * { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }

/* ---------------- modals ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(3, 6, 12, .68); backdrop-filter: blur(2px);
}
.modal.active { display: flex; }
.modal-content {
  background: var(--panel); border: 1px solid var(--line-2); border-bottom: none;
  width: 100%; max-width: 640px; max-height: 92vh; display: flex; flex-direction: column;
  border-radius: 14px 14px 0 0; box-shadow: var(--shadow-2);
  animation: sheetUp .26s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.modal-content.narrow { max-width: 420px; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px;
  border-bottom: 1px solid var(--line); background: var(--bg-2);
  border-radius: 14px 14px 0 0;
}
.modal-sub { font-size: 11px; color: var(--dim); font-family: var(--mono); }
.modal-head .modal-close { margin-left: auto; }
.modal-body { padding: 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-actions {
  position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0 2px;
  background: linear-gradient(180deg, rgba(11,18,32,0) 0%, var(--panel) 40%);
}
.modal-actions .btn-primary {
  order: 2; flex: 1;
}
.modal-actions .btn-secondary { order: 3; flex: 1; }
.modal-actions .btn-danger { order: 1; flex: 1; }
.confirm-text { color: var(--dim); font-size: 13px; margin: 4px 0 12px; }

.search-results { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 45vh; overflow-y: auto; }
.search-hit { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); cursor: pointer; }
.search-hit:hover { border-color: var(--accent); }
.search-hit b { display: block; font-size: 12.5px; }
.search-hit span { font-size: 11px; color: var(--dim); }

/* ---------------- toasts ---------------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(11, 18, 32, .96); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  padding: 9px 13px; border-radius: var(--radius-sm); font-size: 12.5px; max-width: 90vw;
  box-shadow: var(--shadow-2); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }

/* ---------------- bottom nav (mobile) ---------------- */
.mnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; background: rgba(8, 13, 24, .97); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(8px);
}
.mnav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 9px; background: transparent; border: none; color: var(--dim);
  font-size: 10px; cursor: pointer; min-height: 54px;
}
.mnav-btn span { font-size: 16px; line-height: 1; }
.mnav-btn.active { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

/* map attribution/controls above the nav */
.maplibregl-ctrl-attrib { font-size: 10px; background: rgba(5, 7, 13, .7) !important; }
.maplibregl-ctrl-attrib a { color: var(--dim) !important; }
.maplibregl-ctrl-group { background: rgba(11, 18, 32, .92) !important; border: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg) brightness(.9); }

/* ---------------- desktop ---------------- */
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .modal { align-items: center; }
  .modal-content { border-radius: 14px; border-bottom: 1px solid var(--line-2); max-height: 88vh; }
  .modal-content.wide { max-width: 780px; }
  /* plenty of room: the header actions live inline, no overflow menu */
  .hdr-extra { display: flex; }
  #btnMore, .more-menu { display: none !important; }
  #btnSearch .ico { display: none; }
}

@media (max-width: 699px) {
  #btnSearch .lbl { display: none; }
  #btnSearch .ico { font-size: 17px; line-height: 1; }
  #btnSearch { padding: 7px 10px; }
  .hdr-project { max-width: 26vw; }
  .btn-sm { padding: 7px 10px; }
}

@media (min-width: 1024px) {
  :root { --header-h: 56px; --nav-h: 0px; }
  .app-main { display: flex; }
  .panel {
    position: relative; inset: auto; transform: none; width: 384px; flex: 0 0 384px;
    padding-bottom: 0; z-index: 20;
  }
  .tabs { overflow: visible; }
  #btnClosePanel, .sheet-toggle { display: none; }
  .mnav { display: none; }
  .map-readout { bottom: 46px; }
  .modal-actions { padding-bottom: 6px; }
}

/* ================= cloud, account and sync chrome =================
   Uses the existing tokens on purpose: restyling the theme re-colours these
   surfaces automatically without touching this block again. */

.sync-chip {
  position: fixed; right: 10px; z-index: 26;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  border-radius: 999px; background: rgba(11, 18, 32, .92); border: 1px solid var(--line-2);
  color: var(--dim); font-size: 11px; cursor: pointer; box-shadow: var(--shadow-1);
  backdrop-filter: blur(6px);
}
.sync-chip:hover { color: var(--text); border-color: var(--accent); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim-2); flex: 0 0 auto; }
.sync-chip.local .sync-dot { background: var(--dim-2); }
.sync-chip.synced .sync-dot { background: var(--ok); box-shadow: 0 0 9px var(--ok); }
.sync-chip.syncing .sync-dot { background: var(--accent); box-shadow: 0 0 9px var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.sync-chip.error .sync-dot { background: var(--bad); box-shadow: 0 0 9px var(--bad); }
@media (min-width: 1024px) { .sync-chip { bottom: 16px; right: 14px; } }

/* ---- auth gate ---- */
.auth-gate {
  position: fixed; inset: 0; z-index: 95; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% 0%, #0b1a2e 0%, #05070d 62%);
}
.auth-gate.active { display: flex; }
.auth-card {
  position: relative; overflow: hidden; width: 100%; max-width: 396px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: 24px 20px 18px;
}
.auth-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .028) 0 1px, transparent 1px 3px);
}
.auth-brand { text-align: center; color: var(--accent); margin-bottom: 20px; }
.auth-title {
  margin: 10px 0 3px; font-size: 21px; letter-spacing: .36em; color: var(--text);
  text-indent: .36em; font-weight: 700;
}
.auth-sub { margin: 0; color: var(--dim); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.auth-form { position: relative; z-index: 1; }
.auth-error {
  background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .42);
  color: #fecaca; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 12px; margin: 0 0 10px; line-height: 1.35;
}
.auth-foot { margin: 14px 0 0; text-align: center; color: var(--dim-2); font-size: 11px; line-height: 1.4; }
.auth-gate .modal-actions { background: none; padding: 4px 0 0; }

/* ---- account roster ---- */
.user-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-row .who { font-weight: 700; }
.user-row .spacer { flex: 1; }
.user-row.disabled { opacity: .6; }
.user-reset { display: flex; gap: 6px; width: 100%; margin-top: 6px; }
.user-reset input { flex: 1; }
