/* styles/components.css — the component library (B1, design §8). One look for every builder's panes: use the classes
   through ui/components.js rather than writing new ones. Colours come only from tokens.css. */

/* ── icon (design §4.4: 18 px on the rail, 16 px in controls) */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.i.lg { width: 18px; height: 18px; }
.i.sm { width: 14px; height: 14px; }

/* ── type helpers (design §4.2) */
.eyebrow { font-size: var(--fs-eyebrow); font-weight: var(--fw-eyebrow); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3-text); }
.meta { font-size: var(--fs-meta); font-weight: 500; color: var(--ink-2); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.title { font-size: var(--fs-title); font-weight: 650; letter-spacing: -.01em; color: var(--ink); line-height: 1.2; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3-text); }
.ok { color: var(--ok-text); } .warn { color: var(--warn-text); } .bad { color: var(--bad-text); } .info { color: var(--info-text); }

/* numbers typeset like a spec sheet (design §4.3): tabular, unit ink-3 at .86 em after a thin space */
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.num .u { color: var(--ink-3-text); font-size: .86em; font-weight: 500; }
.num.bound .v { color: var(--warn-text); }
.num.net .v { color: var(--ok-text); }
.num .measured { color: var(--ink-3-text); font-size: .86em; font-weight: 500; margin-left: .35em; }
.num .sec { color: var(--ink-3-text); font-size: .86em; font-weight: 500; margin-left: .5em; }

/* ── buttons (desktop 32 px; touch 44 px) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--control-h); padding: 0 12px;
  border: 0; border-radius: var(--r-input); background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap;
  font-size: var(--fs-control); font-weight: 500; line-height: 1;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:hover { background: var(--fill-1); }
.btn:active { background: var(--fill-2); }
.btn[aria-pressed="true"], .btn.on { background: var(--fill-3); }
.btn[disabled], .btn[aria-disabled="true"] { color: var(--ink-4); cursor: default; background: transparent; }
.btn.icon { width: var(--control-h); padding: 0; }
.btn.primary { background: var(--accent); color: var(--on-accent-text); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); }
.btn.outline { box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.outline:hover { background: var(--fill-1); }
.btn.danger { color: var(--bad-text); }
.btn.sm { height: 28px; padding: 0 10px; }
.btn.block { width: 100%; }
.btn .kbd { margin-left: 2px; }
@media (pointer: coarse) { .btn { min-height: var(--touch); } .btn.icon { min-width: var(--touch); } }

/* ── keyboard caps */
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-kbd);
  background: var(--fill-2); box-shadow: inset 0 -1px 0 var(--line-2); color: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--font); line-height: 1; }

/* ── chips and pills */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r-chip); border: 0;
  background: var(--fill-1); color: var(--ink); font-size: var(--fs-control); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease); }
.chip:hover { background: var(--fill-2); }
.chip.active, .chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.chip .count { color: var(--ink-3-text); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--fill-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok-text); } .pill.warn { background: var(--warn-soft); color: var(--warn-text); }
.pill.bad { background: var(--bad-soft); color: var(--bad-text); } .pill.info { background: var(--info-soft); color: var(--info-text); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--warn); color: var(--on-warn); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--panel); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.accent { background: var(--accent); }

/* LiveDot (design §8: green live, amber pulse = new build waiting, red stale/offline, grey static) */
.livedot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; position: relative; }
.livedot[data-state="live"] { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.livedot[data-state="waiting"] { background: var(--warn); animation: pulse 1.6s var(--ease) infinite; }
.livedot[data-state="stale"], .livedot[data-state="offline"] { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--warn-soft); } 50% { box-shadow: 0 0 0 5px var(--warn-soft); } }

/* ── segmented control */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--r-chip); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.seg > button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2);
  font-size: var(--fs-control); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg > button:hover { color: var(--ink); background: var(--fill-1); }
.seg > button[aria-checked="true"] { background: var(--fill-3); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.seg > button[disabled] { color: var(--ink-4); cursor: default; background: transparent; }
.seg.accent > button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-text); }

/* ── toggle (switch) */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-body); color: var(--ink); user-select: none; }
.toggle .sw { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--fill-3); flex: none; transition: background var(--t-fast) var(--ease); }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: transform var(--t-fast) var(--ease); }
.toggle[aria-checked="true"] .sw { background: var(--accent); }
.toggle[aria-checked="true"] .sw::after { transform: translateX(12px); background: var(--on-accent); }
.toggle[aria-checked="mixed"] .sw::after { transform: translateX(6px); }
.toggle[aria-disabled="true"] { color: var(--ink-4); cursor: default; }

