/* Aker brand tokens, copied from cognite-aker-monorepo packages/theme (tokens.css, base.css, ui.css). */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --void: #030910; --canvas: #050E17; --surface: #0A1824; --surface-2: #0F2132; --surface-3: #16293C;
  --navy: #081E32; --navy-2: #12344F; --navy-3: #1F4564;
  --heading: #FFFFFF; --ink: #E6EDF4; --soft: #C8D6E2; --muted: #9DB2C4; --faint: #6F889D;
  --hairline: #213A50; --hairline-2: #152A3C; --fog: #12263A;
  --line-btn: #3A5670; --text-2: #B9C9D7;
  --orange: #FF9900; --orange-hot: #FFB040; --orange-ink: #FFB84D; --orange-tint: rgba(255, 153, 0, 0.12);
  --on-orange: #04101A;
  --green: #3DDC97; --red: #FF6B61; --amber: #FFC266; --blue: #6CB6F5; --violet: #B79CF0; --slate: #7E93A6;
  --green-tint: rgba(61, 220, 151, 0.12); --amber-tint: rgba(255, 194, 102, 0.12); --blue-tint: rgba(108, 182, 245, 0.12);
  --red-tint: rgba(255, 107, 97, 0.12); --violet-tint: rgba(183, 156, 240, 0.13);
  --font-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif; --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --header-h: 56px;
  /* One knob for every font size in the mockups. */
  --text-scale: 1.15;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--ink); font: 400 calc(13px * var(--text-scale))/1.45 var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: var(--orange-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--heading); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.mono { font-family: var(--font-mono); font-size: 0.92em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Header shared by every mockup */
.app-header { height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--void); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 20; }
.app-header .brand { display: flex; align-items: baseline; gap: 10px; }
.app-header .brand b { color: var(--heading); font-size: calc(14px * var(--text-scale)); font-weight: 600; }
.app-header .brand span { color: var(--orange-ink); font-size: calc(11px * var(--text-scale)); font-weight: 500; }
.app-header .spacer { flex: 1; }
.app-header select { height: 34px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-btn); border-radius: 4px; padding: 0 8px; font: inherit; }
.app-header .case-meta { color: var(--muted); font-size: calc(12px * var(--text-scale)); }
.app-header .case-name { color: var(--heading); border: 1px solid var(--hairline); border-radius: 4px; padding: 6px 10px; }

/* Buttons */
.cta { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 0; border-radius: 4px; background: var(--orange); color: var(--on-orange); font-size: calc(12.5px * var(--text-scale)); font-weight: 600; cursor: pointer; }
.cta:hover { background: var(--orange-hot); }
.cta:disabled { opacity: 0.5; cursor: default; }
.ghost { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border: 1px solid var(--line-btn); border-radius: 4px; background: transparent; color: var(--heading); font-size: calc(12.5px * var(--text-scale)); font-weight: 500; cursor: pointer; }
.ghost:hover { border-color: var(--orange); }
.ghost.small, .cta.small { height: 27px; padding: 0 8px; font-size: calc(11.5px * var(--text-scale)); }
.link-btn { border: 0; background: none; padding: 0; color: var(--orange-ink); cursor: pointer; font-size: calc(12px * var(--text-scale)); }
.link-btn:hover { text-decoration: underline; }

/* Counter in the header */
.counter { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line-btn); border-radius: 4px; background: var(--surface-2); cursor: pointer; font-size: calc(12.5px * var(--text-scale)); }
.counter b { color: var(--orange-ink); font-family: var(--font-mono); }
.counter[data-zero="true"] b { color: var(--green); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: 6px; padding: 14px 16px; min-width: 0; }
.panel-title { font-size: calc(13px * var(--text-scale)); font-weight: 600; color: var(--heading); margin: 0 0 8px; }
.eyebrow { font-size: calc(11px * var(--text-scale)); font-weight: 500; color: var(--orange-ink); }

