/* ==========================================================================
   VastuCraft — product stylesheet
   Paper-and-ink drafting aesthetic. Light by default, dark on request.
   ========================================================================== */

:root {
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: 'Instrument Serif', Georgia, serif;

  --bg: #f4f2ee;            /* app canvas */
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #efede8;
  --paper: #fbfaf7;         /* drawing paper */
  --line: #e3dfd7;
  --line-strong: #cfc9bf;
  --ink: #1b1a18;
  --ink-2: #4f4b45;
  --ink-3: #8a847b;
  --accent: #b5471f;        /* brick */
  --accent-ink: #8f3715;
  --accent-soft: #f6e4db;
  --green: #2f7a4f;
  --green-soft: #e1f0e6;
  --amber: #b7791f;
  --amber-soft: #f8edd6;
  --red: #b23b3b;
  --red-soft: #f6e0e0;
  --blue: #2d5b8e;
  --blue-soft: #e2ebf5;
  --focus: 0 0 0 3px rgba(181, 71, 31, 0.22);
  --shadow-1: 0 1px 2px rgba(27, 26, 24, 0.06), 0 1px 0 rgba(27, 26, 24, 0.03);
  --shadow-2: 0 6px 20px -8px rgba(27, 26, 24, 0.22), 0 2px 6px rgba(27, 26, 24, 0.06);
  --shadow-3: 0 24px 60px -20px rgba(27, 26, 24, 0.35);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  /* plan drawing */
  --pv-paper: #fbfaf7;
  --pv-grid: rgba(27, 26, 24, 0.045);
  --pv-plot: #f1f4ea;
  --pv-plot-line: #6b6a65;
  --pv-setback: #b5471f;
  --pv-wall: #1b1a18;
  --pv-wall-int: #2c2a27;
  --pv-rail: #5f7f93;
  --pv-parapet: #6d6a64;
  --pv-cut: #fbfaf7;
  --pv-door: #1b1a18;
  --pv-swing: #6b6a65;
  --pv-glass: #3a7bb7;
  --pv-frame: #1b1a18;
  --pv-fx: #6a655d;
  --pv-fx-faint: #b9b3a8;
  --pv-text: #1b1a18;
  --pv-text-2: #5f5a53;
  --pv-dim: #8a4a30;
  --pv-road: #e4e1da;
  --pv-road-line: #b9b4a9;
  --pv-grass: #b9c9a1;
  --pv-vastu: #7a4ea3;
  --tint-living: #f3ede1;
  --tint-dining: #f5efe3;
  --tint-kitchen: #f8e7d6;
  --tint-bedroom: #e9ecf3;
  --tint-bath: #e3edf1;
  --tint-pooja: #fbeccd;
  --tint-stair: #ebe9e4;
  --tint-porch: #ecebe7;
  --tint-open: #e6efe3;
  --tint-office: #eae7f2;
  --tint-store: #f0ede8;
  --tint-court: #e3efe0;
  --tint-void: #f5f3ee;
}

:root[data-theme="dark"] {
  --bg: #121315;
  --surface: #1a1c1f;
  --surface-2: #202326;
  --surface-3: #272a2e;
  --paper: #15171a;
  --line: #2b2f34;
  --line-strong: #3a3f45;
  --ink: #f1efe9;
  --ink-2: #c9c4bb;
  --ink-3: #8a857c;
  --accent: #e2714a;
  --accent-ink: #f1906f;
  --accent-soft: #3a241c;
  --green: #5cbf86;
  --green-soft: #1d2f25;
  --amber: #e0a94b;
  --amber-soft: #352a16;
  --red: #e26b6b;
  --red-soft: #3a2020;
  --blue: #6ea3dd;
  --blue-soft: #1f2a38;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 24px 60px -20px rgba(0, 0, 0, 0.8);

  --pv-paper: #15171a;
  --pv-grid: rgba(255, 255, 255, 0.05);
  --pv-plot: #1a1f1b;
  --pv-plot-line: #8c8a84;
  --pv-setback: #e2714a;
  --pv-wall: #f1efe9;
  --pv-wall-int: #d8d4cc;
  --pv-rail: #7fa7bf;
  --pv-parapet: #9a968e;
  --pv-cut: #15171a;
  --pv-door: #f1efe9;
  --pv-swing: #a7a39b;
  --pv-glass: #6cb2f0;
  --pv-frame: #f1efe9;
  --pv-fx: #a9a398;
  --pv-fx-faint: #5a5852;
  --pv-text: #f1efe9;
  --pv-text-2: #b3ada3;
  --pv-dim: #e8a88c;
  --pv-road: #1f2124;
  --pv-road-line: #4a4d52;
  --pv-grass: #2b3a2a;
  --pv-vastu: #b58ee0;
  --tint-living: #262320;
  --tint-dining: #272421;
  --tint-kitchen: #2b241f;
  --tint-bedroom: #21242b;
  --tint-bath: #1f272b;
  --tint-pooja: #2e2a1e;
  --tint-stair: #232425;
  --tint-porch: #202122;
  --tint-open: #1f2520;
  --tint-office: #242230;
  --tint-store: #222322;
  --tint-court: #1f2a1f;
  --tint-void: #1b1d1f;
}

