/* Lighting Builder: the same floating toolbars, side dock and colours as Set Builder, so the two apps feel like one. Lighting-specific parts are at the end. */
:root {
  color-scheme: light;
  --bg:#e9ecf1; --surface:rgba(250,251,253,.9); --surface-solid:#fbfcfd; --line:rgba(20,30,50,.13);
  --fg:#16191f; --dim:#5d6877; --accent:#0a6cff; --accent-fg:#fff; --danger:#c62828; --warn:#a85d00; --ok:#1c8a37; --info:#3a5f96;
  --hover:rgba(20,30,50,.08); --field:rgba(20,30,50,.06); --accent-soft:rgba(10,108,255,.14); --warn-soft:rgba(224,138,0,.16);
  --shadow:0 6px 22px rgba(30,40,60,.16); --r:14px; --hdr:74px;
  --canvas:#eef1f5;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg:#16181c; --surface:rgba(34,37,43,.9); --surface-solid:#22252b; --line:rgba(255,255,255,.11);
  --fg:#eef0f3; --dim:#9aa3b0; --accent:#3d8bff; --accent-fg:#fff; --danger:#ff7b7b; --warn:#ffb454; --ok:#3ecf55; --info:#8fb5ee;
  --hover:rgba(255,255,255,.1); --field:rgba(255,255,255,.07); --accent-soft:rgba(61,139,255,.24); --warn-soft:rgba(255,180,84,.16);
  --shadow:0 6px 24px rgba(0,0,0,.4); --canvas:#1c1f25;
}
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--fg);
  font:15px/1.4 -apple-system, system-ui, "SF Pro Text", "Segoe UI", Roboto, sans-serif; overflow:hidden; overscroll-behavior:none; }
