/* PlyHive configurator. Same notebook language as the dolly builder: dot-grid paper, graphite ink, birch ply,
   the teal ribbon for anything you can act on. App frame: top bar, a sidebar tree (a drawer on phones), the canvas,
   and an inspector that is a right panel on desktop and a bottom sheet on phones. */
:root {
  --paper: #F1F2EE;
  --sheet: #FAFAF8;
  --dot: #BCC1B9;
  --ink: #24292D;
  --ink-2: #586067;
  --rule: #D2D6CF;
  --birch: #E6D1A6;
  --birch-cut: #D9BE8E;
  --ply-line: #A9874F;
  --on-birch: #2B2117;
  --on-birch-2: #5E4A2E;
  --ribbon: #0E7C8A;
  --ribbon-ink: #FFFFFF;
  --ribbon-soft: color-mix(in srgb, var(--ribbon) 12%, transparent);
  --print: #4FA3AE;
  --wall: #8C6D3E;
  --ok: #2F7D4F;
  --low: #B5530E;
  --blind: #C0392B;
  --scrim: rgba(20, 24, 26, 0.38);
  --shadow: 0 10px 30px rgba(20, 24, 26, 0.16), 0 2px 6px rgba(20, 24, 26, 0.10);
  --font-display: var(--font-body);
  --font-display-wt: 600;
  --font-body: "Barlow", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --honey: #F5C24D;
  --hex: var(--ink);
  --slat: var(--honey);
  --bar-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #181B1D; --sheet: #202427; --dot: #363C40; --ink: #E4E7E3; --ink-2: #A1A9AF; --rule: #32383C;
    --birch: #CDB689; --birch-cut: #BFA273; --ply-line: #8C6D3E; --ribbon: #48C0CD; --ribbon-ink: #0A1D20;
    --print: #5BB5C0; --wall: #BFA273; --ok: #5CC489; --low: #F0954D; --blind: #F07067; --scrim: rgba(0, 0, 0, 0.55); --hex: var(--honey); --slat: #000;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #181B1D; --sheet: #202427; --dot: #363C40; --ink: #E4E7E3; --ink-2: #A1A9AF; --rule: #32383C;
  --birch: #CDB689; --birch-cut: #BFA273; --ply-line: #8C6D3E; --ribbon: #48C0CD; --ribbon-ink: #0A1D20;
  --print: #5BB5C0; --wall: #BFA273; --ok: #5CC489; --low: #F0954D; --blind: #F07067; --scrim: rgba(0, 0, 0, 0.55); --hex: var(--honey); --slat: #000;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.45; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ribbon); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
.label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); }
.num, .data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- frame ---------- */
.app { height: 100%; display: grid; grid-template-rows: var(--bar-h) minmax(0, 1fr); grid-template-columns: var(--side-w, 264px) minmax(0, 1fr); grid-template-areas: "bar bar" "side main"; }
.bar { grid-area: bar; display: flex; align-items: center; gap: 12px; padding-inline: 12px 16px; border-bottom: 1.5px solid var(--ink); background: var(--sheet); min-width: 0; }
.brand { display: flex; align-items: center; gap: 5px; font-family: var(--font-display); font-size: 1.55rem; line-height: 1; letter-spacing: 0.01em; white-space: nowrap; background: none; border: 0; padding: 4px; }
.brand svg { width: 29px; height: 23px; flex: none; }
.brand svg.word { width: 106px; height: 29px; }
.crumbs { display: flex; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; }
.crumbs .sep { color: var(--ink-2); }
.crumbs button { border: 0; background: none; padding: 4px 2px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.crumbs button:hover { color: var(--ink); }
.crumbs .here { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .grow { flex: 1; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid transparent; border-radius: 3px; background: none; flex: none; }
.iconbtn:hover { background: var(--ribbon-soft); }
.iconbtn svg { width: 22px; height: 22px; }
.menu-btn { display: none; }
.sync { font-family: var(--font-data); font-size: 0.75rem; color: var(--ink-2); white-space: nowrap; }
.sync.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.sync.local::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--low); margin-right: 6px; vertical-align: 1px; }

.side { grid-area: side; border-right: 1px solid var(--rule); background: var(--sheet); overflow-y: auto; padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 18px; }
.side h2 { padding-inline: 8px; }
.tree { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tree ul { list-style: none; margin: 0 0 4px; padding: 0 0 0 22px; display: grid; gap: 1px; border-left: 1px dashed var(--rule); margin-left: 15px; }
.tree button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 3px; display: flex; align-items: center; gap: 10px; min-height: 40px; }
.tree button:hover { background: var(--ribbon-soft); }
.tree button[aria-current="page"] { background: var(--ribbon); color: var(--ribbon-ink); }
.tree button[aria-current="page"] .muted { color: inherit; opacity: 0.8; }
.tree .space-btn { font-weight: 600; }
.tree svg { width: 18px; height: 18px; flex: none; }
.tree .count { margin-left: auto; font-family: var(--font-data); font-size: 0.78rem; }
.side .add-row { border: 1px dashed var(--rule); background: none; border-radius: 3px; padding: 9px 10px; text-align: left; color: var(--ink-2); font-weight: 600; min-height: 40px; }
.side .add-row:hover { border-color: var(--ribbon); color: var(--ribbon); }
.navlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.navlist button { width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 3px; display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 40px; }
.navlist button:hover { background: var(--ribbon-soft); }
.navlist button[aria-current="page"] { background: var(--ribbon); color: var(--ribbon-ink); }
.navlist svg { width: 18px; height: 18px; flex: none; }
.navlist .badge { margin-left: auto; font-family: var(--font-data); font-size: 0.75rem; padding: 1px 7px; border-radius: 10px; background: var(--low); color: var(--sheet); }

.main { grid-area: main; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }

/* ---------- view header ---------- */
.vhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.backrow { flex-basis: 100%; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn.back { padding-left: 10px; border-color: var(--ink-2); }
.btn.back svg { width: 20px; height: 20px; }
.wallpick { border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; padding: 8px 32px 8px 12px; min-height: 40px; font-weight: 600; font-size: 0.92rem; max-width: 100%; }
.vhead h1 { font-family: var(--font-display); font-weight: var(--font-display-wt); font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1; letter-spacing: 0.01em; min-width: 0; overflow-wrap: anywhere; }
.vhead .meta { font-family: var(--font-data); font-size: 0.82rem; color: var(--ink-2); }
.vhead .tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-size: 0.88rem; font-weight: 600; border-right: 1px solid var(--rule); min-height: 38px; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--ribbon-soft); }
.seg button[aria-pressed="true"] { background: var(--ribbon); color: var(--ribbon-ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; padding: 8px 14px; font-weight: 600; font-size: 0.92rem; min-height: 40px; white-space: nowrap; }
.btn:hover { border-color: var(--ribbon); color: var(--ribbon); }
.btn.primary { background: var(--ribbon); color: var(--ribbon-ink); border-color: var(--ribbon); }
.btn.primary:hover { filter: brightness(1.07); color: var(--ribbon-ink); }
.btn.danger { color: var(--blind); }
.btn.danger:hover { border-color: var(--blind); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[aria-pressed="true"] { background: var(--ribbon); color: var(--ribbon-ink); border-color: var(--ribbon); }

/* ---------- canvas ---------- */
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden;
  background-color: var(--paper); }
.stage svg.cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage .labels { position: absolute; inset: 0; pointer-events: none; }
.part-label { position: absolute; left: 0; top: 0; padding: 2px 7px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; background: var(--ink); color: var(--paper); border-radius: 2px; white-space: nowrap; }
.hint { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; justify-content: center; pointer-events: none; }
.hint span { background: var(--ink); color: var(--paper); padding: 7px 12px; border-radius: 3px; font-size: 0.88rem; font-weight: 500; box-shadow: var(--shadow); max-width: 100%; }
.zoomer { position: absolute; left: 12px; bottom: 12px; display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; }
.zoomer button { width: 40px; height: 40px; border: 0; background: none; font-size: 1.2rem; font-weight: 600; border-bottom: 1px solid var(--rule); }
.zoomer button:last-child { border-bottom: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; }
.zoomer button:hover { background: var(--ribbon-soft); }
.fab { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 10px; align-items: center; }
.stage.has-insp .fab { right: 388px; }
.stage.has-insp .zoomer { display: flex; }
.fab .add { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--ribbon); color: var(--ribbon-ink); box-shadow: var(--shadow); display: grid; place-items: center; }
.fab .add svg { width: 28px; height: 28px; }
.fab .kbd { font-family: var(--font-data); font-size: 0.75rem; color: var(--ink-2); background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 3px 7px; }
.legend { position: absolute; right: 12px; top: 12px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 6px 10px; font-size: 0.8rem; max-width: calc(100% - 24px); }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* svg drawing classes */
.g-dot { fill: var(--dot); }
.g-floor { fill: var(--sheet); }
.g-plane { stroke: var(--wall); stroke-width: 7; stroke-linecap: round; fill: none; }
.g-plane-hit { stroke: transparent; stroke-width: 26; stroke-linecap: round; fill: none; cursor: pointer; }
.g-plane.sel { stroke: var(--ribbon); }
.g-plane-label { fill: var(--ink-2); font-family: var(--font-body); font-weight: 600; font-size: 12.5px; letter-spacing: 0.05em; text-transform: uppercase; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.g-dim { fill: var(--ink-2); font-family: var(--font-data); font-size: 11.5px; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.g-block { fill: var(--birch); stroke: var(--ink); stroke-width: 1.4; }
.g-block.fixture { fill: var(--birch-cut); }
.g-block.ghost { fill: var(--birch); opacity: 0.45; stroke-dasharray: 5 4; }
.g-block.sel { stroke: var(--ribbon); stroke-width: 3; }
.g-block.hit { stroke: var(--blind); stroke-width: 2.4; }
.g-front { stroke: var(--ink); stroke-width: 2.6; }
.g-text { fill: var(--on-birch); font-family: var(--font-body); font-weight: 700; font-size: 12.5px; }
.g-sub { fill: var(--on-birch-2); font-family: var(--font-data); font-size: 10.5px; }
.g-groove { stroke: var(--ink-2); stroke-width: 0.6; opacity: 0.35; }
.g-wall { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.2; }
.g-floorline { stroke: var(--ink); stroke-width: 2.2; }
.g-cam { fill: var(--ink); }
.g-range { fill: color-mix(in srgb, var(--ribbon) 7%, transparent); stroke: var(--ribbon); stroke-width: 1.2; stroke-dasharray: 6 5; }
.g-cov-ok { stroke: var(--ok); stroke-width: 4; stroke-linecap: round; }
.g-cov-no { stroke: var(--blind); stroke-width: 4; stroke-linecap: round; }
.g-chip { fill: var(--ink); }
.g-chip-t { fill: var(--paper); font-family: var(--font-data); font-size: 10.5px; font-weight: 500; }
.g-chip.low { fill: var(--low); }
.g-chip.ok { fill: var(--ok); }
.g-draft { stroke: var(--ribbon); stroke-width: 3; stroke-dasharray: 8 5; fill: none; }
.g-vertex { fill: var(--ribbon); }
.g-cursor { fill: none; stroke: var(--ribbon); stroke-width: 2; }
.g-handle { fill: var(--sheet); stroke: var(--ribbon); stroke-width: 2; }

/* ---------- inspector ---------- */
.insp { position: absolute; right: 12px; top: 12px; bottom: 12px; width: 360px; max-width: calc(100% - 24px); background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 20; }
.insp-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--rule); }
.insp-head .t { flex: 1; min-width: 0; display: grid; gap: 2px; }
.insp-head input.name { border: 0; border-bottom: 1px dashed transparent; background: none; font-weight: 700; font-size: 1.15rem; padding: 2px 0; width: 100%; }
.insp-head input.name:hover, .insp-head input.name:focus { border-bottom-color: var(--rule); outline: none; }
.insp-head .handle { display: none; }
.insp-head .expand { display: none; }
.insp-tabs { display: flex; border-bottom: 1px solid var(--rule); padding-inline: 10px; gap: 4px; }
.insp-tabs button { border: 0; background: none; padding: 10px 10px 9px; font-weight: 600; font-size: 0.9rem; color: var(--ink-2); border-bottom: 2.5px solid transparent; min-height: 42px; }
.insp-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ribbon); }
.insp-body { flex: 1; overflow-y: auto; padding: 14px 16px 18px; display: grid; gap: 18px; align-content: start; }
.insp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: grid; gap: 5px; }
.field > label, .field > .label { font-weight: 600; font-size: 0.92rem; }
.field input[type="text"], .field input[type="url"], .field input[type="number"], .field select, .field textarea { width: 100%; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 8px 10px; min-height: 40px; }
.field .sub { font-size: 0.82rem; color: var(--ink-2); }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; }
.slider label { font-weight: 600; font-size: 0.95rem; }
.slider output { font-family: var(--font-data); font-size: 1rem; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--ribbon); margin: 6px 0 0; height: 26px; }
.slider .sub { grid-column: 1 / -1; font-size: 0.82rem; color: var(--ink-2); }
.slider input:disabled { opacity: 0.45; }
/* the typed-number box that replaces a slider's readout (and a drawer count) */
.numbox { display: inline-flex; align-items: baseline; gap: 2px; justify-self: end; }
.numbox input, .slider .numbox input, .field .numbox input { grid-column: auto; width: calc(9ch + 14px); height: 28px; min-height: 0; margin: 0; padding: 2px 6px; font-family: var(--font-data); font-size: 1rem; text-align: right; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; accent-color: auto; }
.numbox input:hover:not(:disabled) { border-color: var(--ink-2); }
.numbox input:focus { outline: 2px solid var(--ribbon); outline-offset: 0; border-color: var(--ribbon); }
.numbox input:disabled, .slider.locked .numbox input { opacity: 1; color: var(--ink-2); }
.numbox .unit { min-width: 1ch; font-family: var(--font-data); font-size: 1rem; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.92rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--font-data); text-align: right; }
.note { font-size: 0.86rem; color: var(--ink-2); border-left: 2px solid var(--rule); padding-left: 10px; }
.tagcard { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); }
.tagcard .face { flex: none; background: #FFFFFF; padding: 4px; border-radius: 2px; line-height: 0; }
.tagcard .face svg { width: 120px; height: auto; }
.tagcard .info { display: grid; gap: 4px; min-width: 0; }
.tagcard .big { font-family: var(--font-data); font-size: 1.5rem; font-weight: 500; }
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--rule); background: var(--paper); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); }
.pill.ok::before { background: var(--ok); }
.pill.low::before { background: var(--low); }
.pill.out::before { background: var(--blind); }
.pill.none::before { background: var(--rule); }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice button { flex: 1 1 120px; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 10px 12px; font-weight: 600; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.choice svg { width: 20px; height: 20px; flex: none; }
.choice button[aria-pressed="true"]:not(.ok):not(.low) { background: var(--ribbon); color: var(--ribbon-ink); border-color: var(--ribbon); }
.choice button[aria-pressed="true"].ok { background: var(--ok); color: var(--sheet); border-color: var(--ok); }
.choice button[aria-pressed="true"].low { background: var(--low); color: var(--sheet); border-color: var(--low); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 0.92rem; }
thead th { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); padding-block: 8px; white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }
td.num { white-space: nowrap; font-family: var(--font-data); }
td.note2 { color: var(--ink-2); font-size: 0.86rem; }