/* ── slider */
.slider { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.slider input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 20px; background: transparent; cursor: pointer; margin: 0; }
.slider input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p, 50%), var(--fill-3) var(--p, 50%)); }
.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); transition: transform var(--t-fast) var(--ease); }
.slider input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
.slider input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--fill-3); }
.slider input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.slider input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); }
.slider .val { min-width: 42px; text-align: right; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── swatch */
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c, #888); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 0 0 var(--accent); transition: box-shadow var(--t-fast) var(--ease); }
.swatch[aria-checked="true"] { box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }

/* ── metric tile (design §8: default, warn (≤), clickable) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { position: relative; padding: 11px 12px 12px; border-radius: var(--r-card); background: var(--fill-1); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; text-align: left; border: 0; color: inherit; font: inherit; }
.tile .tl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.tile .tv { margin-top: 6px; font-size: var(--fs-tile); font-weight: 650; letter-spacing: -.015em; line-height: 1.1; }
.tile .tv .u { font-size: 12.5px; font-weight: 600; margin-left: 2px; }
/* a homeowner value is words ("about 38 squares"): let it wrap between them instead of running into the next tile */
.tile .tv .num { white-space: normal; }
.tile .ts { margin-top: 4px; font-size: 11.5px; color: var(--ink-3-text); line-height: 1.35; }
.tile.warn .tv .v { color: var(--warn-text); }
.tile.click { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.tile.click:hover { background: var(--fill-2); }
.tile.click::after { content: "›"; position: absolute; right: 12px; top: 10px; color: var(--ink-3-text); opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.tile.click:hover::after { opacity: 1; }
.tile.skel .tv { height: 26px; width: 60%; border-radius: 6px; background: var(--fill-2); }

/* ── KV row (design §8: value, bound, measured, net, link, mixed) */
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 30px; padding: 5px 0; font-size: var(--fs-body); }
.kv + .kv { border-top: 1px solid var(--line); }
.kv .k { color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.kv .val { text-align: right; font-size: var(--fs-value); font-weight: 600; color: var(--ink); }
.kv.small .val { font-size: var(--fs-body); font-weight: 500; }
.kv.link { cursor: pointer; } .kv.link:hover .k { color: var(--ink); }
.kv .mixed { color: var(--ink-3-text); }

/* ── FtIn field (design §8: idle, focus, editing, invalid, locked, mixed) */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.field .box { display: flex; align-items: center; gap: 6px; height: var(--control-h); padding: 0 10px; border-radius: var(--r-input); background: var(--well); box-shadow: inset 0 0 0 1px var(--line-2); transition: box-shadow var(--t-fast) var(--ease); }
.field .box:focus-within { box-shadow: inset 0 0 0 1px var(--sel), 0 0 0 3px var(--sel-fill); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--fs-body); font-variant-numeric: tabular-nums; text-align: right; padding: 0; }
.field .sec { font-size: 11.5px; color: var(--ink-3-text); white-space: nowrap; }
.field.invalid .box { box-shadow: inset 0 0 0 1px var(--bad); }
.field .msg { font-size: 11.5px; color: var(--bad-text); }
.field.locked .box { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.field.locked input { color: var(--ink-2); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }

/* ── sections (inspector section padding 16/18) */
.sec-block { padding: 14px 18px 16px; border-top: 1px solid var(--line); }
.sec-block:first-child { border-top: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sec-head .act { font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: none; border: 0; cursor: pointer; padding: 2px 0; }
.sec-head .act:hover { color: var(--ink); }

/* ── empty, error and skeleton states (design §9) */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; color: var(--ink-2); font-size: var(--fs-body); }
.empty .i { width: 22px; height: 22px; color: var(--ink-3-text); }
.empty .et { font-weight: 600; color: var(--ink); font-size: 14px; }
.empty.ok .i, .empty.ok .et { color: var(--ok-text); }
.skel-row { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--fill-1), var(--fill-2), var(--fill-1)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skel-row + .skel-row { margin-top: 10px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.card-state { max-width: 440px; padding: 24px 26px; border-radius: var(--r-card); background: var(--panel-2); box-shadow: var(--e3); color: var(--ink); }
.card-state .title { margin: 10px 0 6px; }
.card-state p { margin: 0 0 16px; color: var(--ink-2); }
.card-state.error .i.lg { color: var(--bad-text); }

/* ── popover / menu (e3) */
.pop { position: fixed; min-width: 200px; max-width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto; padding: 6px; border-radius: var(--r-card); background: var(--panel-2); box-shadow: var(--e3); z-index: 41;
  animation: pop-in var(--t-panel) var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.menu { display: flex; flex-direction: column; gap: 1px; }
.menu .mi { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; font-size: var(--fs-control); }
.menu .mi:hover, .menu .mi.kb { background: var(--fill-2); }
.menu .mi[aria-checked="true"] { color: var(--accent-text); }
.menu .mi .kbd { margin-left: auto; }
.menu .mi .hint2 { margin-left: auto; color: var(--ink-3-text); font-size: 11.5px; }
.menu .mi:hover .hint2, .menu .mi.kb .hint2 { color: var(--ink-2); }   /* on the raised row --ink-3-text falls under 4.5:1 */
.menu .mi .ml { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .mi.two { height: auto; min-height: 44px; padding-top: 7px; padding-bottom: 7px; align-items: flex-start; }
.menu .mi.two > .i { margin-top: 2px; }
.menu .mi .m2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu .mi .m2a { font-weight: 600; }
.menu .mi .m2b { font-size: 11.5px; line-height: 1.35; color: var(--ink-2); white-space: normal; }
.menu .mi[aria-checked="true"] .m2b { color: var(--ink-2); }
.menu .sep { height: 1px; margin: 4px 6px; background: var(--line); }
.menu .mh { padding: 8px 10px 4px; }
.menu .empty { padding: 10px; }

/* ── toast (design §8: info, success, warn, error; action; 5 s; errors persist) */
.toast { display: flex; align-items: center; gap: 10px; min-height: 40px; max-width: 100%; padding: 8px 8px 8px 14px; border-radius: var(--r-card); background: var(--panel-2); color: var(--ink); box-shadow: var(--e3);
  font-size: var(--fs-body); animation: toast-in var(--t-panel) var(--ease); }
.toast .i { color: var(--info-text); }
.toast.success .i { color: var(--ok-text); } .toast.warn .i { color: var(--warn-text); } .toast.error .i { color: var(--bad-text); }
.toast.error { box-shadow: var(--e3), inset 3px 0 0 var(--bad); }
.toast .tx { flex: 1; min-width: 0; }
.toast .btn { height: 28px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity var(--t-panel) var(--ease), transform var(--t-panel) var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── hover card (design §8: one in the world) */
.hovercard .hc { min-width: 180px; max-width: 280px; padding: 10px 12px; border-radius: var(--r-card); }
.hovercard .hc-h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.hovercard .hc-h .tt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hovercard .hc-h .id { margin-left: auto; padding: 1px 7px; border-radius: var(--r-pill); background: var(--fill-2); color: var(--ink); font-weight: 600; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.hovercard .hc-r { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.hovercard .hc-r b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.hovercard .hc-k { margin-top: 8px; font-size: 11px; color: var(--ink-3-text); }

/* ── table (design §8: header, hover, selected (--sel edge), warn, total, empty) */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; height: 30px; padding: 0 10px; background: var(--panel); color: var(--ink-3-text); font-size: 11.5px; font-weight: 500; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.n, .tbl td.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td { height: var(--control-h-dense); padding: 0 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr { cursor: default; }
.tbl tbody tr:hover td { background: var(--fill-1); }
.tbl tbody tr[aria-selected="true"] td { background: var(--sel-fill); }
.tbl tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--sel); }
.tbl tr.warn td { color: var(--warn-text); }
.tbl tr.total td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--line-2); }
.tbl .emptyrow td { color: var(--ink-3-text); height: 48px; text-align: center; }
.tbl-wrap { overflow: auto; min-height: 0; }

/* ── scrubber (design §8: one component, kind = time | peel | story | tour) */
.scrub { position: relative; flex: 1; min-width: 120px; height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.scrub .track { position: relative; height: 10px; border-radius: 999px; background: var(--fill-2); cursor: pointer; }
.scrub[data-kind="time"] .track { background: var(--scrub-sky, var(--sky-track)); }
.scrub .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent-soft); pointer-events: none; }
.scrub[data-kind="time"] .fill { display: none; }
.scrub .thumb { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.35); transition: transform var(--t-fast) var(--ease); outline: none; }
.scrub .thumb:focus-visible { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--sel); }
.scrub.dragging .thumb { transform: scale(1.25); }
.scrub .ticks { position: relative; height: 14px; font-size: 10.5px; color: var(--ink-3-text); }
.scrub .ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.scrub .ticks span.lm { color: var(--ink-2); }
.scrub .ticks span.edge-l { transform: none; }
.scrub .ticks span.edge-r { transform: translateX(-100%); }
.scrub .live { position: absolute; bottom: 100%; transform: translate(-50%, -4px); padding: 2px 7px; border-radius: 6px; background: var(--panel-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; box-shadow: var(--e2); opacity: 0; pointer-events: none; transition: opacity var(--t-fast) var(--ease); }
.scrub.dragging .live { opacity: 1; }
.scrub[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ── modal (⌘K, ?; design §4.4 e4: 55% scrim + 2 px blur) */
.modal-scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: grid; place-items: start center; padding-top: 12vh; animation: fade-in var(--t-panel) var(--ease); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(620px, calc(100vw - 24px)); max-height: 72vh; display: flex; flex-direction: column; border-radius: var(--r-card); background: var(--panel-2); box-shadow: var(--e3); overflow: hidden; }
.modal.wide { width: min(980px, calc(100vw - 24px)); max-height: min(88vh, 860px); }
.modal-scrim:has(.modal.wide) { padding-top: max(24px, 6vh); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.modal-body { overflow: auto; padding: 8px; }
.keys-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 26px; padding: 4px 10px 12px; }
@media (max-width: 760px) { .keys-grid { grid-template-columns: 1fr; } }
.keys-grid .kcol { display: flex; flex-direction: column; min-width: 0; }
.keys-grid h3 { margin: 12px 0 6px; }
.keys-grid .kr { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 28px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.keys-grid .kr .kl { min-width: 0; }
.keys-grid .kr .kw { color: var(--ink-3-text); font-size: 11.5px; }
.keys-grid .kr .kk { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 55%; }
/* the modal's footer line of key hints (⌘K, ?) */
.modal-foot { flex: none; display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-2); }
.modal-foot .kbd { height: 18px; min-width: 18px; font-size: 10.5px; margin-right: 2px; }
.modal-foot .grow { flex: 1; }
.modal .menu .mi .ml { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal .menu .mi .hint2 { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .modal-foot { display: none; } .modal-scrim { padding-top: 8vh; } }

/* ═══════════════════════════════════════════════ shell parts (design §2.1, §8) */
/* RailItem: default, hover, active (accent-soft + accent icon + label), focus, badge, dirty dot, disabled */
.rail-item { position: relative; width: var(--rail-item); height: var(--rail-item); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; border-radius: var(--r-card); background: transparent; color: var(--ink-2); cursor: pointer; font-size: 10.5px; font-weight: 500; line-height: 1;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.rail-item .i { width: 18px; height: 18px; }
.rail-item:hover { background: var(--fill-1); color: var(--ink); }
.rail-item[aria-selected="true"], .rail-item[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.rail-item[aria-disabled="true"] { color: var(--ink-4); cursor: default; background: transparent; }
.rail-item .dirty { position: absolute; top: 7px; left: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--panel); }
.rail-item .badge { top: 4px; right: 5px; }

/* HouseChip + BuildChip (one card): loading skeleton + 2 px progress, LiveDot, popovers */
.house-chip { position: relative; display: flex; align-items: center; height: var(--top-h); border-radius: var(--r-hud); padding: 0 4px 0 6px; max-width: 520px; }
.house-chip .hc-house, .house-chip .hc-build { display: flex; align-items: center; gap: 10px; height: 36px; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 13px; padding: 0 10px 0 4px; min-width: 0; }
.house-chip .hc-house:hover, .house-chip .hc-build:hover { background: var(--fill-1); }
.house-chip .thumb { width: 32px; height: 32px; border-radius: var(--r-chip); background: var(--fill-2); display: grid; place-items: center; color: var(--ink-2); flex: none; overflow: hidden; }
.house-chip .thumb img { width: 100%; height: 100%; object-fit: cover; }
.house-chip .hc-house { flex: 0 1 auto; overflow: hidden; }
.house-chip .nm { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 100%; overflow: hidden; text-align: left; }
.house-chip .nm1 { display: flex; align-items: center; gap: 7px; max-width: 100%; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.house-chip .nm-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.house-chip .nm2 { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
/* the Build chip holds a short name; it clips rather than ever running over the house line (G1 finding, B2 request #43) */
.house-chip .hc-build { flex: 0 1 auto; gap: 6px; padding: 0 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.house-chip .hc-build .bl { min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.house-chip .hc-build::before { content: ""; width: 1px; height: 22px; background: var(--line-2); margin-right: 6px; }
.house-chip .progress { position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--fill-2); overflow: hidden; }
.house-chip .progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width var(--t-panel) var(--ease); }
.house-chip .skel-name { width: 110px; height: 11px; border-radius: 6px; background: var(--fill-2); }
.house-chip .skel-meta { width: 160px; height: 9px; border-radius: 5px; background: var(--fill-1); margin-top: 5px; }
.pop .house-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 6px; }
.pop .house-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 0; border-radius: var(--r-card); background: var(--fill-1); color: var(--ink); text-align: left; cursor: pointer; }
.pop .house-card:hover { background: var(--fill-2); }
.pop .house-card[aria-current="true"] { box-shadow: inset 0 0 0 1px var(--accent-line); background: var(--accent-soft); }
.pop .mod-row { display: flex; align-items: center; gap: 8px; font-size: 12px; min-height: 22px; color: var(--ink-2); }
.pop .mod-row .st { width: 14px; display: inline-grid; place-items: center; }
.pop .mod-row.failed .st, .pop .mod-row.failed .rs { color: var(--bad-text); }
.pop .mod-row.ready .st { color: var(--ok-text); }
.pop .mod-row .rs { margin-left: auto; color: var(--ink-3-text); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .pop-sec { padding: 8px 10px; }
.pop .pop-sec + .pop-sec { border-top: 1px solid var(--line); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--fill-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ToolStrip: segment default / hover / active / disabled; dropdown; toggle */
.toolstrip { display: flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: var(--r-hud); white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.toolstrip::-webkit-scrollbar { display: none; }
.toolstrip .ts-label { padding: 0 4px 0 8px; }
.toolstrip .ts-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; flex: none; }
.toolstrip .btn { height: 32px; }
.toolstrip .seg { background: transparent; box-shadow: none; padding: 0; }
.toolstrip .seg > button { height: 32px; padding: 0 12px; border-radius: var(--r-chip); }
.toolstrip.compact .bl, .toolstrip.compact .seg > button > :not(.i) { display: none; }
.toolstrip .walk-pill { display: flex; align-items: center; gap: 10px; padding: 0 12px; font-size: var(--fs-control); color: var(--ink-2); }
.toolstrip .walk-pill b { color: var(--ink); font-weight: 600; }
.toolstrip[data-stub] { }

/* ViewBar + SaveChip */
.viewbar { display: flex; align-items: center; gap: 2px; height: var(--top-h); padding: 0 6px; border-radius: var(--r-hud); }
.viewbar .btn { height: 32px; }
.viewbar .btn.primary { margin-left: 4px; }
.save-chip { display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 6px 0 14px; border-radius: var(--r-hud); background: var(--hud-solid); box-shadow: var(--e2); font-size: var(--fs-control); font-weight: 500; white-space: nowrap; }
.save-chip .dot { background: var(--warn); }
.save-chip.error { box-shadow: var(--e2), inset 0 0 0 1px var(--bad); color: var(--bad-text); }
.save-chip.error .dot { background: var(--bad); }
.save-chip.saved .dot { background: var(--ok); }

/* ViewCube + compass: idle, hover, dragging; sun marker by day, moon at night */
.compass { position: relative; width: var(--cube); height: var(--cube); border-radius: 50%; background: var(--hud-solid); box-shadow: var(--e2); border: 0; padding: 0; cursor: pointer; color: var(--ink-2); }
.compass:hover { color: var(--ink); }
.compass svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.compass .ring { fill: none; stroke: var(--line-2); stroke-width: 1; }
.compass .tick { stroke: var(--ink-3); stroke-width: 1.2; }
.compass .north { fill: var(--bad); }
.compass .nlabel { fill: var(--ink); font: 700 10px var(--font); text-anchor: middle; dominant-baseline: central; }
.compass .sun { fill: var(--accent); stroke: var(--panel-2); stroke-width: 1.5; }
.compass .moon { fill: var(--ink-2); stroke: var(--panel-2); stroke-width: 1.5; }
.compass .cube { fill: var(--fill-2); stroke: var(--ink-3); stroke-width: 1; }
/* ViewCube states (design §8): hover side (an arc + the side's letter), hover centre (Home), dragging (turns the view) */
.compass .side-hl { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; }
.compass .side-label { fill: var(--accent-text); font: 700 9.5px var(--font); text-anchor: middle; dominant-baseline: central; }
.compass.hover-centre .cube { fill: var(--accent-soft); stroke: var(--accent); }
.compass.dragging { cursor: grabbing; }
.compass { cursor: pointer; touch-action: none; }
.viewcube .cube-btns { display: flex; gap: 2px; padding: 2px; border-radius: var(--r-chip); background: var(--hud-solid); box-shadow: var(--e2); }
.viewcube .cube-btns .btn { width: 26px; height: 26px; padding: 0; border-radius: 8px; }
.viewcube .cube-btns .btn .i { width: 14px; height: 14px; }

/* Inspector: empty (workspace summary), read-only ("Edit in … ›"), loading, error */
.insp-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); flex: none; }
.insp-head .eyebrow { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.insp-head .sub { margin-top: 3px; font-size: 12.5px; color: var(--ink-2); }
.insp-head .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.insp-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; min-height: 0; overscroll-behavior: contain; }
.insp-foot { flex: none; display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.insp-foot .btn { flex: 1; }
.insp-ro { display: flex; align-items: center; gap: 8px; padding: 8px 18px; font-size: 12px; color: var(--ink-2); background: var(--fill-1); border-bottom: 1px solid var(--line); }
.insp-ro button { margin-left: auto; background: none; border: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; font-size: 12px; }
.note-line { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 18px 14px; }
.note-line input { flex: 1; min-width: 0; height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-input); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-size: 12.5px; }
.note-line input::placeholder { color: var(--ink-3-text); }

/* Tray: time chip · scrubber slot · weather, date, play, expand */
.tray .tc { display: flex; align-items: center; gap: 10px; min-width: 0; flex: none; height: 48px; padding: 0 10px 0 4px; border: 0; background: transparent; color: var(--ink); border-radius: 14px; cursor: pointer; text-align: left; }
.tray .tc:hover { background: var(--fill-1); }
.tray .orb { width: 28px; height: 28px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 35%, #FFE6A6, var(--accent) 60%, #D98A2B); box-shadow: 0 0 14px rgba(246,179,76,.45); }
.tray .orb.moon { background: radial-gradient(circle at 35% 35%, #F4F6FA, #B9C3D3 70%); box-shadow: 0 0 12px rgba(185,195,211,.35); }
.tray .clock { font-size: 19px; font-weight: 650; letter-spacing: -.01em; line-height: 1; }
.tray .clock small { font-size: 11px; font-weight: 600; margin-left: 2px; color: var(--ink-2); }
.tray .tline { font-size: 11.5px; color: var(--ink-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.tray .slot { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.tray .right { display: flex; align-items: center; gap: 6px; flex: none; }
.tray .tsep { width: 1px; height: 28px; background: var(--line-2); flex: none; }
.tray .slot .stub-note { font-size: 12px; color: var(--ink-3-text); }
.twin[data-bp="phone"] .tray .slot, .twin[data-bp="phone"] .tray .right, .twin[data-bp="phone"] .tray .tsep, .twin[data-bp="phone"] .tray .tline { display: none; }
.twin[data-bp="phone"] .tray .tc { height: 40px; padding: 0 4px; }
.twin[data-bp="phone"] .tray .orb { width: 26px; height: 26px; }
.twin[data-walk="on"] .tray .slot, .twin[data-walk="on"] .tray .right .wx, .twin[data-walk="on"] .tray .right .dt { display: none; }
@media (max-width: 1279.98px) { .tray .tline { max-width: 150px; } .tray .right .chip .cl { display: none; } }

/* Drawer: tabs with counts; resize grip (200 px … 50 vh) */
.drawer-grip { flex: none; height: 10px; cursor: ns-resize; display: grid; place-items: center; touch-action: none; }
.drawer-grip::after { content: ""; width: 36px; height: 4px; border-radius: 4px; background: var(--fill-3); }
.drawer-head { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px 6px 12px; border-bottom: 1px solid var(--line); }
.drawer-head .tabs { display: flex; gap: 2px; }
.drawer-head .tab { height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-chip); background: transparent; color: var(--ink-2); font-size: var(--fs-control); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.drawer-head .tab:hover { background: var(--fill-1); color: var(--ink); }
.drawer-head .tab[aria-selected="true"] { background: var(--fill-3); color: var(--ink); }
.drawer-head .tab .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--fill-2); color: var(--ink-2); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.drawer-head .subtabs { display: flex; gap: 2px; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line-2); }
.drawer-head .subtabs .tab { height: 26px; font-size: 12px; }
.drawer-head .grow { flex: 1; }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.act-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px 4px 14px; }
.act-head .grow { flex: 1; }
.activity { list-style: none; margin: 0; padding: 6px 12px 12px; }
.activity li .lab { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity li.bad { color: var(--bad-text); }
.activity li.save .lab { color: var(--ink-2); }
.activity li { display: flex; align-items: center; gap: 10px; min-height: 30px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.activity li .t { color: var(--ink-3-text); font-size: 11.5px; width: 64px; flex: none; font-variant-numeric: tabular-nums; }
.activity li.undone { color: var(--ink-3-text); text-decoration: line-through; }
.activity li .doc { margin-left: auto; }

/* Layers drawer: presets, filter, groups, rows (on, off, partial, loading, unavailable, diagnostic) */
.layers-head { flex: none; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.layers-head .row1 { display: flex; align-items: center; gap: 8px; }
.layers-head .row1 .lsum { margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.layers-head input { height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-input); background: var(--well); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-size: 12.5px; }
.layers-head input::placeholder { color: var(--ink-3-text); }
.layers-head input:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--sel), 0 0 0 3px var(--sel-fill); }
.layers-head .seg { display: flex; }
.layers-head .seg > button { flex: 1 1 auto; justify-content: center; padding: 0 6px; font-size: 12px; }
.layers-body { flex: 1 1 auto; overflow: auto; padding: 4px 6px 10px; overscroll-behavior: contain; }
.layers-foot { flex: none; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3-text); }
.lgroup { padding: 8px 6px 2px; }
.lgroup + .lgroup { border-top: 1px solid var(--line); margin-top: 4px; }
.lghead { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 0 2px 6px; }
.lghead .gsum { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; }
.lghead .geye, .lghead .disc { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; border-radius: 8px; }
.lghead .geye { width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.lghead .geye:hover, .lghead .disc:hover { background: var(--fill-2); color: var(--ink); }
.lghead .geye[aria-checked="false"] { color: var(--ink-4); }
.lghead .geye[aria-checked="mixed"] { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.lghead .disc { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 2px; margin-left: -4px; }
.lrow { display: flex; align-items: flex-start; gap: 8px; min-height: 32px; padding: 2px 6px; border-radius: 8px; font-size: 12.5px; }
.lrow:hover { background: var(--fill-1); }
.lrow .lmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 5px 0 4px; }
.lrow .lline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lrow .ln { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.lrow .lc { flex: none; color: var(--ink-3-text); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lrow .spin { flex: none; }
.lrow.off .ln { color: var(--ink-2); }
.lrow.unavailable .ln { color: var(--ink-3-text); }
.lrow .why { font-size: 11px; color: var(--ink-3-text); line-height: 1.35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lrow .why .retry { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; font-size: 11px; cursor: pointer; }
.lrow.diagnostic .ln { font-family: var(--font-mono); font-size: 11.5px; }
.lrow .eye, .lrow .eye-sp { width: 28px; height: 28px; flex: none; margin-top: 2px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.lrow .eye:hover { background: var(--fill-2); color: var(--ink); }
.lrow.off .eye { color: var(--ink-4); }
.lrow .eye[disabled] { cursor: default; background: transparent; color: var(--ink-4); }
.lrow .lkey { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11px; color: var(--ink-2); }
.lrow .lkey .kk { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.lrow .lkey .kline { width: 22px; height: 8px; flex: none; }
.lrow .lctl .slider { min-width: 0; }
.lrow .ln.link { border: 0; background: none; padding: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lrow .ln.link:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.lrow.diagnostic .ln.link { font-family: var(--font-mono); font-size: 11.5px; }   /* a diagnostic row stays mono when its name is a link */
.lrow.slider-row .lmain { gap: 2px; }
.lrow .lctl .slider .val { min-width: 44px; }

/* Phone: tab bar (active = accent fill) and bottom sheet (peek / half / full) */
.tabbar .tb { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: var(--r-card); background: transparent; color: var(--ink-2); font-size: 11px; font-weight: 500; cursor: pointer; min-width: 44px; }
.tabbar .tb .i { width: 20px; height: 20px; }
.tabbar .tb[aria-selected="true"] { background: var(--accent); color: var(--on-accent-text); }
.tabbar .tb .badge { top: 4px; right: calc(50% - 22px); }
.sheet-grip { flex: none; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-grip::after { content: ""; width: 38px; height: 5px; border-radius: 5px; background: var(--fill-3); }
.sheet-tools { flex: none; padding: 0 12px 8px; overflow-x: auto; }
.sheet-tools:empty { display: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.sheet .insp-head { padding-top: 4px; }
/* drawer tabs become sheet tabs (design §12): the one drawer host moves into the sheet while a drawer tab is chosen */
.sheet-tabs { flex: none; display: flex; gap: 2px; padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-tabs::-webkit-scrollbar { display: none; }
.sheet-tabs .tab { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-chip);
  background: transparent; color: var(--ink-2); font-size: var(--fs-control); font-weight: 500; cursor: pointer; white-space: nowrap; }
.sheet-tabs .tab[aria-selected="true"] { background: var(--fill-3); color: var(--ink); }
.sheet-tabs .tab .i { display: none; }   /* words only, so all five tabs fit a 390 px phone */
.sheet-tabs .tab { padding: 0 11px; }
.sheet .drawer { position: static; inset: auto; width: auto; height: 100%; min-height: 0; border-radius: 0; box-shadow: none; background: transparent; z-index: auto; }
.sheet .drawer .drawer-grip { display: none; }
.sheet .drawer .drawer-head { padding-left: 10px; }
.sheet .drawer .drawer-head .tabs { display: none; }   /* the sheet's own tab row replaces them; the Takeoff sub-tabs stay */
.sheet .drawer .drawer-head .subtabs { margin-left: 0; padding-left: 0; border-left: 0; }
.sheet .drawer .drawer-head:has(.subtabs[hidden]) { display: none; }   /* no sub-tabs: the sheet's own tabs are the header */
/* the tool strip inside the phone sheet is a chip row, not glass (the ≤6 blur rule, design §4.4) */
.sheet .toolstrip { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0; height: 40px; }
/* phone (design §12): House chip without the Build chip or meta line; the compass is 44 px */
@media (max-width: 640px) {
  .house-chip .hc-build, .house-chip .nm2 { display: none; }
  .house-chip .thumb { width: 30px; height: 30px; }
  .compass { width: var(--top-h); height: var(--top-h); }
  .compass .nlabel, .compass .body { display: none; }
}

/* roof-system's callouts and story caption (roof-system.js is read-only; roof/roof.js hands it #overlay-root). Its own
   injected <style id=rs-callout-css> loads later, so these rules carry the #overlay-root id to win. Callout cards sit on
   solid --panel-2 (numbers on solid, design §4.4); the caption is the one HUD caption card, above the tray, centred on
   the free area (the shell publishes --free-* from shell.insets()). */
#overlay-root .rs-co { font: 500 12px/1.35 var(--font); font-feature-settings: "tnum" 1, "cv11" 1; }
#overlay-root .rs-card { max-width: 240px; padding: 8px 11px 9px; border: 0; border-radius: var(--r-card); background: var(--panel-2); color: var(--ink); box-shadow: var(--e3); }
#overlay-root .rs-card b { font-size: 12.5px; font-weight: 600; letter-spacing: 0; }
#overlay-root .rs-card span { color: var(--ink-2); }
#overlay-root .rs-card em { color: var(--accent-text); font-weight: 600; }
#overlay-root .rs-cap { left: calc(var(--free-left, 0px) + (100vw - var(--free-left, 0px) - var(--free-right, 0px)) / 2); bottom: calc(var(--free-bottom, 88px) + 4px);
  width: min(560px, calc(100vw - var(--free-left, 0px) - var(--free-right, 0px) - 32px)); padding: 14px 18px 12px; border: 0; border-radius: var(--r-caption);
  background: var(--hud); -webkit-backdrop-filter: var(--hud-blur); backdrop-filter: var(--hud-blur); box-shadow: var(--e2); color: var(--ink); text-align: left; }
#overlay-root .rs-cap b { font: 600 15px/1.25 var(--font); margin-bottom: 4px; }
#overlay-root .rs-cap span { color: var(--ink-2); font-size: 13px; }
#overlay-root .rs-cap .bar { background: var(--fill-3); }
#overlay-root .rs-cap .bar i { background: var(--accent); }
.hovercard { border-radius: var(--r-card); }
/* the drawer's tab row never wraps; only the tabs scroll sideways when narrow (1024 px, tablet), the close stays put,
   and an overflowing row fades at its edge so it reads as scrollable */
.drawer-head .tabscroll { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.drawer-head .tabscroll::-webkit-scrollbar { display: none; }
.drawer-head .tab { white-space: nowrap; flex: none; }
.tabscroll.overflow, .sheet .toolstrip.overflow { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
@media (max-width: 1279.98px) { .drawer-head .tabs .tab .i { display: none; } }
.tabbar .tb[aria-disabled="true"] { color: var(--ink-4); cursor: default; }
/* a modal sits above the polite toasts (they never cover its content); save errors (assertive) stay on top of everything */
.modal-scrim { z-index: 65; }
.toasts.urgent { z-index: 70; }

/* Display popover (design §2.1): theme, units, quality, reduce motion — opens beside the rail's Display button */
.disp { width: 320px; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 12px; }
.disp-h { padding: 6px 2px 0; }
.disp-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.disp-row > .meta { padding-top: 7px; }
.disp-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; min-width: 0; }
.disp-note { font-size: 11px; text-align: right; max-width: 230px; line-height: 1.35; }
.disp-foot { font-size: 11px; padding: 8px 2px 0; border-top: 1px solid var(--line); }
.disp .seg > button { padding: 0 9px; }
.disp-row.disp-stack { flex-direction: column; align-items: stretch; gap: 6px; }   /* Quality: five choices need the full width */
.disp-row.disp-stack > .meta { padding-top: 0; }
.disp-stack > .disp-ctl { align-items: flex-start; }
.disp-stack .disp-note { text-align: left; max-width: none; }
.disp-stack .seg > button { padding: 0 7px; }
/* the context menu's "Note here" field */
.note-pop { padding: 6px; }
.note-input { width: 260px; height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-input); background: var(--well); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 12.5px; }
.note-input::placeholder { color: var(--ink-3-text); }
/* the ⌘-drag marquee (design §7.2): selection colour, no glass */
.marquee { position: fixed; z-index: 4; pointer-events: none; border: 1px solid var(--sel); background: var(--sel-fill); border-radius: 2px; }
/* Walk (design §5.9): the crosshair at the free area's centre and the target card under it */
.walk-ui { position: fixed; z-index: 4; pointer-events: none; width: 0; height: 0;
  left: calc(var(--free-left, 0px) + (100vw - var(--free-left, 0px) - var(--free-right, 0px)) / 2);
  top: calc(var(--free-top, 0px) + (100vh - var(--free-top, 0px) - var(--free-bottom, 0px)) / 2); }
.walk-ui .crosshair { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; }
.walk-ui .crosshair::before, .walk-ui .crosshair::after { content: ""; position: absolute; background: rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.45); border-radius: 1px; }
.walk-ui .crosshair::before { left: 10px; top: 2px; width: 2px; height: 18px; }
.walk-ui .crosshair::after { left: 2px; top: 10px; width: 18px; height: 2px; }
.walk-ui .crosshair.hit::before, .walk-ui .crosshair.hit::after { background: var(--accent); }
.walk-ui .walk-card { position: absolute; left: 0; top: 22px; transform: translateX(-50%); min-width: 160px; max-width: 320px; padding: 8px 12px 9px; border-radius: var(--r-card); white-space: nowrap; }
.walk-ui .walk-card .wh { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.walk-ui .walk-card .wh .wt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.walk-ui .walk-card .wh .id { margin-left: auto; padding: 1px 7px; border-radius: var(--r-pill); background: var(--fill-2); font-size: 11.5px; }
.walk-ui .walk-card .ws2 { margin-top: 3px; font-size: 11.5px; color: var(--ink-2); }

/* ── Elevation look (look/elevation.js): the height key, bottom-left of the free area */
.elev-key { position: fixed; z-index: 4; pointer-events: none; display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px;
  background: rgba(6, 14, 30, .72); border: 1px solid rgba(90, 150, 255, .28); color: #d8e6ff; font: 500 11px/1.2 var(--font);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 0 24px rgba(40, 110, 255, .18); }
.elev-key-title { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 10px; color: #9fc1ff; }
.elev-key-body { display: grid; grid-template-columns: 10px auto; gap: 8px; height: 132px; }
.elev-key-bar { border-radius: 3px; box-shadow: 0 0 10px rgba(80, 160, 255, .35); }
.elev-key-ticks { position: relative; min-width: 62px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.elev-key-ticks span { position: absolute; left: 0; transform: translateY(50%); white-space: nowrap; }
.elev-key-note { color: #8aa3c8; font-size: 10px; }
@media (max-width: 640px) { .elev-key-body { height: 96px; } }