/* Chips: status, aspect, basis */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 3px; font-size: calc(11px * var(--text-scale)); font-weight: 500; white-space: nowrap; background: var(--fog); color: var(--muted); }
.chip[data-status="required"] { background: var(--green-tint); color: var(--green); }
.chip[data-status="candidate"] { background: var(--amber-tint); color: var(--amber); }
.chip[data-status="out"] { background: var(--fog); color: var(--faint); }
.chip[data-basis="assumed"] { background: var(--violet-tint); color: var(--violet); }
.chip[data-basis="computed"] { background: var(--blue-tint); color: var(--blue); }
.chip[data-basis="given"] { background: var(--fog); color: var(--soft); }
.chip[data-basis="set"] { background: var(--green-tint); color: var(--green); }
.chip[data-aspect="function"] { background: var(--amber-tint); color: var(--amber); }
.chip[data-aspect="product"] { background: var(--blue-tint); color: var(--blue); }
.chip[data-aspect="location"] { background: var(--violet-tint); color: var(--violet); }
.chip[data-kind="need"] { background: var(--green-tint); color: var(--green); }
.chip[data-kind="artifact"] { background: var(--fog); color: var(--soft); border: 1px solid var(--hairline); }
.chip[data-kind="suggest"] { background: var(--orange-tint); color: var(--orange-ink); }
.chip[data-basis="rule"] { background: var(--blue-tint); color: var(--blue); border: 1px solid var(--blue); }
.chip[data-scope="build"] { background: var(--green-tint); color: var(--green); }
.chip[data-scope="reuse"] { background: var(--blue-tint); color: var(--blue); }
.chip[data-scope="open"] { background: var(--amber-tint); color: var(--amber); }
.chip[data-scope="out"] { background: var(--fog); color: var(--faint); text-decoration: line-through; }
.chip[data-scope="unreached"] { background: transparent; color: var(--faint); border: 1px dashed var(--hairline); }
.chip.warn-chip { background: var(--red-tint); color: var(--red); }
.chip[data-doc="missing"] { background: var(--red-tint); color: var(--red); }
.chip[data-doc="available"] { background: var(--blue-tint); color: var(--blue); }

/* Warnings: an option the case values contradict */
.warn-lines { display: grid; gap: 2px; }
.warn-line { color: var(--red); font-size: calc(11.5px * var(--text-scale)); line-height: 1.4; }
.warn-line[data-chosen="false"] { color: var(--faint); }
.warn-line[data-chosen="false"] b { color: var(--muted); }
.warn-line .mono { color: inherit; }
[data-bad="true"] { color: var(--red) !important; }

/* Step bar in the header */
.steps { display: flex; gap: 2px; margin-left: 6px; }
.step { display: inline-grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 7px; align-items: center; height: 42px; padding: 0 10px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--soft); cursor: pointer; text-align: left; font-size: calc(12px * var(--text-scale)); line-height: 1.15; }
.step:hover { border-color: var(--line-btn); }
.step .step-n { grid-row: 1 / span 2; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-btn); font-family: var(--font-mono); font-size: calc(11px * var(--text-scale)); color: var(--muted); }
.step .step-count, .step .step-changed { grid-column: 2; font-family: var(--font-mono); font-size: calc(10.5px * var(--text-scale)); color: var(--faint); }
.step .step-changed { display: none; }
.step[data-state="current"] { background: var(--surface-2); border-color: var(--orange); color: var(--heading); }
.step[data-state="current"] .step-n { border-color: var(--orange); color: var(--orange-ink); }
.step[data-state="done"] .step-n { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.step[data-state="done"] .step-count { color: var(--green); }
.step[data-state="warn"] .step-count { color: var(--amber); }
.step[aria-pressed="true"] { background: var(--surface-3); }

/* Segmented choice used by every view that sets a decision inline */
.seg { display: inline-flex; border: 1px solid var(--line-btn); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--line-btn); background: transparent; padding: 5px 10px; min-height: 28px; font-size: calc(11.5px * var(--text-scale)); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover:not(:disabled) { background: var(--surface-3); color: var(--heading); }
.seg button:disabled { cursor: not-allowed; }
.seg button[aria-pressed="true"] { background: var(--orange); color: var(--on-orange); font-weight: 600; }
.seg button[aria-pressed="true"][data-basis="assumed"] { background: var(--violet); }
.seg button[data-suggested="true"]:not([aria-pressed="true"]) { box-shadow: inset 0 -2px 0 var(--orange); color: var(--orange-ink); }
.seg button[data-warn="true"]:not([aria-pressed="true"]) { color: var(--red); box-shadow: inset 0 -2px 0 var(--red); }
.seg button[data-warn="true"][aria-pressed="true"] { background: var(--red); color: var(--on-orange); }

/* Open items drawer */
.drawer { position: fixed; top: var(--header-h); right: 0; bottom: 0; width: 420px; background: var(--surface); border-left: 1px solid var(--hairline); z-index: 30; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 160ms ease; }
.drawer[data-open="true"] { transform: none; }
.drawer header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.drawer header h3 { flex: 1; min-width: 0; }
.drawer .body { overflow: auto; padding: 8px 14px 20px; }
.item-row { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hairline-2); }
.item-row .dot { width: 8px; height: 8px; border-radius: 2px; margin-top: 5px; background: var(--amber); }
.item-row[data-kind="check"] .dot { background: var(--red); }
.item-row[data-kind="confirm"] .dot { background: var(--violet); }
.item-row[data-kind="artifact"] .dot { background: var(--blue); }
.item-row[data-kind="input"] .dot { background: var(--red); }
.item-row .meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; color: var(--faint); font-size: calc(11.5px * var(--text-scale)); }
.item-row .meta .link-btn { font-size: inherit; }
.drawer[data-mode="inputs"] { width: 460px; }