/* ---------- sheets & dialogs ---------- */
.sheet-pop { position: fixed; z-index: 50; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px)); max-height: min(80vh, 720px); background: var(--sheet); border: 1px solid var(--rule); border-radius: 5px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.sheet-pop .ph { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--rule); }
.sheet-pop .ph h2 { font-size: 1.15rem; flex: 1; }
.sheet-pop .pb { overflow-y: auto; padding: 14px 18px 18px; display: grid; gap: 16px; }
.sheet-pop .pf { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.typegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.typecard { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 10px 12px 12px; text-align: left; display: grid; gap: 6px; align-content: start; min-height: 120px; }
.typecard:hover, .typecard.focus { border-color: var(--ribbon); box-shadow: inset 0 0 0 1px var(--ribbon); }
.typecard svg { width: 44px; height: 44px; }
.typecard b { font-size: 0.98rem; }
.typecard span { font-size: 0.82rem; color: var(--ink-2); line-height: 1.35; }
.typesearch { width: 100%; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 10px 12px; min-height: 44px; font-size: 1rem; }
.group-h { margin-top: 2px; }

/* ---------- pages (lists, build list, catalog, scan, settings) ---------- */
.page { flex: 1; overflow-y: auto; }
.page-in { max-width: 1080px; margin: 0 auto; padding: 20px clamp(16px, 4vw, 36px) 80px; display: grid; gap: 30px; }
.block-sec { display: grid; gap: 12px; }
.block-sec > h2 { font-size: 1.3rem; font-weight: 600; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.block-sec > p { max-width: 68ch; color: var(--ink-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--rule); background: var(--sheet); border-radius: 4px; padding: 14px 16px; display: grid; gap: 8px; text-align: left; align-content: start; }
button.card:hover { border-color: var(--ribbon); }
.card h3 { font-size: 1.1rem; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini { width: 100%; height: 120px; display: block; background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.3px); background-size: 14px 14px; border: 1px solid var(--rule); border-radius: 3px; background-color: var(--paper); }
.titleblock { display: flex; flex-wrap: wrap; gap: 1px; margin: 0; border: 1.5px solid var(--ink); background: var(--rule); }
.titleblock div { flex: 1 1 140px; padding: 8px 12px 10px; background: var(--sheet); display: grid; gap: 2px; min-width: 0; }
.titleblock dd { margin: 0; font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.titleblock dt { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); }
.tagsheet { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; background: #FFFFFF; border: 1px solid var(--rule); border-radius: 3px; }
.tagsheet figure { margin: 0; display: grid; gap: 4px; justify-items: center; }
.tagsheet figcaption { font-family: var(--font-data); font-size: 0.72rem; color: #586067; max-width: 150px; text-align: center; overflow-wrap: anywhere; }
.empty { border: 1px dashed var(--rule); border-radius: 4px; padding: 26px 20px; display: grid; gap: 10px; justify-items: start; background: var(--sheet); }
.empty h3 { font-size: 1.1rem; }
.list { display: grid; gap: 8px; }
.list-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; }
.list-row .grow { flex: 1 1 200px; min-width: 0; display: grid; gap: 2px; }
.list-row .grow b { overflow-wrap: anywhere; }
.drop { border: 1.5px dashed var(--ribbon); border-radius: 5px; padding: 28px 18px; display: grid; gap: 12px; justify-items: center; text-align: center; background: var(--ribbon-soft); }
.drop label.btn { cursor: pointer; }
.scanimg { position: relative; max-width: 100%; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; line-height: 0; }
.scanimg img { width: 100%; height: auto; display: block; }
.scanimg svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.toast { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 3px; box-shadow: var(--shadow); z-index: 60; font-weight: 500; max-width: calc(100% - 32px); }
.confirm { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--blind); border-radius: 3px; }
.confirm .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- phones ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "main"; }
  .menu-btn { display: inline-grid; }
  .side { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: min(310px, 86vw); transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow); padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .app.nav-open .side { transform: none; }
  .bar { gap: 6px; padding-inline: 6px 12px; }
  .sync span { display: none; }
  .vhead { padding: 10px 14px; }
  .vhead .tools { margin-left: 0; width: 100%; }
  .insp { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none; max-height: 62%; border-radius: 12px 12px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .insp.min { max-height: none; }
  .insp.min .insp-tabs, .insp.min .insp-body { display: none; }
  .insp-head .handle { display: block; position: absolute; left: 50%; top: 5px; width: 40px; height: 4px; border-radius: 2px; background: var(--rule); transform: translateX(-50%); }
  .insp-head { position: relative; padding-top: 16px; }
  .fab .kbd { display: none; }
  .stage.has-insp .fab, .stage.has-insp .zoomer { display: none; }
  .stage.has-insp.insp-min .fab { display: flex; bottom: 100px; }
  .insp-head .expand { display: inline-grid; }
  .sheet-pop { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto; max-height: 86%; border-radius: 12px 12px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .legend { top: auto; bottom: 84px; right: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* compact view header */
.vhead { display: block; padding: 8px 12px; position: relative; }
.hrow { display: flex; align-items: center; gap: 8px 10px; min-width: 0; }
.hrow .vt { font-family: var(--font-display); font-weight: var(--font-display-wt); font-size: clamp(1.35rem, 3.4vw, 1.9rem); line-height: 1.05; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.hrow select.vt { font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; border: 1px solid var(--rule); background: var(--sheet); border-radius: 3px; padding: 7px 30px 7px 10px; min-height: 40px; max-width: 46vw; }
.hrow .meta { font-family: var(--font-data); font-size: 0.8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hrow .grow { flex: 1; }
.hrow .seg button { min-height: 36px; padding: 6px 12px; }
.btn.back .short { display: none; }
.modepill { cursor: pointer; flex: none; }
.menu { position: absolute; right: 12px; top: calc(100% - 4px); z-index: 30; min-width: 230px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 5px; box-shadow: var(--shadow); padding: 6px; display: grid; }
.menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 10px; border-radius: 3px; font-weight: 500; min-height: 44px; }
.menu button:hover { background: var(--ribbon-soft); }
.menu button svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.menu button span:first-of-type { flex: 1; }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 2px; }
.sw { width: 34px; height: 20px; border-radius: 10px; background: var(--rule); position: relative; flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet); transition: left 0.15s; }
.sw.on { background: var(--ribbon); }
.sw.on::after { left: 16px; }
/* wall drawing bar: docked at the bottom, out of the way of the drawing */
.drawbar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 15; display: flex; align-items: center; gap: 8px; background: var(--sheet); border: 1.5px solid var(--ribbon); border-radius: 6px; box-shadow: var(--shadow); padding: 8px 8px 8px 14px; max-width: 620px; margin-inline: auto; }
.drawbar .dtext { flex: 1; display: grid; min-width: 0; line-height: 1.25; }
.drawbar .dtext span { font-size: 0.86rem; color: var(--ink-2); }
.drawbar .btn:disabled { opacity: 0.45; cursor: default; }
.stage:has(.drawbar:not([hidden])) .fab, .stage:has(.drawbar:not([hidden])) .zoomer { display: none; }
.hint span { font-size: 0.84rem; padding: 6px 10px; }
@media (max-width: 860px) {
  .hrow .meta { display: none; }
  .btn.back { padding: 6px 10px 6px 6px; min-height: 40px; }
  .btn.back .long { display: none; }
  .btn.back .short { display: inline; }
  .app[data-route="space"] .bar .crumbs, .app[data-route="plane"] .bar .crumbs { display: none; }
}

@media (max-width: 860px) {
  .hrow select.vt { flex: 1 1 auto; min-width: 0; max-width: none; }
  .modepill { padding: 3px 8px; font-size: 0.74rem; }
}
.insp { overflow: hidden; }
.insp-body { min-height: 0; }

/* every touch lands on the svg; hits come from the layout data */
.stage svg.cv * { pointer-events: none; }

/* divider drawer editor */
.drawer-pick { display: flex; flex-direction: column; gap: 4px; list-style: none; margin: 0; padding: 0; }
.dr-row { display: flex; align-items: stretch; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; min-height: 44px; position: relative; transition: transform .15s ease; }
.drawer-pick.sorting .dr-row.dragging { transition: none; z-index: 2; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.dr-row.on { background: var(--ribbon); color: var(--ribbon-ink); border-color: var(--ribbon); }
.dr-row .grip { border: 0; background: none; color: inherit; opacity: .55; width: 40px; flex: none; display: grid; place-items: center; cursor: grab; touch-action: none; padding: 0; }
.dr-row .grip:active { cursor: grabbing; }
.dr-row .dr-name { flex: 1; border: 0; background: none; color: inherit; text-align: left; font-family: var(--font-data); font-weight: 500; padding: 0 4px; min-height: 44px; }
.dr-row .dr-check { display: flex; align-items: center; gap: 6px; padding: 0 12px; font-size: .85rem; cursor: pointer; }
.dr-row .dr-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ribbon); }
.dr-row.on .dr-check input { accent-color: var(--paper); }
.dvplan { background: var(--sheet); border: 1px solid var(--rule); padding: 6px; touch-action: manipulation; cursor: pointer; }
.dvplan svg { display: block; width: 100%; height: auto; max-height: 340px; user-select: none; -webkit-user-select: none; }
.pl-wall { fill: var(--birch-cut); stroke: var(--ink); stroke-width: 0.9; }
.pl-in { fill: var(--paper); }
.pl-long { fill: var(--birch); stroke: var(--ink); stroke-width: 0.9; }
.pl-print { fill: var(--print); stroke: var(--ink); stroke-width: 0.6; }
.pl-ghost { stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.6; }

@media (max-width: 860px) { .hrow.has-pick #vh-title, .hrow.has-pick .grow { display: none; } .hrow.has-pick .wallpick { flex: 1 1 auto; min-width: 0; } }
.g-resize rect { fill: var(--sheet); stroke: var(--ribbon); stroke-width: 2; }
.g-resize path { fill: none; stroke: var(--ribbon); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.g-resize.on rect { fill: var(--ribbon); }
.g-resize.on path { stroke: var(--ribbon-ink); }
.dr-row .dr-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dr-row .dr-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-row .dr-h { font-size: .8rem; opacity: .7; flex: none; }
.seg.dvmode button { display: inline-flex; align-items: center; gap: 6px; }
.dvplan.fill { cursor: pointer; }
.pl-cell { fill: var(--sheet); stroke: var(--rule); stroke-width: 1; }
.pl-cell.has { fill: color-mix(in srgb, var(--ribbon) 16%, var(--sheet)); stroke: var(--ribbon); }
.pl-cell.low { fill: color-mix(in srgb, var(--low) 22%, var(--sheet)); stroke: var(--low); }
.pl-cell.sel { stroke: var(--ink); stroke-width: 3; }
.pl-ctext { font-family: var(--font-data); font-size: 11px; font-weight: 600; fill: var(--ink); pointer-events: none; }
.pl-ctext.sub { font-weight: 400; font-size: 10px; fill: var(--ink-2); }
.cellcard { border: 1px solid var(--rule); border-left: 4px solid var(--ribbon); background: var(--paper); border-radius: 3px; padding: 10px 12px; display: grid; gap: 12px; }
.cellhead { display: flex; align-items: baseline; gap: 10px; }
.cellhead .big { font-family: var(--font-data); font-size: 1.4rem; font-weight: 600; }
.cellhead .iconbtn { align-self: center; }
.tree .space-row { display: flex; align-items: center; gap: 2px; }
.tree .space-row .space-btn { flex: 1; min-width: 0; }
.tree .space-row .space-btn span:not(.count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .caret { width: 30px; min-width: 30px; padding: 0; justify-content: center; color: var(--ink-2); }
.tree .caret svg { width: 12px; height: 12px; transition: transform .15s ease; }
.tree .caret.open svg { transform: rotate(90deg); }
.tree .caret-sp { width: 30px; flex: none; }
.tree ul { margin-left: 47px; }
.orderbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 8px 10px; font-size: .92rem; }
.orderbar svg { width: 18px; height: 18px; flex: none; }
.orderbar .grow { flex: 1; }
.orderbar .btn { min-height: 36px; padding: 4px 12px; }
.orderbar.ordered { border-color: var(--ribbon); background: var(--ribbon-soft); }
.slider.locked label { display: inline-flex; align-items: center; gap: 6px; }
.slider.locked input { opacity: .45; }
.price { font-size: .95rem; min-width: 56px; text-align: right; }
.carttotal { display: grid; gap: 10px; margin-top: 14px; max-width: 460px; }
.seg.cartmode { margin-top: 6px; align-self: start; width: max-content; max-width: 100%; }
.seg.cartmode button { min-height: 34px; padding: 4px 12px; font-size: .86rem; }
.orderitems { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.orderitems li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.orderitems li > span:first-child { font-weight: 600; }
.orderitems .btn { min-height: 32px; padding: 2px 10px; }
.g-plane-label.link { fill: var(--ribbon); text-decoration: underline; text-underline-offset: 3px; }
.g-dr-empty { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 3; opacity: .6; }
.g-dr-add circle { fill: var(--sheet); stroke: var(--ribbon); stroke-width: 1.6; }
.g-dr-add path { stroke: var(--ribbon); stroke-width: 2.2; stroke-linecap: round; }
.g-dr-size rect { fill: var(--ribbon); }
.g-dr-size text { fill: var(--ribbon-ink); font-family: var(--font-data); font-size: 12px; font-weight: 600; }
.field.pulse select { border-color: var(--ribbon); box-shadow: 0 0 0 3px var(--ribbon-soft); }
.szpick { position: fixed; z-index: 60; display: grid; gap: 4px; padding: 8px; min-width: 96px; background: var(--sheet); border: 1px solid var(--ink); border-radius: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.szpick .label { font-size: .7rem; text-align: center; }
.szpick button { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; min-height: 40px; font-family: var(--font-data); font-weight: 600; font-size: 1rem; }
.szpick button[aria-selected="true"] { background: var(--ribbon); color: var(--ribbon-ink); border-color: var(--ribbon); }
.szpick button:hover { border-color: var(--ribbon); }
.g-hostplane { stroke: var(--ribbon); stroke-width: 3; stroke-linecap: round; }
.g-hostplane-label { fill: var(--ribbon); font-family: var(--font-body); font-weight: 600; font-size: 10.5px; text-decoration: underline; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
.g-face-cand { stroke: var(--ribbon); stroke-width: 2; stroke-dasharray: 5 4; }
.g-face-add rect { fill: var(--sheet); stroke: var(--ribbon); stroke-width: 1.4; }
.g-face-add text { fill: var(--ribbon); font-family: var(--font-body); font-weight: 600; font-size: 11px; }
.faces { display: flex; flex-wrap: wrap; gap: 6px; }
.btn.face { min-height: 38px; padding: 4px 12px; }
.btn.face.on { border-color: var(--ribbon); background: var(--ribbon-soft); }
.btn.face .muted { font-size: .8rem; }
.g-blocked { fill: rgba(200, 40, 30, .22); stroke: #B3261E; stroke-width: 1.6; stroke-dasharray: 6 4; }
.g-blocked-t { fill: #8E1B14; font-family: var(--font-body); font-weight: 600; font-size: 11px; }
.g-slotdiv { stroke: var(--ink); stroke-width: 1; }
.g-slotdiv.live { stroke: var(--ribbon); stroke-width: 2; }
.g-slotgrip { fill: var(--sheet); stroke: var(--ribbon); stroke-width: 2; }
.g-slot-sel { fill: color-mix(in srgb, var(--ribbon) 20%, transparent); }
.g-slot-t { fill: var(--ink); font-family: var(--font-body); font-weight: 600; font-size: 10px; }
.slotchips { display: flex; flex-wrap: wrap; gap: 4px; }
.slotchip { border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 4px 8px; min-width: 44px; min-height: 40px; display: grid; justify-items: center; line-height: 1.1; position: relative; font-family: var(--font-data); }
.slotchip span { font-size: .72rem; opacity: .75; }
.slotchip i { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--ribbon); }
.slotchip[aria-pressed="true"] { background: var(--ribbon); color: var(--ribbon-ink); border-color: var(--ribbon); }
.slotchip[aria-pressed="true"] i { background: var(--ribbon-ink); }

/* sidebar width: drag the edge, arrow keys on it, double-click to reset */
.side-resize { position: fixed; top: var(--bar-h); bottom: 0; left: calc(var(--side-w, 264px) - 4px); width: 8px; cursor: col-resize; z-index: 30; touch-action: none; }
.side-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.side-resize:hover::after, .side-resize:focus-visible::after, .side-resize.on::after { background: var(--ribbon); }
.side-resize:focus-visible { outline: none; }
body.side-dragging, body.side-dragging * { cursor: col-resize !important; user-select: none !important; }
@media (max-width: 860px) { .side-resize { display: none; } }
/* layout from a photo */
.lay .list-row.same { opacity: .62; }
.lay .chk { width: 26px; height: 26px; flex: none; display: inline-grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--sheet); color: var(--sheet); font-weight: 700; cursor: pointer; padding: 0; }
.lay .chk[aria-pressed="true"] { background: var(--ink); }
.lay .chk.off { border-color: var(--rule); color: var(--muted, #888); cursor: default; }
.lay .btn-row { display: flex; gap: 8px; }
.g-chip.anchor { fill: #FFF3C4; stroke: #8A6A00; }
.g-chip.anchor + .g-chip-t { fill: #5A4500; }
/* dragging a drawer */
.g-drghost rect { fill: var(--birch); stroke: var(--ink); stroke-width: 1.5; opacity: .88; }
.g-drghost circle { fill: var(--paper); stroke: var(--ink); }
.g-drghost.ok rect { stroke: var(--ribbon); stroke-width: 3; }
.g-drghost.bad rect { stroke: #B3261E; stroke-width: 3; stroke-dasharray: 6 4; fill: rgba(200,40,30,.18); }
.g-drop { stroke: var(--ribbon); stroke-width: 4; stroke-linecap: round; }
.g-drop.bad { stroke: #B3261E; }
.drtip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--sheet); font: 500 .82rem/1.25 var(--font, system-ui); padding: 5px 9px; border-radius: 3px; max-width: 280px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.drtip.ok { background: var(--ribbon); }
.drtip.bad { background: #B3261E; }
/* settings panel: movable and resizable */
.insp-head { touch-action: none; cursor: grab; }
.insp-head:active { cursor: grabbing; }
.insp-head input.name { cursor: text; }
.insp-head .handle { display: block; position: absolute; left: 50%; top: 5px; width: 40px; height: 4px; border-radius: 2px; background: var(--rule); transform: translateX(-50%); }
.insp-head { position: relative; padding-top: 16px; }
.insp .rz { position: absolute; z-index: 3; }
.insp .rz-n, .insp .rz-s { left: 10px; right: 10px; height: 8px; cursor: ns-resize; }
.insp .rz-n { top: -4px; } .insp .rz-s { bottom: -4px; }
.insp .rz-e, .insp .rz-w { top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; }
.insp .rz-e { right: -4px; } .insp .rz-w { left: -4px; }
.insp .rz-ne, .insp .rz-nw, .insp .rz-se, .insp .rz-sw { width: 14px; height: 14px; }
.insp .rz-ne { top: -4px; right: -4px; cursor: nesw-resize; } .insp .rz-sw { bottom: -4px; left: -4px; cursor: nesw-resize; }
.insp .rz-nw { top: -4px; left: -4px; cursor: nwse-resize; } .insp .rz-se { bottom: -4px; right: -4px; cursor: nwse-resize; }
.insp .rz-se, .insp .rz-sw, .insp .rz-ne, .insp .rz-nw { width: 22px; height: 22px; }
.insp .rz-se::after { content: ''; position: absolute; right: 7px; bottom: 7px; width: 11px; height: 11px; border-right: 3px solid var(--ribbon); border-bottom: 3px solid var(--ribbon); border-bottom-right-radius: 3px; }
.insp .rz-se:hover::after { border-color: color-mix(in srgb, var(--ribbon) 75%, black); }
.insp-head .handle { width: 46px; height: 5px; background: color-mix(in srgb, var(--ribbon) 45%, var(--rule)); }
@media (max-width: 860px) { .insp .rz { display: none; } }

/* the settings panel's resize arrows: big, bold, teal */
.insp .rz-e, .insp .rz-w { cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-18 -18 36 36'%3E%3Cg transform='rotate(0)' stroke-linecap='round' stroke-linejoin='round' fill='none'%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='white' stroke-width='7'/%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='%230E7C8A' stroke-width='3.5'/%3E%3C/g%3E%3C/svg%3E") 18 18, ew-resize; width: 12px; }
.insp .rz-n, .insp .rz-s { cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-18 -18 36 36'%3E%3Cg transform='rotate(90)' stroke-linecap='round' stroke-linejoin='round' fill='none'%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='white' stroke-width='7'/%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='%230E7C8A' stroke-width='3.5'/%3E%3C/g%3E%3C/svg%3E") 18 18, ns-resize; height: 12px; }
.insp .rz-e { right: -6px; } .insp .rz-w { left: -6px; } .insp .rz-n { top: -6px; } .insp .rz-s { bottom: -6px; }
.insp .rz-nw, .insp .rz-se { cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-18 -18 36 36'%3E%3Cg transform='rotate(45)' stroke-linecap='round' stroke-linejoin='round' fill='none'%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='white' stroke-width='7'/%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='%230E7C8A' stroke-width='3.5'/%3E%3C/g%3E%3C/svg%3E") 18 18, nwse-resize; }
.insp .rz-ne, .insp .rz-sw { cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='-18 -18 36 36'%3E%3Cg transform='rotate(-45)' stroke-linecap='round' stroke-linejoin='round' fill='none'%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='white' stroke-width='7'/%3E%3Cpath d='M-12 0H12M-12 0l6-6M-12 0l6 6M12 0l-6-6M12 0l-6 6' stroke='%230E7C8A' stroke-width='3.5'/%3E%3C/g%3E%3C/svg%3E") 18 18, nesw-resize; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); color: var(--ink); cursor: pointer; }
.toggle-row:hover { border-color: var(--ribbon); }
.toggle-row > span:first-child { display: grid; gap: 2px; }
.toggle-row .sub { font-size: .82rem; color: var(--ink-2); }
.slatfaces { display: grid; gap: 6px; }
.slatfaces .toggle-row { padding: 7px 12px; }
.toggle-row.fixed { cursor: default; opacity: .7; }
.toggle-row[disabled] { cursor: not-allowed; opacity: .6; }

/* pricing settings */
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.price-grid > label { display: grid; gap: 4px; font-size: .86rem; font-weight: 600; }
.money-in { display: flex; align-items: center; gap: 4px; font-family: var(--font-data); }
.price-grid input[type="number"] { width: 100%; min-width: 0; border: 1px solid var(--rule); background: var(--paper); border-radius: 3px; padding: 8px 10px; min-height: 40px; font-family: var(--font-data); }
.price-grid .field > label { font-size: .86rem; }
.lam-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.25); }

.g-stowed { fill: rgba(18, 133, 141, 0.06); stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 5 4; }
.g-stowed.sel { fill: rgba(18, 133, 141, 0.16); stroke: var(--ribbon); stroke-width: 2.5; }

.g-marq { fill: rgba(18, 133, 141, 0.08); stroke: var(--ribbon); stroke-width: 1.5; stroke-dasharray: 6 4; pointer-events: none; }
.g-marq-dot { fill: none; stroke: var(--ribbon); stroke-width: 2; pointer-events: none; }

.on-dark .g-text:not(.out), .on-dark .g-sub, .on-dark .g-slot-t { fill: #fff; }

/* Ask Claude */
.ai-btn { min-height: 34px; padding: 6px 12px; margin-right: 10px; color: var(--ribbon); border-color: var(--ribbon); }
.ai-btn[aria-expanded="true"] { background: var(--ribbon); color: #fff; }
.ai { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); max-height: min(60vh, 520px); display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--ribbon); border-radius: 6px; box-shadow: var(--shadow); z-index: 60; }
.ai[hidden] { display: none; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px 14px; }
.ai-head .grow { flex: 1; }
.ai-head .btn { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; }
.ai-log { overflow-y: auto; padding: 4px 14px 8px; display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.ai-tip { font-size: 0.9rem; margin: 0; }
.ai-msg { font-size: 0.93rem; line-height: 1.4; white-space: pre-wrap; }
.ai-msg.me { align-self: flex-end; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px 10px 2px 10px; padding: 6px 10px; max-width: 85%; }
.ai-msg.bot { align-self: flex-start; max-width: 95%; }
.ai-msg.err { color: var(--blind, #B3261E); }
.ai-acts { font-family: "IBM Plex Mono", monospace; font-size: 0.78rem; color: var(--ribbon); }
.ai-form { display: flex; gap: 8px; padding: 8px 10px 10px; border-top: 1px solid var(--rule); align-items: flex-end; }
.ai-form textarea { flex: 1; resize: none; font: inherit; font-size: 0.95rem; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); min-height: 40px; max-height: 120px; }
.ai-form textarea:focus { outline: 2px solid var(--ribbon); outline-offset: -1px; }
@media (max-width: 640px) { .ai-btn span { display: none; } .ai-btn { margin-right: 4px; } .ai { bottom: 10px; } }

/* drawer counts on the Drawers tab */
.dr-counts { display: flex; flex-direction: column; gap: 6px; }
.dr-count { display: grid; grid-template-columns: 1fr 36px 36px 36px; align-items: center; gap: 6px; }
.dr-count-l { font-weight: 600; font-size: 0.92rem; }
.dr-count .iconbtn { width: 36px; height: 36px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet); font-size: 1.15rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.dr-count .iconbtn:disabled { opacity: 0.35; }
.dr-count output { text-align: center; font-family: "IBM Plex Mono", monospace; font-size: 1rem; font-weight: 500; }
.dr-count .numbox { justify-self: center; gap: 0; }
.dr-count .numbox input, .field .dr-count .numbox input { width: 36px; height: 36px; min-height: 36px; padding: 0; text-align: center; font-weight: 500; }
.dr-count .numbox .unit { display: none; }

/* custom cabinet: the edge picker */
.cc-pick { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; margin: 4px 0 6px; }
.cc-pick svg { display: block; width: 100%; height: auto; }
.cc-face { fill: rgba(205, 182, 137, 0.35); stroke: var(--ink-2); stroke-width: 0.8; stroke-linejoin: round; }
.cc-edge { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.cc-edge.hid { stroke-dasharray: 4 4; stroke-width: 1.2; opacity: 0.6; }
.cc-edge.used { stroke: var(--ribbon); }
.cc-hit { stroke: transparent; stroke-width: 16; stroke-linecap: round; cursor: pointer; }
.cc-hit:hover { stroke: rgba(18, 133, 141, 0.28); }
.cc-cut { border: 1px solid var(--rule); border-radius: 4px; padding: 6px 10px 2px; margin-top: 8px; background: var(--sheet); }
.cc-cut-h { display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; }
.cc-cut-h .iconbtn { width: 32px; height: 32px; }

/* cart filters */
.cartfilter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.cartfilter input[type=search] { flex: 1 1 220px; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet); color: var(--ink); font: inherit; }
.cartfilter select { flex: 0 1 auto; min-height: 40px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet); color: var(--ink); font: inherit; max-width: 100%; }
.cartshown { margin: 0 0 8px; font-size: .9rem; }
.linkbtn { background: none; border: none; padding: 0; color: var(--ribbon); font: inherit; text-decoration: underline; cursor: pointer; }
@media (max-width: 640px) { .cartfilter select { flex: 1 1 45%; } }

/* AI block */
#aib-text, #aib-rev { width: 100%; font: inherit; font-size: .95rem; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); resize: vertical; }
#aib-text:focus, #aib-rev:focus { outline: 2px solid var(--ribbon); outline-offset: -1px; }
.aib-photos { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.aib-thumb { position: relative; width: 64px; height: 64px; border-radius: 4px; overflow: hidden; border: 1px solid var(--rule); }
.aib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aib-thumb button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.aib-add { min-height: 36px; padding: 6px 12px; cursor: pointer; }
.aib-status { font-size: .9rem; margin: 6px 0; color: var(--ribbon); }
.aib-status.err { color: var(--blind, #B3261E); }
.aib-card { border: 1px solid var(--rule); border-left: 3px solid var(--ribbon); border-radius: 4px; padding: 8px 10px; background: var(--sheet); }
.aib-card .label svg, .ph h2 svg { vertical-align: -3px; margin-right: 4px; color: var(--ribbon); }

.ai-model { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-2); margin-left: auto; }
.ai-model select { min-height: 34px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet); color: var(--ink); font: inherit; font-size: .88rem; }
.ai-foot { display: flex; justify-content: flex-end; padding: 0 10px 8px; }

/* drawing a cabinet */
.g-cabdraft { fill: none; stroke: var(--ribbon); stroke-width: 2.5; stroke-dasharray: 7 5; pointer-events: none; }
.g-cabfill { fill: rgba(18, 133, 141, 0.12); stroke: none; pointer-events: none; }
.g-cabpt { fill: var(--sheet); stroke: var(--ribbon); stroke-width: 2.5; pointer-events: none; }
.g-cabpt.first { fill: var(--ribbon); }
.cab-side { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.cab-side.open { stroke-dasharray: 5 5; stroke-width: 2; opacity: .6; }
.cab-side.doorL, .cab-side.doorR, .cab-side.doors { stroke: var(--ribbon); stroke-width: 5; }
.cab-side.sel { stroke: #EE6C55; }
.cab-num { font: 600 12px var(--font-body); fill: var(--ink-2); pointer-events: none; }
.cab-num.sel { fill: #EE6C55; }
.cab-kinds { flex-wrap: wrap; }
.cab-kinds button { flex: 1 1 45%; }

.lib-note { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--ribbon); }
.lib-note svg { width: 16px; height: 16px; flex: none; }

/* signed out, an account outside the team, or offline: only the bar and a card */
.app.gated { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "main"; }
.app.gated .side, .app.gated .menu-btn, .app.gated ~ .side-resize { display: none; }
.gate-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Settings, People: outside Google accounts the team let in */
.people { list-style: none; margin: 0; padding: 0; display: grid; max-width: 520px; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.people-email { font-family: var(--font-data); font-size: 0.9rem; min-width: 0; overflow-wrap: anywhere; }
.people-add { display: flex; flex-wrap: wrap; gap: 8px; max-width: 520px; }
.people-add input { flex: 1 1 220px; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet); color: var(--ink); font: inherit; }

/* Drawing planes: a wall that has squared up turns solid green, with a guide along its line and the right-angle mark at the corner.
   Walls it runs parallel to light up with the same arrow mark, a dotted line runs from a corner it is even with, and a ring
   shows it landed on a corner. */
.g-draft.sq { stroke: var(--ok); stroke-dasharray: none; }
.g-cursor.sq { stroke: var(--ok); }
.g-guide { stroke: var(--ok); stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.75; fill: none; pointer-events: none; }
.g-right { stroke: var(--ok); stroke-width: 2; fill: none; stroke-linejoin: miter; pointer-events: none; }
.g-right-t { fill: var(--ok); font: 600 11px var(--font-data); pointer-events: none; }
.g-par { stroke: var(--ok); stroke-width: 7; stroke-linecap: round; opacity: 0.3; fill: none; pointer-events: none; }
.g-par-mark { stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; pointer-events: none; }
.g-align { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 3 4; fill: none; pointer-events: none; }
.g-align-pt { fill: var(--paper); stroke: var(--ok); stroke-width: 2; pointer-events: none; }
.g-snap-corner { fill: none; stroke: var(--ok); stroke-width: 2.5; pointer-events: none; }
/* Erasing while drawing: the plane under the pointer turns red, and the Erase button shows it is on */
.g-erase { stroke: var(--blind); stroke-width: 8; stroke-linecap: round; opacity: 0.8; pointer-events: none; }
.drawbar.erasing { border-color: var(--blind); }
.drawbar.erasing .wall-len { display: none; }
.drawbar .btn[aria-pressed="true"], .drawbar .btn[aria-pressed="true"]:hover { background: var(--blind); border-color: var(--blind); color: var(--sheet); }
@media (max-width: 640px) { .drawbar .btn.ic span { display: none; } .drawbar .btn.ic { padding: 8px 10px; } }
/* Right-click on a plane in the top view: a small menu by the pointer */
.pmenu { position: fixed; right: auto; top: auto; z-index: 60; min-width: 180px; }
.pmenu .label { padding: 6px 10px 2px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button.danger, .menu button.danger svg { color: var(--blind); }
/* The plane view's Delete, by the plane picker: pressed once it asks, pressed again it deletes */
.hrow .iconbtn.del { width: 40px; height: 40px; color: var(--ink-2); }
.wallhead select.vt { min-width: min(9.5rem, 40vw); }   /* the plane's name stays readable; the title and size give way first */
.hrow .iconbtn.del:hover { color: var(--blind); }
.hrow .iconbtn.del svg { width: 20px; height: 20px; }
.hrow .delarm { min-height: 38px; padding: 6px 12px; flex: none; border-color: var(--blind); }
/* Undo and Redo in the message at the top */
.toast { display: flex; align-items: center; gap: 14px; }
.toast-act { border: 0; background: none; padding: 2px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wall-len { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); flex: none; }
.wall-len input { width: 10ch; min-height: 36px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); color: var(--ink); font: 500 0.95rem var(--font-data); }
.wall-len input:focus { outline: 2px solid var(--ribbon); outline-offset: 1px; }
@media (pointer: coarse) { .wall-len { display: none; } }

/* Report a bug: always in the top bar; the team reads reports in Settings */
.report-btn { min-height: 34px; padding: 6px 12px; margin-right: 8px; font-size: 0.88rem; }
.report-btn svg { color: var(--low); }
@media (max-width: 640px) { .report-btn span { display: none; } .report-btn { padding: 6px 8px; margin-right: 4px; } }
.reports { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 640px; }
.report { display: grid; gap: 6px; justify-items: start; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); }
.report.done { opacity: 0.7; }
.report-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.report-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.report-meta { margin: 0; font-size: 0.8rem; overflow-wrap: anywhere; }
.report .pill { font: 600 0.72rem var(--font-data); letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.report .pill.bug { color: var(--low); }
.report .pill.idea { color: var(--ribbon); }
.reports-done { margin-top: 12px; }
.reports-done summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }

/* Activity: the team's view of who has been in and what everyone changed */
.act-h1 { font-family: var(--font-display); font-weight: var(--font-display-wt); font-size: clamp(2.1rem, 6vw, 3.2rem); line-height: 0.95; text-wrap: balance; }
.act-people th[scope="row"] { font-weight: 400; min-width: 0; }
.act-person { display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.act-person span { font-size: 0.82rem; overflow-wrap: anywhere; }
.act-person:hover b { color: var(--ribbon); }
.act-people tr.on th, .act-people tr.on td { background: var(--ribbon-soft); }
.act-people .num { text-align: right; }
.act-note { font-size: 0.84rem; margin-top: 8px; }
.pill.team::before { background: var(--ribbon); }
.act-feed { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--rule); }
.act-feed li { display: grid; gap: 3px; padding: 10px 2px; border-bottom: 1px solid var(--rule); min-width: 0; }
.act-line { overflow-wrap: anywhere; }
.act-meta { font-size: 0.84rem; }
.act-where { border: 0; background: none; padding: 0; font: inherit; color: var(--ribbon); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
@media (max-width: 560px) {   /* phones: each person on two lines, name and email left, access and last seen right */
  .act-people thead { display: none; }
  .act-people tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
  .act-people tbody tr:last-child { border-bottom: 0; }
  .act-people th, .act-people td { padding: 0; border: 0; }
  .act-people th[scope="row"] { grid-column: 1; grid-row: 1 / span 2; }
  .act-people td { grid-column: 2; justify-self: end; font-size: 0.84rem; }
  .act-people td.num { display: none; }
}

/* New space from a room scan: the walls it found, to check before making the space */
.scan-pick { cursor: pointer; }
.scan-prev { display: grid; gap: 6px; justify-items: center; padding: 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }
.scan-plan { width: 100%; max-width: 300px; height: auto; }
.scan-plan line { stroke: var(--wall); stroke-width: 3; stroke-linecap: round; }
.scan-prev p { margin: 0; font-family: var(--font-data); font-size: 0.9rem; }
.scan-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.scan-err { color: var(--blind); font-size: 0.9rem; margin: 0; }
.scan-ways { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; }
.scan-sq { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.scan-sq input { width: 18px; height: 18px; accent-color: var(--ribbon); }
.scan-prev .sub { text-align: center; }

/* A block's Faces tab: a checkbox per side to make it a plane; the side picked on the plan or in 3D is marked */
.faces { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.faces li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }
.faces li.on { border-color: var(--ribbon); box-shadow: inset 3px 0 0 var(--ribbon); }
.face-check { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.face-check input { width: 20px; height: 20px; accent-color: var(--ribbon); flex: none; margin: 0; }
.face-check > span { display: grid; gap: 2px; min-width: 0; }
.face-check .sub { font-size: 0.8rem; color: var(--ink-2); }
.face-check.off { cursor: default; opacity: 0.6; }
/* the plan: the picked face, and the side under the pointer */
.g-face-pick { stroke: var(--ribbon); stroke-width: 6; stroke-linecap: round; pointer-events: none; }
.g-face-hover { stroke: var(--ribbon); stroke-width: 4; stroke-linecap: round; opacity: 0.5; pointer-events: none; }
