/* Archie (serg_ai) web app.
   Brand tokens: serg_ai brand-tokens v1.0.0 (Arch owns the source; copied values below, keep in sync).
   One loud thing: the drawing sheet. Everything around it is quiet night chrome.
   Amber is functional only: "check this" (low confidence, issues). */

@font-face { font-family: 'Inter Tight'; src: url('../fonts/inter-tight.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --sa-ink: #08111F; --sa-night: #0E1A2B; --sa-night-2: #13223A;
  --sa-surface: rgba(170, 195, 245, 0.06); --sa-glass-border: rgba(200, 218, 255, 0.13);
  --sa-hairline: rgba(170, 190, 225, 0.12); --sa-hairline-strong: rgba(170, 190, 225, 0.24);
  --sa-white: #EEF2FA; --sa-text: rgba(214, 224, 244, 0.78); --sa-muted: rgba(200, 214, 240, 0.62);
  --sa-red: #E0482F; --sa-blue: #125BF3; --sa-glow: #A8C2FF; --sa-on-light: #050A16;
  --sa-font-display: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  --sa-font-body: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  --sa-font-mono: 'Geist Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --sa-radius-sm: 4px; --sa-radius-md: 12px; --sa-radius-pill: 999px;
  --sa-ease: cubic-bezier(.2, .7, .2, 1); --sa-fast: 160ms; --sa-base: 320ms;
  /* app-only */
  --amber: #F2A93B; --amber-soft: rgba(242, 169, 59, 0.16); --ok: #5FD3A2;
  --paper: #FFFFFF; --rail-w: 56px; --panel-w: 340px; --bar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--sa-night); color: var(--sa-text);
  font: 15px/1.5 var(--sa-font-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--sa-font-display); color: var(--sa-white); letter-spacing: -0.015em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 600; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 600; }
h3 { font-size: 15px; line-height: 1.3; font-weight: 600; }
p { margin: 0 0 12px; max-width: 68ch; }
a { color: var(--sa-glow); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.num, .mono { font-family: var(--sa-font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--sa-muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--sa-glow); outline-offset: 2px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- controls */
button, .btn {
  font: 500 14px/1 var(--sa-font-body); color: var(--sa-white); cursor: pointer;
  background: var(--sa-surface); border: 1px solid var(--sa-glass-border);
  border-radius: var(--sa-radius-sm); padding: 9px 14px; display: inline-flex; gap: 8px; align-items: center;
  text-decoration: none; transition: background var(--sa-fast) var(--sa-ease), border-color var(--sa-fast) var(--sa-ease);
}
button:hover, .btn:hover { border-color: var(--sa-hairline-strong); background: rgba(170, 195, 245, 0.1); }
button.primary, .btn.primary { background: var(--sa-red); border-color: var(--sa-red); color: #fff; }
button.primary:hover, .btn.primary:hover { background: #E95B43; border-color: #E95B43; }
button.ghost { background: transparent; border-color: transparent; color: var(--sa-text); }
button.ghost:hover { color: var(--sa-white); background: var(--sa-surface); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: 6px 10px; font-size: 13px; }
input, select, textarea {
  font: 14px/1.4 var(--sa-font-body); color: var(--sa-white); background: var(--sa-ink);
  border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-sm); padding: 8px 10px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--sa-red); }
input[type=range] { padding: 0; accent-color: var(--sa-red); }
input[type=color] { padding: 2px; height: 34px; width: 52px; }
textarea { resize: vertical; min-height: 64px; }
label { display: block; font-size: 13px; color: var(--sa-muted); margin-bottom: 4px; }

/* ---------------------------------------------------------------- top bar */
.bar {
  height: var(--bar-h); display: flex; align-items: center; gap: 16px; padding: 0 16px;
  border-bottom: 1px solid var(--sa-hairline); background: var(--sa-ink); position: relative; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--sa-white); }
.brand .sa { font: 600 15px var(--sa-font-display); color: var(--sa-muted); }
.brand .sa:hover { color: var(--sa-white); }
.brand .name { font: 700 19px var(--sa-font-display); letter-spacing: -0.02em; }
.bar .project-name { font: 500 15px var(--sa-font-display); color: var(--sa-white); background: transparent; border: 1px solid transparent; width: auto; max-width: 260px; }
.bar .project-name:hover, .bar .project-name:focus { border-color: var(--sa-glass-border); }
.steps { display: flex; gap: 2px; margin: 0 auto; }
.steps a {
  color: var(--sa-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--sa-radius-sm); font-size: 14px;
}
.steps a[aria-current=page] { color: var(--sa-white); background: var(--sa-surface); box-shadow: inset 0 -2px 0 var(--sa-red); }
.steps a:hover { color: var(--sa-white); }
.plan-pill { font-size: 12px; padding: 4px 10px; border-radius: var(--sa-radius-pill); border: 1px solid var(--sa-glass-border); color: var(--sa-text); white-space: nowrap; }
.bar .spacer { flex: 1; }

/* ---------------------------------------------------------------- pages */
.page { max-width: 1200px; margin: 0 auto; padding: 40px clamp(20px, 4vw, 56px) 80px; }
.page header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }

/* projects: each project is shown by its own drawing */
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 24px; }
.sheet-card { text-decoration: none; color: inherit; display: block; }
.sheet-card .thumb {
  aspect-ratio: 1.414; background: var(--paper); border-radius: 2px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 14px 30px -18px rgba(0,0,0,.8); display: grid; place-items: center;
  transition: transform var(--sa-base) var(--sa-ease);
}
.sheet-card:hover .thumb { transform: translateY(-2px) rotate(-0.4deg); }
.sheet-card .thumb svg { width: 88%; height: 88%; }
.sheet-card .thumb .empty { color: #8a93a6; font-size: 13px; }
.sheet-card .meta { display: flex; justify-content: space-between; margin-top: 10px; gap: 8px; }
.sheet-card .meta strong { color: var(--sa-white); font-weight: 500; }

.dropzone {
  border: 1.5px dashed var(--sa-hairline-strong); border-radius: var(--sa-radius-md); padding: 28px;
  display: grid; gap: 14px; justify-items: start; background: var(--sa-surface);
}
.dropzone.drag { border-color: var(--sa-red); background: rgba(229, 72, 59, 0.08); }
.demo-row { display: flex; gap: 12px; flex-wrap: wrap; }
.demo-row button img { width: 64px; height: 45px; object-fit: cover; border-radius: 2px; background: #fff; }

/* ---------------------------------------------------------------- workspace */
.workspace { display: grid; grid-template-columns: var(--rail-w) 1fr var(--panel-w); height: calc(100vh - var(--bar-h)); }
.workspace.no-rail { grid-template-columns: 1fr var(--panel-w); }
.rail { border-right: 1px solid var(--sa-hairline); display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; background: var(--sa-ink); }
.rail button { width: 40px; height: 40px; padding: 0; justify-content: center; background: transparent; border-color: transparent; color: var(--sa-text); }
.rail button svg { width: 20px; height: 20px; }
.rail button[aria-pressed=true] { background: var(--sa-surface); color: var(--sa-white); box-shadow: inset 2px 0 0 var(--sa-red); }
.rail hr { border: 0; border-top: 1px solid var(--sa-hairline); width: 100%; margin: 6px 0; }

.table { position: relative; overflow: hidden; background:
  radial-gradient(120% 90% at 50% 40%, var(--sa-night-2), var(--sa-night) 70%); }
.table .canvas { position: absolute; inset: 0; touch-action: none; }
.table .canvas.tool-select { cursor: default; }
.table .canvas.tool-wall, .table .canvas.tool-dim, .table .canvas.tool-measure, .table .canvas.tool-room { cursor: crosshair; }
.table .canvas.panning { cursor: grabbing; }
.overlay-toggle { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 2px; background: var(--sa-ink); border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-sm); padding: 2px; }
.overlay-toggle button { border: 0; padding: 7px 10px; font-size: 13px; background: transparent; }
.overlay-toggle button[aria-pressed=true] { background: var(--sa-surface); color: var(--sa-white); }
.zoom-ctrl { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 2px; background: var(--sa-ink); border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-sm); padding: 2px; }
.zoom-ctrl button { border: 0; background: transparent; min-width: 32px; justify-content: center; }
.hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--sa-ink); border: 1px solid var(--sa-glass-border);
  padding: 7px 12px; border-radius: var(--sa-radius-pill); font-size: 13px; color: var(--sa-white); pointer-events: none; white-space: nowrap; }

