/* Blueprint Evidence. Tokens follow DESIGN.md; components reference tokens only.
   v2: a calm engineering tool. Hairline rules and type carry structure; no pills, no tinted boxes,
   one accent (blueprint blue) and amber only for "check". */

:root {
  /* surfaces: elevation by lightness, slate tinted toward hue 245 */
  --bg:        oklch(0.165 0.012 245);
  --surface:   oklch(0.190 0.013 245);
  --raised:    oklch(0.228 0.015 245);
  --overlay:   oklch(0.262 0.017 245);
  --well:      oklch(0.135 0.010 245);   /* the viewer: recessed below bg */
  --rule:      oklch(0.268 0.014 245);   /* hairlines between rows and sections */
  --border:    oklch(0.330 0.016 245);   /* control edges */
  --border-strong: oklch(0.430 0.018 245);

  /* text */
  --fg:        oklch(0.930 0.008 245);
  --fg-2:      oklch(0.790 0.014 245);
  --muted:     oklch(0.680 0.016 245);

  /* one accent: blueprint blue (hue 235, outside the indigo band). It also marks "proven". */
  --accent:    oklch(0.760 0.105 235);
  --accent-hi: oklch(0.830 0.085 235);
  --accent-lo: oklch(0.760 0.105 235 / 0.12);
  --accent-fg: oklch(0.180 0.030 240);

  /* amber is the only other hue: estimate, "check this", disagreement */
  --warn:      oklch(0.820 0.125 78);
  --warn-lo:   oklch(0.820 0.125 78 / 0.12);
  /* red only for failures of the tool itself (a request that failed), never for an answer tier */
  --err:       oklch(0.720 0.130 25);
  --ok: var(--accent);

  /* type: IBM Plex Sans for UI, Plex Mono for figures, codes and citations. Ratio about 1.2 */
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --fs-xs: 13px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-answer: 26px;

  /* space: 4px base */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;

  --r: 3px;          /* controls */
  --r-0: 0;          /* rows, sections */

  --dur-fast: 120ms;
  --dur: 180ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --rail-w: 52px;
  --bar-h: 40px;
  --picker-w: 300px;
  --detail-w: 384px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--fs-base)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
::selection { background: oklch(0.760 0.105 235 / 0.35); color: var(--fg); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); }

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
.mono { font-family: var(--mono); }
.meta { color: var(--muted); font-size: var(--fs-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* type roles: hierarchy from size and weight, not from boxes */
.h-page  { font-size: var(--fs-xl); font-weight: 600; }
.h-title { font-size: var(--fs-md); font-weight: 500; overflow-wrap: anywhere; }
.h-panel { font-size: var(--fs-sm); font-weight: 600; color: var(--fg); }
.label   { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); margin-bottom: var(--s1); }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; grid-template-rows: var(--bar-h) minmax(0, 1fr); height: calc(100vh - var(--foot-h, 0px)); min-height: 0; }

/* app bar: the name stays on every view (Ask, Results) */
.appbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 0 var(--s3) 0 var(--s4); background: var(--well); border-bottom: 1px solid var(--rule); min-width: 0; }
.brand { display: flex; align-items: center; gap: var(--s2); color: var(--fg); min-width: 0; }
.brand .ico { color: var(--accent); flex: none; }
.brand-name { font-size: var(--fs-base); font-weight: 600; white-space: nowrap; }
.appbar .btn-quiet { min-height: 28px; flex: none; }

.rail {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  padding: var(--s2) 0; background: var(--well); border-right: 1px solid var(--rule);
}
.rail-gap { flex: 1; }
.rail-btn {
  position: relative; width: 100%; height: 44px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 0; color: var(--muted); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.rail-btn:hover { color: var(--fg); background: var(--surface); }
/* current view: the icon brightens and a 2px accent rule marks the edge (a nav indicator, not a card stripe) */
.rail-btn[aria-current="page"] { color: var(--fg); box-shadow: inset 2px 0 0 var(--accent); }
.rail-btn[aria-expanded="true"]#pickerToggle { color: var(--fg); }   /* a toggle, not a place: no indicator rule */
.rail-btn .ico { width: 18px; height: 18px; }
.rail-btn::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  padding: 2px var(--s2); background: var(--overlay); border: 1px solid var(--border); border-radius: var(--r);
  font-size: var(--fs-xs); color: var(--fg); white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out); z-index: 20;
}
.rail-btn:hover::after, .rail-btn:focus-visible::after { opacity: 1; }
.rail-btn:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.rail-btn.warn { color: var(--warn); }

.view { min-width: 0; min-height: 0; }
.view-ask {
  position: relative;
  display: grid; grid-template-columns: var(--picker-w) minmax(0, 1fr) var(--detail-w);
  height: calc(100vh - var(--foot-h, 0px) - var(--bar-h));
}
.view-ask.no-picker { grid-template-columns: minmax(0, 1fr) var(--detail-w); }   /* the hidden picker takes no grid cell */
.view-ask.no-picker .picker { display: none; }

/* drag handles on the inner edges of the library and the answer panel (desktop only) */
.grip {
  position: absolute; top: 0; bottom: 0; width: 9px; z-index: 12; cursor: col-resize; touch-action: none; outline: none;
}
.grip-picker { left: calc(var(--picker-w) - 4px); }
.grip-detail { right: calc(var(--detail-w) - 4px); }
.view-ask.no-picker .grip-picker { display: none; }
.grip::before {                      /* a short bar at mid height: visible, quiet */
  content: ""; position: absolute; left: 3px; top: 50%; width: 3px; height: 32px; margin-top: -16px;
  background: var(--border); transition: background-color var(--dur-fast) var(--ease-out);
}
.grip::after {                       /* the full-height hairline appears on hover, drag and focus */
  content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: var(--accent); opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.grip:hover::before, .grip:focus-visible::before, .grip.drag::before { background: var(--accent); }
.grip:hover::after, .grip:focus-visible::after, .grip.drag::after { opacity: 1; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .viewer, body.resizing .picker, body.resizing .detail { pointer-events: none; }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 32px; padding: 0 var(--s3); border-radius: var(--r); border: 1px solid var(--border);
  background: transparent; color: var(--fg); font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--raised); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; background: transparent; border-color: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; min-width: 72px; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-primary:disabled { background: var(--accent); border-color: var(--accent); }
/* quiet: a text command; underline on hover so it still reads as clickable without a box */
.btn-quiet { background: transparent; border-color: transparent; color: var(--fg-2); padding: 0 var(--s2); }
.btn-quiet:hover { background: transparent; border-color: transparent; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.btn-block { width: 100%; }
.btn[aria-busy="true"] { cursor: progress; }

input[type="text"], input[type="search"], select {
  width: 100%; min-height: 32px; padding: 0 var(--s3); background: var(--well); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--r);
  transition: border-color var(--dur-fast) var(--ease-out);
}
input::placeholder { color: oklch(0.600 0.014 245); }
input[type="text"]:hover, input[type="search"]:hover, select:hover { border-color: var(--border-strong); }
input[type="text"]:focus-visible, input[type="search"]:focus-visible, select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
select { padding-right: var(--s6); appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 32px; }
.check { display: inline-flex; gap: var(--s2); align-items: center; font-size: var(--fs-sm); color: var(--fg-2); cursor: pointer; min-height: 24px; }
.check input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.field-inline { display: flex; align-items: center; gap: var(--s2); }
.field-inline .label { margin: 0; white-space: nowrap; }
.field-inline select { width: auto; min-width: 160px; }

/* key / value table: the answer panel, "Where", the order check. Each row is ruled by a hairline. */
.kv { display: grid; grid-template-columns: 104px minmax(0, 1fr); margin: 0; font-size: var(--fs-sm); }
.kv > dt, .kv > dd { padding: 5px 0; border-top: 1px solid var(--rule); min-width: 0; }
.kv > dt { color: var(--muted); padding-right: var(--s3); }
.kv > dd { margin: 0; overflow-wrap: anywhere; }
.kv > dd.num { font-family: var(--mono); }
.kv > .wide { grid-column: 1 / -1; border-top: 0; padding-top: 0; }
.kv .code { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); margin-left: 6px; }

/* ------------------------------------------------------------ picker */
.picker {
  display: flex; flex-direction: column; gap: var(--s3); min-height: 0; padding: var(--s3) 0 var(--s2);
  background: var(--surface); border-right: 1px solid var(--rule);
}
.picker > * { margin-left: var(--s3); margin-right: var(--s3); }
.picker-head { display: flex; justify-content: space-between; align-items: baseline; min-height: 24px; }
.drop {
  position: relative; display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3);
  border: 1px dashed var(--border); border-radius: var(--r); cursor: pointer; font-size: var(--fs-sm); line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.drop .ico { margin-top: 1px; color: var(--fg-2); }
