/* Torgeson Electric brand: navy #172A3C, lime #D2D431, blue #224FAA, Roboto (from torgesonelectric.com) */
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url(vendor/fonts/roboto-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url(vendor/fonts/roboto-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url(vendor/fonts/roboto-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 900; font-display: swap; src: url(vendor/fonts/roboto-latin-900-normal.woff2) format('woff2'); }
:root {
  --navy: #172a3c; --navy-2: #0f1e2c; --navy-3: #22384d; --lime: #d2d431; --lime-2: #bfc12a; --blue: #224faa;
  --bg: #eef1f4;
  --stage: #e1e6eb;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --text: #172a3c;
  --muted: #5a6a7a;
  --line: #d5dce3;
  --accent: #224faa;
  --accent-ink: #ffffff;
  --accent-soft: #e3eaf7;
  --lime-soft: #f2f3c9;
  --mark: #e8710a;           /* measure / snap markers: must stand out on any model colour */
  --bar: var(--navy); --bar-ink: #ffffff; --bar-muted: #a9b8c6;
  --ok: #1e8a4c;
  --warn: #b7791f; --warn-soft: #fbf0dc;
  --shadow: 0 6px 24px rgba(15, 30, 44, .16);
  --radius: 10px;
  --tb-h: 64px;
  --top-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1722; --stage: #132230; --surface: #172a3c; --surface-2: #1f3549; --text: #e9eef3; --muted: #9fb0c0; --line: #2a4157;
    --accent: #d2d431; --accent-ink: #172a3c; --accent-soft: rgba(210, 212, 49, .16); --lime-soft: rgba(210, 212, 49, .16);
    --bar: #0f1e2c; --warn-soft: #3a2e17; --shadow: 0 6px 24px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1722; --stage: #132230; --surface: #172a3c; --surface-2: #1f3549; --text: #e9eef3; --muted: #9fb0c0; --line: #2a4157;
  --accent: #d2d431; --accent-ink: #172a3c; --accent-soft: rgba(210, 212, 49, .16); --lime-soft: rgba(210, 212, 49, .16);
  --bar: #0f1e2c; --warn-soft: #3a2e17; --shadow: 0 6px 24px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { overflow: hidden; touch-action: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* Top bar */
#topbar { height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0;
  display: flex; align-items: center; gap: 8px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 5; }
#title { flex: 1; min-width: 0; }
#modelName { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#modelSub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn:active, .iconbtn:hover { background: var(--surface-2); }
.iconbtn svg, .tool svg { width: 24px; height: 24px; }
#netStatus { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
#netStatus.off { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Stage */
#stage { position: relative; flex: 1; min-height: 0; background: var(--stage); }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 99px; box-shadow: var(--shadow); font-size: 14px; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; background: color-mix(in srgb, var(--stage) 80%, transparent); z-index: 3; text-align: center; }
#loading .bar { width: min(320px, 70vw); height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
#loading .txt { color: var(--muted); font-size: 14px; }
.mlabel { position: absolute; transform: translate(-50%, -50%); background: var(--text); color: var(--surface); font-weight: 650;
  padding: 3px 8px; border-radius: 6px; font-size: 13px; pointer-events: none; white-space: nowrap; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* Walk controls */
#joy { position: absolute; left: 24px; bottom: 24px; width: 130px; height: 130px; border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 55%, transparent); border: 2px solid var(--line); touch-action: none; z-index: 2; }
#joy i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: var(--accent); opacity: .9; }
#walkUD { position: absolute; right: 18px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 2; }
#walkUD button { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); font-size: 18px; touch-action: none; }

/* Toolbar */
#toolbar { display: flex; justify-content: safe center; gap: 2px; background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + var(--safe-b)); z-index: 5; overflow-x: auto; scrollbar-width: none; }
#toolbar::-webkit-scrollbar { display: none; }
.tool { min-width: 62px; height: 56px; border: 0; border-radius: 10px; background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); cursor: pointer; flex: none; padding: 0 6px; }
.tool:hover { background: var(--surface-2); }
.tool.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.tool:disabled { opacity: .35; }

/* Panel */
#panel { position: absolute; z-index: 4; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; }
@media (min-width: 820px) {
  #panel { top: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 10px); left: 10px; width: 370px;
    bottom: calc(var(--tb-h) + var(--safe-b) + 10px); border-radius: var(--radius); }
}
@media (max-width: 819px) {
  #panel { left: 0; right: 0; bottom: calc(var(--tb-h) + var(--safe-b)); max-height: 52%; height: 52%; border-radius: var(--radius) var(--radius) 0 0; }
}
.ph { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--line); }
.ph h2 { flex: 1; font-size: 16px; margin: 0; }
#panelBody { overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.pad { padding: 12px 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; min-height: 42px; padding: 0 14px; cursor: pointer; font-weight: 550; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; }