/* plan rendering on the sheet (world mm, y up; SVG flips) */
.plan-svg .paper { fill: var(--paper); }
.plan-svg .room { fill: transparent; }
.plan-svg .room.fill { fill: rgba(20, 40, 80, 0.035); }
.plan-svg .wall { fill: #1b1f27; stroke: none; }
.plan-svg .wall.low { fill: url(#hatch); }
.plan-svg .wall-hit { stroke: transparent; fill: none; cursor: pointer; }
.plan-svg .wall-hit:hover + .wall-outline, .plan-svg .wall-outline.sel { stroke: var(--sa-red); }
.plan-svg .wall-outline { fill: none; stroke: transparent; pointer-events: none; }
.plan-svg .opening-gap { fill: var(--paper); }
.plan-svg .door-leaf, .plan-svg .door-swing, .plan-svg .window-line { fill: none; stroke: #1b1f27; }
.plan-svg .door-swing { stroke-dasharray: 60 40; stroke: #555; }
.plan-svg .opening-hit { fill: transparent; cursor: pointer; }
.plan-svg .opening-hit.sel { fill: rgba(229, 72, 59, 0.25); }
.plan-svg .node { fill: #fff; stroke: #1b1f27; cursor: grab; }
.plan-svg .node.locked { fill: #1b1f27; }
.plan-svg .node.sel, .plan-svg .node:hover { fill: var(--sa-red); stroke: var(--sa-red); }
.plan-svg .lowconf { stroke: var(--amber); fill: var(--amber-soft); }
.plan-svg .lowconf-pulse { fill: none; stroke: var(--amber); animation: pulse 1.8s var(--sa-ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
.plan-svg .label { font-family: var(--sa-font-body); fill: #1b1f27; text-anchor: middle; dominant-baseline: middle; cursor: pointer; }
.plan-svg .label .area { font-family: var(--sa-font-mono); fill: #5b6375; }
.plan-svg .label.sel { fill: var(--sa-red); }
.plan-svg .dim line { stroke: #4b5468; }
.plan-svg .dim text { font-family: var(--sa-font-mono); fill: #2f3747; text-anchor: middle; }
.plan-svg .dim.conflict line { stroke: var(--sa-red); }
.plan-svg .dim.conflict text { fill: var(--sa-red); }
.plan-svg .dim .dim-hit { stroke: transparent; cursor: pointer; }
.plan-svg .issue-mark { fill: none; stroke: var(--sa-red); stroke-dasharray: 80 50; }
.plan-svg .ghost { stroke: var(--sa-red); stroke-dasharray: 80 60; fill: none; }
.plan-svg .snap-dot { fill: var(--sa-red); }
.plan-svg .grid line { stroke: rgba(30, 60, 120, 0.07); }
.plan-svg .fixture { fill: none; stroke: #8a93a6; }
.plan-svg .constraint { fill: var(--sa-blue); opacity: .7; }

/* ---------------------------------------------------------------- inspector panel */
.panel { border-left: 1px solid var(--sa-hairline); background: var(--sa-ink); overflow-y: auto; display: flex; flex-direction: column; }
.panel section { padding: 18px; border-bottom: 1px solid var(--sa-hairline); }
.panel section > h3 { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.panel .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.panel .row.one { grid-template-columns: 1fr; }
.panel .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issues li button {
  width: 100%; text-align: left; display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: start;
  background: transparent; border: 1px solid var(--sa-hairline); padding: 9px 10px; line-height: 1.35; font-weight: 400; color: var(--sa-text);
}
.issues li button:hover { border-color: var(--sa-hairline-strong); }
.issues .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--amber); }
.issues .error .dot { background: var(--sa-red); }
.issues .info .dot { background: var(--sa-glow); }
.ask { display: grid; gap: 8px; }
.ask .reply { font-size: 14px; color: var(--sa-white); background: var(--sa-surface); border-radius: var(--sa-radius-sm); padding: 10px 12px; }
.ask .options { display: grid; gap: 6px; }
.versions { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; max-height: 220px; overflow-y: auto; }
.versions li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 6px; border-radius: 3px; }
.versions li.current { background: var(--sa-surface); color: var(--sa-white); }
.versions button { padding: 3px 8px; font-size: 12px; }
.empty-state { padding: 18px; color: var(--sa-muted); }

/* progress while reading */
.reading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(14, 26, 43, 0.78); z-index: 3; min-height: 340px; padding: 16px; }
.reading .elapsed { font-variant-numeric: tabular-nums; color: var(--sa-white); }
.reading .card { background: var(--sa-ink); border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-md); padding: 24px 28px; min-width: 300px; display: grid; gap: 10px; }
.reading .steps-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.reading .steps-list li { display: flex; gap: 10px; align-items: center; color: var(--sa-muted); }
.reading .steps-list li.done { color: var(--sa-white); }
.reading .steps-list li.active { color: var(--sa-white); }
.reading .steps-list li .tick { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--sa-hairline-strong); }
.reading .steps-list li.done .tick { background: var(--ok); border-color: var(--ok); }
.reading .steps-list li.active .tick { border-color: var(--sa-red); border-top-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- settings */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 40px; }
.settings-nav { position: sticky; top: 24px; align-self: start; display: grid; gap: 2px; }
.settings-nav a { color: var(--sa-muted); text-decoration: none; padding: 7px 10px; border-radius: var(--sa-radius-sm); }
.settings-nav a.active, .settings-nav a:hover { color: var(--sa-white); background: var(--sa-surface); }
.settings-group { margin-bottom: 48px; scroll-margin-top: 24px; }
.settings-group > header { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 6px; }
.settings-group > p { margin-bottom: 18px; }
.settings-section { border-top: 1px solid var(--sa-hairline); padding: 16px 0 6px; }
.settings-section > h3 { margin-bottom: 12px; color: var(--sa-text); font-weight: 500; }
.field { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.1fr) 92px; gap: 16px; align-items: start; padding: 10px 0; }
.field .label-col label { color: var(--sa-white); font-size: 14px; margin: 0; }
.field .label-col .help { font-size: 13px; color: var(--sa-muted); margin-top: 3px; max-width: 46ch; }
.field .src { font-size: 12px; color: var(--sa-muted); margin-top: 4px; }
.field .src.project { color: var(--sa-glow); }
.field .src.account { color: var(--sa-text); }
.field .src.plan { color: var(--amber); }
.field .reset-col { text-align: right; }
.field .input-unit { display: flex; align-items: center; gap: 8px; }
.field .input-unit span { color: var(--sa-muted); font-size: 13px; white-space: nowrap; }
.field .checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.field .checks label { display: flex; gap: 6px; align-items: center; color: var(--sa-text); margin: 0; font-size: 14px; }
.field.locked { opacity: .75; }
.lock { font-size: 12px; color: var(--amber); display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
.field.error input, .field.error select { border-color: var(--sa-red); }
.field .err { color: var(--sa-red); font-size: 13px; margin-top: 4px; }
.room-map { display: grid; gap: 6px; }
.room-map .room-row { display: grid; grid-template-columns: 1fr 110px 30px; gap: 8px; align-items: center; }
.scope-switch { display: flex; gap: 2px; background: var(--sa-ink); border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-sm); padding: 2px; }
.scope-switch button { border: 0; background: transparent; padding: 7px 12px; }
.scope-switch button[aria-pressed=true] { background: var(--sa-surface); color: var(--sa-white); }

/* ---------------------------------------------------------------- style + export + 3d */
.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.style-choice { background: transparent; border: 1px solid var(--sa-hairline); padding: 6px; display: grid; gap: 6px; text-align: left; border-radius: var(--sa-radius-sm); }
.style-choice[aria-pressed=true] { border-color: var(--sa-red); box-shadow: 0 0 0 1px var(--sa-red); }
.style-choice .sw { aspect-ratio: 1.414; border-radius: 2px; overflow: hidden; display: grid; place-items: center; }
.style-choice .sw img, .style-choice .sw svg { width: 100%; height: 100%; object-fit: contain; }
.sheet-view { position: absolute; inset: 0; overflow: auto; display: grid; place-items: center; padding: 32px; }
.sheet-view .sheet { background: var(--paper); box-shadow: 0 24px 60px -30px rgba(0,0,0,.9); max-width: 100%; }
.sheet-view .sheet img, .sheet-view .sheet svg { display: block; max-width: min(1100px, 100%); height: auto; }
.viewer { position: absolute; inset: 0; }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.formats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; }
.formats label { display: flex; gap: 8px; align-items: center; color: var(--sa-text); font-size: 14px; margin: 0; }
.formats label .muted { font-size: 12px; margin-left: -4px; }
.artifacts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.artifacts a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--sa-hairline); border-radius: var(--sa-radius-sm); text-decoration: none; color: var(--sa-white); }
.artifacts a:hover { border-color: var(--sa-hairline-strong); }
.notice { border-left: 2px solid var(--amber); padding: 8px 12px; background: var(--amber-soft); color: var(--sa-white); font-size: 14px; border-radius: 0 var(--sa-radius-sm) var(--sa-radius-sm) 0; }
.notice.error { border-color: var(--sa-red); background: rgba(229, 72, 59, 0.12); }
.disclaimer { font-size: 12px; color: var(--sa-muted); }

/* toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--sa-ink); border: 1px solid var(--sa-glass-border); color: var(--sa-white); padding: 10px 14px; border-radius: var(--sa-radius-sm); box-shadow: 0 10px 30px -10px rgba(0,0,0,.8); display: flex; gap: 12px; align-items: center; }
.toast.error { border-color: var(--sa-red); }

/* login */
.login { min-height: calc(100vh - var(--bar-h)); display: grid; place-items: center; padding: 24px; }
.login .box { width: min(420px, 100%); display: grid; gap: 14px; }
.login .plans { display: flex; gap: 8px; flex-wrap: wrap; }
.login .example { margin: 4px 0 2px; }
.login .example img { width: 100%; height: auto; display: block; border-radius: var(--sa-radius-md); background: #fff; }
.login .example figcaption { display: grid; grid-template-columns: repeat(3, 1fr); font-size: 12px; color: var(--sa-muted, #8B97AB); margin-top: 6px; }
.login .example figcaption span:nth-child(2) { text-align: center; }
.login .example figcaption span:nth-child(3) { text-align: right; }
.login:has(.example) .box { width: min(560px, 100%); }
.issues details { margin-top: 8px; }
.issues details summary { cursor: pointer; color: var(--sa-muted, #8B97AB); font-size: 13px; padding: 4px 0; }
.artifacts details summary { cursor: pointer; padding: 8px 0; }
.artifacts .main a strong { font-weight: 600; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 900px) {
  /* the steps get their own scrollable row so 3D / Style / Export are always reachable on a phone */
  .bar { flex-wrap: wrap; height: auto; min-height: var(--bar-h); row-gap: 0; padding-top: 8px; }
  .bar .spacer { flex: 1; }
  .steps { order: 3; width: calc(100% + 32px); margin: 8px -16px 0; padding: 0 12px; overflow-x: auto; scrollbar-width: none;
           border-top: 1px solid var(--sa-hairline); justify-content: space-between; }
  .steps a { padding: 12px 10px; white-space: nowrap; }
  .bar .project-name, .plan-pill { display: none; }
  .bar > .btn { margin-left: auto; }
  .login { place-items: start center; padding-top: 28px; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 62vh auto; height: auto; }
  .workspace.no-rail { grid-template-columns: 1fr; grid-template-rows: 62vh auto; height: auto; }
  .workspace.no-rail.empty { grid-template-rows: auto; }
  .workspace.no-rail.empty .table { display: none; }
  .reading .card { min-width: 0; width: 100%; }
  .page header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--sa-hairline); overflow-x: auto; }
  .rail hr { width: 0; height: 28px; margin: 6px 4px; border-top: 0; border-left: 1px solid var(--sa-hairline); align-self: center; }
  .rail button[aria-pressed=true] { box-shadow: inset 0 -2px 0 var(--sa-red); }
  .panel { border-left: 0; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .field { grid-template-columns: 1fr; gap: 6px; }
  .field .reset-col { text-align: left; }
}

/* dialogs */
dialog { background: var(--sa-ink); color: var(--sa-text); border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-md); padding: 0; min-width: min(380px, 92vw); }
dialog::backdrop { background: rgba(2, 4, 10, 0.6); }
.dlg { padding: 20px; display: grid; gap: 12px; }
.dlg .actions { display: flex; justify-content: flex-end; gap: 8px; }

.bfield { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }

/* first-run */
.hero { border: 1px solid var(--sa-glass-border); border-radius: var(--sa-radius-md); background: var(--sa-surface); padding: 28px; display: grid; gap: 18px; max-width: 760px; }
.hero h1 { font-size: 26px; }
.hero ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hero ol li { border-top: 2px solid var(--sa-blue); padding-top: 10px; color: var(--sa-text); }
.hero ol li strong { display: block; color: var(--sa-white); font-family: var(--sa-font-display); }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 900px) { .hero { padding: 20px; } .hero ol { grid-template-columns: 1fr; } }
.tabs { display: flex; gap: 4px; margin: 16px 0; border-bottom: 1px solid var(--sa-hairline); }
.tabs button { background: transparent; border: 0; border-radius: 0; padding: 10px 12px; color: var(--sa-muted); }
.tabs button[aria-selected=true] { color: var(--sa-white); box-shadow: inset 0 -2px 0 var(--sa-blue); }
.login form .row { margin-bottom: 12px; }
.badge { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: var(--sa-radius-pill); background: rgba(18, 91, 243, 0.18); color: var(--sa-glow); }

button.linkish { background: none; border: 0; padding: 0; color: var(--sa-white); text-decoration: underline; font: inherit; cursor: pointer; min-height: 0; }