/* Case inputs in the drawer */
.in-lead { margin: 4px 0 12px; font-size: calc(12px * var(--text-scale)); }
.presets, .docs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.presets .eyebrow, .docs .eyebrow { flex-basis: 100%; }
.presets .ghost[aria-pressed="true"] { border-color: var(--orange); background: var(--orange-tint); }
.doc-row { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--text-scale)); }
.doc-row > span:first-child { flex: 1; min-width: 0; }
.doc-row[data-changed="true"] .chip[data-doc="available"] { box-shadow: inset 0 0 0 1px var(--blue); }
.in-group { display: grid; gap: 2px; margin-bottom: 14px; }
.in-group .eyebrow { margin-bottom: 4px; }
.in-row { display: grid; grid-template-columns: 1fr 150px 40px; gap: 2px 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--hairline-2); font-size: calc(12.5px * var(--text-scale)); }
.in-row label { color: var(--soft); }
.in-row[data-changed="true"] label { color: var(--orange-ink); }
.in-row[data-missing="true"] label { color: var(--red); }
.in-field { display: flex; align-items: center; gap: 6px; }
.in-field input, .spec-row input, .sidebar input[type="number"], .sidebar input[type="text"] {
  width: 84px; height: 28px; background: var(--surface-2); border: 1px solid var(--line-btn); border-radius: 4px;
  color: var(--heading); padding: 0 6px; font: inherit; font-family: var(--font-mono); text-align: right;
  appearance: textfield; -moz-appearance: textfield; color-scheme: dark;
}
.in-field input::-webkit-outer-spin-button, .in-field input::-webkit-inner-spin-button,
.spec-row input::-webkit-outer-spin-button, .spec-row input::-webkit-inner-spin-button,
.sidebar input[type="number"]::-webkit-outer-spin-button, .sidebar input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }
.in-row[data-changed="true"] input, .spec-row[data-param="changed"] input { border-color: var(--orange); }
.in-row[data-missing="true"] input, .spec-row[data-param="missing"] input { border-color: var(--red); }
.spec-row[data-param="atlas"] input { border-color: var(--violet); }
.in-field .unit { color: var(--faint); font-size: calc(11px * var(--text-scale)); white-space: nowrap; }
.in-text { color: var(--muted); grid-column: 2 / span 2; }
.in-src { grid-column: 1 / -1; font-size: calc(11px * var(--text-scale)); }