/* Tree */
.search { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--surface-2); color: var(--text); font: inherit; }
.trow { display: flex; align-items: center; min-height: 40px; gap: 2px; padding-right: 8px; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); cursor: pointer; }
.trow:hover { background: var(--surface-2); }
.trow.sel { background: var(--accent-soft); }
.trow.dim .nm { opacity: .45; }
.trow .exp { width: 32px; height: 40px; border: 0; background: none; flex: none; color: var(--muted); cursor: pointer; }
.trow .exp.leaf { visibility: hidden; }
.trow .eye { width: 36px; height: 40px; border: 0; background: none; flex: none; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.trow .eye svg { width: 20px; height: 20px; }
.trow .eye.off { color: var(--accent); }
.trow .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .cls { font-size: 11px; color: var(--muted); margin-left: 6px; }

/* Properties */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; }
.crumbs button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 3px 9px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.pg { border-top: 1px solid var(--line); }
details.pg summary { padding: 10px 16px; font-weight: 650; cursor: pointer; background: var(--surface-2); }
table.pt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.pt td { padding: 6px 16px; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); vertical-align: top; word-break: break-word; }
table.pt td:first-child { color: var(--muted); width: 42%; padding-right: 6px; }

/* Lists */
.li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.li:hover { background: var(--surface-2); }
.li .grow { flex: 1; min-width: 0; }
.li > svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.grp { padding: 10px 16px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }

/* Section sliders */
.axis { padding: 8px 16px; }
.axis label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.dual { position: relative; height: 36px; }
.dual input { position: absolute; left: 0; right: 0; width: 100%; top: 6px; pointer-events: none; -webkit-appearance: none; appearance: none; background: none; }
.dual input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.dual input::-moz-range-thumb { pointer-events: auto; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
.dual .track { position: absolute; left: 0; right: 0; top: 16px; height: 6px; border-radius: 9px; background: var(--line); }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; min-height: 48px; border-bottom: 1px solid var(--line); }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Library */
#library { position: absolute; inset: 0; z-index: 6; background: var(--bg); overflow: auto; }
.libwrap { max-width: 860px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 40px; }
.libhead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.libhead h1 { font-size: 22px; margin: 0; flex: 1; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card h3 { margin: 0; font-size: 16px; }
.card .meta { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.drop { margin-top: 18px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); color: var(--accent); }
.empty { padding: 20px; text-align: center; color: var(--muted); }

/* Measure: axis colours, snap marker, result cards */
:root { --ax-x: #c92a2a; --ax-y: #2b8a3e; --ax-z: #1864c8; }
.mlabel.ax { font-size: 12px; padding: 2px 6px; transform: translate(-50%, -50%); color: #fff; }
.mlabel.ax-x, .axd.ax-x { background: var(--ax-x); }
.mlabel.ax-y, .axd.ax-y { background: var(--ax-y); }
.mlabel.ax-z, .axd.ax-z { background: var(--ax-z); }
.mlabel.live { opacity: .8; }
.snapmark { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; z-index: 2; }
.snapmark, .sk { border: 2.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.snapmark[data-type="edge"], .sk[data-type="edge"] { transform: rotate(45deg) scale(.82); }
.snapmark[data-type="face"], .sk[data-type="face"] { border-radius: 50%; transform: scale(.7); }
.snapkey { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.snapkey span { display: inline-flex; align-items: center; gap: 8px; }
.sk { display: inline-block; width: 14px; height: 14px; }
.mcard { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.mhead { display: flex; align-items: baseline; gap: 10px; padding: 0 16px; flex-wrap: wrap; }
.mhead .small { flex: 1; }
.mdist { font-size: 20px; font-variant-numeric: tabular-nums; }
.axrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 16px; }
.axc { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 6px 8px; font-variant-numeric: tabular-nums; font-size: 13px; min-width: 0; }
.axd { color: #fff; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 5px; flex: none; }

/* Egnyte library */
.acct { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; flex-wrap: wrap; }
.acct .grow { flex: 1; min-width: 180px; }
.plist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.plist .li:last-child { border-bottom: 0; }
.card.warn { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
details.drop summary { list-style: none; }
details.drop summary::-webkit-details-marker { display: none; }

/* model set / selection sets in the tree panel */
.prow { gap: 10px; }
.prow .nm, .setrow .nm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setrow.sel { background: var(--accent-soft); }

/* share */
.qrbox { display: inline-block; padding: 8px; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.qrbox svg { display: block; width: 220px; height: 220px; max-width: 60vw; max-height: 60vw; }

/* view cube */
#viewcube { position: absolute; top: 12px; right: 12px; width: 96px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#viewcube .vc-stage { position: relative; width: 70px; height: 70px; margin: 14px 12px 22px; }
#viewcube .vc-face { position: absolute; left: 0; top: 0; width: 70px; height: 70px; border: 1px solid var(--line); box-sizing: border-box;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backface-visibility: hidden; transform-origin: 50% 50%;
  display: grid; grid-template-columns: 24% 1fr 24%; grid-template-rows: 24% 1fr 24%; }
#viewcube .vc-hit { margin: 0; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; min-width: 0; min-height: 0;
  font: 650 9px/1 system-ui, sans-serif; letter-spacing: .03em; overflow: hidden; }
#viewcube .vc-hit.hov, #viewcube .vc-hit:hover { background: var(--accent-soft); color: var(--accent); }
#viewcube .vc-hit:not(.vc-mid).hov { background: color-mix(in srgb, var(--accent) 45%, transparent); }
#viewcube .vc-home { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
#viewcube .vc-home svg { width: 18px; height: 18px; }
@media (max-width: 819px) { #viewcube { top: 8px; right: 6px; transform: scale(.8); transform-origin: top right; } }

/* search */
.sform { display: flex; gap: 8px; }
.sform .search { flex: 1; min-width: 0; }
.sfield { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sfield .search { flex: 1; min-width: 0; height: 36px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 4px 10px; font-size: 13px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sres-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
details.pg summary { display: flex; align-items: center; gap: 6px; }
details.pg summary .gbtn { margin-left: auto; }
.li .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- PDF plans ---------- */
#planpick { position: absolute; inset: 0; z-index: 8; background: var(--stage); display: flex; flex-direction: column; }
#planpick[hidden] { display: none; }
.pp-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pp-msg { font-size: 13px; line-height: 1.3; min-width: 0; }
.pp-pages { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13px; }
.pp-pages[hidden] { display: none; }
.pp-view { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: crosshair; }
.pp-cv { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 2px 14px rgba(0,0,0,.18); background: #fff; }
.pp-marks { position: absolute; inset: 0; pointer-events: none; }
.pp-mark { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px solid #e8710a; border-radius: 50%; }
.pp-mark::before, .pp-mark::after { content: ''; position: absolute; background: #e8710a; }
.pp-mark::before { left: 11px; top: -8px; width: 2px; height: 38px; }
.pp-mark::after { top: 11px; left: -8px; height: 2px; width: 38px; }
.pp-mark span { position: absolute; left: 22px; top: -20px; background: #e8710a; color: #fff; font: 600 12px/18px system-ui, sans-serif; padding: 0 6px; border-radius: 9px; }
#planinset { position: absolute; left: 12px; top: 12px; z-index: 4; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; text-align: center; }
#planinset[hidden] { display: none; }
#planinset canvas { display: block; width: 168px; height: 168px; border-radius: 6px; }
#planinset div { margin-top: 4px; color: var(--muted); }
.planrow { border-bottom: 1px solid var(--line); }
.planrow .toggle { padding: 10px 14px; }
.planctl { padding: 0 14px 10px; align-items: center; }
.planctl input[type=range] { flex: 1; min-width: 90px; accent-color: #e8710a; }
.pdfic { font: 700 9px/1 system-ui, sans-serif; color: #fff; background: #c4362b; border-radius: 3px; padding: 4px 3px; flex: none; }
@media (max-width: 819px) { #planinset canvas { width: 120px; height: 120px; } }

/* floating Show all (after isolate / hide) */
#showAllBtn { position: absolute; left: 12px; top: 12px; z-index: 3; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px; }
#showAllBtn[hidden] { display: none; }
#showAllBtn svg { width: 18px; height: 18px; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips .small.muted { align-self: center; margin-right: 2px; }
select.search { appearance: auto; padding-right: 8px; }

/* ======================= Torgeson brand layer ======================= */
/* top bar: navy with the lime rule from torgesonelectric.com */
#topbar { background: var(--bar); color: var(--bar-ink); border-bottom: 3px solid var(--lime); }
#topbar .iconbtn { color: var(--bar-ink); }
#topbar .iconbtn:hover, #topbar .iconbtn:active { background: rgba(255,255,255,.1); }
#brandMark { height: 26px; width: auto; flex: none; margin: 0 2px 0 -2px; }
#modelName { font-weight: 700; letter-spacing: .01em; }
#modelSub { color: var(--bar-muted); }
#netStatus { background: rgba(255,255,255,.12); color: var(--bar-ink); }
#netStatus.off { background: var(--lime); color: var(--navy); font-weight: 700; }

/* buttons: lime primary with navy text, like the logo */
.btn { border-radius: 8px; font-weight: 500; }
.btn.primary { background: var(--lime); border-color: var(--lime-2); color: var(--navy); font-weight: 700; }
.btn.primary:hover { background: var(--lime-2); }
.btn.ghost { background: transparent; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .chip.on { background: var(--lime); border-color: var(--lime); color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { background: var(--lime); border-color: var(--lime); color: var(--navy); } }
.toggle input, .planctl input[type=range] { accent-color: var(--navy); }

/* toolbar: active tool gets a lime tab */
.tool { font-weight: 500; }
.tool.on { background: var(--lime-soft); color: var(--text); font-weight: 700; box-shadow: inset 0 3px 0 var(--lime); }
.tool.on svg { color: var(--text); }

/* panels */
.ph { background: var(--surface); }
.ph h2 { font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.ph h2::before { content: ''; display: inline-block; width: 4px; height: 14px; background: var(--lime); margin-right: 8px; vertical-align: -1px; border-radius: 1px; }
.grp { color: var(--muted); font-weight: 700; letter-spacing: .06em; }
#loading .bar { background: color-mix(in srgb, var(--navy) 18%, transparent); }
#loading .bar i { background: var(--lime); }
.snapmark, .sk { border-color: var(--mark); background: color-mix(in srgb, var(--mark) 22%, transparent); }
.card.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); }

/* ---------- main page (model library) ---------- */
#library { background: var(--bg); }
.libhero { background: var(--navy); color: #fff; border-bottom: 4px solid var(--lime); position: relative; overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px); }
.libhero::after { /* the logo's parallel "wire" lines, faint, as a texture on the right */
  content: ''; position: absolute; right: -40px; top: -30px; width: 360px; height: 260px; opacity: .07; pointer-events: none;
  background: repeating-linear-gradient(180deg, var(--lime) 0 6px, transparent 6px 18px); border-radius: 0 0 0 180px; }
.libhero-in { max-width: 920px; margin: 0 auto; padding: 22px 16px 22px; display: flex; align-items: center; gap: 22px; position: relative; z-index: 1; flex-wrap: wrap; }
.brandlogo { height: 64px; width: auto; display: block; }
.herotext { flex: 1; min-width: 200px; border-left: 2px solid rgba(255,255,255,.18); padding-left: 22px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--lime); }
.herotitle { font-size: 26px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; margin-top: 4px; }
.herosub { font-size: 13px; color: #b9c6d3; margin-top: 4px; }
.heroright { display: flex; align-items: center; gap: 10px; }
.heroacct { display: flex; align-items: center; gap: 10px; background: var(--navy-3); border: 1px solid rgba(255,255,255,.14); border-radius: 99px; padding: 4px 4px 4px 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--lime); color: var(--navy); font-weight: 900; font-size: 13px; display: grid; place-items: center; flex: none; }
.heroacct .who { font-size: 13px; line-height: 1.2; padding-right: 4px; }
.heroacct .who span { display: block; font-size: 11px; color: #b9c6d3; }
.heroacct .btn, .libhero .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.heroacct .btn:hover, .libhero .btn:not(.primary):hover { background: rgba(255,255,255,.1); }
.libhero .iconbtn { color: #fff; }
.libhero .iconbtn:hover { background: rgba(255,255,255,.1); }
.libwrap { max-width: 920px; padding: 22px 16px 28px; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; margin: 2px 0 14px; flex-wrap: wrap; }
.pagehead h1 .pnum { display: block; font-size: 13px; letter-spacing: .06em; color: var(--muted); }
.pagehead h1 { font-size: 22px; font-weight: 900; margin: 0; flex: 1; min-width: 220px; line-height: 1.2; }
.pagehead .crumb { width: 100%; }
#library .grp { color: var(--text); font-size: 13px; font-weight: 900; letter-spacing: .08em; display: flex; align-items: center; gap: 10px; padding: 18px 2px 10px !important; }
#library .grp::before { content: ''; width: 4px; height: 16px; background: var(--lime); border-radius: 1px; flex: none; }
#library .grp > span { flex: 1; }
.plist { border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,30,44,.06); }
.plist .li { padding: 12px 16px; min-height: 58px; border-left: 4px solid transparent; transition: border-color .12s, background .12s; }
.plist .li:hover { border-left-color: var(--lime); background: var(--surface-2); }
.plist .li .pnum { font-weight: 900; color: var(--text); margin-right: 6px; font-variant-numeric: tabular-nums; }
.plist .li .chev { color: var(--muted); font-size: 18px; }
.card { border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,30,44,.06); border-top: 4px solid var(--navy); gap: 10px; }
:root[data-theme="dark"] .card { border-top-color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { border-top-color: var(--lime); } }
.card h3 { font-weight: 700; }
.card .btnrow { margin-top: auto; }
.badge { font-weight: 700; letter-spacing: .02em; }
.signin-card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--lime); border-radius: var(--radius); padding: 18px 20px; margin: 4px 0 8px; }
.signin-card .grow { flex: 1; min-width: 220px; }
.signin-card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.libsettings { display: grid; gap: 12px; margin-top: 20px; }
.libsettings .toggle, .libsettings .drop { margin: 0 !important; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.libsettings .drop { border-style: dashed; padding: 14px 16px; }
.libfoot { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 16px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.libfoot img { height: 22px; width: auto; }
.libfoot b { color: var(--text); letter-spacing: .04em; text-transform: uppercase; font-weight: 900; font-size: 11px; }
.libfoot .grow { flex: 1; min-width: 160px; }
@media (max-width: 640px) {
  .libhero-in { gap: 14px; padding: 16px 16px 18px; }
  .brandlogo { height: 50px; }
  .herotext { border-left: 0; padding-left: 0; min-width: 100%; }
  .herotitle { font-size: 21px; }
  .herosub { display: none; }
  .heroright { width: 100%; }
  .heroacct { flex: 1; border-radius: 12px; }
  .heroacct .who { flex: 1; }
  .libhero .herox { position: absolute; right: 8px; top: 8px; }
  .libhero::after { width: 220px; height: 170px; }
}
/* view cube buttons: home + perspective/orthographic */
#viewcube .vc-btns { display: flex; gap: 6px; align-items: center; }
#viewcube .vc-proj { height: 30px; min-width: 52px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: 700 11px/1 Roboto, system-ui, sans-serif; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; box-shadow: var(--shadow); }
#viewcube .vc-proj.on { background: var(--navy); border-color: var(--navy); color: var(--lime); }
#viewcube .vc-proj:hover { border-color: var(--navy); }

/* ---------- who's here ---------- */
.peoplebtn { height: 36px; min-width: 40px; padding: 0 8px; border: 1px solid rgba(255,255,255,.22); border-radius: 99px; background: transparent; color: var(--bar-ink);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; flex: none; }
.peoplebtn svg { width: 20px; height: 20px; }
.peoplebtn:hover { background: rgba(255,255,255,.1); }
.peoplebtn.active { border-color: var(--lime); }
.peoplebtn.hiding { opacity: .7; border-style: dashed; }
.pavs { display: inline-flex; }
.pav { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font: 900 10px/1 Roboto, system-ui, sans-serif; border: 2px solid var(--bar); flex: none; }
.pavs .pav + .pav { margin-left: -8px; }
.pav.lg { width: 34px; height: 34px; font-size: 12px; border: 0; }
.pcount { font-weight: 900; font-size: 13px; color: var(--lime); }
.prow { gap: 10px; cursor: default; }
.plabel { position: absolute; transform: translate(-50%, -100%); background: var(--pc, #224faa); color: #fff; font: 700 11px/1 Roboto, system-ui, sans-serif;
  padding: 4px 7px; border-radius: 99px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.peoplebtn.err { border-color: #e0a100; color: #ffd166; }
/* "look here" pointer */
.pping { position: absolute; width: 0; height: 0; pointer-events: none; transition: opacity .4s; }
.pping.out { opacity: 0; }
.pping i { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--pc); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
.pping i::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid var(--pc); animation: ppulse 1.2s ease-out infinite; }
@keyframes ppulse { from { transform: scale(.4); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
.pping span { position: absolute; left: 14px; top: -30px; background: var(--pc); color: #fff; font: 700 11px/1 Roboto, system-ui, sans-serif; padding: 4px 7px; border-radius: 99px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pping i, .pping span { pointer-events: auto; cursor: pointer; }
.pping i { width: 22px; height: 22px; left: -11px; top: -11px; }   /* a little bigger: it's a tap target now */
#pingToast { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 10px;
  background: var(--surface); color: var(--text); border-left: 5px solid var(--pc, var(--lime)); border-radius: 10px; box-shadow: var(--shadow);
  padding: 8px 8px 8px 12px; font-size: 14px; max-width: calc(100% - 24px); }
#pingToast[hidden] { display: none; }
#pingToast .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); flex: none; animation: ppulse2 1.2s ease-out infinite; }
@keyframes ppulse2 { 0% { box-shadow: 0 0 0 0 var(--pc); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* right-click / press-and-hold menu */
#ctxmenu { position: absolute; z-index: 9; min-width: 230px; max-width: min(300px, calc(100% - 16px)); background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,30,44,.25); padding: 6px; user-select: none; }
#ctxmenu[hidden] { display: none; }
#ctxmenu .ctx-head { padding: 8px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
#ctxmenu .ctx-head b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ctxmenu .ctx-head span { font-size: 12px; color: var(--muted); }
#ctxmenu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text); min-height: 40px; }
#ctxmenu button:hover { background: var(--lime-soft); }
#ctxmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
#ctxmenu .kbd { margin-left: auto; display: inline-flex; gap: 3px; }
#ctxmenu kbd { font: 600 11px/1 Roboto, system-ui, sans-serif; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; color: var(--muted); }

/* grids, levels, height above floor */
.gbubble { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 2px solid #3f6ea8;
  color: #23466f; font: 900 12px/22px Roboto, system-ui, sans-serif; text-align: center; pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,.2); white-space: nowrap; }
.lvrow { gap: 8px; cursor: default; }
.aff { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; padding: 8px 10px; border-left: 4px solid var(--lime); background: var(--surface-2); border-radius: 6px; font-size: 14px; }
.aff-k { font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---------- notes ---------- */
.npin { position: absolute; transform: translate(-50%, -100%); min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px 13px 13px 2px; border: 2px solid #fff;
  background: var(--navy); color: var(--lime); font: 900 12px/22px Roboto, system-ui, sans-serif; cursor: pointer; pointer-events: auto; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.npin.closed { background: #8a97a5; color: #fff; }
.nnum { min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--navy); color: var(--lime); font: 900 12px/26px Roboto, system-ui, sans-serif; text-align: center; flex: none; }
.nnum.closed { background: #8a97a5; color: #fff; }
.nhead { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.nhead h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.ntext { margin-top: 10px; white-space: pre-wrap; line-height: 1.45; }
.nphotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin-top: 10px; }
.nph { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.nph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.nph img.missing { object-fit: contain; font-size: 11px; color: var(--muted); }
.nphx { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.ncom { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ncom div { margin-top: 2px; white-space: pre-wrap; }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; }
label.btn { display: inline-flex; align-items: center; gap: 6px; }
.tool { position: relative; }
.tool[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: 4px; right: 10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--lime); color: var(--navy); font: 900 10px/16px Roboto, system-ui, sans-serif; }
.photoview { position: fixed; inset: 0; z-index: 50; background: rgba(8,14,20,.92); display: grid; place-items: center; }
.photoview img { max-width: 96vw; max-height: 92vh; border-radius: 6px; }
.photoview .iconbtn { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; color: #fff; }

/* ---------- snapshot editor ---------- */
#snapEd { position: fixed; inset: 0; z-index: 40; background: #0c1722; display: flex; flex-direction: column; }
#snapEd[hidden] { display: none; }
.se-bar { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; background: var(--navy); border-bottom: 3px solid var(--lime); flex-wrap: wrap; }
.se-bar .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.se-tools { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.se-act { display: flex; gap: 6px; }
.setool { width: 38px; height: 38px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; font-size: 18px; cursor: pointer; }
.setool.on { background: var(--lime); color: var(--navy); border-color: var(--lime); }
.secol { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); cursor: pointer; }
.secol.on { border-color: #fff; box-shadow: 0 0 0 2px var(--lime); }
.se-sep { width: 1px; height: 26px; background: rgba(255,255,255,.2); margin: 0 4px; }
.se-wrap { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 10px; }
.se-cv { touch-action: none; cursor: crosshair; box-shadow: 0 4px 24px rgba(0,0,0,.5); background: #fff; }
.se-text { position: absolute; z-index: 2; min-width: 200px; height: 36px; padding: 0 10px; border-radius: 6px; border: 2px solid var(--lime); font: 600 16px Roboto, system-ui, sans-serif; }
@media (max-width: 640px) { .se-act { width: 100%; justify-content: flex-end; } .se-tools { order: 3; width: 100%; } }

/* ---------- help ---------- */
#help { position: fixed; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column; }
#help[hidden] { display: none; }
.hp-bar { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px 14px; background: var(--navy); color: #fff; border-bottom: 3px solid var(--lime); }
.hp-bar > b { font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: 15px; }
.hp-bar .hp-q { flex: 1; max-width: 520px; margin-left: auto; background: #fff; color: #172a3c; border-color: transparent; }
.hp-bar .iconbtn { color: #fff; }
.hp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.hp-toc { overflow: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 8px 0 30px; }
.hp-art { overflow: auto; padding: 22px 28px 60px; }
.hp-cat { padding: 14px 18px 6px; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: 8px; }
.hp-cat::before { content: ''; width: 4px; height: 14px; background: var(--lime); border-radius: 1px; }
.hp-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 18px 8px 30px; font-size: 14px; color: var(--text); cursor: pointer; border-left: 3px solid transparent; }
.hp-item:hover { background: var(--surface-2); }
.hp-item.on { border-left-color: var(--lime); background: var(--lime-soft); font-weight: 700; }
.hp-hit { padding-left: 18px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); }
.hp-snip { font-size: 13px; color: var(--muted); line-height: 1.35; }
.hp-res-h { padding: 10px 18px; font-size: 13px; color: var(--muted); }
mark { background: color-mix(in srgb, var(--lime) 55%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
.hp-art h1 { font-size: 24px; font-weight: 900; margin: 4px 0 14px; line-height: 1.2; }
.hp-crumb { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hp-html { max-width: 760px; line-height: 1.6; font-size: 15px; }
.hp-html li { margin: 4px 0; }
.hp-html a, .hp-welcome a { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }
.hp-html .tip { border-left: 4px solid var(--lime); background: var(--surface-2); padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.hp-html kbd { font: 600 12px/1 Roboto, system-ui, sans-serif; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 3px 6px; }
.htab { border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.htab th, .htab td { border-bottom: 1px solid var(--line); padding: 6px 12px 6px 0; text-align: left; vertical-align: top; }
.htab th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hp-nav { display: flex; justify-content: space-between; gap: 10px; max-width: 760px; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 14px; flex-wrap: wrap; }
.hp-back { display: none; margin-bottom: 8px; }
.hp-welcome { max-width: 560px; margin: 40px auto; text-align: center; color: var(--muted); }
.hp-welcome h1 { color: var(--text); }
.herohelp { color: #fff; }
@media (max-width: 819px) {
  .hp-body { grid-template-columns: 1fr; }
  .hp-art { display: none; padding: 16px 16px 50px; }
  #help.reading .hp-art { display: block; }
  #help.reading .hp-toc { display: none; }
  .hp-back { display: inline-flex; }
  .hp-toc { border-right: 0; }
  .hp-bar > b { display: none; }
}

/* ---------- plan map ---------- */
#mapBtn { position: absolute; left: 12px; top: 56px; z-index: 3; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px; }
#mapBtn[hidden] { display: none; }
#mapBtn svg { width: 18px; height: 18px; }
#planmap { position: absolute; left: 12px; top: 56px; z-index: 4; width: min(320px, 52vw); height: min(270px, 46vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
#planmap[hidden] { display: none; }
#planmap.big { left: 8px; top: 8px; width: calc(100% - 16px); height: calc(100% - 16px); z-index: 6; }
.pm-head { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 8px; background: var(--navy); border-bottom: 2px solid var(--lime); }
.pm-head .iconbtn { width: 34px; height: 34px; color: #fff; font-size: 17px; }
.pm-head .iconbtn svg { width: 18px; height: 18px; }
.pm-plan { flex: 1; min-width: 0; height: 30px; border-radius: 6px; border: 0; padding: 0 6px; font: 600 12px Roboto, system-ui, sans-serif; background: #fff; color: #172a3c; }
.pm-view { position: relative; flex: 1; overflow: hidden; touch-action: none; background: #f4f6f8; cursor: crosshair; }
.pm-img { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.15); }
.pm-ov { position: absolute; left: 0; top: 0; pointer-events: none; }
.pm-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; pointer-events: none; text-align: center; padding: 10px; }
.pm-msg:empty { display: none; }
.pm-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; border-top: 1px solid var(--line); color: var(--muted); }
.pm-land { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; flex: none; }
.pm-land button { border: 0; background: transparent; font: 600 11px Roboto, system-ui, sans-serif; padding: 4px 9px; cursor: pointer; color: var(--muted); }
.pm-land button.on { background: var(--navy); color: var(--lime); }
#planmap:not(.big) .pm-foot .small { display: none; }
@media (max-width: 819px) { #planmap:not(.big) { width: 54vw; height: 48vw; } }

/* Colour by property */
#legend { position: absolute; right: 12px; bottom: 12px; z-index: 3; width: min(240px, 58vw); max-height: 46%; overflow: auto; background: rgba(255,255,255,.96); color: #172a3c;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px 0 6px; font-size: 13px; }
#legend[hidden] { display: none; }
.lg-h { display: flex; align-items: center; gap: 6px; padding: 2px 4px 4px 10px; cursor: pointer; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.lg-h b { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-h .iconbtn { width: 30px; height: 30px; }
.lg-h .iconbtn svg { width: 16px; height: 16px; }
.lg-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 4px 10px; font: 500 13px Roboto, system-ui, sans-serif; color: inherit; text-align: left; cursor: pointer; }
.lg-row:hover { background: rgba(23,42,60,.06); }
.lg-row i, .cbrow .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.lg-row span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-row em { font-style: normal; color: #6b7a89; font-size: 12px; }
.lg-more { border: 0; background: transparent; padding: 4px 10px; font: 600 12px Roboto, system-ui, sans-serif; color: var(--blue); cursor: pointer; }
.cbrow { min-height: 44px; padding: 6px 12px 6px 16px; }
.cbrow .sw { width: 18px; height: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; font: 600 12px Roboto, system-ui, sans-serif; padding: 6px 11px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--navy); color: var(--lime); }
.sfield > .small.muted { min-width: 52px; }
@media (max-width: 819px) { #legend { bottom: 64px; right: 8px; max-height: 36%; } }
.projgrp { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.projgrp .seg button { text-transform: none; letter-spacing: 0; }
.pav.guest { background: var(--lime); color: var(--navy); }

/* touch controls: no text selection, magnifier or Copy / Look Up menu on a long press (iOS) */
#walkUD, #walkUD *, #joy, #joy *, #toolbar, #viewcube, #canvas, canvas, #labels, #selchip, #legend, #mapBtn, #showAllBtn, .peoplebtn {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#walkUD button { display: grid; place-items: center; color: var(--text); padding: 0; }
#stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#stage #panel, #stage #panel * { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
#stage #panel button, #stage #panel .chip, #stage #panel .tool { -webkit-user-select: none; user-select: none; }

/* Walk mode bar: level, gravity, walls */
#walkBar { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 140px);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#walkBar[hidden] { display: none; }
#walkBar > button { border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow); border-radius: 99px; height: 34px; padding: 0 13px; font: 600 13px Roboto, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
#walkBar > button.wb-t { color: var(--muted); }
#walkBar > button.wb-t.on { background: var(--navy); color: var(--lime); border-color: var(--navy); }
#walkBar > button.wb-land { background: var(--lime); color: var(--navy); border-color: var(--lime); }
#walkBar > button.wb-lv { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.wb-menu { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); min-width: 220px; max-height: 50vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 4px; }
.wb-menu button { display: flex; justify-content: space-between; gap: 14px; width: 100%; border: 0; background: transparent; color: var(--text); padding: 10px 12px; border-radius: 8px; font: 500 14px Roboto, system-ui, sans-serif; text-align: left; cursor: pointer; }
.wb-menu button span { color: var(--muted); font-size: 12px; }
.wb-menu button.on, .wb-menu button:hover { background: var(--surface-2); }
@media (max-width: 819px) { #walkBar { top: 50px; max-width: calc(100% - 120px); } #walkBar > button { height: 32px; padding: 0 11px; font-size: 12px; } }

/* Links (submittals, cut sheets, web pages) */
.lkgrp { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lkgrp .btn { text-transform: none; letter-spacing: 0; }
.lkrow { min-height: 50px; }
.lkrow .lkdel { width: 30px; height: 30px; flex: none; }
.lkrow .lkdel svg { width: 15px; height: 15px; }
.pdfic.file { background: #5b6b7c; }
.pdfic.web { background: var(--blue); }
.lkform label { display: block; margin: 12px 0 4px; }
.lkform select.search, .lkform input.search { width: 100%; height: 38px; font-size: 14px; }
#docview { position: fixed; inset: 0; z-index: 60; background: #2a3440; display: flex; flex-direction: column; }
#docview[hidden] { display: none; }
.dv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); background: var(--navy); color: #fff; border-bottom: 3px solid var(--lime); }
.dv-bar .dv-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 14px; }
.dv-bar .dv-pages { color: #b9c6d3; white-space: nowrap; }
.dv-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; }
.dv-page { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); flex: none; }
@media (max-width: 600px) { #dvTab { display: none; } }
/* Submittals checklist */
.subgrp > summary .small { margin-left: 6px; font-weight: 500; }
.subrow { gap: 8px; min-height: 52px; padding-right: 10px; }
.subrow .subck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font: 900 12px/1 system-ui, sans-serif; color: #fff; flex: none; }
.subrow.done .subck { background: #2eaa5c; border-color: #2eaa5c; }
.subrow a { color: var(--blue); text-decoration: none; }
.subrow .btn { flex: none; }
.mlabel.main.clash { background: #d64541; color: #fff; }
.mcard.clash .mdist { color: #d64541; }
.rmcat > summary { display: flex; align-items: center; gap: 8px; }
.rmcat > summary .rmsel { margin-left: auto; }

/* device symbols in the room view */
.rsym { position: absolute; transform: translate(-50%, -50%); pointer-events: none; /* taps are hit-tested from the canvas so pinch and drag still reach the view */ display: flex; flex-direction: column; align-items: center; gap: 1px; }
.rsym img { height: 30px; width: auto; max-width: 48px; display: block; background: rgba(255,255,255,.88); border-radius: 4px; padding: 1px; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); }
.rsym span { font: 700 10px/1 Roboto, system-ui, sans-serif; color: #172a3c; background: rgba(255,255,255,.92); border-radius: 3px; padding: 2px 3px; white-space: nowrap; }
.rsym .rsym-tag { font: 700 11px/1 Roboto, system-ui, sans-serif; color: #172a3c; background: #fff; border: 1.5px solid #172a3c; border-radius: 9px; padding: 2px 6px; white-space: nowrap; }
.rsym:hover img, .rsym:hover .rsym-tag { outline: 2px solid var(--mark); outline-offset: 1px; border-radius: 4px; }
/* device symbol styles (room panel › Symbol style) */
.rsym.st-lime img { background: transparent; padding: 0; filter: drop-shadow(0 0 .6px #172a3c) drop-shadow(0 0 .6px #172a3c) drop-shadow(0 0 1px #172a3c) drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); }
.rsym.st-navy img { background: #172a3c; padding: 2px; border-radius: 5px; }
.rsym.st-lime span, .rsym.st-navy span { background: #172a3c; color: #d2d431; }
.rmstyle .seg { margin-left: auto; }
/* AR */
#arVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; background: #000; }
body.ar-on #c { z-index: 1; }
body.ar-on #toolbar, body.ar-on #joy, body.ar-on #walkUD, body.ar-on #walkBar, body.ar-on #viewcube, body.ar-on #selchip, body.ar-on #legend, body.ar-on #mapBtn, body.ar-on #showAllBtn, body.ar-on .peoplebtn { display: none !important; }
#arUI { position: fixed; inset: 0; z-index: 60; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px); font: 500 13px Roboto, system-ui, sans-serif; color: #fff; }
#arUI[hidden] { display: none; }
#arUI button, #arUI input, #arUI label { pointer-events: auto; }
#arUI .ar-top { display: flex; align-items: center; gap: 10px; background: rgba(15,30,44,.82); border-radius: 12px; padding: 8px 10px 8px 14px; }
#arUI .ar-top b { color: #d2d431; font-size: 15px; }
#arUI .ar-mode { flex: 1; color: #c9d4de; font-size: 12px; }
#arUI .ar-x { border: 0; border-radius: 9px; background: #d2d431; color: #172a3c; font: 700 14px Roboto, system-ui, sans-serif; padding: 8px 16px; }
#arUI .ar-hint { align-self: center; margin-top: 8px; background: rgba(15,30,44,.7); border-radius: 9px; padding: 6px 10px; font-size: 12px; text-align: center; max-width: 340px; }
#arUI .ar-bottom { margin-top: auto; display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: end; background: rgba(15,30,44,.82); border-radius: 14px; padding: 10px; }
#arUI .ar-pad { display: grid; grid-template-columns: repeat(3, 46px); gap: 6px; }
#arUI .ar-side { display: flex; flex-direction: column; gap: 6px; }
#arUI .ar-pad button, #arUI .ar-side button { height: 44px; min-width: 46px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font: 600 16px Roboto, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
#arUI .ar-side button { font-size: 12px; padding: 0 10px; }
#arUI .ar-pad button:active, #arUI .ar-side button:active { background: #d2d431; color: #172a3c; }
#arUI .ar-opts { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#arUI .ar-opts label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #c9d4de; }
#arUI .ar-opts input[type=range] { width: 100%; accent-color: #d2d431; }
#arUI .ar-opts .ar-ck { flex-direction: row; align-items: center; gap: 6px; }
@media (max-width: 420px) { #arUI .ar-bottom { grid-template-columns: auto auto; } #arUI .ar-opts { grid-column: 1 / -1; } }
#walkBar .wb-ar { background: #172a3c; color: #d2d431; font-weight: 700; }
body.ar-on #topbar { display: none !important; }

/* ---------- light / dark menu (header and library) ---------- */
.thm { position: fixed; z-index: 60; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; min-width: 180px; }
.thm button { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; padding: 9px 10px; border-radius: 6px; cursor: pointer; text-align: left; font-size: 14px; }
.thm button:hover { background: var(--surface-2); }
.thm button svg { width: 20px; height: 20px; flex: none; }
.thm button.on { font-weight: 700; }
.thm button.on::after { content: '✓'; margin-left: auto; color: var(--accent); }
@media (max-width: 520px) { #topbar #btnTheme { display: none; } }