.hidden, [hidden] { display:none !important; }
button, input, select, textarea { font:inherit; color:inherit; }
button { background:transparent; border:0; border-radius:10px; min-height:44px; padding:0 14px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:7px; }
button:active { background:var(--hover); }
@media (hover:hover) { button:hover:not(.primary):not(.on):not(:disabled) { background:var(--hover); } }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
button:disabled { opacity:.38; pointer-events:none; }
button.primary { background:var(--accent); color:var(--accent-fg); font-weight:600; }
button.primary:active { filter:brightness(.9); }
button.danger { color:var(--danger); }
button.ghost { border:1px solid var(--line); }
button.small { min-height:34px; padding:0 10px; font-size:13px; border-radius:8px; }
.ico { width:22px; height:22px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.card, .panel, .pill, .menu { background:var(--surface); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
.pill { display:flex; align-items:center; gap:4px; padding:4px; }
button.icon { width:44px; padding:0; }
.muted { color:var(--dim); } .small { font-size:12.5px; }
.chip { display:inline-block; background:var(--hover); border-radius:999px; padding:1px 9px; font-size:12px; font-weight:600; }
.chip.warn { background:var(--warn-soft); color:var(--warn); } .chip.stop { background:rgba(198,40,40,.16); color:var(--danger); }

/* work area */
#work { position:fixed; inset:0; background:var(--canvas); }
.view, .canvaswrap { position:absolute; inset:0; }
.canvaswrap canvas { position:absolute; inset:0; width:100%; height:100%; display:block; touch-action:none; }

/* top bar: file / tools / view+share */
.savedot { width:9px; height:9px; border-radius:50%; background:var(--ok); margin:0 4px; flex:none; }
.savedot.dirty { background:var(--warn); }
button.title { color:var(--dim); font-weight:600; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; justify-content:flex-start; padding:0 10px 0 4px; display:block; line-height:44px; }
.toolrow { display:flex; align-items:stretch; gap:2px; }
.tbtn { flex-direction:column; gap:2px; min-width:56px; min-height:56px; padding:4px 6px; font-size:11.5px; line-height:1.15; color:var(--fg); }
.tbtn .ico { width:24px; height:24px; }
.tbtn.on { background:var(--accent); color:var(--accent-fg); }
.tbtn.on:active { filter:brightness(.9); background:var(--accent); }
.tsep { width:1px; background:var(--line); margin:6px 4px; flex:none; }

/* message strip */
.msg { position:fixed; left:50%; transform:translateX(-50%); top:calc(var(--hdr) + 8px); z-index:19; max-width:min(520px, calc(100vw - 24px)); display:flex; align-items:center; gap:7px; cursor:pointer;
  padding:5px 12px; border-radius:999px; font-size:12.5px; line-height:1.3; opacity:.96; box-shadow:var(--shadow); border:1px solid var(--line); background:var(--surface-solid); }
.msg.tip { color:var(--fg); border-color:color-mix(in srgb, var(--warn) 55%, var(--line)); background:color-mix(in srgb, var(--warn) 12%, var(--surface-solid)); }
.msg.tip .ico { color:var(--warn); }
.msg.warn { border-color:var(--warn); background:color-mix(in srgb, var(--warn) 18%, var(--surface-solid)); }
.msg.ok { border-color:var(--ok); background:color-mix(in srgb, var(--ok) 15%, var(--surface-solid)); }
.msg .ico { width:15px; height:15px; flex:none; }
.msg.tip { box-shadow:none; }

/* properties card and the palette */
.panel { position:fixed; z-index:15; overflow-y:auto; padding:14px; }
.ph { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.ph .dot { width:12px; height:12px; border-radius:4px; flex:none; }
.ph input.name { font-size:17px; font-weight:700; border:1px solid transparent; background:transparent; padding:4px 6px; border-radius:8px; min-width:0; flex:1; }
.ph input.name:hover { background:var(--field); } .ph input.name:focus { background:var(--field); }
.ph h2 { margin:0; font-size:17px; flex:1; }
.sub { color:var(--dim); font-size:13px; margin:0 6px 10px; }
.sec { border-top:1px solid var(--line); padding:12px 2px 4px; margin-top:8px; }
.sec h3 { margin:0 0 8px; font-size:11.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--dim); font-weight:700; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.fields { display:grid; gap:8px; grid-template-columns:repeat(3, 1fr); margin-bottom:8px; }
.fields.two { grid-template-columns:repeat(2, 1fr); } .fields.one { grid-template-columns:1fr; }
.f { display:block; font-size:12px; color:var(--dim); min-width:0; }
.f > input, .f > select, .f > textarea { display:block; margin-top:3px; color:var(--fg); }
input, select, textarea { width:100%; min-width:0; min-height:42px; padding:0 10px; background:var(--field); border:1px solid transparent; border-radius:10px; font-size:16px; }
textarea { padding:8px 10px; resize:vertical; min-height:70px; }
input:hover, select:hover, textarea:hover { border-color:var(--line); }
input[type=checkbox] { width:20px; min-height:20px; height:20px; accent-color:var(--accent); }
input[type=range] { padding:0; background:transparent; accent-color:var(--accent); min-height:30px; }
label.chk { display:flex; gap:10px; align-items:center; font-size:14px; margin:6px 0; color:var(--fg); }
.btnrow { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0; } .btnrow > button { flex:1; }
.fieldline { display:flex; gap:8px; align-items:center; margin:6px 0; } .fieldline > span { flex:none; font-size:13px; color:var(--dim); min-width:70px; }
.list { display:flex; flex-direction:column; gap:4px; }
.list .item { display:flex; align-items:center; gap:9px; padding:0 10px; min-height:44px; border-radius:10px; cursor:pointer; }
.list .item:hover { background:var(--hover); } .list .item.sel { background:var(--accent-soft); }
.list .item .dot { width:11px; height:11px; border-radius:3px; flex:none; }
.list .item .grow { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.badge { font-size:11px; font-weight:700; color:#fff; padding:1px 8px; border-radius:999px; background:var(--warn); } .badge.stop { background:var(--danger); }
.empty { text-align:center; padding:18px 8px 8px; color:var(--dim); }
.empty .ico { width:34px; height:34px; opacity:.6; margin-bottom:6px; }
.bigbtns { display:grid; gap:8px; margin-top:10px; }
.bigbtns button { justify-content:flex-start; min-height:52px; border:1px solid var(--line); background:var(--surface-solid); font-weight:600; padding:0 14px; }
.bigbtns button small { display:block; font-weight:400; color:var(--dim); font-size:12px; }
.bigbtns button span { text-align:left; }

/* checks (the old "hints") */
.hint { border:1px solid var(--line); border-left:4px solid var(--info); border-radius:10px; padding:8px 11px; margin:7px 0; font-size:13.5px; cursor:pointer; background:var(--surface-solid); }
.hint.warn { border-left-color:var(--warn); } .hint.stop { border-left-color:var(--danger); } .hint.info { border-left-color:var(--info); }
.hint .sev { font-weight:700; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; margin-right:6px; }
.hint.warn .sev { color:var(--warn); } .hint.stop .sev { color:var(--danger); } .hint.info .sev { color:var(--info); }
.hint.on { outline:2px solid var(--accent); }
.hint .fixbtn { margin-top:6px; }
.disclaimer { font-size:12px; color:var(--dim); margin:10px 2px 2px; }
.note { background:var(--warn-soft); border:1px solid color-mix(in srgb, var(--warn) 50%, var(--line)); border-radius:10px; padding:9px 12px; font-size:13.5px; margin:8px 0; }
details > summary { cursor:pointer; list-style:none; min-height:36px; display:flex; align-items:center; gap:6px; font-weight:600; font-size:13.5px; }
details > summary::-webkit-details-marker { display:none; }
details > summary::before { content:'›'; display:inline-block; width:14px; transition:transform .15s; color:var(--dim); font-size:18px; line-height:1; }
details[open] > summary::before { transform:rotate(90deg); }

/* contextual bottom bar */
#bottom { position:fixed; left:50%; transform:translateX(-50%); bottom:calc(12px + env(safe-area-inset-bottom)); z-index:18; max-width:calc(100vw - 24px); overflow-x:auto; gap:2px; }
#bottom .abtn { min-height:46px; padding:0 14px; white-space:nowrap; font-size:14px; }
#bottom .abtn.on { background:var(--accent-soft); }
#bottom .sep { width:1px; align-self:stretch; background:var(--line); margin:6px 4px; flex:none; }
#bottom label.inl { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--dim); padding:0 6px; white-space:nowrap; }
#bottom input.len { width:120px; min-height:38px; } #bottom select { width:auto; min-height:38px; }

/* menu */
.menu { position:fixed; left:12px; top:calc(var(--hdr) + 8px); z-index:40; width:268px; padding:6px; }
.menu button { width:100%; justify-content:flex-start; min-height:44px; font-size:14.5px; }
.menu hr { border:0; border-top:1px solid var(--line); margin:5px 4px; }

/* full-screen sheets: shopping list, settings, help */
.sheet { position:fixed; inset:0; z-index:30; background:var(--bg); display:flex; flex-direction:column; }
.sheethead { display:flex; align-items:center; justify-content:space-between; padding:calc(10px + env(safe-area-inset-top)) 16px 8px; max-width:1100px; width:100%; margin:0 auto; }
.sheethead h1 { margin:0; font-size:22px; }
.sheetbody { flex:1; overflow-y:auto; padding:6px 16px 60px; max-width:1100px; width:100%; margin:0 auto; }
.sheetbody h2 { font-size:16px; margin:22px 0 8px; } .sheetbody h3 { font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--dim); margin:16px 0 6px; }
.cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:12px; }
.card { padding:13px 15px; } .big { font-size:28px; font-weight:700; }
table.t { width:100%; border-collapse:collapse; font-size:14px; background:var(--surface-solid); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
table.t th, table.t td { text-align:left; padding:9px 11px; border-bottom:1px solid var(--line); }
table.t th { background:var(--field); font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--dim); }
table.t td.n, table.t th.n { text-align:right; font-variant-numeric:tabular-nums; }
table.t tr.clk { cursor:pointer; } table.t tr.sel td { background:var(--accent-soft); }
table.t input { min-height:34px; padding:0 8px; }
.bars { display:flex; flex-direction:column; gap:5px; margin:8px 0 14px; }
.bar { display:flex; align-items:center; gap:8px; font-size:11px; color:var(--dim); }
.bar .b { position:relative; height:24px; border:1px solid #8a7a5c; background:#f3ead8; border-radius:3px; display:flex; overflow:hidden; flex:none; }
.bar .b i { display:block; height:100%; font-style:normal; font-size:10px; text-align:center; line-height:24px; color:#3a2e18; overflow:hidden; border-right:1px solid #8a7a5c; }
.sheets { display:flex; flex-wrap:wrap; gap:12px; margin:8px 0 14px; }
.sheets svg { background:#fcfaf4; border:1px solid #8a7a5c; border-radius:3px; }
.tag { font-size:10.5px; padding:1px 8px; border-radius:999px; font-weight:700; }
.tag.sourced { background:#d6f0df; color:#14673a; } .tag.general { background:#dfe9fb; color:#234a9a; } .tag.assumption { background:#fde6c6; color:#8a4b00; }
.howto { padding:0; overflow:hidden; } .howto summary { padding:12px 15px; font-size:15px; } .howto .body { padding:0 15px 14px 33px; color:var(--dim); font-size:14px; } .howto .body ol { margin:6px 0 0; padding-left:18px; } .howto .body li { margin:4px 0; color:var(--fg); }

/* welcome */
.welcome { position:fixed; inset:0; z-index:60; background:linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--bg)), var(--bg) 55%); overflow-y:auto; }
.winner { max-width:1000px; margin:0 auto; padding:calc(26px + env(safe-area-inset-top)) 22px 40px; }
.winner .brand { display:flex; align-items:center; gap:10px; font-weight:700; font-size:18px; }
.winner h1 { font-size:38px; margin:34px 0 4px; letter-spacing:-.02em; } .winner .lead { font-size:17px; color:var(--dim); margin:0 0 22px; }
.wbig { display:grid; grid-template-columns:1.4fr 1fr; gap:14px; }
.wcard { text-align:left; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:6px; min-height:118px; padding:18px 20px; border-radius:var(--r); border:1px solid var(--line); background:var(--surface-solid); box-shadow:var(--shadow); }
.wcard.main { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); } .wcard b { font-size:19px; } .wcard span { font-size:14px; opacity:.85; font-weight:400; }
.winner h3 { margin:26px 0 10px; font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--dim); }
.wtiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:10px; }
.wtile { text-align:left; flex-direction:column; align-items:flex-start; justify-content:flex-start; min-height:96px; padding:13px 15px; border-radius:12px; border:1px solid var(--line); background:var(--surface-solid); gap:3px; }
.wtile b { font-size:15px; } .wtile span { font-size:13px; color:var(--dim); font-weight:400; }
.wtour { margin-top:22px; padding:20px 22px; border-radius:var(--r); background:linear-gradient(120deg, #0b4fd1, #0a6cff 60%, #4a9bff); color:#fff; display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.wtour b { font-size:20px; display:block; } .wtour p { margin:4px 0 0; opacity:.9; } .wtour button { background:#fff; color:#0a4fd0; font-weight:700; }
.wfoot { margin-top:18px; display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; color:var(--dim); font-size:13px; }

/* tour */
#tour { position:fixed; inset:0; z-index:80; }
.tour-spot { position:fixed; border-radius:12px; box-shadow:0 0 0 9999px rgba(8,12,20,.62); transition:all .2s; pointer-events:none; outline:2px solid var(--accent); }
.tour-card { position:fixed; width:min(340px, calc(100vw - 24px)); background:var(--surface-solid); border:1px solid var(--line); border-radius:14px; padding:16px; box-shadow:var(--shadow); }
.tour-card b { font-size:16px; } .tour-card p { margin:6px 0 12px; color:var(--dim); font-size:14px; }
.tour-dots { display:flex; gap:5px; margin-bottom:10px; } .tour-dots i { width:7px; height:7px; border-radius:50%; background:var(--line); } .tour-dots i.on { background:var(--accent); }
.tour-actions { display:flex; gap:6px; justify-content:space-between; }

/* dialogs */
dialog { border:1px solid var(--line); border-radius:16px; padding:0; background:var(--surface-solid); color:var(--fg); max-width:min(600px, 94vw); width:100%; box-shadow:0 24px 70px rgba(0,0,0,.35); }
dialog::backdrop { background:rgba(10,15,25,.55); }
.dlgform { padding:18px 20px 16px; display:flex; flex-direction:column; gap:10px; }
.dlgform h2 { margin:0 0 2px; font-size:19px; }
.dlgbody { display:flex; flex-direction:column; gap:8px; max-height:68vh; overflow-y:auto; padding:2px; }
.dlgbtns { display:flex; flex-direction:row-reverse; gap:8px; margin-top:6px; }
.dlgbtns button { min-width:110px; } .dlgbtns button[value=cancel] { border:1px solid var(--line); }
.dlgnote { font-size:13.5px; background:var(--field); border-radius:10px; padding:9px 12px; } .dlgnote.warn { background:var(--warn-soft); }
.dlgsec { font-size:11.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--dim); font-weight:700; margin:10px 0 0; border-top:1px solid var(--line); padding-top:12px; }
.dlgbody .row { display:flex; gap:8px; align-items:flex-end; } .dlgbody .row > * { flex:1; min-width:0; }
.polyrow { display:flex; align-items:center; gap:6px; padding:0 8px; }

.busy { position:fixed; inset:0; background:rgba(10,15,25,.5); display:flex; align-items:center; justify-content:center; z-index:90; }
.busybox { padding:20px 26px; display:flex; gap:14px; align-items:center; background:var(--surface-solid); }
.spin { width:22px; height:22px; border:3px solid var(--line); border-top-color:var(--accent); border-radius:50%; animation:sp .9s linear infinite; }
@keyframes sp { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition:none !important; animation-duration:.01ms !important; } }

/* narrower screens: the tools drop under the file bar, the properties become a bottom sheet */
@media (max-width: 920px) {
  .wbig { grid-template-columns:1fr; } .winner h1 { font-size:30px; }
  button.title { max-width:110px; }
  .fields { grid-template-columns:repeat(3, 1fr); }
}
@media (max-width: 520px) { .fields { grid-template-columns:repeat(2, 1fr); } .tbtn { min-width:52px; } }

/* generic bits used by the properties card and the 3D editor's inspector */
.row { display:flex; gap:8px; align-items:flex-end; margin-bottom:8px; } .row > * { flex:1; min-width:0; } .row > .fix { flex:none; }
label.f { display:block; font-size:12px; color:var(--dim); } label.f > input, label.f > select, label.f > textarea { display:block; margin-top:3px; color:var(--fg); }
#props h2, #palette h2 { font-size:17px; margin:0 0 4px; } #props h3, #palette h3 { margin:12px 0 6px; font-size:11.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--dim); font-weight:700; }
#props > h2:first-child { margin-top:2px; }
.pal-item { display:flex; align-items:center; gap:9px; padding:0 10px; min-height:44px; border:1px solid var(--line); border-radius:10px; margin-bottom:6px; cursor:grab; background:var(--surface-solid); user-select:none; }
.pal-item:hover { border-color:var(--accent); } .pal-item small { color:var(--dim); margin-left:auto; font-size:12px; }
.pal-item .sw { width:22px; height:14px; border-radius:3px; border:1px solid #0003; flex:none; }
.panel .small.muted, .muted.small { color:var(--dim); }




.howto { box-shadow:none; }

#zoomSeg select { min-height:40px; width:auto; max-width:150px; margin:0 4px; font-size:13px; }
#zoomSeg button { min-height:40px; padding:0 9px; gap:4px; } #zoomSeg button small { font-size:11.5px; }
#zoomSeg button.on { background:var(--accent-soft); color:var(--fg); font-weight:600; }
.keypad { position:fixed; left:50%; bottom:10px; transform:translateX(-50%); z-index:60; display:flex; gap:8px; padding:10px; background:var(--surface-solid); border:1px solid var(--line); border-radius:16px; box-shadow:0 8px 30px rgba(0,0,0,.25); }
.keypad.hidden { display:none; }
.kp-grid { display:grid; grid-template-columns:repeat(4, 64px); gap:6px; } .kp-side { display:flex; flex-direction:column; gap:6px; }
.keypad button { min-height:56px; font-size:20px; border-radius:10px; border:1px solid var(--line); background:var(--field); color:var(--fg); }
.kp-side button { min-width:84px; flex:1; font-size:16px; } .keypad button.primary { background:var(--accent); color:var(--accent-fg); border-color:transparent; }
body.has-keypad { padding-bottom:0; }

#roBanner { position:fixed; left:50%; top:14px; transform:translateX(-50%); z-index:50; max-width:min(720px,94vw); display:flex; gap:10px; align-items:center; flex-wrap:wrap; padding:10px 14px; border-radius:14px; background:var(--card,#fff); border:1px solid var(--line,#ccc); box-shadow:0 8px 30px rgba(0,0,0,.2); font-size:14px; }
#roBanner.hidden { display:none; }
body.readonly #toolsStage, body.readonly #bottom, body.readonly #props, body.readonly #checks, body.readonly #btnUndo, body.readonly #btnRedo, body.readonly #btnName, body.readonly #btnBook, body.readonly #pillTools, body.readonly #saveDot { display:none !important; }
body.readonly #pillFile { padding-right:6px; }

.vertag { position:fixed; right:8px; bottom:4px; z-index:5; background:none; border:0; padding:2px 6px; font-size:11px; color:var(--dim, #7a828e); opacity:.8; cursor:pointer; min-height:0; }
.vertag:hover { opacity:1; text-decoration:underline; }
body[data-sheet] .vertag, body.readonly .vertag { display:none; }
body.readonly #btnAccount { display:none !important; }
#btnAccount .lbl { max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

#sightCard { position:fixed; left:12px; top:calc(var(--hdr) + 64px); z-index:12; width:min(300px, calc(100vw - 24px)); max-height:calc(100vh - var(--hdr) - 120px); overflow:auto; padding:12px 14px; font-size:13.5px; }
#sightCard.hidden { display:none; }
#sightCard h2 { font-size:15px; margin:0 0 6px; display:flex; align-items:center; gap:6px; }
#sightCard .seatrow { display:flex; gap:6px; margin:8px 0; } #sightCard .seatrow button { flex:1; min-height:44px; padding:4px; line-height:1.15; }
#sightCard .seatrow button.on { background:var(--accent-soft); font-weight:600; outline:2px solid var(--accent); }
#sightCard .seatrow small { display:block; font-weight:400; color:var(--dim); }
#sightCard .legend { display:inline-block; width:12px; height:12px; background:rgba(214,48,48,.45); border-radius:3px; vertical-align:-1px; margin-right:4px; }
body.readonly #sightCard { display:none; }

.sc-pieces { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:2px 12px; margin:4px 0 8px; }
.sc-pieces .chk { margin:2px 0; }
.t th[colspan] { background:var(--field); text-align:left; font-size:12px; }

#terms { position:fixed; inset:0; z-index:200; background:rgba(15,20,30,.72); display:flex; align-items:center; justify-content:center; padding:12px; overflow:auto; }
#terms.hidden { display:none; }
.termsbox { background:var(--surface-solid, #fff); color:var(--fg); max-width:640px; width:100%; max-height:calc(100vh - 24px); display:flex; flex-direction:column; border-radius:16px; padding:20px 22px; box-shadow:0 20px 60px rgba(0,0,0,.4); }
.termsbox h1 { font-size:20px; margin:0 0 4px; } .termsbox .lead { margin:0 0 10px; color:var(--dim); font-size:14px; }
.termstext { overflow:auto; border:1px solid var(--line); border-radius:10px; padding:4px 14px 10px; margin-bottom:12px; font-size:14px; line-height:1.5; flex:1; min-height:140px; }
.termstext h2 { font-size:14px; margin:14px 0 2px; } .termstext p { margin:2px 0; }
.termsagree { display:flex; gap:10px; align-items:flex-start; margin:0 0 12px; font-size:14px; } .termsagree input { margin-top:3px; width:20px; height:20px; flex:none; }

button.minbtn { min-width:36px; width:36px; min-height:36px; height:36px; padding:0; border-radius:10px; background:transparent; border:0; color:var(--dim); flex:none; display:inline-flex; align-items:center; justify-content:center; }
button.minbtn:hover { color:var(--fg); }
.propsfoot { display:none; }
@media (max-width: 920px) {
  /* the properties and the lumber list are sheets at the bottom: compact, scrolling, with a Done button */
  #props, #palette { max-height:min(40vh, 340px); overflow-y:auto; padding-bottom:0; border-radius:16px; }
  body:has(#bottom.hidden) #props, body:has(#bottom.hidden) #palette { bottom:calc(12px + env(safe-area-inset-bottom)); }
  .propsfoot { display:flex; gap:8px; position:sticky; bottom:0; margin:10px -14px 0; padding:10px 14px calc(10px + env(safe-area-inset-bottom) * 0); background:var(--surface-solid, #fff); border-top:1px solid var(--line); z-index:2; }
  .propsfoot button { flex:1; min-height:46px; font-size:16px; }
  #dock { top:auto; bottom:calc(var(--dockbottom, 86px) + env(safe-area-inset-bottom)); }
  body.focus #dock { top:12px; bottom:auto; }
  #top { gap:6px; }
}


.msg { border-radius:18px; }
@media (max-width: 520px) { #bottom .bname { display:none; } .msg { font-size:12px; padding:6px 12px; max-width:calc(100vw - 24px); } }

@media (max-width: 920px) {
  /* while the number pad is up, the properties sheet sits above it so its Done button stays reachable */
  body.has-keypad #props, body.has-keypad #palette { bottom:calc(var(--kpad, 0px) + 20px); max-height:calc(100vh - var(--kpad, 0px) - var(--hdr) - 40px); }
  body.has-keypad #dock, body.has-keypad #bottom { display:none; }
}

#updBar { position:fixed; left:50%; bottom:76px; transform:translateX(-50%); z-index:70; max-width:min(560px,94vw); display:flex; gap:12px; align-items:center; padding:10px 14px; border-radius:14px; background:var(--surface-solid); color:var(--fg); border:1px solid var(--line); box-shadow:var(--shadow); font-size:14px; }
#updBar button { min-height:40px; padding:0 14px; }

.wtop { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.wacct { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.wacct .primary { min-height:44px; padding:0 18px; }


/* =====================================================================================================================
   Chrome: one sectioned toolbar across the top, a side column of panels with a strip of tabs on the right edge.
   ===================================================================================================================== */
:root { --bar:60px; --sidew:56px; }
#work { inset:var(--bar) var(--sidew) 0 0; }
body.focus #work { inset:0; }

#top { position:fixed; left:0; right:0; top:0; height:var(--bar); z-index:20; display:flex; align-items:center; gap:0; padding:0 6px; background:var(--surface-solid); border-bottom:1px solid var(--line); box-shadow:0 2px 12px rgba(20,30,50,.07); overflow-x:auto; overflow-y:hidden; scrollbar-width:none; }
#top::-webkit-scrollbar { display:none; }
#top .grow { flex:1 1 6px; min-width:6px; }
.sect { display:flex; align-items:center; gap:3px; flex:none; padding:0 8px; height:100%; }
.sect + .sect { border-left:1px solid var(--line); }
#top .grow + .sect { border-left:1px solid var(--line); }
#top button { min-height:44px; }
.toolrow { display:flex; align-items:center; gap:2px; }
.tbtn { flex-direction:column; justify-content:center; gap:1px; min-width:52px; min-height:50px !important; padding:3px 6px; font-size:11px; line-height:1.1; color:var(--fg); border-radius:10px; }
.tbtn .ico { width:22px; height:22px; }
.tbtn.on { background:var(--accent); color:var(--accent-fg); }
.tbtn.on:active { filter:brightness(.9); background:var(--accent); }
.tsep { width:1px; height:30px; background:var(--line); margin:0 5px; flex:none; }
#pillRight .tbtn { flex-direction:row; min-height:44px !important; min-width:0; gap:7px; font-size:14px; padding:0 12px; }
#pillRight .primary { gap:7px; padding:0 14px; }
button.title { max-width:170px; }
.seg { display:inline-flex; align-items:center; background:var(--field); border-radius:10px; padding:2px; gap:2px; }
.seg button { min-height:38px !important; padding:0 10px; border-radius:8px; font-size:13.5px; gap:5px; }
.seg button.on { background:var(--accent); color:var(--accent-fg); font-weight:600; }
#viewPill { gap:8px; }
#zoomSeg button { padding:0 8px; } #zoomSeg button small { font-size:11.5px; }
#zoomSeg button.on { background:var(--accent-soft); color:var(--fg); font-weight:600; }
#zoomSeg select { min-height:38px; width:auto; max-width:140px; margin:0 3px; font-size:13px; }

/* labels fold into icons as the bar runs out of room, so nothing wraps or overlaps */
@media (max-width: 1600px) { #pillTools .tbtn, #toolsBuild .tbtn { min-width:48px; min-height:50px !important; padding:3px 4px; } #pillTools .tbtn span, #toolsBuild .tbtn span { font-size:10.5px; } #btnShop .lbl { display:none; } #btnShop { padding:0 11px; } }
@media (max-width: 1400px) { .sect { padding:0 5px; } #pillRight #btnBook .lbl { display:none; } #pillRight #btnBook { padding:0; width:44px; } #zoomSeg [data-zoom="sel"], button.title { display:none; } #zoomSeg button.snapb small, #zoomSeg [data-sighttoggle] small { display:none; } }
@media (max-width: 1240px) { #btnAccount .lbl { display:none; } #zoomSeg button small { display:none; } #btnHelp, .savedot { display:none; } .sect { padding:0 5px; } #top button.icon { width:40px; } .tbtn { min-width:40px !important; } }

/* ---- the side column ---- */
#side { position:fixed; top:var(--bar); right:0; bottom:0; display:flex; z-index:16; }
#sidebody { display:none; width:340px; overflow-y:auto; background:var(--surface-solid); border-left:1px solid var(--line); padding:6px 10px 24px; }
body.side-open #sidebody { display:block; }
#sidebody .panel { position:static; max-height:none; width:auto; padding:10px 4px 6px; background:transparent; border:0; border-radius:0; box-shadow:none; backdrop-filter:none; -webkit-backdrop-filter:none; overflow:visible; }
#sidebody .panel + .panel:not(.hidden):not(.pmin) { border-top:1px solid var(--line); margin-top:8px; }
#dock { width:56px; display:flex; flex-direction:column; align-items:center; gap:6px; padding:8px 0; background:var(--surface-solid); border-left:1px solid var(--line); }
button.mintab { width:46px; min-height:46px; padding:3px 2px; border-radius:11px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; font-size:9.5px; line-height:1.1; font-weight:600; background:transparent; color:var(--dim); border:0; text-align:center; }
button.mintab .ico { width:21px; height:21px; }
button.mintab:hover { background:var(--hover); color:var(--fg); }
button.mintab.on { background:var(--accent-soft); color:var(--accent); }
button.mintab.focusbtn { margin-top:auto; font-weight:500; }
.pmin { display:none !important; }
body.focus #top, body.focus #sidebody, body.focus .panel, body.focus #bottom, body.focus #msg, body.focus #roBanner { display:none !important; }
body.focus #side { top:10px; right:10px; bottom:auto; }
body.focus #dock { background:var(--surface-solid); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); padding:4px; }
body.focus #dock .mintab:not(.focusbtn) { display:none; }
body.focus #dock .mintab.focusbtn { margin:0; width:auto; flex-direction:row; padding:0 12px; gap:6px; min-height:40px; }

/* floating bits sit in the middle of what is left of the screen */
#bottom { left:calc((100vw - var(--sidew)) / 2); max-width:calc(100vw - var(--sidew) - 24px); }
.msg { left:calc((100vw - var(--sidew)) / 2); top:calc(var(--bar) + 8px); }
.menu { left:6px; top:calc(var(--bar) + 4px); }
#updBar { left:calc((100vw - var(--sidew)) / 2); }

/* ---- phones and small tablets: the panels are sheets at the bottom, the strip becomes loose tabs ---- */
@media (max-width: 920px) {
  :root { --bar:56px; --sidew:0px; }
  #work { inset:var(--bar) 0 0 0; }
  #side { position:static; display:contents; }
  #sidebody { display:contents; }
  #sidebody .panel { position:fixed; padding:14px; background:var(--surface); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); overflow-y:auto; }
  #sidebody .panel + .panel { border-top:1px solid var(--line); margin-top:0; }
  #sidebody .panel { left:12px; right:12px; width:auto; bottom:calc(76px + env(safe-area-inset-bottom)); max-height:min(40vh, 340px); z-index:15; }
  body:has(#bottom.hidden) #sidebody .panel { bottom:calc(12px + env(safe-area-inset-bottom)); }
  body.has-keypad #sidebody .panel { bottom:calc(var(--kpad, 0px) + 20px); max-height:calc(100vh - var(--kpad, 0px) - var(--bar) - 40px); }
  #dock { position:fixed; right:8px; bottom:calc(var(--dockbottom, 86px) + env(safe-area-inset-bottom)); z-index:40; width:auto; background:none; border:0; padding:0; flex-direction:column-reverse; align-items:flex-end; gap:8px; pointer-events:none; }
  #dock > * { pointer-events:auto; }
  button.mintab { width:auto; min-height:44px; padding:6px 12px; flex-direction:row; gap:7px; font-size:13px; background:var(--surface-solid); color:var(--fg); border:1px solid var(--line); box-shadow:var(--shadow); }
  button.mintab.focusbtn { margin:0; }
  body.focus #side { display:block; position:fixed; top:10px; right:10px; }
  body.focus #dock { position:static; flex-direction:row; box-shadow:none; border:0; padding:0; }
  .msg, #bottom, #updBar { left:50%; }
  #bottom { max-width:calc(100vw - 24px); }
  .tbtn { min-width:40px !important; min-height:44px !important; }
  #btnAccount, #btnSettings, #btnHelp, .savedot, #zoomSeg [data-zoom="out"], #zoomSeg [data-zoom="in"], #zoomSeg [data-zoom="sel"] { display:none !important; }
  #top button.icon { width:40px; } .sect { padding:0 4px; }
}
@media (max-width: 520px) { button.title, #btnHelp, #btnSettings { display:none; } }

/* ---- the menu ---- */
.menu { width:300px; max-height:calc(100vh - var(--bar) - 16px); overflow-y:auto; padding:4px 6px 8px; }
.menu button { min-height:40px; font-size:14.5px; gap:10px; border-radius:9px; }
.menu .mgroup { font-size:10.5px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; color:var(--dim); padding:12px 12px 3px; }
.menu .mgroup:first-child { padding-top:6px; }
.menu .mcard { min-height:56px; background:var(--accent-soft); border:1px solid color-mix(in srgb, var(--accent) 35%, transparent); margin:2px 0 4px; }
.menu .mcard span { display:flex; flex-direction:column; text-align:left; } .menu .mcard small { color:var(--dim); font-weight:400; font-size:12px; }
.menu .macct { display:flex; align-items:center; gap:9px; padding:6px 12px; font-size:13px; color:var(--dim); overflow:hidden; } .menu .macct span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.menu .msub > summary { padding:0 12px; min-height:40px; border-radius:9px; font-weight:400; font-size:14.5px; gap:10px; } .menu .msub > summary:hover { background:var(--hover); }
.menu .msub > summary::before { display:none; }
.menu .msub button { padding-left:44px; min-height:36px; font-size:14px; }
.menu .mver { padding:10px 12px 2px; border-top:1px solid var(--line); margin-top:8px; }

/* ---- the library sheet ---- */
.libwrap { display:grid; grid-template-columns:210px 1fr; gap:22px; align-items:start; }
.libnav { position:sticky; top:0; display:flex; flex-direction:column; gap:6px; }
.libnav button { flex-direction:column; align-items:flex-start; justify-content:center; min-height:56px; padding:6px 14px; gap:0; border:1px solid var(--line); background:var(--surface-solid); border-radius:12px; text-align:left; }
.libnav button small { color:var(--dim); font-weight:400; font-size:12px; }
.libnav button.on { background:var(--accent-soft); border-color:var(--accent); }
.libwho { padding:10px 6px; line-height:1.4; }
.libbody { min-width:0; }
.libtitle { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; flex-wrap:wrap; margin-bottom:12px; }
.libtitle h2 { margin:0 0 2px; } .libtitle p { margin:0; max-width:56ch; }
.libgrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(290px, 1fr)); gap:12px; margin:8px 0 14px; }
.libgrid.two { grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); } .libgrid.tight { grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:8px; }
.libcard, .libpanel, .libitem { background:var(--surface-solid); border:1px solid var(--line); border-radius:13px; padding:12px 14px; }
.libcard.active { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
.libhead { display:flex; align-items:center; gap:8px; } .libname { font-weight:700; font-size:16px; background:transparent; border:1px solid transparent; padding:0 6px; min-height:36px; flex:1; }
.libfacts { display:flex; flex-wrap:wrap; gap:4px 14px; margin:2px 6px 10px; }
.libacts { display:flex; flex-wrap:wrap; gap:6px; }
.libitem { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px 8px 14px; } .libitem > span:first-child { flex:1; min-width:0; }
.libbtns { display:flex; gap:6px; flex:none; }
.libempty { border:1px dashed var(--line); border-radius:13px; padding:22px; color:var(--dim); text-align:center; margin:8px 0 14px; }
.libpanel h3, .libpanel summary { margin:0 0 8px; }
.libpanel summary { font-size:14px; font-weight:700; }
.libmore { margin-top:14px; } .libmore summary { font-weight:600; color:var(--dim); }
.libstat { display:grid; grid-template-columns:auto auto; gap:0 8px; align-items:baseline; text-align:right; } .libstat b { font-size:22px; } .libstat small { color:var(--dim); }
.libtable td input { width:84px; min-height:34px; } .libtable tr.grp th { background:var(--field); text-transform:none; letter-spacing:0; font-size:12.5px; color:var(--fg); }
button.danger { color:var(--danger); }
@media (max-width: 760px) {
  .libwrap { grid-template-columns:1fr; gap:10px; }
  .libnav { position:static; flex-direction:row; overflow-x:auto; } .libnav button { flex:1; min-width:110px; } .libnav button small, .libwho { display:none; }
}
.vertag { right:calc(var(--sidew) + 8px); }

#secureBox.flash { animation:secflash 1.6s ease; border-radius:12px; } @keyframes secflash { 0%,60% { background:var(--accent-soft); box-shadow:0 0 0 6px var(--accent-soft); } 100% { background:transparent; box-shadow:0 0 0 0 transparent; } }

/* the "fasten it here?" card */
#offer { position:fixed; left:calc((100vw - var(--sidew)) / 2); transform:translateX(-50%); bottom:84px; z-index:25; display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:center; max-width:calc(100vw - var(--sidew) - 24px); padding:10px 14px; border-radius:16px; background:var(--surface-solid); border:1px solid var(--accent); box-shadow:var(--shadow); font-size:14px; }
#offer.hidden { display:none; }
#offer .obtns { display:flex; gap:6px; flex-wrap:wrap; } #offer button { min-height:40px; padding:0 14px; }
@media (max-width: 920px) { #offer { left:50%; max-width:calc(100vw - 24px); bottom:130px; } }

/* pictures on flats */
.picrow { display:flex; gap:12px; align-items:flex-start; margin-bottom:6px; }
.picprev { width:96px; height:72px; object-fit:cover; border-radius:10px; border:1px solid var(--line); flex:none; background:var(--field); }
.picprev[hidden] { display:none; }
.libpics { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:12px; margin:8px 0 14px; }
.libpic { background:var(--surface-solid); border:1px solid var(--line); border-radius:13px; overflow:hidden; display:flex; flex-direction:column; }
.libpic img { width:100%; height:120px; object-fit:cover; display:block; background:var(--field); }
.libpic .pb { padding:8px 10px; display:flex; flex-direction:column; gap:6px; } .libpic input.libname { font-size:14px; min-height:34px; }
.libmeter { height:8px; border-radius:999px; background:var(--field); overflow:hidden; margin:6px 0 4px; } .libmeter i { display:block; height:100%; background:var(--accent); }
@media (min-width: 921px) { .vertag { bottom:74px; } }

/* windows in the Adjust dialog */
.winrow { border:1px solid var(--line); border-radius:12px; padding:8px 10px 2px; margin:6px 0; }

/* a count on a side tab */
button.mintab { position:relative; }
.tabbadge { position:absolute; top:1px; right:1px; min-width:17px; height:17px; padding:0 4px; border-radius:9px; background:var(--warn); color:#fff; font-size:10px; font-style:normal; font-weight:700; line-height:17px; text-align:center; }
.tabbadge.stop { background:var(--danger); }

/* the Save button next to the show name */
button.savebtn { min-height:34px !important; padding:0 12px; border-radius:9px; font-size:13px; font-weight:600; border:1px solid var(--accent); color:var(--accent); background:transparent; margin:0 2px; }
button.savebtn.saved { border-color:var(--line); color:var(--dim); font-weight:500; }
.menu label.msel { display:flex; align-items:center; gap:10px; padding:2px 12px; min-height:44px; font-size:14.5px; color:var(--fg); }
.menu label.msel > span { flex:none; } .menu label.msel select { flex:1; min-width:0; min-height:38px; font-size:14px; }
@media (max-width: 1240px) { button.savebtn { padding:0 8px; } }
@media (max-width: 1500px) { .savedot { display:none; } }
@media (max-width: 1400px) { #zoomSeg button small { display:none; } #top button.icon { width:40px; } #pillRight .tbtn { padding:0 9px; } }

/* a bar that scrolls sideways: a fade and an arrow show there is more */
.fade-r { -webkit-mask-image:linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image:linear-gradient(to right, #000 calc(100% - 44px), transparent); }
.fade-l { -webkit-mask-image:linear-gradient(to left, #000 calc(100% - 44px), transparent); mask-image:linear-gradient(to left, #000 calc(100% - 44px), transparent); }
.fade-l.fade-r { -webkit-mask-image:linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent); mask-image:linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent); }
button.scrollhint { position:fixed; z-index:30; width:32px; min-height:32px; height:32px; padding:0; border-radius:50%; background:var(--surface-solid); border:1px solid var(--line); box-shadow:var(--shadow); font-size:22px; line-height:1; color:var(--accent); display:none; align-items:center; justify-content:center; }
button.scrollhint.on { display:flex; }
body.focus button.scrollhint { display:none; }

/* Library and Stock in the side column */
#library .libgrid, #stock .libgrid, #library .libgrid.tight, #stock .libgrid.tight, #stock .libgrid.two { grid-template-columns:1fr; }
#library .libtitle, #stock .libtitle { margin-bottom:8px; } #library .libtitle h2, #stock .libtitle h2 { font-size:16px; } #library .libtitle p, #stock .libtitle p { font-size:12.5px; }
#library .libtabs { display:flex; margin:4px 0 8px; } #library .libtabs button { flex:1; }
#library .libitem, #stock .libitem { flex-wrap:wrap; } #library .libbtns, #stock .libbtns { flex-wrap:wrap; }
#stock .row, #library .row { flex-wrap:wrap; } #stock .row > *, #library .row > * { min-width:120px; }
#stock .libtable td input { width:70px; } #stock .libpanel, #library .libpanel { padding:10px 12px; }
#library .libpics { grid-template-columns:repeat(2, 1fr); }
.lentag { position: absolute; z-index: 5; pointer-events: none; background: #0b4fd1; color: #fff; font-weight: 600; font-size: 13px; padding: 4px 9px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.25); white-space: nowrap; }
#vcube { position:absolute; top:12px; right:12px; width:76px; height:76px; perspective:300px; z-index:4; }
#vcube .vc-cube { position:absolute; left:16px; top:16px; width:44px; height:44px; transform-style:preserve-3d; }
#vcube .vc-cube button { position:absolute; inset:0; width:44px; height:44px; min-height:0; padding:0; font-size:10px; font-weight:600; color:var(--fg); background:var(--surface); border:1px solid var(--line); border-radius:4px; cursor:pointer; backface-visibility:hidden; }
#vcube .vc-cube button:hover { background:var(--accent-soft); color:var(--accent); }
#vcube .vc-home { position:absolute; right:0; top:0; width:22px; height:22px; min-height:0; padding:0; border-radius:50%; font-size:12px; background:var(--surface-solid); border:1px solid var(--line); cursor:pointer; }
@media (max-width: 920px) {
  /* a sheet is open: its tab sits at the top right (above the sheet, off the stage) so a second tap closes it */
  body.sheet-open #dock { top:calc(var(--bar) + 10px + env(safe-area-inset-top)); bottom:auto; flex-direction:column; }
  body.sheet-open button.mintab.on { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); }
}
.emptycard { position:absolute; left:50%; top:42%; transform:translate(-50%,-50%); width:min(440px, calc(100% - 32px)); text-align:center; padding:22px 20px; background:var(--surface-solid); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow); z-index:6; }
.emptycard h2 { margin:0 0 4px; font-size:21px; }
.emptycard p { margin:6px 0 12px; color:var(--dim); }
.emptybtns { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-bottom:6px; }
.emptybtns button { flex:1 1 120px; min-height:74px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; font-size:16px; font-weight:600; border-radius:14px; }
.emptybtns button small { font-weight:400; font-size:11.5px; opacity:.85; }
button.linkbtn { background:none; border:0; padding:0; min-height:0; color:var(--accent); text-decoration:underline; font:inherit; cursor:pointer; }
.emptycard { pointer-events:none; }
.emptycard button, .emptycard .term { pointer-events:auto; }
button.term { background:none; border:0; padding:0; min-height:0; font:inherit; color:inherit; text-decoration:underline dotted; text-underline-offset:3px; cursor:help; }
button.term:hover { color:var(--accent); }
.mintab.helpbtn { }
#coach { position:fixed; left:50%; transform:translateX(-50%); top:calc(var(--bar, 60px) + 10px); z-index:60; width:min(460px, calc(100vw - 24px)); background:var(--surface-solid); border:2px solid var(--accent); border-radius:16px; box-shadow:var(--shadow); padding:12px 14px; }
#coach.hidden { display:none; }
#coach .coachtop { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--accent); }
#coach p { margin:6px 0 4px; font-size:15px; line-height:1.35; }
#coach .coachbtns { display:flex; justify-content:flex-end; gap:8px; margin-top:6px; }
body.guided .msg { top:calc(var(--hdr) + 150px); }

/* ---- colour-coded groups: the same colour means the same kind of job everywhere (panel, dialogs, bottom bar) ---- */
:root { --c-size:#2f7cf6; --c-place:#1c9a5a; --c-build:#d9822b; --c-fasten:#8a5cf6; --c-feature:#0e9fb0; --c-look:#d6249f; --c-notes:#6b7a90; --c-shop:#b88a00; }
:root[data-theme="dark"] { --c-size:#6aa3ff; --c-place:#4fc58a; --c-build:#f0a258; --c-fasten:#ad8cff; --c-feature:#4cc4d3; --c-look:#f070c4; --c-notes:#9aa7ba; --c-shop:#e0b73a; }
.dsec { --c:var(--c-notes); border-left:4px solid var(--c); background:color-mix(in srgb, var(--c) 8%, transparent); border-radius:4px 12px 12px 4px; padding:10px 12px 12px; margin:12px 0; }
.dsec > h3, .dsec > summary > h3 { display:flex; align-items:center; gap:8px; margin:0 0 6px; font-size:13px; letter-spacing:.03em; text-transform:none; color:var(--c); font-weight:700; }
.dsec .dchip { width:24px; height:24px; border-radius:8px; background:var(--c); color:#fff; display:inline-flex; align-items:center; justify-content:center; flex:none; }
.dsec .dchip .ico { width:15px; height:15px; }
.dsec .dhelp { margin:0 0 8px; font-size:12.5px; color:var(--dim); line-height:1.35; }
.dsec.c-size { --c:var(--c-size); } .dsec.c-place { --c:var(--c-place); } .dsec.c-build { --c:var(--c-build); } .dsec.c-fasten { --c:var(--c-fasten); }
.dsec.c-feature { --c:var(--c-feature); } .dsec.c-look { --c:var(--c-look); } .dsec.c-notes { --c:var(--c-notes); } .dsec.c-shop { --c:var(--c-shop); }
.dsec.sec { border-top:0; }
.dsec summary { cursor:pointer; list-style:none; } .dsec summary::-webkit-details-marker { display:none; }
.dlgbody .dsec { margin:12px 0; }
/* the bottom action bar: same colours as the groups */
#bottom .abtn[data-b="adjust"], #bottom .abtn[data-b="edit3d"] { color:var(--c-size); }
#bottom .abtn[data-b="window"], #bottom .abtn[data-b="dooropen"] { color:var(--c-feature); }
#bottom .abtn[data-b="supports"], #bottom .abtn[data-b="fasten"], #bottom .abtn[data-b="edgewall"] { color:var(--c-fasten); }
#bottom .abtn[data-b="copy"], #bottom .abtn[data-b="inventory"] { color:var(--c-place); }
#bottom .abtn .ico { color:inherit; }
/* the side tabs */
#dock .mintab[data-dock="props"] .ico { color:var(--c-size); } #dock .mintab[data-dock="checks"] .ico { color:var(--c-build); }
#dock .mintab[data-dock="library"] .ico { color:var(--c-fasten); } #dock .mintab[data-dock="stock"] .ico { color:var(--c-place); }
#dock .mintab[data-dock="palette"] .ico { color:var(--c-build); } #dock .mintab.helpbtn .ico { color:var(--c-feature); }
#dock .mintab.on .ico, body.sheet-open button.mintab.on .ico { color:inherit; }
/* the bottom of the details panel: one main action, one quieter one */
.propsacts { display:flex; gap:8px; margin-top:12px; } .propsacts button { flex:1; min-height:46px; }
.propsacts .primary { background:var(--c-size); border-color:var(--c-size); color:#fff; }
.dsec.sec > h3, .dsec.sec > summary > h3 { justify-content:flex-start; text-transform:none; letter-spacing:.02em; font-size:13.5px; color:var(--c); }
#props .dsec { margin:12px 0; }
#props .dsec > h3, #props .dsec > summary > h3, #props .dsec.sec > h3 { margin:0 0 6px; font-size:13.5px; letter-spacing:.02em; text-transform:none; color:var(--c); justify-content:flex-start; }
.dnav { position:sticky; top:-1px; z-index:3; display:flex; gap:6px; overflow-x:auto; padding:6px 0 8px; margin:-2px 0 4px; background:var(--surface-solid); }
.dnav button { --c:var(--c-notes); flex:none; min-height:32px; padding:0 12px; border-radius:16px; font-size:12.5px; font-weight:600; border:1.5px solid var(--c); color:var(--c); background:color-mix(in srgb, var(--c) 10%, transparent); }
.dnav button.c-size { --c:var(--c-size); } .dnav button.c-place { --c:var(--c-place); } .dnav button.c-build { --c:var(--c-build); } .dnav button.c-fasten { --c:var(--c-fasten); }
.dnav button.c-feature { --c:var(--c-feature); } .dnav button.c-look { --c:var(--c-look); } .dnav button.c-notes { --c:var(--c-notes); } .dnav button.c-shop { --c:var(--c-shop); }
.dnav { flex:none; flex-shrink:0; min-height:44px; }
.dlgbody > .dsec { flex-shrink:0; }
/* ---- audit fixes ---- */
/* nothing floats over a full-screen page (Help, Shopping list, Settings) or the menu */
button.scrollhint { z-index:21; }
body[data-sheet]:not([data-sheet=""]) #dock, body[data-sheet]:not([data-sheet=""]) button.scrollhint, body[data-sheet]:not([data-sheet=""]) #bottom { display:none; }
@media (max-width: 920px) {
  #dock { z-index:22; }
  /* closed tabs sit in one row above the action bar (they used to be a tall stack that covered the stage) */
  body:not(.sheet-open):not(.focus) #dock { left:8px; right:8px; flex-direction:row; align-items:center; justify-content:flex-start; overflow-x:auto; gap:6px; padding:2px; scrollbar-width:none; }
  body:not(.sheet-open):not(.focus) #dock::-webkit-scrollbar { display:none; }
  body:not(.sheet-open):not(.focus) #dock .mintab { flex:none; min-height:40px; padding:4px 10px; }
  /* an open sheet: its tab is at the top right, so the hint and the view cube keep clear of it */
  body.sheet-open .msg { left:10px; right:auto; transform:none; max-width:calc(100vw - 170px); }
  body.sheet-open #vcube { top:64px; }
  /* the sheet's Done bar sits flush on the bottom edge */
  #sidebody #props { padding-bottom:0; }
}
@media (max-width: 920px) {
  /* a sheet always sits just above the action bar, however tall that bar is */
  #sidebody .panel { bottom:calc(var(--dockbottom, 86px) - 12px + env(safe-area-inset-bottom)); }
}

/* ======================================================================================================================
   Lighting Builder additions
   ====================================================================================================================== */
:root { --plan-bg:#eef1f5; --plan-stage:#fbfcfd; --plan-grid:rgba(0,0,0,.07); --plan-grid5:rgba(0,0,0,.16); --plan-band:rgba(10,108,255,.10); --plan-ghost:#6b7280; --plan-person:#2f6fb5; --ink:var(--fg); --beam:#e08a00; }
:root[data-theme=dark] { --plan-bg:#1c1f25; --plan-stage:#252a33; --plan-grid:rgba(255,255,255,.08); --plan-grid5:rgba(255,255,255,.18); --plan-band:rgba(61,139,255,.16); --plan-ghost:#9aa4b0; --plan-person:#6fa8dc; --beam:#f5a623; }
body { overflow:hidden; }
#plan, #view3d { position:absolute; inset:0; width:100%; height:100%; touch-action:none; display:block; }
#plan { cursor:grab; }
body[data-view="3d"] #planWrap { display:none; } body[data-view="plan"] #stage3dWrap { display:none; }
#stage3dWrap { position:absolute; inset:0; }

/* the library, as lists of rows */
.fix { display:block; width:100%; text-align:left; margin:4px 0; min-height:52px; padding:8px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface-solid); color:var(--fg); }
.fix small { display:block; color:var(--dim); font-size:12px; font-weight:400; } .fix.on { border-color:var(--accent); background:var(--accent-soft); }
.rowfav { display:flex; align-items:stretch; gap:4px; } .rowfav > .fix, .rowfav > .gel { flex:1; min-width:0; }
.star { flex:none; width:44px; min-height:44px; margin:4px 0; border:1px solid var(--line); border-radius:10px; background:var(--surface-solid); color:var(--dim); font-size:22px; padding:0; } .star.on { color:#e0a000; border-color:#e0a000; }
.gel { display:flex; gap:10px; align-items:center; text-align:left; margin:4px 0; min-height:52px; padding:6px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-solid); justify-content:flex-start; } .gel.on { border-color:var(--accent); background:var(--accent-soft); } .gel small { display:block; color:var(--dim); font-size:12px; font-weight:400; }
.sw { display:inline-block; flex:none; width:34px; height:34px; border-radius:8px; border:1px solid #0006; vertical-align:middle; }
.tag { font-size:11px; font-weight:600; padding:0 6px; border-radius:8px; background:var(--field); color:var(--dim); }
.tag3 { display:inline-block; padding:0 7px; border-radius:8px; font-size:11px; font-weight:700; } .tag3.ok { background:color-mix(in srgb, var(--ok) 18%, transparent); color:var(--ok); } .tag3.est { background:color-mix(in srgb, var(--warn) 18%, transparent); color:var(--warn); }
.chips { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:6px 0; } .chipbtn { position:relative; } .chipbtn input { position:absolute; opacity:0; } .chipbtn span { display:inline-block; min-height:36px; padding:6px 14px; border:1px solid var(--line); border-radius:20px; font-weight:600; } .chipbtn input:checked + span { background:var(--accent-soft); border-color:var(--accent); } .chipbtn input:focus-visible + span { outline:2px solid var(--accent); }
.clearbtn { width:100%; min-height:40px; margin:6px 0; border:1px dashed var(--line); border-radius:10px; }
.gobogrid { display:grid; grid-template-columns:repeat(auto-fill, minmax(88px, 1fr)); gap:6px; } .gobocell { position:relative; } .gobo { display:block; width:100%; padding:4px; border:1px solid var(--line); border-radius:10px; background:var(--surface-solid); font-size:11px; } .gobo.on { border-color:var(--accent); border-width:3px; padding:2px; } .gobo svg { display:block; width:100%; height:auto; border-radius:50%; } .gobo span { display:block; margin-top:2px; } .gobocell .star { position:absolute; top:2px; right:2px; width:32px; min-height:32px; margin:0; font-size:17px; background:#000a; color:#fff; border:0; }
.own { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:4px 0; border-bottom:1px solid var(--line); } .own small { display:block; color:var(--dim); font-size:12px; } .own.over { color:var(--danger); } .own input { width:84px !important; flex:none; text-align:center; }
.subtabs { display:flex; gap:4px; overflow-x:auto; margin:0 -2px 8px; padding:2px; } .sub { flex:none; min-height:38px; padding:0 13px; border:1px solid var(--line); border-radius:20px; background:var(--surface-solid); font-weight:600; font-size:13.5px; } .sub.on { background:var(--accent-soft); border-color:var(--accent); }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:6px 0; } .grid2 button, .panel .row button { border:1px solid var(--line); background:var(--surface-solid); }
.lookrow { display:flex; gap:4px; align-items:stretch; } .lookrow .fix { flex:1; min-width:0; } .lookrow .mini { flex:none; width:46px; min-height:44px; margin:4px 0; border:1px solid var(--line); border-radius:10px; font-size:11.5px; padding:0; background:var(--surface-solid); }
.switch { display:flex; align-items:center; gap:10px; min-height:44px; } .switch input { width:22px; height:22px; accent-color:var(--accent); flex:none; }
.slider { display:flex; align-items:center; gap:10px; margin:6px 0; } .slider input[type=range] { flex:1; min-height:34px; accent-color:var(--accent); } .slider output { min-width:3.6em; text-align:right; font-variant-numeric:tabular-nums; } .slider > span { min-width:5.2em; font-size:12.5px; color:var(--dim); }
.filebtn { display:block; position:relative; margin:8px 0; } .filebtn input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; } .filebtn span { display:flex; align-items:center; justify-content:center; min-height:52px; border-radius:12px; border:2px dashed var(--accent); font-weight:700; } .filebtn input:focus-visible + span { outline:2px solid var(--accent); }
fieldset.f { border:0; padding:0; margin:6px 0; }
.chiplink { min-height:32px !important; padding:2px 10px !important; border:2px solid var(--chip, var(--accent)); border-radius:16px; background:var(--surface-solid); font-size:12px; display:inline-flex; }
.sorow { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:6px 0; border-bottom:1px solid var(--line); } .sorow > input[type=text] { flex:1 1 100%; } .sorow label { display:flex; align-items:center; gap:4px; font-size:13px; color:var(--dim); } .sorow label input { width:72px; min-height:36px; }
.heads { list-style:none; padding:0; margin:0; } .heads button { width:100%; text-align:left; justify-content:flex-start; margin:4px 0; padding:8px 12px; border:1px solid var(--line); border-left:5px solid var(--warn); border-radius:10px; background:var(--surface-solid); height:auto; line-height:1.35; }
.swatches { display:flex; gap:8px; margin-top:8px; } .swatches input { position:absolute; opacity:0; } .swatches span { display:block; width:36px; height:36px; border-radius:50%; border:3px solid transparent; } .swatches input:checked + span { border-color:var(--fg); }
.dtitle { margin:2px 0 6px; font-size:17px; } .warn2 { color:var(--warn); }
.panel select, .panel input[type=text], .panel input[type=number], .panel input[type=search], .panel textarea { width:100%; min-height:42px; padding:6px 10px; border:1px solid var(--line); border-radius:9px; background:var(--field); color:var(--fg); font-size:15px; }
.panel input[type=range], .panel input[type=checkbox], .panel input[type=radio], .panel input[type=color] { width:auto; min-height:0; }
.panel input[type=color] { width:64px; min-height:40px; padding:2px; }
.panel .row2 { display:flex; gap:6px; }
.dsec .f { margin:6px 0; display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; font-size:12.5px; } .dsec .f > span { flex:1 1 100%; color:var(--dim); } .dsec .f > input, .dsec .f > select, .dsec .f > textarea { flex:1 1 110px; } .dsec .f > em { font-style:normal; color:var(--dim); }
.dsec.c-room { --c:var(--c-look); }

/* the light meter, as a card beside the stage */
#meterbox { position:fixed; right:calc(var(--sidew, 0px) + 12px); top:calc(var(--bar) + 12px); z-index:17; width:min(330px, calc(100vw - 24px)); padding:10px 12px; font-size:14px; }
#meterbox .big2 { font-size:26px; font-weight:700; font-variant-numeric:tabular-nums; line-height:1.1; } #meterbox .row2 { display:flex; gap:6px; margin:6px 0; } #meterbox .row2 button { flex:1; min-height:40px; border:1px solid var(--line); border-radius:10px; } #meterbox .row2 button[aria-pressed="true"] { border-color:var(--accent); background:var(--accent-soft); }
#meterbox ul { margin:4px 0; padding-left:18px; } #meterbox .tag2 { font-size:11px; padding:0 6px; border-radius:8px; background:var(--field); }
@media (max-width: 920px) { #meterbox { top:calc(var(--bar) + 10px); right:10px; width:min(310px, calc(100vw - 20px)); } }
/* the placing banner and the guided card float over the stage like Set Builder's message strip */
#placebar { position:fixed; left:calc((100vw - var(--sidew, 0px)) / 2); transform:translateX(-50%); top:calc(var(--bar) + 8px); z-index:19; display:flex; gap:12px; align-items:center; padding:6px 8px 6px 16px; border-radius:999px; background:var(--surface-solid); border:2px solid var(--accent); box-shadow:var(--shadow); max-width:calc(100vw - 24px); }
#placebar button { min-height:40px; padding:0 16px; border-radius:999px; background:var(--accent); color:var(--accent-fg); font-weight:600; }
@media (max-width: 920px) { #placebar { left:50%; } }
#guided { position:fixed; left:calc((100vw - var(--sidew, 0px)) / 2); transform:translateX(-50%); bottom:calc(86px + env(safe-area-inset-bottom)); z-index:19; width:min(440px, calc(100vw - 24px)); padding:12px 14px; }
@media (max-width: 920px) { #guided { left:50%; bottom:calc(160px + env(safe-area-inset-bottom)); } }
#guided p { margin:4px 0 8px; } #guided .row { margin:0; }
/* the stage's empty state */
.emptycard { position:absolute; left:50%; top:42%; transform:translate(-50%, -50%); width:min(92%, 460px); padding:18px; text-align:center; pointer-events:none; } .emptycard button { pointer-events:auto; }
.emptybtns { display:flex; flex-direction:column; gap:8px; margin:10px 0; } .emptybtns button { flex-direction:column; min-height:56px; gap:0; } .emptybtns button small { font-weight:400; opacity:.85; }
body[data-view="3d"] .emptycard { display:none; }
/* the bottom pill: coloured actions like Set Builder's */
#bottom .abtn[data-b="copy"], #bottom .abtn[data-b="mirror"], #bottom .abtn[data-b="repeat"] { color:var(--c-place); } #bottom .abtn[data-b="group"], #bottom .abtn[data-b="attach"] { color:var(--c-fasten); } #bottom .abtn[data-b="alignrow"], #bottom .abtn[data-b="aligncol"], #bottom .abtn[data-b="spread"] { color:var(--c-size); } #bottom .abtn[data-b="delete"] { color:var(--danger); }
#bottom .lookname { min-width:150px; max-width:260px; text-align:center; font-weight:600; font-size:13.5px; padding:0 8px; }
.dock-badge { }

/* ---- manual move controls (Details > Move this light) */
.mvrow { margin:10px 0 12px; }
.mvhead { display:flex; justify-content:space-between; align-items:baseline; gap:8px; font-weight:600; font-size:14px; }
.mvhead .mvout { font-weight:500; color:var(--dim); font-variant-numeric:tabular-nums; font-size:13px; text-align:right; }
.mvctl { display:flex; align-items:center; gap:8px; margin:4px 0 2px; }
.mvctl input[type=range] { flex:1; min-width:0; min-height:44px; }
.mvb { flex:none; width:44px; height:44px; min-height:44px !important; border-radius:12px; background:var(--field); border:1px solid var(--line); display:inline-flex; align-items:center; justify-content:center; touch-action:none; user-select:none; }
.mvb:active { background:var(--accent); color:var(--accent-fg); }
.mvb[data-stop="1"] { opacity:.55; }
.mvends { display:flex; justify-content:space-between; font-size:12px; color:var(--dim); gap:6px; }
.mvends .mvstop { color:var(--warn, #b45309); font-weight:600; text-align:center; flex:1; }
details.reach { margin-top:8px; } details.reach summary { cursor:pointer; font-weight:600; font-size:13.5px; padding:6px 0; }
.chiplink { border:1px solid var(--chip, var(--accent)); color:var(--chip, var(--accent)); background:transparent; border-radius:999px; min-height:28px !important; padding:0 10px; font-size:12.5px; }
.warn2 { color:var(--warn, #b45309); }

/* ---- welcome and empty-stage big buttons */
.big { display:flex !important; flex-direction:column; align-items:flex-start; justify-content:center; gap:2px; width:100%; min-height:56px; padding:10px 16px; margin:8px 0; border-radius:14px; text-align:left; font-size:16px; font-weight:600; border:1px solid var(--line); background:var(--surface-solid); color:inherit; }
.big small { display:block; font-size:13px; font-weight:400; opacity:.8; white-space:normal; }
.big.primary { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); }
#welcome .card .row { display:flex; gap:8px; } #welcome .card .row button { flex:1; min-height:44px; }

/* ---- paperwork (printed pages) */
#printdoc { display:none; }
@media print {
  body > *:not(#printdoc) { display:none !important; }
  body { background:#fff !important; } #printdoc { display:block !important; color:#111; font:11px/1.35 system-ui, sans-serif; }
  @page { size: letter landscape; margin: 0.45in; }
  #printdoc .page { page-break-after:always; break-after:page; } #printdoc .page:last-child { page-break-after:auto; }
  #printdoc .ph { display:flex; justify-content:space-between; align-items:flex-end; border-bottom:2px solid #111; padding-bottom:6px; margin-bottom:10px; }
  #printdoc h1 { font-size:20px; margin:0; } #printdoc .ph p { margin:2px 0 0; font-size:13px; font-weight:600; } #printdoc .pm { font-size:10px; text-align:right; color:#444; }
  #printdoc table { width:100%; border-collapse:collapse; font-size:10px; } #printdoc th, #printdoc td { border:1px solid #888; padding:2px 5px; text-align:left; vertical-align:top; } #printdoc th { background:#e6e9ee; }
  #printdoc td.none { color:#666; text-align:center; } #printdoc .plot { width:100%; max-height:5.4in; } #printdoc .small { font-size:9.5px; color:#444; }
  #printdoc .pf { margin-top:10px; padding-top:5px; border-top:1px solid #999; font-size:8.5px; color:#555; }
}

/* ---- accessibility: contrast, a hidden page heading */
.vh { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; padding:0; }
:root { --accent:#0860e6; }
:root[data-theme="dark"] { --accent-fg:#0b1220; }

button.primary, .primary { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); }
button.primary:disabled { opacity:.5; }
:root[data-theme="light"] .mintab.on { color:#0a4fc0; }
:root[data-theme="dark"] .mintab.on { color:#a9cbff; }
:root[data-theme="light"] .dsec.sec > h3 { color:color-mix(in srgb, var(--c) 68%, #000); }
:root[data-theme="light"] .tag3.ok { color:#0f5e27; } :root[data-theme="light"] .tag3.est { color:#7a4300; }
:root[data-theme="dark"] .sub.on { color:#e3ecfa; }
:root[data-theme="light"] #props .dsec.sec > h3, :root[data-theme="light"] #props .dsec > h3 { color:color-mix(in srgb, var(--c) 68%, #000); }
.big.primary small { opacity:1; color:inherit; } .big small { opacity:.92; }