/* Scope statement */
.modal.wide { width: min(1080px, 100%); }
.st-figures { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 6px 0 14px; }
.figure { background: var(--surface-2); border-radius: 4px; padding: 8px 10px; }
.figure b { display: block; font-family: var(--font-mono); font-size: calc(18px * var(--text-scale)); color: var(--heading); font-weight: 500; }
.figure span { font-size: calc(11px * var(--text-scale)); color: var(--muted); }
.figure[data-tone="warn"] b { color: var(--amber); }
.figure[data-tone="bad"] b { color: var(--red); }
.st-sec { margin-top: 14px; }
.modal .st-sec h3 { display: flex; gap: 10px; align-items: center; margin: 0 0 6px; color: var(--heading); }
.st-table { width: 100%; border-collapse: collapse; font-size: calc(12.5px * var(--text-scale)); }
.st-table td { padding: 6px 8px; border-bottom: 1px solid var(--hairline-2); vertical-align: top; }
.st-table td:first-child { width: 28%; }
.st-table .st-name { font-size: calc(13px * var(--text-scale)); color: var(--heading); }
.st-table .chip { margin-left: 6px; }
.st-reason { color: var(--soft); }
.st-arts { width: 26%; font-size: calc(11.5px * var(--text-scale)); }
.st-sec[data-scope="out"] .st-name { color: var(--faint); text-decoration: line-through; }
.st-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.detail-reason { color: var(--soft); font-size: calc(12.5px * var(--text-scale)); margin: -4px 0 8px; }

/* Values list */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: calc(12.5px * var(--text-scale)); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-family: var(--font-mono); color: var(--heading); white-space: nowrap; }
.kv dd[data-missing="true"] { color: var(--red); }
.kv dd[data-bad="true"] { color: var(--red); }

/* Suggestion card */
.suggest { border: 1px solid var(--hairline); border-radius: 6px; background: var(--surface-2); padding: 10px 12px; }
.suggest .head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.suggest .what { color: var(--heading); font-weight: 600; }
.suggest .why { color: var(--soft); margin: 4px 0 6px; }
.suggest .src { color: var(--faint); font-size: calc(11.5px * var(--text-scale)); }
.suggest .actions { display: flex; gap: 6px; margin-top: 8px; }
.conf { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: calc(11px * var(--text-scale)); color: var(--muted); }
.conf i { display: inline-block; width: 36px; height: 4px; background: var(--fog); border-radius: 2px; overflow: hidden; position: relative; }
.conf i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--c, 0%); background: var(--orange); }

/* Detail panel */
.detail-title { font-size: calc(16px * var(--text-scale)); margin: 2px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.detail-sec { display: grid; gap: 6px; justify-items: start; margin: 12px 0; }
.attr-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: calc(12.5px * var(--text-scale)); }
.attr-table td { padding: 5px 6px; border-bottom: 1px solid var(--hairline-2); vertical-align: top; }
.attr-table .src { font-size: calc(11.5px * var(--text-scale)); }
.art-row { display: flex; gap: 8px; align-items: center; }

/* Outline table */
.outline { width: 100%; border-collapse: collapse; font-size: calc(12.5px * var(--text-scale)); }
.outline th { text-align: left; font-size: calc(11px * var(--text-scale)); font-weight: 500; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: var(--canvas); z-index: 1; }
.outline td { padding: 6px 8px; border-bottom: 1px solid var(--hairline-2); vertical-align: middle; }
.outline tr:focus { outline: none; }
.outline tr:focus td { background: var(--surface-2); }
.outline tr:focus td:first-child { box-shadow: inset 2px 0 0 var(--orange); }
.o-pattern td { background: var(--surface); color: var(--heading); padding-top: 9px; padding-bottom: 9px; }
.o-pattern[data-active="false"] { opacity: 0.45; }
.o-toggle { border: 0; background: none; color: var(--muted); cursor: pointer; width: 18px; padding: 0; }
.o-disc { margin-left: 10px; font-size: calc(11.5px * var(--text-scale)); }
.o-repeat { margin-left: 8px; }
.o-block { cursor: pointer; }
.o-block:hover td { background: var(--surface); }
.o-block[data-selected="true"] td { background: var(--orange-tint); }
.o-block[data-kind="need"] .o-name { color: var(--green); }
.o-block[data-scope="out"] .o-name { color: var(--faint); text-decoration: line-through; }
.o-block[data-scope="unreached"] .o-name { color: var(--faint); }
.outline .seg button { white-space: normal; max-width: 92px; text-align: left; line-height: 1.25; }
.o-why { min-width: 200px; max-width: 280px; font-size: calc(11.5px * var(--text-scale)); color: var(--muted); }
.o-why .warn-line { margin-top: 2px; }
.o-name { margin-right: 8px; }
.o-needs { color: var(--green); font-size: calc(11.5px * var(--text-scale)); margin-top: 2px; opacity: 0.85; }
.o-block[data-scope="out"] .o-needs, .o-block[data-scope="unreached"] .o-needs { color: var(--faint); }
.o-art { margin-right: 4px; font-size: calc(10.5px * var(--text-scale)); }
.o-ctx { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; max-width: 380px; }
.o-src { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(11.5px * var(--text-scale)); }
.o-multi td { background: var(--canvas); }
.o-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 10px; font-size: calc(12px * var(--text-scale)); }
.outline.compact td { padding: 4px 6px; }

