/* NIX Visualizer — NIX brand system (light default, dark supported)
   Ink navy + nix-blue actions; cyan only for glows/graphics; the drafting
   surface (photos, plan, 3D) is the one dark, gridded area of the app. */

:root {
  --bg: #F3F7FB;
  --surface: #FFFFFF;
  --surface-2: #EAF1F8;
  --ink: #1B2D47;
  --ink-2: #33445A;
  --muted: #5B6B80;
  --line: #D8E2EC;
  --nix-blue: #0670A3;
  --nix-blue-hover: #055D88;
  --on-nix-blue: #FFFFFF;
  --cyan: #14B8DC;
  --deep: #034B77;
  --sky: #56AAD3;
  --ok: #0E8C9B;
  --ok-bg: #E1F4F6;
  --warn: #B87503;
  --warn-bg: #FCF1DC;
  --danger: #C8410B;
  --danger-bg: #FCE7DD;
  --draft: #0B2240;          /* drafting surface */
  --draft-2: #12305A;
  --draft-grid: rgba(120, 188, 224, .10);
  --focus: 0 0 0 3px rgba(6, 112, 163, .35);
  --shadow-lift: 0 10px 30px -12px rgba(11, 34, 64, .35);
  --r-ctl: 8px;
  --r-panel: 14px;
  --font: 'Commissioner', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-brand: 'Jost', 'Commissioner', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081A31; --surface: #0E2442; --surface-2: #13305A; --ink: #E6EEF7; --ink-2: #C6D3E2; --muted: #8FA3BC;
    --line: #21406B; --nix-blue: #14B8DC; --nix-blue-hover: #3CCBEA; --on-nix-blue: #0B2240;
    --ok: #3CC5D3; --ok-bg: #0F3B4A; --warn: #F0B04A; --warn-bg: #3D2E10; --danger: #FF8A5B; --danger-bg: #43200F;
    --draft: #050F1E; --draft-2: #0B1E38; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #081A31; --surface: #0E2442; --surface-2: #13305A; --ink: #E6EEF7; --ink-2: #C6D3E2; --muted: #8FA3BC;
  --line: #21406B; --nix-blue: #14B8DC; --nix-blue-hover: #3CCBEA; --on-nix-blue: #0B2240;
  --ok: #3CC5D3; --ok-bg: #0F3B4A; --warn: #F0B04A; --warn-bg: #3D2E10; --danger: #FF8A5B; --danger-bg: #43200F;
  --draft: #050F1E; --draft-2: #0B1E38; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--nix-blue); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 .7em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1; }
.mdi { line-height: 1; }
:focus-visible { outline: none; box-shadow: var(--focus); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --- brand ------------------------------------------------------------ */
.wordmark { font-family: var(--font-brand); font-size: 22px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.wordmark b { font-weight: 700; }
.wordmark span { font-weight: 300; }
.wordmark small { font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.tagline { font-family: var(--font-brand); font-size: 10px; letter-spacing: .25em; color: var(--sky); }
/* bold/light pairing that echoes "NIX Online" */
.pair b { font-weight: 700; }
.pair span { font-weight: 300; }

/* --- controls ---------------------------------------------------------- */
.btn { --b: var(--surface); --c: var(--ink); --bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--bd); background: var(--b); color: var(--c);
  font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--nix-blue); }
.btn.primary { --b: var(--nix-blue); --c: var(--on-nix-blue); --bd: var(--nix-blue); }
.btn.primary:hover { --b: var(--nix-blue-hover); }
.btn.ghost { --b: transparent; --bd: transparent; }
.btn.ghost:hover { --b: var(--surface-2); }
.btn.danger { --c: var(--danger); }
.btn.danger:hover { --bd: var(--danger); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.icon { padding: 0; width: 40px; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .mdi { font-size: 18px; }

label.field { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 15px/1.4 var(--font); }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--nix-blue); outline: none; box-shadow: var(--focus); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--nix-blue); flex: none; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* choice chips: survey answers, filters, scenario picks */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font: 500 14px/1.2 var(--font); cursor: pointer; }
.chip:hover { border-color: var(--nix-blue); }
.chip[aria-pressed="true"] { background: var(--nix-blue); border-color: var(--nix-blue); color: var(--on-nix-blue); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.blue { background: var(--nix-blue); color: var(--on-nix-blue); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 18px; }
.panel.flat { border: 0; background: var(--surface-2); }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty > .mdi { font-size: 40px; color: var(--sky); display: block; margin-bottom: 6px; }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* --- shell -------------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 2px; margin-left: 10px; }
.topbar nav a { padding: 8px 12px; border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.topbar nav a.on { background: var(--surface-2); color: var(--ink); }
.topbar .spacer { flex: 1; }
.page { max-width: 1240px; margin: 0 auto; padding: 24px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; }

/* --- login ---------------------------------------------------------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.login-art { position: relative; overflow: hidden; background: var(--draft); color: #E6EEF7; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(var(--draft-grid) 1px, transparent 1px), linear-gradient(90deg, var(--draft-grid) 1px, transparent 1px); background-size: 28px 28px; }
.login-art > * { position: relative; }
.login-art .wordmark { color: #fff; font-size: 30px; }
.login-art h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 300; max-width: 13em; color: #fff; }
.login-art h1 b { font-weight: 700; }
.login-art svg { width: 100%; max-width: 560px; height: auto; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-form form { width: 100%; max-width: 380px; display: grid; gap: 16px; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login-art { padding: 28px 22px; min-height: 280px; } .login-art svg { max-height: 150px; } }

/* --- project list -------------------------------------------------------- */
.proj-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.proj { display: grid; grid-template-rows: 150px auto; border-radius: var(--r-panel); overflow: hidden; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.proj:hover { border-color: var(--nix-blue); }
.proj-cover { background: var(--draft) center/cover no-repeat; position: relative; }
.proj-cover .pill { position: absolute; left: 10px; top: 10px; }
.proj-body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.proj-body h3 { font-size: 16px; }
.proj-new { display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: var(--r-panel); min-height: 230px; color: var(--nix-blue); font-weight: 600; text-decoration: none; background: transparent; cursor: pointer; font-family: var(--font); font-size: 15px; }
.proj-new:hover { border-color: var(--nix-blue); background: var(--surface); }
.proj-new .mdi { font-size: 34px; display: block; text-align: center; }

/* --- project workspace --------------------------------------------------- */
.ws { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 61px); background: linear-gradient(to right, var(--surface) 232px, var(--line) 232px, var(--line) 233px, transparent 233px); }
.ws-side { border-right: 1px solid var(--line); background: var(--surface); padding: 18px 12px; position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto; }
.ws-side .proj-title { padding: 0 8px 14px; }
.ws-side .proj-title h2 { font-size: 17px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: step; }
.steps a { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; }
.steps a:hover { background: var(--surface-2); }
.steps a.on { background: var(--surface-2); color: var(--ink); }
.steps .n { counter-increment: step; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.steps .n::before { content: counter(step); }
.steps a.done .n { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.steps a.done .n::before { content: '✓'; }
.steps a.on .n { border-color: var(--nix-blue); color: var(--nix-blue); }
.steps-sep { margin: 14px 8px 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.steps .tool .n::before { content: none; }
.steps .tool .n { border: 0; font-size: 18px; color: var(--muted); }
.ws-main { padding: 22px 26px 90px; min-width: 0; }
.ws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.ws-head h1 { font-size: 24px; }
.ws-head p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.ws-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .ws { grid-template-columns: 1fr; background: none; }
  .ws-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .ws-side .proj-title { display: none; }
  .steps { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .steps a { grid-template-columns: 22px auto; }
  .steps a .badge, .steps-sep { display: none; }
  .ws-main { padding: 16px 14px 90px; }
}

/* --- drafting surface ------------------------------------------------------ */
.draft { position: relative; background: var(--draft); border-radius: var(--r-panel); overflow: hidden; color: #E6EEF7;
  background-image: linear-gradient(var(--draft-grid) 1px, transparent 1px), linear-gradient(90deg, var(--draft-grid) 1px, transparent 1px);
  background-size: 24px 24px; }
.draft .btn { --b: rgba(255,255,255,.08); --c: #E6EEF7; --bd: rgba(255,255,255,.16); }
.draft .btn:hover { --bd: var(--cyan); }
.draft .btn.primary { --b: var(--cyan); --c: #0B2240; --bd: var(--cyan); }

/* rooms + uploads */
.room-list { display: grid; gap: 12px; }
.room { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px; display: grid; gap: 12px; }
.room-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-head .mdi.type { font-size: 22px; color: var(--nix-blue); width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.room-head .name { font-weight: 600; font-size: 16px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.thumb { position: relative; width: 108px; height: 80px; border-radius: 9px; overflow: hidden; flex: none; background: var(--surface-2) center/cover no-repeat; border: 1px solid var(--line); }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(11,34,64,.75); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.thumb .st { position: absolute; left: 4px; bottom: 4px; }
.thumb.add { display: grid; place-items: center; cursor: pointer; border: 1.5px dashed var(--line); background: transparent; color: var(--nix-blue); font: 600 12px var(--font); text-align: center; gap: 2px; }
.thumb.add:hover { border-color: var(--nix-blue); }
.thumb.add .mdi { font-size: 22px; }
.dropzone { border: 1.5px dashed var(--line); border-radius: var(--r-panel); padding: 22px; text-align: center; background: var(--surface); }
.dropzone.over { border-color: var(--nix-blue); background: var(--surface-2); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--nix-blue); width: 0; transition: width .2s; }

/* design: photo with device markers */
.design { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .design { grid-template-columns: 1fr; } }
.photo-stage { position: relative; user-select: none; touch-action: none; }
.photo-stage img { width: 100%; height: auto; display: block; }
.photo-stage .det { position: absolute; border: 1.5px dashed rgba(120,188,224,.55); border-radius: 4px; pointer-events: none; }
.photo-stage.hide-det .det { display: none; }
.marker { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: grab;
  background: #0B2240; color: var(--cyan); display: grid; place-items: center; font-size: 18px;
  box-shadow: 0 0 0 2px var(--cyan), 0 0 18px 2px rgba(20,184,220,.55); }
.marker.suggested { color: #E6EEF7; box-shadow: 0 0 0 2px rgba(230,238,247,.65); background: rgba(11,34,64,.7); }
.marker.rejected { opacity: .35; box-shadow: 0 0 0 2px rgba(230,238,247,.4); }
.marker.sel { width: 42px; height: 42px; font-size: 22px; box-shadow: 0 0 0 3px #fff, 0 0 26px 6px rgba(20,184,220,.8); z-index: 2; }
.marker.dragging { cursor: grabbing; }
.marker .q { position: absolute; right: -6px; top: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--cyan); color: #0B2240; font: 700 11px/18px var(--font); padding: 0 4px; }
.stage-bar { display: flex; gap: 8px; align-items: center; padding: 10px; flex-wrap: wrap; }
.stage-bar .grow { flex: 1; }
.filmstrip { display: flex; gap: 6px; padding: 0 10px 10px; overflow-x: auto; }
.filmstrip button { flex: none; width: 76px; height: 54px; border-radius: 7px; border: 2px solid transparent; background: center/cover no-repeat; cursor: pointer; padding: 0; }
.filmstrip button.on { border-color: var(--cyan); }

.devlist { display: grid; gap: 8px; }
.dev { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.dev:hover { border-color: var(--sky); }
.dev.sel { border-color: var(--nix-blue); box-shadow: var(--focus); }
.dev .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; background: var(--surface-2); color: var(--nix-blue); }
.dev.accepted .ic { background: var(--nix-blue); color: var(--on-nix-blue); }
.dev.rejected { opacity: .55; }
.dev .t { font-weight: 600; font-size: 14px; line-height: 1.25; }
.dev .r { font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.toggle { position: relative; width: 44px; height: 26px; border-radius: 13px; border: 0; background: var(--line); cursor: pointer; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle[aria-checked="true"] { background: var(--nix-blue); }
.toggle[aria-checked="true"]::after { transform: translateX(18px); }

/* packages */
.packages { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.package { text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-family: var(--font); color: var(--ink); }
.package[aria-pressed="true"] { border-color: var(--nix-blue); box-shadow: var(--focus); }
.package b { display: block; font-size: 16px; }
.package span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .packages { grid-template-columns: 1fr; } }

/* scenarios */
.scen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.scen { text-align: left; padding: 16px; border-radius: var(--r-panel); border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; gap: 6px; font-family: var(--font); color: var(--ink); }
.scen .mdi { font-size: 26px; color: var(--nix-blue); }
.scen b { font-size: 16px; }
.scen p { font-size: 13.5px; color: var(--muted); margin: 0; }
.scen[aria-pressed="true"] { background: var(--draft); color: #E6EEF7; border-color: var(--draft); }
.scen[aria-pressed="true"] .mdi { color: var(--cyan); }
.scen[aria-pressed="true"] p { color: #A9BDD4; }

/* survey */
.survey { display: grid; gap: 22px; max-width: 760px; }
.q-block { display: grid; gap: 10px; }
.q-block h3 { font-weight: 600; font-size: 16px; }

/* quote */
.quote-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 18px; border-radius: var(--r-panel); background: var(--draft); color: #fff; }
.quote-total b { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(5, 15, 30, .55); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-lift); display: grid; gap: 16px; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { padding: 11px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-lift); }
.toast.err { background: var(--danger); color: #fff; }

.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); font-size: 14px; }
.notice .mdi { font-size: 20px; color: var(--nix-blue); }
.notice.warn { background: var(--warn-bg); } .notice.warn .mdi { color: var(--warn); }

/* key/value lists */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* stat tiles (backoffice) */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }

@media (max-width: 640px) { .hide-sm { display: none; } .topbar { padding: 8px 12px; gap: 6px; } .topbar nav { margin-left: 0; } .page { padding: 18px 14px 70px; } }
.ws > * { min-width: 0; }
@media (max-width: 640px) {
  .wordmark { font-size: 19px; } .wordmark small { display: none; }
  .topbar nav a { padding: 6px 8px; font-size: 13px; }
  .ws-side .steps-sep + .steps { margin-top: 6px; }
}
@media (max-width: 900px) { .ws-side { overflow: hidden; } .ws-side .steps { overflow-x: auto; scrollbar-width: none; } }
@media (max-width: 400px) { .topbar .btn.ghost.sm { padding: 5px 7px; } }

/* plan + 3D */
.plan-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.plan-bar .grow { flex: 1; }
.plan-draft { height: 70vh; min-height: 420px; touch-action: none; user-select: none; -webkit-user-select: none; }
.plan-svg { display: block; width: 100%; height: 100%; cursor: grab; font-family: var(--font); }
.plan-svg:active { cursor: grabbing; }
.plan-svg * { vector-effect: non-scaling-stroke; }
.pl-grid .g05 { stroke: rgba(120,188,224,.07); stroke-width: 1; }
.pl-grid .g1 { stroke: rgba(120,188,224,.16); stroke-width: 1; }
.pl-room .body { fill: rgba(120,188,224,.08); stroke: #78BCE0; stroke-width: 2; cursor: move; }
.pl-room.on .body { fill: rgba(20,184,220,.14); stroke: #14B8DC; stroke-width: 2.5; }
.pl-room text { pointer-events: none; }
.pl-name { fill: #E6EEF7; font-weight: 600; }
.pl-dims { fill: #A9BDD4; }
.pl-open line, .pl-open path { pointer-events: none; fill: none; }
.pl-open .gap { stroke: var(--draft); stroke-width: 4; }
.pl-open .leaf { stroke: #E6EEF7; stroke-width: 1.5; }
.pl-open .swing { stroke: rgba(230,238,247,.55); stroke-width: 1; stroke-dasharray: 3 3; }
.pl-open .glass { stroke: #E6EEF7; stroke-width: 1.4; }
.pl-open .glass.mid { stroke: rgba(230,238,247,.5); stroke-width: 1; }
.pl-open .shutter { stroke: #14B8DC; stroke-width: 2.5; }
.pl-furn rect { fill-opacity: .85; stroke: rgba(11,34,64,.55); stroke-width: 1; cursor: move; }
.pl-furn.on rect { stroke: #fff; stroke-width: 2; }
.pl-flabel { fill: #0B2240; text-anchor: middle; font-weight: 600; pointer-events: none; }
.pl-bg { pointer-events: none; }
.pl-dev { cursor: grab; }
.pl-dev .halo { fill: rgba(20,184,220,.22); pointer-events: none; }
.pl-dev .disc { fill: #0B2240; stroke: #14B8DC; stroke-width: 2; }
.pl-dev.acc .disc { fill: #14B8DC; stroke: #fff; stroke-width: 1.5; }
.pl-dev.sug .disc { fill: rgba(11,34,64,.6); stroke: rgba(230,238,247,.6); stroke-dasharray: 3 2; }
.pl-dev.on .disc { stroke: #fff; stroke-width: 3; }
.pl-dev .ic { font-family: 'Material Design Icons'; text-anchor: middle; pointer-events: none; fill: #E6EEF7; }
.pl-dev.acc .ic { fill: #0B2240; }
.pl-dev .qty { fill: #fff; font-weight: 700; pointer-events: none; }
.pl-handle { fill: #fff; stroke: #14B8DC; stroke-width: 2; }
.pl-handle.h-nw, .pl-handle.h-se { cursor: nwse-resize; } .pl-handle.h-ne, .pl-handle.h-sw { cursor: nesw-resize; }
.pl-handle.h-n, .pl-handle.h-s { cursor: ns-resize; } .pl-handle.h-e, .pl-handle.h-w { cursor: ew-resize; }
.plan-zoom { position: absolute; right: 10px; top: 10px; display: grid; gap: 6px; }
.plan-hint { position: absolute; left: 12px; bottom: 10px; right: 60px; color: #A9BDD4; pointer-events: none; }
.plan-side { display: grid; gap: 12px; align-content: start; }
.plan-side h3 { display: flex; align-items: center; gap: 6px; }
.plan-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-3col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.plan-rooms { display: grid; gap: 4px; }
.plan-roomrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14px var(--font); cursor: pointer; text-align: left; }
.plan-roomrow:hover { border-color: var(--nix-blue); }
.plan-roomrow .mdi { font-size: 18px; color: var(--nix-blue); }
.plan-fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.plan-fitem { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 500 13px/1.2 var(--font); cursor: pointer; text-align: left; }
.plan-fitem:hover { border-color: var(--nix-blue); }
.plan-fitem i, .plan-sw { width: 14px; height: 14px; border-radius: 4px; flex: none; display: inline-block; border: 1px solid rgba(11,34,64,.2); }
.plan-more summary { cursor: pointer; color: var(--nix-blue); font-weight: 600; padding: 4px 0; }
.plan-more[open] summary { margin-bottom: 6px; }
.plan-open { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.plan-open .input { min-height: 36px; padding: 6px 9px; font-size: 14px; }
.plan-devic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); color: var(--nix-blue); }
.plan-devic.acc { background: var(--draft); color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan), 0 0 14px rgba(20,184,220,.5); }
.plan-side input[type=range] { width: 100%; accent-color: var(--nix-blue); }
.v3-draft { height: 70vh; min-height: 420px; touch-action: none; }
.v3-draft canvas { display: block; width: 100%; height: 100%; outline: none; }
.v3-top { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; pointer-events: none; }
.v3-top > * { pointer-events: auto; }
.v3-top .grow { flex: 1; pointer-events: none; }
.v3-top select { min-height: 32px; padding: 4px 8px; width: auto; max-width: 180px; font-size: 13px; background: rgba(11,34,64,.75); color: #E6EEF7; border-color: rgba(255,255,255,.16); }
.v3-scen { position: absolute; left: 10px; right: 10px; bottom: 10px; display: grid; gap: 6px; pointer-events: none; }
.v3-scen > * { pointer-events: auto; }
.v3-scen .bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.v3-scen .bar .btn { flex: none; background: rgba(11,34,64,.78); backdrop-filter: blur(6px); }
.v3-scen .bar .btn.mine { --bd: rgba(20,184,220,.55); }
.v3-scen .bar .btn[aria-pressed="true"] { --b: #14B8DC; --c: #0B2240; --bd: #14B8DC; background: #14B8DC; }
.v3-cap { align-self: start; justify-self: start; max-width: min(640px, 100%); padding: 7px 11px; border-radius: 9px; background: rgba(5,15,30,.72); color: #E6EEF7; font-size: 13px; backdrop-filter: blur(6px); }
.v3-cap:empty { display: none; }
.v3-label { position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 4px 9px; border-radius: 7px; background: rgba(5,15,30,.86); color: #E6EEF7; font-size: 12.5px; white-space: nowrap; pointer-events: none; box-shadow: 0 0 0 1px rgba(20,184,220,.5); }
.v3-label .mdi { color: #14B8DC; margin-right: 4px; }
.v3-draft .empty { position: absolute; inset: 0; display: grid; place-content: center; color: #A9BDD4; }
@media (max-width: 640px) {
  .plan-draft, .v3-draft { height: 62vh; min-height: 380px; }
  .plan-3col { grid-template-columns: 1fr 1fr; }
  .v3-top select { max-width: 130px; }
}
@media (max-width: 640px) { .ws-foot .btn { white-space: normal; text-align: center; flex: 1; min-width: 0; } }

/* backoffice + technician */
.mono { white-space: nowrap; font-variant-numeric: tabular-nums; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 13px; }
.input.sm, select.input.sm { min-height: 34px; padding: 5px 9px; font-size: 14px; }
.btn.big { min-height: 50px; padding: 12px 20px; font-size: 16px; }
.panel.flush { padding: 0; overflow-x: auto; }
.panel.flush .table th:first-child, .panel.flush .table td:first-child { padding-left: 16px; }
.warn-text b { color: var(--warn); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
/* technician */
.tech { display: grid; gap: 16px; max-width: 860px; }
.tech-visit { display: grid; gap: 12px; }
.tech-addr { display: flex; gap: 8px; align-items: center; font-size: 15px; text-decoration: none; padding: 10px 12px; border-radius: var(--r-ctl); background: var(--surface-2); }
.tech-addr .mdi { font-size: 18px; }
.tech-addr span:not(.mdi) { flex: 1; color: var(--ink); }
.tech-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tech-actions .btn { flex: 1 1 200px; }
.tech-progress { display: grid; gap: 8px; padding: 12px 16px; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); position: sticky; top: 62px; z-index: 5; }
.tech-progress .progress { height: 8px; border-radius: 4px; }
.tech-progress .progress > i { background: var(--ok); }
details.tech-room > summary { list-style: none; cursor: pointer; }
details.tech-room > summary::-webkit-details-marker { display: none; }
details.tech-room .chev { font-size: 22px; color: var(--muted); transition: transform .15s; }
details.tech-room[open] .chev { transform: rotate(180deg); }
details.tech-room:not([open]) { gap: 0; }
.tech-dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tech-dev { display: grid; gap: 8px; padding: 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.tech-dev.removed { background: var(--danger-bg); border-color: transparent; }
.tech-dev.removed .t { text-decoration: line-through; }
.tech-dev-top { display: flex; gap: 10px; align-items: center; }
.tech-dev-top > label { flex-wrap: nowrap; flex: none; }
.tech-dev .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; background: var(--surface-2); color: var(--nix-blue); flex: none; }
.tech-dev .t { font-weight: 600; font-size: 14px; line-height: 1.25; }
.tech-dev .pill { margin: 3px 4px 0 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 14px var(--font); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"].ok { background: var(--ok); color: #fff; }
.seg button[aria-pressed="true"].change { background: var(--warn); color: #fff; }
.seg button[aria-pressed="true"].remove { background: var(--danger); color: #fff; }
.tech-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.tech-finish .btn.big { justify-self: start; }
.tech .thumb.add input { display: none; }
@media (max-width: 560px) {
  .tech-dims { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .tech-add { grid-template-columns: 1fr; }
  .tech-finish .btn.big { justify-self: stretch; }
  .tech-progress { top: 56px; }
}
/* project backoffice */
.office { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.office-side { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
@media (max-width: 1200px) { .office { grid-template-columns: 1fr; } .office-side { position: static; max-height: none; } }
.bom td { vertical-align: top; }
.bom-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 18px; align-items: start; }
.bom-totals { display: grid; gap: 6px; font-size: 14px; }
.bom-totals b, .bom-margin b { font-variant-numeric: tabular-nums; }
.bom-totals .quote-total { margin-top: 6px; padding: 12px 16px; }
.bom-totals .quote-total b { font-size: 24px; }
.bom-margin { display: grid; gap: 6px; font-size: 14px; padding: 12px 14px; }
@media (max-width: 700px) { .bom-foot { grid-template-columns: 1fr; } }
.map-list { display: grid; gap: 8px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 360px); gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.map-row:last-child { border-bottom: 0; }
@media (max-width: 640px) { .map-row { grid-template-columns: 1fr; gap: 6px; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: 12px; border-left: 2px solid var(--line); font-size: 13.5px; }
.timeline li { position: relative; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--sky); }
/* global backoffice */
.admin-tabs { margin-bottom: 18px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.admin-tabs .chip { text-decoration: none; white-space: nowrap; flex: none; }
.stat { position: relative; }
.stat .stat-ic { position: absolute; right: 14px; top: 14px; font-size: 20px; color: var(--sky); }
.admin-2col { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .admin-2col { grid-template-columns: 1fr; } }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 36px; gap: 10px; align-items: center; color: var(--ink-2); text-decoration: none; font-size: 14px; }
.bar:hover .bar-l { color: var(--nix-blue); }
.bar-t { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar-t i { display: block; height: 100%; border-radius: 6px; background: var(--nix-blue); }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.recent { display: grid; }
.recent-row { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover b { color: var(--nix-blue); }
.cat-block > h2 { font-size: 18px; }
.cat-type { display: grid; gap: 10px; padding: 14px; }
.cat-type h3 .mdi { color: var(--nix-blue); }
.cat-table td { padding: 5px 4px; }
.cat-table th { padding: 6px 4px; white-space: nowrap; }
.cat-table td.c { text-align: center; }
.cat-table td.c input { width: 18px; height: 18px; accent-color: var(--nix-blue); }
.cat-table .input.num { text-align: right; }
.cat-table tr.inactive td { opacity: .55; }
.cat-table tr.saved td { background: var(--ok-bg); transition: background .2s; }
.table tfoot td { border-bottom: 0; }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-panel); background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); backdrop-filter: blur(8px); }

.admin-body .stack, .office-main, .tech { grid-template-columns: minmax(0, 1fr); }
.admin-body .row.between > input[type=search] { flex: 1 1 220px; }
.bom { min-width: 680px; }
.cat-table { min-width: 1080px; }
.cat-table select.input.sm { min-width: 104px; padding-right: 4px; }