.drop strong { font-weight: 500; }
.drop .meta { font-size: var(--fs-xs); }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.over { background: var(--accent-lo); }
.drop:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* sources: plain text filters, the current one underlined in the accent */
.sources { display: flex; flex-wrap: wrap; gap: 0 var(--s4); padding-bottom: 2px; border-bottom: 1px solid var(--rule); }
.src {
  display: inline-flex; gap: 5px; align-items: baseline; min-height: 26px; padding: 3px 0; margin-bottom: -1px;
  border: 0; border-radius: 0; background: transparent;
  font-size: var(--fs-xs); color: var(--fg-2); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}
.src .n { color: var(--muted); font-family: var(--mono); }
.src:hover { color: var(--fg); }
.src[aria-checked="true"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
.src:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.draw-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; border-top: 1px solid var(--rule); }
.draw-list li { border-bottom: 1px solid var(--rule); }
.draw-list ul { list-style: none; margin: 0; padding: 0; }
.dgroup + .dgroup { margin-top: var(--s3); }
.uploads[hidden] { display: none; }
.uploads ul { list-style: none; margin: 0; padding: 0; }
.uploads li { border-bottom: 1px solid var(--rule); }
.uploads .h-group { padding: var(--s1) 0; }
/* compact uploads (BM, 14 Nov): folded with a count, at most about three rows tall, then it scrolls */
.uploads-fold > summary { cursor: pointer; display: flex; align-items: baseline; gap: var(--s2); list-style-position: inside; }
.uploads-fold > summary .meta { font-weight: 400; font-size: var(--fs-xs); }
.uploads-fold > summary .up-t { white-space: nowrap; }
.uploads-fold ul { max-height: 150px; overflow-y: auto; border-top: 1px solid var(--rule); }
@media (max-height: 820px) { .uploads-fold ul { max-height: 104px; } }
/* the grip under the list: drag it to make the list taller (final polish, 14 Nov) */
.up-grip { height: 10px; margin-top: -1px; cursor: ns-resize; touch-action: none; position: relative; border-top: 1px solid var(--rule); }
.up-grip::after { content: ""; position: absolute; left: 50%; top: 3px; width: 32px; height: 3px; margin-left: -16px; border-radius: 2px; background: var(--border-strong); }
.up-grip:hover::after, .up-grip.on::after, .up-grip:focus-visible::after { background: var(--accent); }
.up-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.h-group { font-size: var(--fs-sm); font-weight: 600; color: var(--fg); }
.dgroup-body[hidden] { display: none; }
.dgroup-toggle {
  display: grid; grid-template-columns: 16px 1fr auto; gap: 0 var(--s2); align-items: start; width: 100%;
  padding: var(--s2) var(--s3); border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.dgroup-toggle:hover { background: var(--raised); }
.dgroup-toggle:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.dgroup-toggle .chev { margin-top: 2px; color: var(--muted); transition: transform var(--dur-fast) var(--ease-out); }
.dgroup-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.dgroup-toggle:disabled { cursor: default; color: var(--fg); }
.dgroup-toggle:disabled:hover { background: transparent; }
.dgroup-toggle:disabled .chev { visibility: hidden; }
.dg-text { display: grid; gap: 2px; min-width: 0; }
.dg-title { display: flex; align-items: center; gap: var(--s2); font-weight: 600; font-size: var(--fs-sm); }
.dg-note { font-weight: 400; font-size: var(--fs-xs); line-height: 1.4; color: var(--muted); }
.dg-mark { width: 8px; height: 8px; flex: none; background: var(--accent); }
.dg-mark.estimate { background: var(--warn); }
.dgroup-toggle .n { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); padding-top: 1px; }
.dgroup .btn-block { margin: var(--s1) 0 0; }
.try-list { list-style: none; margin: var(--s1) 0 0; padding: 0; }
.try-list li { padding: 6px 0; border-top: 1px solid var(--rule); }
.try-list .meta { font-size: var(--fs-xs); line-height: 1.4; max-width: 44ch; }
.try { padding: 0; min-height: 24px; border: 0; background: transparent; color: var(--accent); font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.try:hover { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.draw-item {
  display: grid; gap: 1px; width: 100%; padding: 6px var(--s3); text-align: left;
  background: transparent; border: 0; border-radius: 0; cursor: pointer; color: var(--fg);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.draw-item:hover { background: var(--raised); }
.draw-item[aria-selected="true"] { background: var(--raised); }
.draw-item[aria-selected="true"] .nm { color: var(--accent); }
.draw-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.draw-item .nm { font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draw-item .nm-file { font-family: var(--mono); font-weight: 400; }
.draw-item .fn { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-tag { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.draw-file { margin: 0; font-size: var(--fs-xs); overflow-wrap: anywhere; }
.draw-item .sub { font-size: var(--fs-xs); color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 var(--s3); }
.draw-item .sub > span { white-space: nowrap; }
.list-note { padding: var(--s3); color: var(--muted); font-size: var(--fs-sm); }
.skel { height: 40px; list-style: none; background: var(--raised); opacity: 0.5; }
.picker > .draw-list { margin-left: 0; margin-right: 0; }

/* ------------------------------------------------------------ work area */
.work { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.workbar { display: grid; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--rule); background: var(--bg); }
.drawing-head { display: grid; gap: 0; }
.drawing-head .meta { font-size: var(--fs-xs); }
/* a fixed slot (two lines): the progress line appearing or going away must not move the question field */
.drawing-head .read-status { color: var(--accent); height: 2.7em; line-height: 1.35; margin: 0; overflow: hidden; }
.ask-row { display: flex; gap: var(--s2); }
.ask-row input { min-height: 36px; font-size: var(--fs-base); }
.ask-row .btn { min-height: 36px; }
.ask-opts { margin-top: 2px; }

/* examples: a plain run of text commands, no chips */
.chips-block { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--s3); align-items: baseline; font-size: var(--fs-sm); }
.chips-label { margin: 0; line-height: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 0 var(--s4); list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: baseline; gap: 5px; min-height: 24px; max-width: 100%; padding: 0;
  border: 0; border-radius: 0; background: transparent;
  font-size: var(--fs-sm); color: var(--accent); cursor: pointer; text-align: left;
  transition: color var(--dur-fast) var(--ease-out);
}
.chip:hover { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.chip .lang { font-family: var(--mono); color: var(--muted); font-size: var(--fs-xs); order: 2; }
.chip.dim { opacity: 0.55; }

.dq { font-size: var(--fs-sm); grid-column: 2; }
.dq summary { cursor: pointer; color: var(--fg-2); min-height: 24px; display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.dq summary::-webkit-details-marker { display: none; }
.dq summary::before { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out); }
.dq[open] summary::before { transform: rotate(45deg); }
.dq summary:hover { color: var(--fg); }
.dq-list { list-style: none; margin: var(--s1) 0 0; padding: 0; max-height: 180px; overflow-y: auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.dq-list li + li { border-top: 1px solid var(--rule); }
.dq-item { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); width: 100%; padding: 5px 0; background: transparent; border: 0; text-align: left; cursor: pointer; font-size: var(--fs-sm); color: var(--fg-2); }
.dq-item:hover { color: var(--fg); background: var(--surface); }
.dq-item .ans { font-family: var(--mono); color: var(--muted); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; text-align: right; }

/* ------------------------------------------------------------ viewer */
.viewer { position: relative; overflow: hidden; min-height: 0; background: var(--well); cursor: grab; touch-action: none; }
.viewer.dragging { cursor: grabbing; }
.viewer:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
/* the drawing carries the view rotation and mirror; the marks layer stays in view space, so numbers stay upright */
.orient { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage img { display: block; user-select: none; background: white; image-rendering: auto; }
.stage.pixel img { image-rendering: pixelated; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.pin { --tone: var(--accent); position: absolute; border: 1.5px solid var(--tone); border-radius: 1px; }
.pin.warn { --tone: oklch(0.72 0.15 70); }
/* proven items: the evidence overlay's paper blue (bpqa/evidence.py BLUE), so pins hold on the white drawing */
.pin.blue { --tone: oklch(0.50 0.13 240); }
.pin.blue span { color: oklch(0.97 0.005 245); }
.pin.off { opacity: 0.35; border-style: dashed; }
.pin.add { --tone: oklch(0.50 0.13 240); border-style: dashed; border-radius: 50%; border-width: 2px; }
.pin.add span { color: oklch(0.97 0.005 245); }
.pin.bad { --tone: var(--err); }
.pin.on { --tone: var(--accent); border-width: 2.5px; }
.pin.on span { color: var(--accent-fg); }
/* measured rooms are outlined along their traced walls; the pin is only the number at the outline's top-left corner */
.pin.room { border: 0; }
.room-outlines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.room-outlines polygon { fill: none; stroke: oklch(0.50 0.13 240); stroke-width: 2; stroke-linejoin: round; }
.room-outlines polygon.warn { stroke: oklch(0.72 0.15 70); }
.room-outlines polygon.bad { stroke: var(--err); }
.room-outlines polygon.off { opacity: 0.35; stroke-dasharray: 5 4; }
.room-outlines polygon.on { stroke: var(--accent); stroke-width: 3.5; fill: oklch(0.70 0.12 240 / 0.12); }
.viewer.adding { cursor: crosshair; }
/* a place where two formats disagree: circled in the estimate amber, darkened for paper */
.dis { position: absolute; border: 2.5px solid oklch(0.66 0.16 60); border-radius: 50%; }
.dis.missed { border-style: dashed; }
.pin span {
  position: absolute; left: -1.5px; bottom: 100%; transform: scale(var(--tag, var(--inv, 1))); transform-origin: 0 100%;
  padding: 0 4px; background: var(--tone); color: oklch(0.18 0.02 245); border-radius: 0;
  font: 600 12px/16px var(--mono); white-space: nowrap;
}
.reticle {
  position: absolute; border: 2px solid var(--accent); border-radius: 0;
  box-shadow: 0 0 0 9999px oklch(0.135 0.010 245 / 0.45);
}
/* empty and busy states sit top left, like a status line on an instrument, not as a centred hero */
.viewer-empty, .viewer-busy {
  position: absolute; inset: 0; display: grid; align-content: start; justify-items: start; gap: var(--s1);
  text-align: left; padding: var(--s5); pointer-events: none;
}
.viewer-empty p { max-width: 52ch; }
.empty-title { font-size: var(--fs-base); font-weight: 600; color: var(--fg); }
.viewer-busy { background: oklch(0.135 0.010 245 / 0.6); padding-top: var(--s4); }
.busy-bar { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: transparent; overflow: hidden; }
.busy-bar span { display: block; width: 30%; height: 100%; background: var(--accent); animation: slide 1.1s var(--ease-out) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.viewer-busy p { color: var(--fg-2); }

.viewer-tools {
  position: absolute; right: var(--s3); top: var(--s3); display: flex; align-items: center; gap: 0; padding: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); max-width: calc(100% - 24px);
}
.tool {
  width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 2px; background: transparent;
  color: var(--fg-2); cursor: pointer; transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.tool:hover { background: var(--raised); color: var(--fg); }
.tool { position: relative; }
.tool[data-tip]::after {
  content: attr(data-tip); position: absolute; right: 0; top: calc(100% + 8px);
  padding: 2px var(--s2); background: var(--overlay); border: 1px solid var(--border); border-radius: var(--r);
  font-size: var(--fs-xs); color: var(--fg); white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out); z-index: 20;
}
.tool[data-tip]:hover::after, .tool[data-tip]:focus-visible::after { opacity: 1; }
.tool-sep { width: 1px; height: 18px; background: var(--rule); margin: 0 var(--s1); }
.tool:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; }
.tool[aria-pressed="true"] { color: var(--accent); background: var(--accent-lo); }
.zoom { min-width: 46px; text-align: center; font-size: var(--fs-xs); color: var(--fg-2); }
.layer-tag { padding: 0 var(--s2); font-size: var(--fs-xs); color: var(--muted); border-right: 1px solid var(--rule); margin-right: 2px; line-height: 24px; }
.layer-tag.ev { color: var(--accent); }

/* ------------------------------------------------------------ evidence layers (Steps card) */
/* the selected item's reasoning, one layer per step, drawn in view space like the pins; strokes keep 2px at any zoom */
.layers { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.layers rect, .layers polygon {
  fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.layers polygon { fill: oklch(0.70 0.12 240 / 0.10); stroke-dasharray: 6 3; }
.layers rect.lk-value { stroke-dasharray: none; }
.layers .dim, .lcap.dim { opacity: 0.15; }
.layers .veil { fill: oklch(0.135 0.010 245 / 0.5); fill-rule: evenodd; stroke: none; pointer-events: none; }
/* the room's own outline steps back while another layer is shown alone */
.marks[data-solo]:not([data-solo="region"]) .room-outlines polygon { opacity: 0.25; }
.marks[data-solo] .pin { opacity: 0.35; }
/* while an item's steps are shown, the other items step back and its own number tag gives way to the captions */
.marks.stepping .pin:not(.steps-of), .marks.stepping .room-outlines polygon:not(.steps-of) { opacity: 0.4; }
.marks.stepping .pin.steps-of > span { display: none; }
.marks.stepping .reticle { display: none; }
.lcap { position: absolute; width: 0; height: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.lcap span {
  position: absolute; left: 0; bottom: 0; transform: scale(var(--inv, 1)); transform-origin: 0 100%;
  padding: 0 5px 0 0; background: var(--accent); color: var(--accent-fg); white-space: nowrap; font: 500 12px/16px var(--font);
}
.lcap.below span { bottom: auto; top: 0; transform-origin: 0 0; }
.lcap b { display: inline-block; padding: 0 4px; margin-right: 5px; font: 600 12px/16px var(--mono); background: var(--accent-fg); color: var(--accent); }
.steps-card {
  position: absolute; left: var(--s3); bottom: var(--s3); z-index: 4; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 72px);
  overflow-y: auto; padding: var(--s1) var(--s3) var(--s2); background: var(--overlay); border: 1px solid var(--border-strong);
  border-radius: var(--r); cursor: default; font-size: var(--fs-sm);
}
.viewer.mode-3d .steps-card { display: none; }
.sc-head { display: flex; align-items: center; gap: var(--s2); min-height: 32px; }
.sc-head h3 { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-n { color: var(--accent); font-weight: 500; margin-right: var(--s2); }
.sc-gap { flex: 1; }
.sc-head .btn { min-height: 26px; padding: 0 var(--s1); }
.sc-head .btn[aria-pressed="true"] { color: var(--accent); }
.sc-close { width: 26px; height: 26px; margin-right: -6px; }
.sc-list { list-style: none; margin: 0; padding: 0; }
.sc-step {
  display: grid; grid-template-columns: 26px 88px minmax(0, 1fr); gap: var(--s2); align-items: start; width: 100%;
  padding: 5px 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: transparent; color: var(--fg-2);
  font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.sc-step .k { color: var(--muted); font-weight: 500; padding-top: 1px; }
.sc-step .v { color: var(--fg-2); overflow-wrap: anywhere; padding-top: 1px; }
.sc-step .v .mono { color: var(--fg); }
.sc-step:hover, .sc-step.on { background: var(--raised); }
.sc-step.on .k { color: var(--fg); }
.sc-step[aria-pressed="true"] .cite { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.sc-step.flat { cursor: default; }
.sc-step:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.sc-3d { color: var(--accent); }
.sc-step:hover .sc-3d { text-decoration: underline; text-underline-offset: 3px; }
.sc-foot { margin: var(--s1) 0 0; padding-top: var(--s1); border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--fs-xs); }
@media (max-width: 760px) {
  .steps-card { max-height: 55%; }
  .sc-step { grid-template-columns: 28px 80px minmax(0, 1fr); }
  .sc-foot { display: none; }
}

/* ------------------------------------------------------------ verification strip */
.strip { border-top: 1px solid var(--rule); background: var(--bg); padding: var(--s2) var(--s4) var(--s3); display: grid; gap: var(--s2); min-width: 0; }
.strip-head { display: flex; align-items: center; flex-wrap: nowrap; gap: var(--s1) var(--s2); min-height: 32px; white-space: nowrap; }
.strip-head > * { flex: none; }
.strip-head .scale-src { flex: 1 1 0; min-width: 0; max-width: none; }
.strip-head .scale-src + .strip-gap { display: none; }
.strip-head .btn { min-height: 28px; }
.strip-head .btn-quiet { padding: 0 var(--s1); }
.strip-head .btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: transparent; text-decoration: none; }
.strip-gap { flex: 1; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); }
.key { display: inline-block; width: 10px; height: 10px; border: 2px solid; margin-left: 6px; }
.key.blue { border-color: var(--accent); }
.key.amber { border-color: var(--warn); }
.scale-src { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
.corr { font-size: var(--fs-xs); color: var(--fg-2); }
.strip-list { list-style: none; margin: 0; padding: 2px 2px var(--s1); display: flex; gap: var(--s3); overflow-x: auto; }
.thumb-cell { display: grid; gap: 0; width: 108px; flex: none; align-content: start; }
.thumb {
  position: relative; display: block; width: 108px; height: 82px; padding: 0; background: white; cursor: pointer;
  border: 2px solid var(--accent); border-radius: 0; overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.thumb canvas { display: block; width: 104px; height: 78px; }
.thumb.amber { border-color: var(--warn); }
.thumb:hover, .thumb.on { outline: 2px solid var(--fg); outline-offset: 1px; }
.thumb.removed { border-style: dashed; border-color: var(--border-strong); }
.thumb.added { border-style: dashed; }
.thumb .tn {
  position: absolute; left: 0; top: 0; padding: 0 5px; font-size: 12px; line-height: 16px; font-weight: 500;
  background: var(--accent); color: var(--accent-fg);
}
.thumb.amber .tn { background: var(--warn); color: var(--accent-fg); }
.thumb.removed .tn { background: var(--border-strong); color: var(--fg); text-decoration: line-through; }
.thumb .tq { position: absolute; right: 0; top: 0; display: grid; place-items: center; width: 18px; height: 18px; background: var(--warn); color: var(--accent-fg); }
.thumb .tq .ico { width: 12px; height: 12px; }
.tl { font-size: var(--fs-xs); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 18px; padding-top: 2px; }
.tl .mono { color: var(--fg); }
/* "Wrong item": a text command under the crop, not a second box */
.tx {
  justify-self: start; min-height: 24px; padding: 0; border: 0; border-radius: 0; background: transparent;
  color: var(--muted); font-size: var(--fs-xs); cursor: pointer; text-align: left;
  transition: color var(--dur-fast) var(--ease-out);
}
.tx:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.tx[aria-pressed="true"] { color: var(--warn); }

/* ------------------------------------------------------------ detail panel */
.detail { min-height: 0; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--rule); }
.detail-empty { display: grid; gap: var(--s3); padding: var(--s4) var(--s5); }
.detail-empty > p { max-width: 44ch; }
.detail-empty .kv dd { color: var(--fg-2); }

.ans-head { padding: var(--s4) var(--s5) var(--s4); border-bottom: 1px solid var(--rule); display: grid; gap: var(--s3); }
.ans-q { color: var(--fg-2); font-size: var(--fs-sm); }
.ans-value { display: flex; align-items: baseline; gap: 0; flex-wrap: wrap; }
.ans-value .v { font-family: var(--font); font-size: var(--fs-answer); line-height: 1.25; font-weight: 500; letter-spacing: 0; font-variant-numeric: lining-nums tabular-nums; }
.ans-value .u { font-family: var(--font); font-size: var(--fs-answer); line-height: 1.25; font-weight: 400; color: var(--fg-2); margin-left: 0.25em; }
.ans-value .v.none { font-size: var(--fs-answer); color: var(--fg-2); font-family: var(--font); font-weight: 500; letter-spacing: 0; }
/* a text answer: read as a sentence, not shouted at display size */
.ans-value .v.text { font-size: var(--fs-base); line-height: 1.5; font-family: var(--font); font-weight: 400; letter-spacing: 0; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* status: icon + words in the tier's colour. No pill, no tint. */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status .ico { width: 15px; height: 15px; }
.status.proven   { color: var(--accent); }
.status.estimate { color: var(--warn); }
.status.cannot   { color: var(--fg-2); }
.cannot-reason { color: var(--fg-2); font-size: var(--fs-xs); line-height: 1.45; }
.verdict { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font); font-weight: 500; margin-left: var(--s2); }
.verdict .ico { width: 13px; height: 13px; }
.verdict.ok { color: var(--accent); }
.verdict.bad { color: var(--warn); }

.sec { padding: var(--s3) var(--s5) var(--s4); border-bottom: 1px solid var(--rule); display: grid; gap: var(--s2); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); min-height: 22px; }
.sec-head .meta { font-size: var(--fs-xs); }

.why { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; font-size: var(--fs-sm); }
.why li { display: grid; grid-template-columns: 28px 1fr; gap: var(--s2); align-items: start; padding: 5px 0; border-top: 1px solid var(--rule); }
/* signature: numbered evidence citations, boxed like the numbers drawn on the overlay */
.cite {
  display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; margin-top: 1px;
  font: 500 12px/1 var(--mono); color: var(--accent); border: 1px solid oklch(0.760 0.105 235 / 0.55); border-radius: 0;
}
.why .txt { color: var(--fg-2); overflow-wrap: anywhere; }
.why .kind { color: var(--fg); font-weight: 500; margin-right: 6px; }
.why .st { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; margin-right: 6px; }
.why .st .ico { width: 13px; height: 13px; }
.why .st.pass { color: var(--accent); }
.why .st.fail { color: var(--warn); }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 280px; overflow-y: auto; font-size: var(--fs-sm); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.items li + li { border-top: 1px solid var(--rule); }
.item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: var(--s2); align-items: center; width: 100%;
  padding: 4px 0; background: transparent; border: 0; color: var(--fg-2); text-align: left; cursor: default;
}
button.item { cursor: pointer; }
button.item:hover, button.item.on { background: var(--raised); color: var(--fg); }
button.item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.item .n { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); padding-left: 2px; }
.item .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .x { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); padding-right: 2px; }
.note { font-size: var(--fs-xs); color: var(--muted); }

.actions { padding: var(--s3) var(--s5) var(--s6); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; }
.corr-note { color: var(--fg-2); }

/* cost meter: log-scale bars, this answer against the plain-prompt model baseline */
.meter { display: grid; gap: 3px; }
.meter .label { margin: 0 0 2px; }
.meter-row { display: grid; grid-template-columns: 140px 1fr 72px; gap: var(--s2); align-items: center; font-size: var(--fs-xs); }
.meter-row .ml { color: var(--fg-2); }
.meter-row .mb { height: 4px; background: var(--rule); overflow: hidden; }
.meter-row .mb i { display: block; height: 100%; background: var(--accent); }
.meter-row.base .mb i { background: var(--muted); }
.meter-row .mv { text-align: right; color: var(--fg); }

/* witnesses: one ruled row per format; a value that disagrees is boxed in amber */
.wit-verdict { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--fs-sm); font-weight: 500; }
.wit-verdict .ico { margin-top: 2px; }
.wit-verdict.ok { color: var(--accent); }
.wit-verdict.warn, .wit-verdict.bad { color: var(--warn); }
.wit-verdict span { color: var(--fg); }
.wit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.wit-list li + li { border-top: 1px solid var(--rule); }
.wit-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 18px; gap: var(--s2); align-items: center; width: 100%;
  padding: 5px 2px; background: transparent; border: 0; text-align: left; cursor: pointer; font-size: var(--fs-sm); color: var(--fg-2);
}
.wit-row:hover:not([disabled]), .wit-row[aria-pressed="true"] { background: var(--raised); color: var(--fg); }
.wit-row[aria-pressed="true"] .wf { color: var(--fg); }
.wit-row[disabled] { cursor: default; }
.wit-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.wit-row .wf { font-size: var(--fs-xs); font-weight: 500; color: var(--accent); }
.wit-row .wr { display: grid; line-height: 1.3; min-width: 0; }
.wit-row .wr .meta { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wit-row .wv { color: var(--fg); padding: 0 5px; border: 1.5px solid transparent; border-radius: 0; white-space: nowrap; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; }
.wit-row .wv.ring { border-color: var(--warn); color: var(--warn); }
.wit-row .wv.na { color: var(--muted); font-family: var(--font); font-size: var(--fs-xs); }
.wit-row .wt { display: grid; place-items: center; }
.wit-row .wt.proven { color: var(--accent); }
.wit-row .wt.estimate { color: var(--warn); }
.dis-note { display: flex; gap: var(--s2); align-items: center; color: var(--fg-2); }
.dis-key { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--warn); flex: none; }   /* the same circle as on the drawing */
.tbl tr.base td { color: var(--fg-2); border-top: 1px dashed var(--border-strong); }

/* ------------------------------------------------------------ results */
.view-results { height: calc(100vh - var(--foot-h, 0px) - var(--bar-h)); overflow-y: auto; }
.results { max-width: 1320px; padding: var(--s5) var(--s8) var(--s8); display: grid; gap: var(--s6); }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; }
.results-head .meta { margin-top: 2px; font-size: var(--fs-xs); }
.results-head .field-inline select { max-width: 520px; }
.headline { font-size: var(--fs-md); color: var(--fg-2); max-width: 80ch; line-height: 1.55; }
.headline strong { color: var(--fg); font-weight: 600; }
.results-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--s6) var(--s8); align-items: start; }
/* results-totals (BM, 14 Nov): headline tiles, the long source names wrap, the fine print folds */
.results-acts { display: flex; gap: var(--s3); align-items: center; }
.back-draw { flex: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.tile { display: grid; gap: var(--s1); align-content: start; padding: var(--s3) var(--s4) var(--s4); background: var(--raised); border: 1px solid var(--border); border-radius: var(--r); min-width: 0; }
.tile p { margin: 0; }
.tile-k { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.tile-v { font-size: 34px; line-height: 1.15; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.tile-s { font-size: var(--fs-xs); color: var(--fg-2); line-height: 1.4; }
.tile-bar { display: block; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; margin: 2px 0; }
.tile-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.tile-bar.dim i { background: var(--fg-2); opacity: 0.6; }
.vs { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: center; margin: var(--s2) 0 var(--s1); }
.vs .tile-bar { margin: 0; height: 10px; border-radius: 5px; }
.vs .tile-bar i { border-radius: 5px; }
.vs-n { font-size: var(--fs-sm); color: var(--fg-2); }
.vs-v { font-size: var(--fs-lg); font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums lining-nums; text-align: right; }
.vs-v.dim { color: var(--fg-2); font-weight: 500; }
.src-tbl td:first-child { white-space: normal; min-width: 12ch; max-width: 30ch; }
.panel .headline { margin: 0; font-size: var(--fs-base); }
.fine { border-top: 1px solid var(--border); padding-top: var(--s3); }
.fine > summary { cursor: pointer; font-size: var(--fs-md); font-weight: 600; color: var(--fg); }
.fine > summary:hover { color: var(--accent); }
.fine-body { display: grid; gap: var(--s6); margin-top: var(--s4); }
.fine-note > summary { cursor: pointer; font-size: var(--fs-xs); color: var(--accent); }
.fine-note p { margin: var(--s1) 0 0; }
.results .chart svg { max-width: 560px; }
.results .panel-head .field-inline select { max-width: 420px; }
.results-side { display: grid; gap: var(--s6); }
/* sections are separated by a rule and a heading, not boxed */
.panel { padding: var(--s3) 0 0; border-top: 1px solid var(--border); display: grid; gap: var(--s2); position: relative; min-width: 0; }
.panel > .h-panel, .panel-head .h-panel { font-size: var(--fs-md); font-weight: 600; }
.panel > .meta, .panel .meta { font-size: var(--fs-xs); max-width: 110ch; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.value-na { font-size: var(--fs-md); color: var(--fg-2); }
.foot { max-width: 100ch; font-size: var(--fs-xs); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { text-align: left; font-weight: 500; font-size: var(--fs-xs); color: var(--muted); padding: 5px var(--s2); border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: bottom; }
.tbl td { padding: 5px var(--s2); border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl th.num, .tbl td.num { text-align: right; font-family: var(--mono); }
.tbl th.num { font-family: var(--font); }
.tbl tr.group td { color: var(--fg); font-weight: 600; padding-top: var(--s3); }
.tbl tr.group td.num { font-weight: 500; }
.tbl tr.total td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.tbl td.dim { color: var(--muted); }
.tbl td.wrap { white-space: normal; min-width: 22ch; }
.tbl td.srcfile { white-space: normal; word-break: break-all; font-size: var(--fs-xs); min-width: 16ch; }
.tbl tbody tr:hover td { background: oklch(0.228 0.015 245 / 0.5); }
.cellbar { display: inline-grid; grid-template-columns: 64px auto; align-items: center; gap: var(--s2); }
.cellbar i { display: block; height: 4px; background: var(--rule); overflow: hidden; }
.cellbar i b { display: block; height: 100%; background: var(--accent); }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .lbl { fill: var(--fg-2); font: 400 12px var(--font); }
.chart .val { fill: var(--fg); font: 500 12px var(--mono); }
.chart .axis { stroke: var(--border-strong); }
.chart .grid { stroke: oklch(0.6 0.02 245 / 0.12); }
.chart .tick { fill: var(--muted); font: 400 12px var(--mono); }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.on .bar { fill: var(--accent-hi); }
.tip { position: absolute; padding: var(--s2) var(--s3); background: var(--overlay); border: 1px solid var(--border-strong); border-radius: var(--r); font-size: var(--fs-xs); pointer-events: none; white-space: pre; z-index: 5; color: var(--fg); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); padding: 1px; gap: 0; }
.seg button { border: 0; background: transparent; color: var(--fg-2); font-size: var(--fs-xs); padding: 3px var(--s2); min-height: 24px; border-radius: 2px; cursor: pointer; }
.seg button:hover { color: var(--fg); background: var(--raised); }
.seg button[aria-checked="true"] { background: var(--raised); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }

/* ------------------------------------------------------------ toast and popover */
.toast {
  position: fixed; bottom: var(--s5); left: 50%; transform: translateX(-50%); padding: var(--s2) var(--s4);
  background: var(--overlay); border: 1px solid var(--border-strong); border-radius: var(--r); font-size: var(--fs-sm); z-index: 30;
  animation: rise var(--dur) var(--ease-out);
}
.toast.err { border-color: var(--err); color: var(--fg); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.popover {
  position: fixed; left: calc(var(--rail-w) + 8px); bottom: var(--s3); width: 340px; padding: var(--s3) var(--s4);
  background: var(--overlay); border: 1px solid var(--border-strong); border-radius: var(--r); z-index: 25;
  font-size: var(--fs-sm); display: grid; gap: var(--s2);
}
.popover dl { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); margin: 0; }
.popover dt { color: var(--muted); }
.popover dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: var(--fs-xs); }

/* ------------------------------------------------------------ 3D view (IFC models) */
.mode-seg { margin-right: 2px; }
.mode-seg button { min-width: 40px; }
.viewer.mode-3d { cursor: default; }
.viewer.mode-3d .stage, .viewer.mode-3d .viewer-empty:not(#v3dFail), .viewer.mode-3d #zoomOut, .viewer.mode-3d #zoomIn,
.viewer.mode-3d #zoomLvl, .viewer.mode-3d #zoomFit, .viewer.mode-3d #rotL, .viewer.mode-3d #rotR, .viewer.mode-3d #mirror,
.viewer.mode-3d #orientReset, .viewer.mode-3d .tool-sep, .viewer.mode-3d #headerToggle, .viewer.mode-3d #openImg,
.viewer.mode-3d .layer-tag { display: none; }
.v3d { position: absolute; inset: 0; background: var(--well); }
.v3d canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.v3d-panel {
  position: absolute; left: var(--s3); top: var(--s3); width: 252px; max-height: calc(100% - 64px); overflow-y: auto;
  padding: var(--s2) var(--s3); display: grid; gap: var(--s2); align-content: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); font-size: var(--fs-sm);
}
.v3d-panel:empty { display: none; }
.v3d-panel .label { margin: 0; }
.v3d-row { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s2); align-items: center; }
.v3d-row .label { grid-column: 1 / -1; }
.v3d-row input[type=range] { width: 100%; accent-color: var(--accent); min-height: 24px; }
.v3d-legend { list-style: none; margin: 0; padding: var(--s2) 0; display: grid; gap: 4px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.v3d-legend li { display: grid; grid-template-columns: 14px 1fr auto; gap: var(--s2); align-items: center; color: var(--fg-2); }
.v3d-legend .sw { width: 12px; height: 12px; }
.v3d-legend .sw.cited { background: var(--accent); }
.v3d-legend .sw.room { background: oklch(0.760 0.105 235 / 0.5); border: 1px solid var(--accent); }
.v3d-legend .sw.ded { background: var(--warn); }
.v3d-floors { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.v3d-floors li { display: grid; grid-template-columns: 1fr auto 32px; gap: var(--s2); align-items: center; min-height: 26px; padding: 2px 0; }
.v3d-floors li .meta { text-align: right; font-size: var(--fs-xs); }
.v3d-floors .check { min-width: 0; }
.v3d-floors .check { align-items: flex-start; }
.v3d-floors .check input { margin-top: 2px; }
.v3d-floors .v3d-sn { display: grid; min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.v3d-floors .v3d-sn small { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.v3d-floors .check.hot span { color: var(--accent); font-weight: 500; }
.v3d-only { border: 0; background: transparent; color: var(--muted); font-size: var(--fs-xs); padding: 0 2px; min-height: 24px; cursor: pointer; }
.v3d-only:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.v3d-panel .btn-quiet { justify-self: start; padding: 0; }
.v3d-card {
  position: absolute; right: var(--s3); bottom: var(--s3); width: 300px; max-height: calc(100% - 80px); overflow-y: auto;
  padding: var(--s2) var(--s3) var(--s3); display: grid; gap: var(--s2); align-content: start;
  background: var(--overlay); border: 1px solid var(--border-strong); border-radius: var(--r); font-size: var(--fs-sm);
}
.v3d-card-head { display: flex; justify-content: space-between; align-items: center; }
.v3d-cls { color: var(--accent); font-size: var(--fs-xs); }
.v3d-name { font-weight: 500; overflow-wrap: anywhere; }
.v3d-dl { display: grid; grid-template-columns: 88px 1fr; gap: 3px var(--s2); margin: 0; }
.v3d-dl dt { color: var(--muted); font-size: var(--fs-xs); }
.v3d-dl dd { margin: 0; font-size: var(--fs-xs); overflow-wrap: anywhere; }
.v3d-pset { border-top: 1px solid var(--rule); padding-top: 4px; }
.v3d-pset summary { cursor: pointer; font-size: var(--fs-xs); color: var(--fg-2); min-height: 24px; display: flex; align-items: center; gap: 6px; }
.v3d-pset .v3d-dl { margin: 4px 0; }
.v3d-status { position: absolute; left: var(--s3); bottom: var(--s2); font-size: 12px; color: var(--muted); pointer-events: none; max-width: calc(100% - 340px); }
.v3d-busy.soft { background: transparent; }
#v3dFail { pointer-events: auto; background: var(--well); }

/* ------------------------------------------------------------ order panel, order check */
.os-sum { font-size: var(--fs-sm); color: var(--fg-2); }
.os-sum .os-q { font-family: var(--font); font-size: var(--fs-lg); color: var(--fg); font-weight: 500; margin-right: 6px; }
#orderSec > .btn { justify-self: start; }
.oc { display: grid; gap: 4px; margin-top: var(--s1); }
.oc .label { margin: 0; }
.oc .ask-row input { min-width: 0; min-height: 32px; }
.oc .ask-row .btn { min-height: 32px; }
.oc-verdict { display: flex; gap: var(--s2); align-items: flex-start; font-weight: 500; font-size: var(--fs-sm); margin-top: var(--s1); }
.oc-verdict .ico { margin-top: 2px; flex: none; }
.oc-verdict.ok { color: var(--accent); }
.oc-verdict.warn, .oc-verdict.bad { color: var(--warn); }
.oc-verdict span { color: var(--fg); }
.oc-cmp { display: grid; grid-template-columns: 112px 1fr; margin: var(--s1) 0 0; font-size: var(--fs-sm); }
.oc-cmp dt, .oc-cmp dd { padding: 4px 0; border-top: 1px solid var(--rule); }
.oc-cmp dt { color: var(--muted); }
.oc-cmp dd { margin: 0; overflow-wrap: anywhere; }
.oc-cmp dd .meta { font-family: var(--font); font-size: var(--fs-xs); display: block; }
.oc-ev { list-style: none; margin: var(--s1) 0 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: var(--fs-sm); }
.oc-ev li { display: grid; grid-template-columns: 36px 1fr auto; gap: var(--s2); align-items: center; padding: 3px 0; }
.oc-ev li + li { border-top: 1px solid var(--rule); }
.oc-ev .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-2); }
.oc-ev .mono { font-size: var(--fs-xs); }

/* ------------------------------------------------------------ order sheet dialog */
.sheet-dlg {
  width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; color: var(--fg);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
}
.sheet-dlg::backdrop { background: oklch(0.135 0.010 245 / 0.7); }
.sheet { padding: var(--s4) var(--s6) var(--s5); display: grid; gap: var(--s4); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); }
.sheet-head .meta { margin-top: 2px; font-size: var(--fs-xs); }
.sheet-q { margin-top: var(--s1); color: var(--fg-2); max-width: 90ch; }
.sheet-inputs { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: flex-end; padding: var(--s3) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.sheet-inputs .field { display: grid; gap: 4px; }
.sheet-inputs .label { margin: 0; }
.sheet-inputs input, .sheet-inputs select { width: 132px; min-height: 32px; padding: 4px var(--s2); background: var(--well); border: 1px solid var(--border); border-radius: var(--r); font-family: var(--mono); font-size: var(--fs-sm); }
.sheet-inputs select { font-family: var(--font); width: 160px; }
.sheet-inputs input:hover, .sheet-inputs select:hover { border-color: var(--border-strong); }
.sheet-inputs input:focus, .sheet-inputs select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sheet-tbl td.ops { font-size: var(--fs-xs); color: var(--fg-2); }
.sheet-tbl .op { display: block; white-space: nowrap; }
.sheet-tbl .op .mono { color: var(--warn); margin-left: 4px; }
.sheet-sum { display: grid; grid-template-columns: minmax(260px, auto) minmax(0, 1fr); gap: var(--s8); align-items: start; }
.sheet-sum > dl { display: grid; grid-template-columns: auto auto; margin: 0; justify-content: start; font-size: var(--fs-sm); }
.sheet-sum > dl dt, .sheet-sum > dl dd { padding: 4px 0; border-top: 1px solid var(--rule); }
.sheet-sum > dl dt { color: var(--fg-2); padding-right: var(--s6); }
.sheet-sum > dl dd { margin: 0; text-align: right; }
.sheet-sum .big { font-family: var(--font); font-size: var(--fs-lg); color: var(--fg); font-weight: 600; padding-top: var(--s2); border-top: 1px solid var(--border-strong); }
.sheet-inputs .btn-quiet { padding: 0; }
.sheet-check { display: grid; gap: var(--s2); max-width: 520px; }
.sheet-foot { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; align-items: flex-end; border-top: 1px solid var(--rule); padding-top: var(--s3); }
.sheet-src { margin: 0; padding-left: var(--s4); font-size: var(--fs-xs); color: var(--muted); max-width: 70ch; display: grid; gap: 2px; }
.sheet-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

@media (max-width: 760px) {
  .v3d-panel { width: auto; right: var(--s3); max-height: 38%; top: 48px; }
  .v3d-floors { max-height: 96px; overflow-y: auto; }
  .v3d-card { left: var(--s3); width: auto; max-height: 50%; }
  .v3d-status { display: none; }
  .sheet { padding: var(--s4); }
  .sheet-sum { grid-template-columns: 1fr; gap: var(--s4); }
  .sheet-inputs input, .sheet-inputs select { width: 120px; }
  .oc-cmp { grid-template-columns: 96px 1fr; }
}

/* ------------------------------------------------------------ responsive */
.strip-head { flex-wrap: wrap; }   /* long scale notes pushed the buttons into the answer panel */
.strip { grid-template-columns: minmax(0, 1fr); }   /* the strip never widens the page (phones) */
@media (max-width: 1280px) {
  :root { --picker-w: 260px; --detail-w: 344px; }
}
@media (max-width: 1080px) {
  .grip { display: none; }
  .view-ask, .view-ask.no-picker { grid-template-columns: minmax(0, 1fr) var(--detail-w); }
  .view-ask .picker { position: fixed; left: var(--rail-w); top: 0; bottom: 0; width: 300px; z-index: 15; border-right: 1px solid var(--border); }
  .view-ask.no-picker .picker { display: none; }
  .results-grid { grid-template-columns: 1fr; }
  .results { padding: var(--s5); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--bar-h) auto 1fr; height: auto; }
  .rail { flex-direction: row; align-items: center; padding: 0 var(--s2); border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail-btn { width: 48px; }
  .rail-btn[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .rail-btn::after { display: none; }
  .view-ask, .view-ask.no-picker { grid-template-columns: minmax(0, 1fr); height: auto; }
  .view-ask > * { min-width: 0; }
  .workbar { padding: var(--s3) var(--s4); }
  .ask-row input { min-width: 0; }
  .chips-block { grid-template-columns: 1fr; }
  .dq { grid-column: 1; }
  .view-ask .picker { position: static; width: auto; max-height: 60vh; border-right: 0; border-bottom: 1px solid var(--rule); }
  .viewer { height: 60vh; }
  .viewer-tools { left: var(--s3); right: var(--s3); max-width: none; overflow-x: auto; }
  .viewer-tools > :first-child { margin-left: auto; }   /* right-aligned, and scrollable from its first button when it overflows */
  .tool[data-tip]::after { display: none; }
  .strip { padding: var(--s2) var(--s4); }
  .scale-src { max-width: 100%; }
  .meter-row { grid-template-columns: 112px 1fr 64px; }
  .detail { border-left: 0; border-top: 1px solid var(--rule); }
  .ans-head, .sec, .actions { padding-left: var(--s4); padding-right: var(--s4); }
  .detail-empty { padding: var(--s4); }
  .view-results { height: auto; }
  .results { padding: var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
  .busy-bar span { animation: none; width: 100%; opacity: 0.6; }
  .toast { animation: none; }
}
.tbl .dim { color: var(--muted); }

/* ------------------------------------------------------------ first-visit tour (v2.6) */
/* the shield dims the page and has a hole over each outlined element (clip-path), so a step can outline several */
.tour-shield { position: fixed; inset: 0; z-index: 900; background: oklch(0.10 0.01 245 / 0.62); }
.tour-spot { position: fixed; z-index: 901; pointer-events: none; border-radius: 3px; outline: 2px solid var(--accent); outline-offset: 0; }
.tour-bubble, .tour-offer {
  position: fixed; z-index: 902; width: 300px; max-width: calc(100vw - 16px); padding: var(--s3) var(--s4);
  background: var(--overlay); border: 1px solid var(--border-strong); border-radius: var(--r);
  display: grid; gap: var(--s3); font-size: var(--fs-base); color: var(--fg);
}
.tour-bubble:focus { outline: none; }
.tour-bubble:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tour-offer { top: 48px; right: var(--s4); }
/* BEGIN tour-offer-v2: the first-visit offer, centred near the top of the viewer area, with a soft dim behind it */
.tour-offer-dim { position: fixed; inset: 0; z-index: 899; background: oklch(0.10 0.01 245 / 0.45); pointer-events: none; }
.tour-offer { top: 132px; left: calc(50% + 28px); transform: translateX(-50%); width: 440px; padding: var(--s6); gap: var(--s4); border-color: var(--accent); }
.tour-offer h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.tour-offer p { font-weight: 400; color: var(--fg-2, var(--fg)); }
.tour-offer .btn-primary { padding: 8px 22px; font-size: var(--fs-base); font-weight: 600; }
/* END tour-offer-v2 */
.tour-bubble p, .tour-offer p { margin: 0; line-height: 1.45; }
.tour-offer p { font-weight: 600; }
.tour-act { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.tour-act .tour-step { font-size: var(--fs-xs); color: var(--muted); margin-right: auto; }
.tour-bubble[hidden], .tour-offer[hidden], .tour-spot[hidden], .tour-shield[hidden] { display: none; }
@media (max-width: 1080px) { #guideOpen, .tour-offer, .tour-offer-dim { display: none; } }

/* answer panel busy state and tour wait line */
.detail-q { margin: 0; color: var(--fg); overflow-wrap: anywhere; }
.tour-wait { margin: 0; }
/* a cached answer says so next to its status, and in a note under the facts (judges asked how repeats are this fast) */
.cache-tag { display: inline-block; margin-left: var(--s2); padding: 0 6px; border: 1px solid var(--accent); border-radius: 3px; color: var(--accent);
  font-size: var(--fs-xs); font-weight: 600; line-height: 18px; vertical-align: 1px; cursor: help; }
.cache-note .cache-tag { margin: 0 var(--s2) 0 0; cursor: default; }
.cache-line { margin-top: var(--s3); }

/* BEGIN used-line */
.used-line { display: flex; flex-wrap: wrap; gap: 2px var(--s4); margin: var(--s2) 0; font-size: var(--fs-xs); color: var(--fg-2); line-height: 1.5; }
.used-line span { white-space: nowrap; }
.used-line b { font-weight: 500; color: var(--muted); }
/* END used-line */
/* BEGIN answer-panel-light (14 Nov): (i) fine print, plain cannot reason, order check folded at the bottom */
.ans-head { position: relative; }
.info-btn { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: auto; border: 1px solid var(--border-strong); border-radius: 50%;
  background: transparent; color: var(--fg-2); font: italic 600 11px/1 var(--font); cursor: pointer; align-self: center; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fine-pop { position: absolute; left: var(--s4); right: var(--s4); top: calc(100% - var(--s3)); z-index: 30; display: grid; gap: var(--s2);
  padding: var(--s3); background: var(--raised); border: 1px solid var(--border-strong); box-shadow: 0 8px 24px oklch(0 0 0 / 0.35); }
.fine-pop[hidden] { display: none; }
.fine-pop .note { margin: 0; }
.cannot-reason .plain-reason { margin: 0; color: var(--fg); font-size: var(--fs-sm); line-height: 1.45; }
.reason-more { margin-top: 4px; }
.reason-more > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); width: max-content; }
.reason-more > summary:hover { color: var(--fg); }
.reason-more > p { margin: 4px 0 0; }
.order-fold { border-bottom: 0; }
.order-fold > summary { cursor: pointer; list-style: revert; }
.order-fold #orderSec { display: grid; gap: var(--s2); }
.order-fold #orderSec[hidden] { display: none; }
.order-fold #orderSec > .sec-head { display: none; }
/* short screens (1280x800 and similar) with an answer shown: the viewer keeps a usable height. The examples row folds
   away until the question field is used, an empty progress slot takes no room, and the strip crops are smaller. */
@media (max-height: 940px) {
  .work.answered .workbar { gap: var(--s2); padding-top: var(--s2); padding-bottom: var(--s2); }
  .work.answered .workbar:not(:focus-within) .chips-block { display: none; }
  .work.answered .drawing-head .read-status:empty { height: 0; }
  .strip { padding-top: var(--s1); padding-bottom: var(--s2); gap: var(--s1); }
  .strip-head { min-height: 28px; flex-wrap: wrap; }
  .thumb-cell { width: 88px; }
  .thumb { width: 88px; height: 67px; }
  .thumb canvas { width: 84px; height: 63px; }
  .strip-list { gap: var(--s2); }
}
/* a narrowed answer panel reflows instead of sliding under its edge (his request, 14 Nov) */
#detailBody, #detailBody .ans-head, #detailBody .sec, #detailBody .kv > dd { min-width: 0; }
#detailBody { overflow-wrap: anywhere; }
#detailBody .btn { overflow-wrap: normal; white-space: nowrap; }
.oc .ask-row .btn { flex: none; }
.used-line > span { white-space: normal; min-width: 0; }
.meter-row { grid-template-columns: minmax(0, 140px) minmax(24px, 1fr) auto; }
/* END answer-panel-light */

/* approximations on scans that print no areas (scale from doors / WC pans): where the number comes from, said first */
.ans-value .about { font-size: var(--fs-base); color: var(--warn); font-weight: 500; margin-right: 0.4em; align-self: center; }
.approx-note { margin: 6px 0 2px; padding: 8px 10px; border-left: 3px solid var(--warn); background: color-mix(in oklch, var(--warn) 9%, transparent);
  font-size: var(--fs-sm); line-height: 1.5; color: var(--fg); }
.approx-tag { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; color: var(--warn); font-weight: 600; }
.approx-tag svg { width: 14px; height: 14px; }
.scale-obj { position: absolute; border: 2px dashed rgb(231, 140, 8); pointer-events: auto; box-sizing: border-box; }
.scale-obj span { position: absolute; left: -2px; bottom: 100%; margin-bottom: 1px; white-space: nowrap; font: 500 10px/14px var(--mono);
  padding: 0 3px; background: rgba(255, 255, 255, 0.9); color: rgb(150, 85, 0); pointer-events: none; }
.marks.stepping .scale-obj, #marks.stepping .scale-obj { opacity: 0.35; }
.layers rect.lk-scale { stroke: rgb(231, 140, 8); stroke-dasharray: 5 3; }
.lcap.mini span { font-size: 11px; padding-left: 4px; }
.lcap.lk-scale span { background: rgb(231, 140, 8); color: oklch(0.2 0.02 245); }
.lcap.lk-scale b { color: rgb(150, 85, 0); }
.scale-src.approx { color: var(--warn); }
/* the evidence image already carries each scale object's label; the viewer mark shows it again only on hover */
.scale-obj span { display: none; }
.scale-obj:hover span { display: block; }

/* BEGIN scale-assumption (app.css): the editable size under an approximation's sentence. Tokens only. */
.approx-text { margin: 0; }
.scale-ctl { display: grid; gap: var(--s1); margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--rule); }
.sc-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); color: var(--fg-2); }
.sc-row label { color: var(--fg-2); }
.sc-num { width: 64px; min-height: 28px; padding: 0 var(--s1) 0 var(--s2); background: var(--well); color: var(--fg); border: 1px solid var(--border);
  border-radius: var(--r); font: 500 var(--fs-sm)/1 var(--mono); font-variant-numeric: tabular-nums; transition: border-color var(--dur-fast) var(--ease-out); }
.sc-num.sc-den { width: 72px; }
.sc-num:hover { border-color: var(--border-strong); }
.sc-num:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sc-num[aria-invalid="true"] { border-color: var(--err); }
.sc-sheet { width: auto; min-width: 72px; min-height: 28px; }
.sc-range { flex: 1 1 96px; min-width: 96px; max-width: 160px; height: 24px; margin: 0; accent-color: var(--warn); cursor: pointer; }
.sc-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sc-status { margin: 0; color: var(--fg-2); font-size: var(--fs-xs); line-height: 1.45; }
.sc-reset { min-height: 24px; padding: 0 var(--s1); margin-left: var(--s1); color: var(--accent); }
/* END scale-assumption (app.css) */

/* ============================================================ BEGIN ask-several (app.css)
   Library selection, the "Ask N drawings" note, and the table in the answer panel. Tokens only. */
.picker-tools { display: inline-flex; align-items: baseline; gap: var(--s3); }
.multi-toggle { min-height: 24px; padding: 0; color: var(--accent); }
.multi-toggle[aria-pressed="true"] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.multi-bar { display: grid; gap: var(--s1); padding-bottom: var(--s2); border-bottom: 1px solid var(--rule); font-size: var(--fs-sm); }
.multi-bar[hidden] { display: none; }
.multi-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); color: var(--fg); }
.multi-acts { display: inline-flex; gap: var(--s1); }
.multi-acts .btn { min-height: 24px; padding: 0 var(--s1); }
.multi-list { list-style: none; margin: 0; padding: 0; height: 112px; overflow-y: auto; }
.multi-list:empty::before { content: "Selected drawings appear here"; display: block; padding: var(--s1) 0; color: var(--muted); font-size: var(--fs-xs); }  /* a fixed-height box: the library below must not shift while ticking */
.multi-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); border-top: 1px solid var(--rule); }
.multi-list .nm { font-family: var(--mono); font-size: var(--fs-xs); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-list .nm.titled { font-family: var(--font); font-size: var(--fs-sm); }
.multi-list .x { flex: none; width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.multi-list .x:hover { color: var(--fg); }
.multi-list .x:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* the checkbox glyph on a library row: only while the toggle is on */
.draw-item .box { display: none; }
.picker.multi .draw-item { grid-template-columns: 16px minmax(0, 1fr); column-gap: var(--s2); user-select: none; }
.picker.multi .draw-item .fn { grid-column: 2; }
.picker.multi .draw-item .sub { grid-column: 2; flex-wrap: wrap; gap: 0 var(--s3); }
.picker.multi .draw-item .box { display: block; grid-row: 1 / span 3; align-self: center; width: 14px; height: 14px; border: 1px solid var(--border-strong); border-radius: 2px; box-sizing: border-box; }
.picker.multi .draw-item.picked { background: var(--raised); }
.picker.multi .draw-item.picked .box { position: relative; background: var(--accent); border-color: var(--accent); }
.picker.multi .draw-item.picked .box::after { content: ""; position: absolute; left: 4px; top: 1px; width: 3px; height: 7px; border: solid var(--accent-fg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.picker.multi .draw-item[aria-selected="true"] .nm { color: inherit; }
.picker.multi .draw-item.picked .nm { color: var(--accent); }

.multi-note { margin: 0; min-height: 2.6em; font-size: var(--fs-sm); color: var(--fg-2); }
.multi-note[hidden] { display: none; }
.ask-opts { display: grid; gap: var(--s1); }
#askBtn { min-width: 72px; white-space: nowrap; }

/* the answer panel shows the table instead of its usual blocks while it is up */
#detail.batch-on > :not(#detailBatch) { display: none; }
.batch[hidden] { display: none; }
/* a clear button at the top of the answer panel, kept in view while the answer scrolls (Markus did not see the old text link) */
.batch-back { margin: 0; padding: var(--s3) var(--s5) var(--s2); position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--rule); }
.batch-back[hidden] { display: none; }
.batch-back .btn { width: 100%; justify-content: flex-start; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.batch-back .btn:hover { background: var(--raised); border-color: var(--accent-hi); color: var(--accent-hi); }
.batch-back .back-ico { transform: rotate(180deg); }
.batch .h-panel { margin: 0; }
.batch-prog { display: grid; gap: var(--s1); }
.batch-prog p { margin: 0; }
.batch-prog .bar { height: 2px; background: var(--rule); }
.batch-prog .bar span { display: block; height: 100%; background: var(--accent); transition: width var(--dur-fast) var(--ease-out); }
.batch-tbl td, .batch-tbl th { vertical-align: top; }
.batch-tbl td:first-child { white-space: normal; overflow-wrap: anywhere; min-width: 14ch; }
.batch-tbl td.unit { color: var(--fg-2); }
.batch-tbl td.status { white-space: nowrap; }
.batch-tbl td.status.proven { color: var(--accent); }
.batch-tbl td.status.estimate { color: var(--warn); }
.batch-tbl td.status.cannot { color: var(--fg-2); }
.batch-tbl td.fail { color: var(--err); }
.batch-tbl .about { font-family: var(--font); font-size: var(--fs-xs); color: var(--warn); }
.batch-tbl tr.dimrow td { color: var(--muted); }
.batch-tbl tr.has-reason td { border-bottom: 0; padding-bottom: 0; }
.batch-tbl tr.reason td { padding-top: 2px; color: var(--fg-2); font-size: var(--fs-xs); line-height: 1.45; white-space: normal; }
.batch-tbl tr.total td:first-child { white-space: normal; }
.batch-tbl tr.total td.status { white-space: normal; min-width: 9ch; }   /* "Includes estimates" was clipped at 1280 px */
.rowlink { display: block; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: var(--fs-sm); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.rowlink:hover { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.rowlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.batch-sum { margin: var(--s2) 0 0; color: var(--fg); font-size: var(--fs-base); line-height: 1.5; font-weight: 500; }
@media (max-width: 1080px) { .batch-back { padding-left: var(--s4); padding-right: var(--s4); } }
/* END ask-several (app.css) ============================================================ */

/* BEGIN compare-tab */
.view-compare { height: calc(100vh - var(--foot-h, 0px) - var(--bar-h)); overflow-y: auto; }
.compare { max-width: 1240px; padding: var(--s5) var(--s8) var(--s8); display: grid; gap: var(--s5); }
.compare-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); }
.compare-head > div { display: grid; gap: var(--s2); max-width: 78ch; }
.cmp-totals table { margin-top: var(--s3); }
.compare-head .meta { margin: 0; }
.cmp { border-top: 1px solid var(--border); padding-top: var(--s3); display: grid; gap: var(--s3); min-width: 0; }
.cmp-q { margin: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.4; max-width: 90ch; }
.cmp-kind { color: var(--accent); margin-right: var(--s2); }
.cmp-dw { margin: 0; }
.cmp-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr); gap: var(--s6); align-items: start; }
.cmp-col { display: grid; gap: var(--s2); align-content: start; min-width: 0; }
.cmp-col .h-group { margin: 0; }
.cmp-ans { margin: 0; font-size: var(--fs-lg); font-weight: 500; font-variant-numeric: tabular-nums lining-nums; }
.cmp-verdict { margin: 0; font-size: var(--fs-sm); color: var(--fg-2); }
.cmp-left .bad.cmp-ans { color: var(--fg-2); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.cmp-left .bad.cmp-verdict { color: var(--warn); }
.cmp-right .ok.cmp-ans { color: var(--accent); }
.cmp-thumb { width: 100%; max-height: 300px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: var(--r); }
.cmp-col .btn { justify-self: start; }
.cmp-totals td { white-space: normal; vertical-align: top; padding: var(--s2); }
.cmp-totals th[scope="row"] { padding: var(--s2) var(--s3) var(--s2) 0; vertical-align: top; color: var(--fg); font-size: var(--fs-sm); border-bottom: 1px solid var(--rule); }
.cmp-totals td:nth-child(2) { color: var(--fg); font-weight: 500; width: 38%; }
.cmp-totals td.dim { color: var(--muted); font-weight: 400; }
.cmp-tot-h { font-size: var(--fs-md); }
@media (max-width: 1000px) { .cmp-cols { grid-template-columns: minmax(0, 1fr); gap: var(--s4); } .compare { padding: var(--s4); } }
/* END compare-tab */

/* Results header links (final polish, 14 Nov): source code and the per-question CSV */
.res-links { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: var(--s1) 0 0; font-size: var(--fs-xs); }
.res-links a { color: var(--accent); }
.csv-links { display: inline-flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.csv-links[hidden] { display: none; }
.csv-links span { color: var(--fg-2); }
/* bake-off cells: the model's right/n, ours on the same questions under it */
#bakeTable td.num { vertical-align: top; }
#bakeTable .bk-m { display: block; }
#bakeTable .bk-o { display: block; font-size: var(--fs-xs); color: var(--fg-2); }
/* the cached answer says so near the top, in plain words (Markus, 14 Nov) */
.cache-why { margin: var(--s2) 0 0; font-size: var(--fs-xs); color: var(--fg-2); line-height: 1.45; }
.cache-why .cache-tag { margin: 0 var(--s2) 0 0; cursor: default; }

/* remove one upload (15 Nov) */
#uploadList li { display: flex; align-items: stretch; }
#uploadList li .draw-item { flex: 1; min-width: 0; }
.up-remove { flex: none; width: 32px; border: 0; background: transparent; color: var(--muted, #8a94a6); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 6px; }
.up-remove:hover, .up-remove:focus-visible { color: var(--text, #e6e9ef); background: rgba(127,127,127,.15); }