/* ───────────── base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font-ui); font-size: 13.5px; line-height: 1.45; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; border-radius: 8px; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
kbd { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; line-height: 14px; background: var(--surface); }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
svg.lucide, .lucide { width: 16px; height: 16px; stroke-width: 1.75; flex: none; }

/* ───────────── app frame ───────────── */
.app { display: grid; grid-template-columns: 344px minmax(0, 1fr) 316px; grid-template-rows: 54px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.app.inspector-collapsed { grid-template-columns: 344px minmax(0, 1fr) 0px; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 300px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--ink); color: var(--paper); }
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-family: var(--font-display); font-size: 21px; letter-spacing: -0.01em; line-height: 1; }
.brand-tag { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; padding-left: 10px; border-left: 1px solid var(--line); line-height: 1; }
.views { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin: 0 auto; }
.view-btn { display: flex; align-items: center; gap: 7px; padding: 6px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 12.5px; transition: background .15s, color .15s; }
.view-btn kbd { margin-left: 2px; display: none; }
.view-btn:hover { color: var(--ink); background: rgba(27, 26, 24, 0.05); }
.view-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.view-btn.is-active .lucide { color: var(--accent); }
:root[data-theme="dark"] .view-btn:hover { background: rgba(255, 255, 255, 0.06); }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 300px; justify-content: flex-end; }
.seg { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.seg button { border: 0; background: transparent; padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 12.5px; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: #2d2b28; }
:root[data-theme="dark"] .btn.primary { background: var(--ink); color: #121315; }
:root[data-theme="dark"] .btn.primary:hover { background: #ffffff; }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn.lg { padding: 11px 16px; font-size: 14px; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn.is-active { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* ───────────── sidebar ───────────── */
.sidebar { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.panel { padding: 16px 18px 18px; border-bottom: 1px solid var(--line); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.panel-title .step { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 600; display: grid; place-items: center; font-family: var(--font-mono); }
:root[data-theme="dark"] .panel-title .step { color: #121315; }
.panel-hint { font-size: 12px; color: var(--ink-3); margin: 0 0 12px; line-height: 1.4; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.field input[type="number"], .field input[type="text"], .field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 9px; font-size: 13px; color: var(--ink); transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.field .unit { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); pointer-events: none; }
.field .with-unit { position: relative; }
.field .with-unit input { padding-right: 30px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.gap { height: 10px; }
.readout { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-family: var(--font-mono); }
.readout strong { color: var(--ink-2); font-weight: 500; }

/* compass picker */
.compass { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 3px; width: 100%; aspect-ratio: 1; max-width: 104px; }
.compass button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.compass button:hover { border-color: var(--ink-3); }
.compass button.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
:root[data-theme="dark"] .compass button.is-active { color: #121315; }
.compass .centre { border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-3); pointer-events: none; }
.compass .centre .lucide { width: 18px; height: 18px; }

/* brief */
.brief-box textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.brief-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11.5px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.understood { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 20px; }
.understood .lbl { font-size: 11px; color: var(--ink-3); margin-right: 2px; }
.tok { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-weight: 500; }
.tok.off { background: var(--surface-3); color: var(--ink-3); text-decoration: line-through; }
.tok.warn { background: var(--amber-soft); color: var(--amber); }
.tok.claude { background: var(--blue-soft); color: var(--blue); }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 10px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); user-select: none; cursor: pointer; }
.toggle:hover { border-color: var(--ink-3); }
.toggle input { display: none; }
.toggle .sw { width: 28px; height: 16px; border-radius: 10px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.toggle .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle input:checked + .sw { background: var(--green); }
.toggle input:checked + .sw::after { transform: translateX(12px); }
.generate-wrap { padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: 0; z-index: 2; }

/* options */
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left; }
.option:hover { border-color: var(--ink-3); }
.option.is-active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.option-thumb { width: 92px; height: 92px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.option-thumb svg { width: 100%; height: 100%; display: block; }
.option-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.option-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.option-tag { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.option-stats { display: flex; gap: 10px; margin-top: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
.option-stats b { font-weight: 500; color: var(--ink); }
.option-stats .vs { color: var(--green); }
.option-stats .vs.mid { color: var(--amber); }
.option-stats .vs.low { color: var(--red); }
.refine-row { display: flex; gap: 6px; }
.refine-row input { flex: 1; }
.refine-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.error-box { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; line-height: 1.4; }

/* ───────────── stage ───────────── */
.stage { position: relative; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.stage-view { position: absolute; inset: 0; display: none; }
.stage-view.is-active { display: block; }
.stage-top { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; z-index: 10; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.floating { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-1); }
.floating .lbl { font-size: 11px; color: var(--ink-3); padding: 0 6px; }
.tool { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool.is-active { background: var(--ink); color: var(--paper); }
:root[data-theme="dark"] .tool.is-active { color: #121315; }
.tool .lucide { width: 14px; height: 14px; }
.tool-group { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 230px); }
.floor-btn .lvl { font-family: var(--font-mono); font-size: 10.5px; opacity: .7; }
.range-tool { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: 12px; color: var(--ink-2); }
.range-tool input[type="range"] { width: 84px; accent-color: var(--accent); }
.range-tool .val { font-family: var(--font-mono); font-size: 11px; min-width: 48px; text-align: right; white-space: nowrap; }

/* metrics strip */
.metrics { position: absolute; left: 14px; bottom: 14px; z-index: 10; display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); overflow: hidden; }
.metric { padding: 8px 14px; display: flex; flex-direction: column; gap: 1px; border-right: 1px solid var(--line); min-width: 96px; }
.metric:last-child { border-right: 0; }
.metric .k { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.metric .v { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--ink); }
.metric .v.good { color: var(--green); }
.metric .v.mid { color: var(--amber); }
.metric .v.low { color: var(--red); }

/* plan */
#plan-svg { width: 100%; height: 100%; display: block; background: var(--pv-paper); cursor: grab; touch-action: none; }
#plan-svg:active { cursor: grabbing; }
.zoom-ctl { position: absolute; right: 14px; bottom: 14px; z-index: 10; display: flex; flex-direction: column; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-1); }
.zoom-ctl button { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 6px; color: var(--ink-2); display: grid; place-items: center; }
.zoom-ctl button:hover { background: var(--surface-2); color: var(--ink); }
.legend { position: absolute; left: 14px; bottom: 76px; z-index: 9; display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 11px; color: var(--ink-2); max-width: 520px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.08); }

/* ── plan drawing styles (SVG) ── */
.pv-paper-bg { fill: var(--pv-paper); }
.pv-road { fill: var(--pv-road); }
.pv-road-centre { stroke: var(--pv-road-line); stroke-width: 1.5; stroke-dasharray: 10 8; }
.pv-road-text { fill: var(--ink-3); font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; }
.pv-plot { fill: var(--pv-plot); }
.pv-grass { opacity: .35; }
.pv-grass-line { stroke: var(--pv-grass); stroke-width: 1; fill: none; }
.pv-plot-line { fill: none; stroke: var(--pv-plot-line); stroke-width: 1.2; stroke-dasharray: 12 5 2 5; }
.pv-compound { fill: none; stroke: var(--pv-plot-line); stroke-width: 2.5; opacity: .45; }
.pv-setback { fill: none; stroke: var(--pv-setback); stroke-width: .9; stroke-dasharray: 6 4; opacity: .8; }
.pv-grid-line { stroke: var(--pv-grid); stroke-width: 1; fill: none; }
.pv-hatch-line { stroke: var(--pv-fx-faint); stroke-width: 1; }
.pv-dot { fill: var(--pv-fx-faint); }
.pv-tile-line { stroke: var(--pv-fx-faint); stroke-width: .7; fill: none; opacity: .7; }
.pv-room-fill { fill: var(--tint-living); stroke: none; transition: filter .12s; }
.t-living .pv-room-fill { fill: var(--tint-living); }
.t-dining .pv-room-fill, .t-lounge .pv-room-fill { fill: var(--tint-dining); }
.t-kitchen .pv-room-fill, .t-utility .pv-room-fill { fill: var(--tint-kitchen); }
.t-bedroom .pv-room-fill, .t-dressing .pv-room-fill { fill: var(--tint-bedroom); }
.t-bath .pv-room-fill, .t-toilet .pv-room-fill { fill: var(--tint-bath); }
.t-pooja .pv-room-fill { fill: var(--tint-pooja); }
.t-stair .pv-room-fill, .t-headroom .pv-room-fill, .t-passage .pv-room-fill { fill: var(--tint-stair); }
.t-porch .pv-room-fill, .t-entry .pv-room-fill { fill: var(--tint-porch); }
.t-balcony .pv-room-fill, .t-terrace .pv-room-fill { fill: var(--tint-open); }
.t-office .pv-room-fill { fill: var(--tint-office); }
.t-store .pv-room-fill, .t-tank .pv-room-fill { fill: var(--tint-store); }
.t-courtyard .pv-room-fill { fill: var(--tint-court); }
.t-void .pv-room-fill { fill: var(--tint-void); }
.t-solar .pv-room-fill, .t-pergola .pv-room-fill { fill: transparent; }
.pv-room { cursor: pointer; }
.pv-room:hover .pv-room-fill { filter: brightness(.96); }
:root[data-theme="dark"] .pv-room:hover .pv-room-fill { filter: brightness(1.25); }
.pv-room.is-selected .pv-room-fill { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 5 3; }
.pv-room.is-bg { cursor: default; }
.pv-void-x { stroke: var(--pv-fx-faint); stroke-width: 1; }
.pv-column { fill: var(--pv-wall); }
.pv-wall { fill: var(--pv-wall); }
.pv-wall.k-int { fill: var(--pv-wall-int); }
.pv-wall.k-rail { fill: var(--pv-rail); }
.pv-wall.k-parapet { fill: var(--pv-parapet); }
.pv-cut { fill: var(--pv-cut); }
.pv-leaf { stroke: var(--pv-door); stroke-width: 2.2; stroke-linecap: round; }
.pv-leaf-main { stroke-width: 3; }
.pv-swing { fill: none; stroke: var(--pv-swing); stroke-width: .8; stroke-dasharray: 3 2; }
.pv-open-line { stroke: var(--pv-swing); stroke-width: .8; stroke-dasharray: 2 3; }
.pv-arch-line { stroke: var(--pv-swing); stroke-width: 1; stroke-dasharray: 5 3; }
.pv-glass { stroke: var(--pv-glass); stroke-width: 1.2; }
.pv-frame { stroke: var(--pv-frame); stroke-width: 1; }
.pv-vent .pv-glass { stroke-dasharray: 2 2; }
.pv-step { fill: none; stroke: var(--pv-fx-faint); stroke-width: 1; }
.pv-label-name { fill: var(--pv-text); font-family: var(--font-ui); font-size: 11px; font-weight: 600; letter-spacing: -.01em; pointer-events: none; }
.pv-label.is-small .pv-label-name { font-size: 8.5px; }
.pv-label-dim { fill: var(--pv-text-2); font-family: var(--font-mono); font-size: 8.5px; pointer-events: none; }
.pv-label.is-small .pv-label-dim { font-size: 7px; }
.pv-label-area { fill: var(--pv-text-2); font-family: var(--font-mono); font-size: 7.5px; pointer-events: none; }
.pv-fx { fill: none; stroke: var(--pv-fx); stroke-width: 1; }
.pv-fx-solid { fill: var(--pv-fx); stroke: none; opacity: .55; }
.pv-fx-faint { fill: none; stroke: var(--pv-fx-faint); stroke-width: .8; }
.pv-fx-green { fill: none; stroke: #6c9a5b; stroke-width: 1; }
.pv-fx-gold { fill: none; stroke: #b7791f; stroke-width: 1.2; }
.pv-fx-blue { fill: none; stroke: #4a7bb7; stroke-width: 1; }
.pv-fx-arrow { stroke: var(--pv-text-2); stroke-width: 1.2; fill: none; }
.pv-fx-break { stroke: var(--pv-text); stroke-width: 1; }
.pv-fx-text { fill: var(--pv-text-2); font-family: var(--font-mono); font-size: 7px; }
.pv-dim { stroke: var(--pv-dim); stroke-width: .7; }
.pv-tick { stroke: var(--pv-dim); stroke-width: 1; }
.pv-ext { stroke: var(--pv-dim); stroke-width: .5; opacity: .6; }
.pv-dim-text { fill: var(--pv-dim); font-family: var(--font-mono); font-size: 8.5px; }
.pv-dim-text.is-small { font-size: 7.5px; }
.pv-sb-text { fill: var(--pv-setback); font-family: var(--font-mono); font-size: 7px; letter-spacing: .06em; opacity: .9; }
.pv-north-ring { fill: var(--pv-paper); stroke: var(--pv-text); stroke-width: 1; }
.pv-north-arrow { fill: var(--pv-text); }
.pv-north-tail { fill: none; stroke: var(--pv-text); stroke-width: .8; }
.pv-north-text { fill: var(--pv-text); font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.pv-scale-a { fill: var(--pv-text); }
.pv-scale-b { fill: var(--pv-paper); stroke: var(--pv-text); stroke-width: .8; }
.pv-scale-text { fill: var(--pv-text-2); font-family: var(--font-mono); font-size: 8px; }
.pv-disclaimer { fill: var(--pv-text-2); font-family: var(--font-mono); font-size: 7.5px; letter-spacing: .08em; }
.pv-vastu-cell { fill: none; stroke: var(--pv-vastu); stroke-width: .8; stroke-dasharray: 4 3; opacity: .7; }
.pv-vastu-cell.is-centre { fill: var(--pv-vastu); fill-opacity: .07; }
.pv-vastu-text { fill: var(--pv-vastu); font-family: var(--font-mono); font-size: 7.5px; letter-spacing: .04em; }
.pv-vastu-diag { stroke: var(--pv-vastu); stroke-width: .5; stroke-dasharray: 2 4; opacity: .5; }

/* 3D hosts */
.three-host { position: absolute; inset: 0; background: linear-gradient(#cfe0ef, #e9eef2); overflow: hidden; }
:root[data-theme="dark"] .three-host { background: linear-gradient(#1b2330, #0f1216); }
.three-host canvas { display: block; width: 100% !important; height: 100% !important; }
.hint { position: absolute; right: 14px; bottom: 14px; z-index: 9; max-width: calc(100% - 28px); padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.hint .lucide { width: 13px; height: 13px; color: var(--accent); }
.hint span { overflow: hidden; text-overflow: ellipsis; }

/* walk HUD */
.walk-hud { position: absolute; inset: 0; pointer-events: none; z-index: 9; }
.walk-hud > * { pointer-events: auto; }
.room-badge { position: absolute; top: 60px; left: 14px; display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-1); }
.room-badge .k { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.room-badge .v { font-weight: 600; font-size: 14px; }
.minimap { position: absolute; right: 14px; top: 60px; width: 200px; height: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-1); overflow: hidden; }
.minimap svg { width: 100%; height: 100%; display: block; }
.minimap .player { fill: var(--accent); }
.minimap .cone { fill: var(--accent); opacity: .25; }
.minimap-floors { position: absolute; right: 14px; top: 236px; }
.stairs-btn { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); }
.crosshair { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; transform: translate(-50%, -50%); pointer-events: none; }
.crosshair::before, .crosshair::after { content: ''; position: absolute; background: rgba(255,255,255,.85); mix-blend-mode: difference; }
.crosshair::before { left: 6px; top: 0; width: 2px; height: 14px; }
.crosshair::after { top: 6px; left: 0; width: 14px; height: 2px; }
.joystick { position: absolute; left: 24px; bottom: 90px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.35); border: 1px solid rgba(255,255,255,.6); backdrop-filter: blur(6px); display: none; touch-action: none; }
.joystick .knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-2); }
.room-chips { position: absolute; left: 14px; bottom: 14px; right: 230px; display: flex; flex-wrap: wrap; gap: 5px; }
.room-chips .chip { background: var(--surface); }
@media (pointer: coarse) { .joystick { display: block; } .room-chips { bottom: 14px; left: 150px; } }

/* VR */
.vr-panel { position: absolute; left: 14px; bottom: 14px; z-index: 9; width: 320px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.vr-panel h3 { margin: 0 0 4px; font-size: 14px; }
.vr-panel p { margin: 0 0 10px; font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.vr-panel .btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.vr-status { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.vr-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.vr-status.ok i { background: var(--green); }
.stereo-divider { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.6); z-index: 8; display: none; }
.is-stereo .stereo-divider { display: block; }

/* AR */
.ar-backdrop { position: absolute; inset: 0; overflow: hidden; background: #cbd5d8; }
.ar-backdrop video, .ar-backdrop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.ar-backdrop .ar-sample { position: absolute; inset: 0; background: linear-gradient(#9cc6e6 0%, #d6e6f0 48%, #8a9a6a 48.5%, #7d8d5c 70%, #6f7f50 100%); }
.ar-backdrop .ar-sample::before { content: ''; position: absolute; left: -10%; right: -10%; top: 48%; height: 12%; background: linear-gradient(#c9c4b7, #b5b0a3); transform: perspective(600px) rotateX(55deg); transform-origin: top; opacity: .9; }
.ar-backdrop .ar-sample::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 2px, transparent 2px 40px); }
.ar-backdrop.mode-camera video, .ar-backdrop.mode-photo img { display: block; }
.ar-backdrop.mode-camera .ar-sample, .ar-backdrop.mode-photo .ar-sample { display: none; }
#three-ar { background: transparent; }
.ar-panel { position: absolute; left: 14px; bottom: 14px; z-index: 9; width: 340px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.ar-panel h3 { margin: 0 0 8px; font-size: 14px; }
.ar-panel .src { display: flex; gap: 6px; margin-bottom: 10px; }
.ar-panel .range { display: grid; grid-template-columns: 64px 1fr 48px; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.ar-panel .range input { accent-color: var(--accent); width: 100%; }
.ar-panel .range .val { font-family: var(--font-mono); font-size: 11px; text-align: right; }
.ar-phone { position: absolute; right: 14px; bottom: 14px; z-index: 9; width: 260px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.ar-phone h3 { margin: 0 0 4px; font-size: 13.5px; }
.ar-phone p { margin: 0 0 8px; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.ar-phone .qr { width: 132px; height: 132px; background: #fff; border-radius: 6px; padding: 6px; margin: 0 auto 8px; display: grid; place-items: center; }
.ar-phone .qr canvas, .ar-phone .qr img { width: 120px; height: 120px; image-rendering: pixelated; }
.ar-phone model-viewer { width: 100%; height: 150px; border-radius: 8px; background: var(--surface-2); --poster-color: transparent; }
.ar-live-hint { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 9; }
.ar-reticle { position: absolute; left: 50%; top: 56%; width: 260px; height: 160px; transform: translate(-50%, -50%); pointer-events: none; z-index: 8; opacity: .5; }
.ar-reticle i { position: absolute; width: 22px; height: 22px; border: 2px solid #fff; mix-blend-mode: difference; }
.ar-reticle i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.ar-reticle i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.ar-reticle i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.ar-reticle i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }

/* cost */
#view-cost { overflow-y: auto; padding: 24px 28px 48px; }
.cost-wrap { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.cost-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cost-head h2 { font-family: var(--font-display); font-size: 28px; font-weight: 400; margin: 0; letter-spacing: -.01em; }
.cost-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }
.cost-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.card .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.card .v { font-family: var(--font-mono); font-size: 24px; font-weight: 500; letter-spacing: -.01em; }
.card .s { font-size: 12px; color: var(--ink-3); }
.card.hero { background: var(--ink); color: var(--paper); border-color: var(--ink); }
:root[data-theme="dark"] .card.hero { color: #121315; }
.card.hero .k, .card.hero .s { color: inherit; opacity: .7; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; }
.panel-card h3 { margin: 0 0 12px; font-size: 14.5px; font-weight: 600; }
.panel-card h3 small { font-weight: 400; color: var(--ink-3); margin-left: 8px; font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
table.t td .scope { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.cta { display: flex; justify-content: space-between; align-items: center; gap: 18px; background: var(--accent-soft); border: 1px solid transparent; border-radius: var(--radius-lg); padding: 20px 22px; }
.cta h3 { margin: 0 0 4px; font-size: 16px; }
.cta p { margin: 0; font-size: 13px; color: var(--ink-2); max-width: 560px; }
.sources { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.sources a { color: var(--ink-2); }
.compare-table td.best { color: var(--green); font-weight: 600; }

/* ───────────── inspector ───────────── */
.inspector { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.app.inspector-collapsed .inspector { display: none; }
.insp-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.insp-tabs button { flex: 1; padding: 11px 4px; border: 0; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.insp-tabs button.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.insp-body { overflow-y: auto; padding: 16px 18px; flex: 1; }
.insp-pane { display: none; }
.insp-pane.is-active { display: block; }
.empty { color: var(--ink-3); font-size: 12.5px; text-align: center; padding: 40px 10px; line-height: 1.5; }
.room-title { font-family: var(--font-display); font-size: 24px; line-height: 1.1; margin: 0 0 2px; }
.room-sub { font-size: 12px; color: var(--ink-3); margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 12.5px; }
.kv .k { color: var(--ink-3); }
.kv .v { text-align: right; font-family: var(--font-mono); font-size: 12px; }
.zone-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--amber-soft); color: var(--amber); font-weight: 500; }
.zone-pill.good { background: var(--green-soft); color: var(--green); }
.zone-pill.bad { background: var(--red-soft); color: var(--red); }
.sect { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.sect h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; }
.sched { width: 100%; border-collapse: collapse; font-size: 12px; }
.sched td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.sched td.num { text-align: right; font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
.sched tr.hdr td { color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; border-bottom: 1px solid var(--line-strong); }
.sched tr.total td { font-weight: 600; border-bottom: 0; }
.sched tr.row { cursor: pointer; }
.sched tr.row:hover td { background: var(--surface-2); }
.check { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.check:last-child { border-bottom: 0; }
.check .st { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.check .st .lucide { width: 11px; height: 11px; stroke-width: 2.5; }
.check.pass .st { background: var(--green-soft); color: var(--green); }
.check.warn .st { background: var(--amber-soft); color: var(--amber); }
.check.fail .st { background: var(--red-soft); color: var(--red); }
.check.info .st { background: var(--blue-soft); color: var(--blue); }
.check .l { font-weight: 500; }
.check .d { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }
.check .z { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); float: right; }
.score-ring { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.score-ring svg { width: 56px; height: 56px; }
.score-ring .num { font-family: var(--font-mono); font-size: 22px; font-weight: 500; }
.score-ring .lbl { font-size: 12px; color: var(--ink-3); }
.note { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); padding: 8px 10px; border-left: 2px solid var(--line-strong); margin-bottom: 8px; }
.note.ai { border-left-color: var(--accent); }

/* ───────────── generation overlay ───────────── */
.gen-overlay { position: absolute; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); }
.gen-overlay.is-active { display: flex; }
.gen-card { width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 20px 22px; }
.gen-card h3 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 400; font-size: 20px; }
.gen-steps { display: flex; flex-direction: column; gap: 8px; }
.gen-step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); }
.gen-step i { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.gen-step.doing { color: var(--ink); }
.gen-step.doing i { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.gen-step.done { color: var(--ink-2); }
.gen-step.done i { background: var(--green); border-color: var(--green); color: #fff; }
.gen-step.done i .lucide { width: 10px; height: 10px; stroke-width: 3; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── modals ───────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: rgba(20, 18, 16, 0.45); backdrop-filter: blur(4px); padding: 20px; }
.modal.is-open { display: flex; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-3); border: 1px solid var(--line); animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.export-list { display: flex; flex-direction: column; gap: 8px; }
.export-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; }
.export-item:hover { border-color: var(--ink-3); background: var(--surface-2); }
.export-item .ic { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-2); }
.export-item .t { font-weight: 600; font-size: 13px; }
.export-item .d { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.share-link { display: flex; gap: 6px; }
.share-link input { flex: 1; font-family: var(--font-mono); font-size: 12px; }
.modal-note { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ───────────── toast ───────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--ink); color: var(--paper); border-radius: 10px; box-shadow: var(--shadow-2); font-size: 12.5px; max-width: 360px; animation: toast-in .25s cubic-bezier(.2,.9,.3,1.2); }
:root[data-theme="dark"] .toast { background: #f1efe9; color: #121315; }
.toast .lucide { color: var(--accent); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ───────────── print ───────────── */
#print-root { display: none; }
@media print {
  @page { size: A3 landscape; margin: 10mm; }
  body { overflow: visible; background: #fff; }
  .app, .modal, .toasts { display: none !important; }
  #print-root { display: block; }
  .sheet { page-break-after: always; width: 100%; height: 95vh; display: grid; grid-template-rows: 1fr auto; font-family: var(--font-ui); color: #1b1a18; }
  .sheet svg { width: 100%; height: 100%; }
  .title-block { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.2fr; border: 1.5px solid #1b1a18; margin-top: 6mm; }
  .title-block > div { padding: 4mm 5mm; border-right: 1px solid #1b1a18; font-size: 10pt; }
  .title-block > div:last-child { border-right: 0; }
  .title-block .k { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .08em; color: #5f5a53; display: block; margin-bottom: 1mm; }
  .title-block .big { font-family: var(--font-display); font-size: 18pt; }
  .sheet table.t { font-size: 10pt; }
  .sheet h2 { font-family: var(--font-display); font-weight: 400; font-size: 20pt; margin: 0 0 6mm; }
}

/* ───────────── responsive ───────────── */
@media (max-width: 1240px) {
  .app { grid-template-columns: 320px minmax(0, 1fr) 0px; }
  .inspector { position: fixed; right: 0; top: 54px; bottom: 0; width: 316px; transform: translateX(100%); transition: transform .2s; z-index: 25; box-shadow: var(--shadow-3); }
  .app.inspector-open .inspector { transform: none; }
  .app.inspector-collapsed .inspector { display: flex; }
  .brand-tag { display: none; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr) 0px; grid-template-rows: 54px minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: 62vh; border-right: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-3); transform: translateY(calc(100% - 52px)); transition: transform .25s; z-index: 26; }
  .sidebar.is-open { transform: none; }
  .sidebar::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; }
  .sheet-handle { display: flex; justify-content: center; padding: 6px 0 2px; font-size: 12px; color: var(--ink-3); cursor: pointer; }
  .topbar { padding: 0 10px; gap: 6px; }
  .brand { min-width: 0; }
  .brand-name { font-size: 18px; }
  .views { margin: 0; overflow-x: auto; }
  .view-btn span { display: none; }
  .view-btn { padding: 7px 9px; }
  .topbar-right { min-width: 0; }
  .topbar-right .btn span { display: none; }
  .topbar-right .btn { padding: 7px; }
  .stage-top { flex-direction: column; align-items: stretch; }
  .tool-group { justify-content: flex-start; overflow-x: auto; }
  .metrics { left: 10px; right: 10px; bottom: 60px; }
  .metric { min-width: 0; flex: 1; padding: 6px 10px; }
  .legend { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .ar-panel, .vr-panel { width: calc(100% - 28px); }
  .ar-phone { display: none; }
  .minimap { width: 150px; height: 125px; }
}
@media (min-width: 921px) { .sheet-handle { display: none; } }

/* ───────────── finishes panel (3D, walk, AR) ───────────── */
.tool.tool-accent { color: var(--accent-ink); }
.tool.tool-accent.is-active { background: var(--accent); color: #fff; }
.finishes { position: absolute; right: 14px; top: 60px; width: 312px; max-height: calc(100% - 150px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); z-index: 12; overflow: hidden; animation: pop .18s cubic-bezier(.2,.9,.3,1.2); }
#app[data-view="walk"] .finishes { right: auto; left: 14px; top: 122px; max-height: calc(100% - 230px); }
#app[data-view="ar"] .finishes { right: auto; left: 14px; max-height: calc(100% - 300px); }
#app[data-view="plan"] .finishes, #app[data-view="cost"] .finishes, #app[data-view="vr"] .finishes { display: none; }
.fin-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 14px; }
.fin-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.fin-title .lucide { color: var(--accent); }
.fin-target { margin: 0 14px 8px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; line-height: 1.35; }
.fin-target b { color: var(--ink); font-weight: 600; }
.fin-target .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.fin-target .clear { margin-left: auto; border: 0; background: transparent; color: var(--ink-3); font-size: 11.5px; text-decoration: underline; padding: 0; }
.fin-tabs { display: flex; gap: 2px; margin: 0 10px; padding: 3px; background: var(--surface-2); border-radius: 9px; }
.fin-tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; background: transparent; border-radius: 7px; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.fin-tabs button .lucide { width: 15px; height: 15px; }
.fin-tabs button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.fin-scope { margin: 8px 14px 4px; display: flex; }
.fin-scope button { flex: 1; }
.fin-scope button[disabled] { opacity: .45; cursor: default; }
.fin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 14px 12px; overflow-y: auto; }
.swatch { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.swatch .chip-img { width: 100%; aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--line); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); background-color: var(--surface-3); transition: transform .12s, box-shadow .12s; }
.swatch:hover .chip-img { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.swatch.is-active .chip-img { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.swatch .nm { font-size: 11px; line-height: 1.25; color: var(--ink); font-weight: 500; }
.swatch .pr { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }
.swatch .pr.up { color: var(--amber); }
.swatch .pr.down { color: var(--green); }
.fin-foot { border-top: 1px solid var(--line); padding: 10px 14px 12px; font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.fin-foot .row { display: flex; justify-content: space-between; gap: 8px; }
.fin-foot .row b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.fin-foot .note { font-size: 11px; color: var(--ink-3); border: 0; padding: 0; margin: 0; }
.fin-foot a { color: var(--accent-ink); cursor: pointer; text-decoration: underline; }
.asset-pill { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); z-index: 11; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.asset-pill .spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
#app[data-view="plan"] .asset-pill, #app[data-view="cost"] .asset-pill { display: none; }
.room-finishes { display: grid; grid-template-columns: 34px 1fr; gap: 6px 10px; align-items: center; font-size: 12px; }
.room-finishes i.sw { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line); display: block; }
.room-finishes .k { color: var(--ink-3); font-size: 11px; }
.credits { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.credits a { color: var(--ink-2); }
@media (max-width: 920px) {
  .finishes, #app[data-view="walk"] .finishes, #app[data-view="ar"] .finishes { left: 8px; right: 8px; top: auto; bottom: 64px; width: auto; max-height: 52vh; }
  .fin-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 920px) {
  .views { flex: 1 1 auto; min-width: 0; scrollbar-width: none; }
  .views::-webkit-scrollbar { display: none; }
  .topbar-right { flex: none; gap: 4px; }
}
@media (max-width: 600px) {
  .brand-name, #btn-theme, #btn-insp-toggle { display: none; }
  .topbar-right .seg button { padding: 4px 7px; }
  .topbar .btn.ghost { display: none; }
}