/* Help */
.help-btn { gap: 7px; }
.help-mark { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--orange); color: var(--on-orange); font-size: calc(11px * var(--text-scale)); font-weight: 600; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 9, 16, 0.72); z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border: 1px solid var(--line-btn); border-radius: 6px; padding: 18px 22px 22px; }
.modal header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.modal h2 { font-size: calc(19px * var(--text-scale)); margin-top: 2px; }
.modal h3 { font-size: calc(12.5px * var(--text-scale)); color: var(--orange-ink); font-weight: 600; margin: 16px 0 6px; }
.modal p, .modal li { color: var(--soft); line-height: 1.55; margin: 0; }
.modal .modal-lead { color: var(--ink); }
.modal ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.modal-legend { display: grid; gap: 6px; color: var(--soft); }
.modal-legend > span { display: flex; gap: 10px; align-items: center; }
.modal-legend .chip { min-width: 84px; justify-content: center; }
.modal-tip { margin-top: 16px !important; padding: 8px 10px; background: var(--surface-2); border-radius: 4px; }
.case-meta b { color: var(--heading); font-weight: 500; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.empty { color: var(--faint); padding: 18px 0; text-align: center; }
.no-case { display: grid; justify-items: center; gap: 8px; padding: 60px 20px; }
.detail-title .tag { margin-left: 8px; font-size: calc(12px * var(--text-scale)); color: var(--muted); font-weight: 400; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.dep-table td:first-child { width: 90px; }

/* Context menu */
.menu { position: fixed; z-index: 70; min-width: 190px; display: grid; padding: 4px; background: var(--surface-2); border: 1px solid var(--line-btn); border-radius: 4px; }
.menu button { border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 3px; cursor: pointer; font-size: calc(12.5px * var(--text-scale)); color: var(--ink); }
.menu button:hover, .menu button:focus { background: var(--surface-3); color: var(--heading); outline: none; }

/* Scope basket along the bottom of the board */
.basket { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--hairline); }
.basket-head { display: flex; align-items: baseline; gap: 6px; padding-top: 4px; }
.basket-head b { color: var(--heading); }
.basket-count { color: var(--orange-ink); }
.basket-list { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 92px; overflow: auto; padding-top: 2px; }
.basket-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.basket-pattern { font-size: calc(11px * var(--text-scale)); margin-right: 2px; }
.basket-item { display: inline-flex; align-items: stretch; border: 1px solid var(--hairline); border-radius: 4px; background: var(--surface-2); }
.basket-item[data-selected="true"] { border-color: var(--heading); }
.basket-item button { border: 0; background: transparent; cursor: pointer; font-size: calc(12px * var(--text-scale)); color: var(--ink); }
.basket-pick { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; }
.basket-pick:hover { color: var(--heading); }
.basket-item .basket-x { padding: 0 7px; border-left: 1px solid var(--hairline); color: var(--muted); }
.basket-item .basket-x:hover { color: var(--red); }

/* Right sidebar: Scope, Specs, Item, Atlas */
.sidebar { width: 460px; max-width: 100%; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--hairline); overflow: hidden; }
.sidebar[hidden] { display: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--hairline); min-width: 0; }
.side-title { margin: 0; font-size: calc(14px * var(--text-scale)); font-weight: 600; color: var(--heading); }
.side-body { overflow-x: hidden; overflow-y: auto; padding: 12px 16px 24px; display: grid; align-content: start; gap: 14px; min-width: 0; }
.side-body > * { min-width: 0; max-width: 100%; }
.sidebar, .side-body { scrollbar-width: thin; scrollbar-color: var(--line-btn) transparent; }
.sidebar ::-webkit-scrollbar { width: 8px; height: 0; }
.sidebar ::-webkit-scrollbar-track { background: transparent; }
.sidebar ::-webkit-scrollbar-thumb { background: var(--line-btn); border-radius: 4px; }
.sidebar ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.side-sec h4 { margin: 0 0 6px; font-size: calc(12.5px * var(--text-scale)); color: var(--orange-ink); font-weight: 600; }
.sidebar .detail, .sidebar .detail-sec, .sidebar .detail-reason, .sidebar .leaf, .sidebar .spec-row, .sidebar .tree-node, .sidebar label, .sidebar .faint, .sidebar .muted { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.sidebar .mono { white-space: normal; overflow-wrap: anywhere; }
.sidebar .detail-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.sidebar .seg { display: flex; flex-wrap: wrap; max-width: 100%; }
.sidebar .seg button { white-space: normal; overflow-wrap: anywhere; max-width: 100%; text-align: left; line-height: 1.3; }
.req-table, .attr-table { width: 100%; border-collapse: collapse; font-size: calc(12px * var(--text-scale)); table-layout: fixed; }
.req-table th { text-align: left; font-weight: 500; font-size: calc(11px * var(--text-scale)); color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--hairline); }
.req-table td, .attr-table td { padding: 5px 6px; border-bottom: 1px solid var(--hairline-2); vertical-align: top; overflow-wrap: anywhere; }
.req-table .src { font-size: calc(11px * var(--text-scale)); }
.chip[data-check="pass"] { background: var(--green-tint); color: var(--green); }
.chip[data-check="fail"] { background: var(--red-tint); color: var(--red); }
.chip[data-check="unknown"] { background: var(--amber-tint); color: var(--amber); }
.doc-list, .side-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.doc-list li, .side-rows li { display: flex; align-items: center; gap: 8px; font-size: calc(12.5px * var(--text-scale)); min-width: 0; }
.doc-list .link-btn { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.doc-list .mono { margin-left: auto; flex-shrink: 0; }
.atlas-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.atlas-head h3 { font-size: calc(14px * var(--text-scale)); }
.atlas-head .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atlas-head .spacer { flex: 1; }
.atlas-log { display: grid; gap: 8px; outline: none; min-width: 0; }
.bubble { max-width: 100%; padding: 8px 11px; border-radius: 6px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.bubble[data-from="atlas"] { justify-self: start; max-width: 92%; background: var(--surface-2); border: 1px solid var(--hairline); color: var(--ink); }
.bubble[data-from="engineer"] { justify-self: end; max-width: 92%; background: var(--navy-2); color: var(--heading); }
.atlas-replies { display: grid; gap: 6px; justify-items: stretch; width: 100%; min-width: 0; }
.atlas-replies .ghost { height: auto; min-height: 27px; width: 100%; max-width: 100%; padding: 6px 10px; text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.bubble[data-thinking="true"] { padding: 10px 14px; }
.atlas-think { display: inline-flex; gap: 5px; align-items: center; height: 12px; }
.atlas-think i { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: atlas-dot 1.2s ease-in-out infinite; }
.atlas-think i:nth-child(2) { animation-delay: 0.2s; }
.atlas-think i:nth-child(3) { animation-delay: 0.4s; }
@keyframes atlas-dot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.modal.doc-modal { width: min(1200px, 100%); height: calc(100vh - 48px); max-height: calc(100vh - 48px); display: flex; flex-direction: column; padding-bottom: 12px; }
.modal.doc-modal .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.modal.doc-modal .doc-actions { margin-top: 0; }
.doc-fit, .doc-frame { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0; border: 1px solid var(--hairline); border-radius: 4px; background: #fff; }
.doc-fit { display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px; }
.doc-sheet { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.doc-frame { background: #fff; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--line-btn); border-radius: 4px; padding: 8px 14px; z-index: 50; font-size: calc(12.5px * var(--text-scale)); }

/* v3: header panel buttons, side panel trees, simulations */
.panel-btn .panel-sub { margin-left: 6px; font-size: calc(10.5px * var(--text-scale)); color: var(--amber); font-weight: 400; }
.side-lead { margin-bottom: 8px; }
.tree-node { border-top: 1px solid var(--hairline-2); padding: 4px 0; }
.tree-node > summary { cursor: pointer; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 3px 0; }
.tree-node > summary .count { margin-left: auto; color: var(--muted); }
.tree-node .tree-node { margin-left: 12px; }
.leaves { list-style: none; margin: 0; padding: 0 0 0 12px; display: grid; gap: 3px; }
.leaf { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: calc(12px * var(--text-scale)); }
.chip[data-leaf="build"], .chip[data-leaf="available"], .chip[data-leaf="pass"], .chip[data-leaf="current"], .chip[data-check="pass"], .chip[data-sim="current"] { background: var(--green-tint); color: var(--green); }
.chip[data-leaf="reuse"], .chip[data-leaf="given"], .chip[data-leaf="avail. offline"] { background: var(--blue-tint); color: var(--blue); }
.chip[data-leaf="open"], .chip[data-leaf="to produce"], .chip[data-leaf="unknown"], .chip[data-check="unknown"], .chip[data-sim="not run"], .chip[data-scope="open"], .chip[data-leaf="running"], .chip[data-sim="running"] { background: var(--amber-tint); color: var(--amber); }
.chip[data-leaf="missing"], .chip[data-leaf="fail"], .chip[data-leaf="obsolete"], .chip[data-check="fail"], .chip[data-sim="obsolete"], .chip[data-missing="true"], .chip[data-param="missing"] { background: var(--red-tint); color: var(--red); }
.chip[data-leaf="atlas"], .chip[data-param="atlas"], .chip[data-origin="eq"] { background: var(--violet-tint); color: var(--violet); }
.chip[data-origin="imf"] { background: var(--blue-tint); color: var(--blue); }
.chip[data-sim="obsolete"] { cursor: pointer; }
.side-foot { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--hairline); margin-top: 8px; }
.filters { display: flex; gap: 4px; margin-bottom: 8px; }
.filters button[aria-pressed="true"] { border-color: var(--orange); }
.spec-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 4px 0 4px 12px; font-size: calc(12px * var(--text-scale)); border-top: 1px dashed var(--hairline-2); min-width: 0; }
.spec-row > label { flex: 1 1 120px; min-width: 0; }
.spec-row > .faint { flex-basis: 100%; padding-left: 2px; }
.spec-row input { width: 84px; flex: 0 0 auto; }
.spec-row[data-param="missing"] label { color: var(--red); }
.spec-row[data-param="changed"] label { color: var(--orange-ink); }
.spec-row[data-param="atlas"] label { color: var(--violet); }
.sim-sec .kv { margin: 6px 0; }
.plot-fig { margin: 8px 0; }
.plot-fig figcaption { margin-bottom: 4px; font-size: calc(11.5px * var(--text-scale)); }
.op-table { width: 100%; font-size: calc(11.5px * var(--text-scale)); border-collapse: collapse; margin: 4px 0 8px; }
.op-table td, .op-table th { padding: 2px 4px; text-align: left; }
.sim-running { display: flex; gap: 10px; align-items: center; padding: 18px 4px; }
.sim-missing { display: grid; gap: 6px; margin: 8px 0 12px; padding-left: 18px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--hairline); border-top-color: var(--orange); animation: spin 0.8s linear infinite; display: inline-block; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
