:root {
  --tpi-bg: #080b10;
  --tpi-panel: #101720;
  --tpi-panel-2: #151e29;
  --tpi-line: rgba(226, 234, 243, 0.17);
  --tpi-line-strong: rgba(226, 234, 243, 0.32);
  --tpi-text: #f0f4f8;
  --tpi-muted: #aeb9c6;
  --tpi-gold: #d2aa55;
  --tpi-green: #34b98a;
  --tpi-green-soft: #183f35;
  --tpi-red: #e16a68;
  --tpi-red-soft: #4a2528;
  --tpi-neutral: #556170;
  --tpi-blue: #6da5d8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body.tpi-lab-body { margin: 0; min-width: 320px; background: var(--tpi-bg); color: var(--tpi-text); font: 14px/1.45 "IBM Plex Sans", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--tpi-gold); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--tpi-text); color: var(--tpi-bg); }
.skip-link:focus { top: 12px; }

.tpi-lab-shell { width: 100%; min-width: 0; padding: 18px; }
.tpi-lab-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 0 16px; border-bottom: 1px solid var(--tpi-line); }
.tpi-lab-brand { display: flex; align-items: center; gap: 12px; }
.tpi-lab-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(210, 170, 85, 0.55); color: var(--tpi-gold); font: 700 12px/1 "IBM Plex Mono", monospace; }
.tpi-lab-brand h1 { margin: 2px 0 0; font: 600 24px/1.1 "Outfit", system-ui, sans-serif; letter-spacing: -0.02em; }
.tpi-lab-kicker { display: block; color: var(--tpi-muted); font: 600 10px/1.3 "IBM Plex Mono", monospace; letter-spacing: 0.09em; text-transform: uppercase; }
.tpi-lab-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.tpi-lab-status { max-width: 360px; color: var(--tpi-muted); font-size: 12px; text-align: right; }
.tpi-lab-status.error { color: var(--tpi-red); }

.tpi-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 8px 13px; border: 1px solid var(--tpi-line-strong); border-radius: 4px; background: var(--tpi-panel-2); color: var(--tpi-text); text-decoration: none; cursor: pointer; }
.tpi-button:hover { border-color: rgba(210, 170, 85, 0.62); }
.tpi-button.primary { border-color: var(--tpi-gold); background: var(--tpi-gold); color: #15130c; font-weight: 700; }
.tpi-button.text { border-color: transparent; background: transparent; color: var(--tpi-muted); }
.tpi-button:disabled { opacity: 0.45; cursor: not-allowed; }

.tpi-authority-bar { display: flex; gap: 9px; align-items: baseline; margin: 12px 0; padding: 10px 12px; border-left: 3px solid var(--tpi-gold); background: #11130f; color: var(--tpi-muted); font-size: 12px; }
.tpi-authority-bar strong { color: var(--tpi-text); }
.tpi-auth-notice { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 12px 0; padding: 18px; border: 1px solid rgba(210, 170, 85, 0.46); background: #14130f; }
.tpi-auth-notice[hidden] { display: none; }
.tpi-auth-notice h2 { margin: 3px 0 5px; font-size: 18px; }
.tpi-auth-notice p { max-width: 680px; margin: 0; color: var(--tpi-muted); font-size: 12px; }
.tpi-toolbar { display: grid; grid-template-columns: auto 1fr minmax(180px, 260px); align-items: end; gap: 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--tpi-line); background: var(--tpi-panel); }
.tpi-range-group, .tpi-mode-group { display: flex; gap: 2px; flex-wrap: wrap; }
.tpi-range-group button, .tpi-mode-group button { min-height: 36px; padding: 7px 10px; border: 1px solid transparent; background: transparent; color: var(--tpi-muted); cursor: pointer; }
.tpi-range-group button:hover, .tpi-mode-group button:hover { color: var(--tpi-text); }
.tpi-range-group button.active, .tpi-mode-group button.active { border-color: var(--tpi-line-strong); background: #171e27; color: var(--tpi-text); }
.tpi-search span, .tpi-output-select span { display: block; margin-bottom: 5px; color: var(--tpi-muted); font-size: 11px; }
.tpi-search input, .tpi-output-select select { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid var(--tpi-line-strong); border-radius: 3px; background: #090d12; color: var(--tpi-text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.tpi-event-workbench { margin-bottom: 12px; border: 1px solid rgba(210, 170, 85, 0.34); background: linear-gradient(135deg, #111720, #11130f); }
.tpi-event-picker { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 62px; padding: 10px 12px; }
.tpi-event-picker h2 { margin: 3px 0 0; font: 600 16px/1.2 "Outfit", system-ui, sans-serif; }
.tpi-event-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.tpi-event-controls label { min-width: min(360px, 34vw); }
.tpi-event-controls select { width: 100%; min-height: 40px; padding: 8px 34px 8px 10px; border: 1px solid var(--tpi-line-strong); border-radius: 3px; background: #090d12; color: var(--tpi-text); }
.tpi-event-context { display: grid; grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.2fr) minmax(220px, 1.2fr) minmax(190px, 0.8fr); border-top: 1px solid var(--tpi-line); }
.tpi-event-context[hidden] { display: none; }
.tpi-event-context > div { min-width: 0; padding: 12px 13px; border-right: 1px solid var(--tpi-line); }
.tpi-event-context > div:last-child { border-right: 0; }
.tpi-event-identity { display: flex; align-items: flex-start; gap: 11px; }
.tpi-event-date { flex: 0 0 auto; padding: 5px 7px; border: 1px solid rgba(210, 170, 85, 0.5); color: var(--tpi-gold); font: 700 10px/1.2 "IBM Plex Mono", monospace; }
.tpi-event-identity h3 { margin: 1px 0 8px; font: 600 14px/1.25 "Outfit", system-ui, sans-serif; }
.tpi-event-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tpi-event-chips span { padding: 3px 5px; background: rgba(210, 170, 85, 0.1); color: #d8c08b; font: 8px/1.2 "IBM Plex Mono", monospace; text-transform: uppercase; }
.tpi-event-question span, .tpi-event-reading span { display: block; margin-bottom: 6px; color: var(--tpi-muted); font: 600 9px/1.25 "IBM Plex Mono", monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.tpi-event-question.ltpi { box-shadow: inset 2px 0 0 var(--tpi-green); }
.tpi-event-question.mtpi { box-shadow: inset 2px 0 0 var(--tpi-blue); }
.tpi-event-question p { margin: 0; color: #dbe2ea; font-size: 11px; line-height: 1.45; }
.tpi-event-reading strong, .tpi-event-reading small { display: block; }
.tpi-event-reading strong { color: var(--tpi-text); font: 600 11px/1.45 "IBM Plex Mono", monospace; }
.tpi-event-reading small { margin-top: 6px; color: var(--tpi-muted); font-size: 10px; }

.tpi-lab-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 12px; border: 1px solid var(--tpi-line); background: var(--tpi-panel); }
.tpi-summary-cell { min-width: 0; padding: 11px 13px; border-right: 1px solid var(--tpi-line); }
.tpi-summary-cell:last-child { border-right: 0; }
.tpi-summary-cell small, .tpi-summary-cell span { display: block; color: var(--tpi-muted); font-size: 11px; }
.tpi-summary-cell strong { display: block; margin: 3px 0 1px; font: 600 19px/1.2 "IBM Plex Mono", monospace; }
.tpi-summary-cell.official strong { color: var(--tpi-green); }
.tpi-summary-cell.shadow strong { color: var(--tpi-gold); }
.tpi-summary-cell.blocked strong { color: var(--tpi-red); }

.tpi-lab-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.tpi-main-stage, .tpi-inspector { min-width: 0; border: 1px solid var(--tpi-line); background: var(--tpi-panel); }
.tpi-stage-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; padding: 9px 13px; border-bottom: 1px solid var(--tpi-line); }
.tpi-stage-head strong { display: block; margin-top: 2px; font-family: "IBM Plex Mono", monospace; }
.tpi-shared-readout { color: var(--tpi-muted); font: 12px/1.35 "IBM Plex Mono", monospace; text-align: right; }
.tpi-price-section, .tpi-raw-section, .tpi-lanes-section, .tpi-composite-section { position: relative; border-bottom: 1px solid var(--tpi-line); }
.tpi-panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 48px; padding: 8px 13px; border-bottom: 1px solid var(--tpi-line); }
.tpi-panel-heading h2 { margin: 2px 0 0; font: 600 14px/1.2 "Outfit", system-ui, sans-serif; }
.tpi-chart-legend, .tpi-state-key { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--tpi-muted); font-size: 11px; }
.tpi-chart-legend button { min-height: 30px; padding: 5px 8px; border: 1px solid var(--tpi-line); border-radius: 3px; background: transparent; color: inherit; cursor: pointer; opacity: 0.5; }
.tpi-chart-legend button.active { background: #18212c; opacity: 1; }
.tpi-chart-legend button::before, .tpi-chart-legend span::before, .tpi-state-key span::before { content: ""; display: inline-block; width: 13px; height: 3px; margin-right: 5px; vertical-align: middle; background: currentColor; }
.price-key { color: #c8d0db; }.official-key { color: var(--tpi-green); }.shadow-key { color: var(--tpi-gold); }.basket-key { color: #f2f5f8; }.candidate-key { color: #8aa4ff; }
.tpi-state-key [data-state-key="up"] { color: var(--tpi-green); }
.tpi-state-key [data-state-key="neutral"] { color: var(--tpi-neutral); }
.tpi-state-key [data-state-key="down"] { color: var(--tpi-red); }
.tpi-state-key [data-state-key="missing"] { color: #313944; }
.tpi-price-chart { height: 320px; }
.tpi-raw-chart { height: 190px; }
.tpi-composite-chart { height: 185px; }
.tpi-chart-empty { position: absolute; inset: 49px 0 0; display: grid; place-items: center; padding: 20px; background: var(--tpi-panel); color: var(--tpi-muted); text-align: center; }
.tpi-output-select { width: min(240px, 40vw); }

.tpi-state-rule-note { max-width: 760px; margin: 5px 0 0; color: var(--tpi-muted); font-size: 11px; }
.tpi-state-rule-note strong { color: #d9e1ea; }
.tpi-lane-axis, .tpi-lane-row { display: grid; grid-template-columns: 230px minmax(320px, 1fr) 104px; align-items: center; }
.tpi-lane-axis { min-height: 28px; padding: 0 10px; border-bottom: 1px solid var(--tpi-line); color: var(--tpi-muted); font: 10px/1 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.tpi-lane-axis span:last-child { text-align: right; }
.tpi-lane-list { max-height: 650px; overflow: auto; background: #0c1219; }
.tpi-lane-row { position: relative; min-height: 42px; padding: 0 10px; border: 0; border-bottom: 1px solid rgba(226, 234, 243, 0.12); background: #101720; color: var(--tpi-text); text-align: left; cursor: pointer; }
.tpi-lane-row:nth-child(even) { background: #121a24; }
.tpi-lane-row:hover { background: #1a2531; }
.tpi-lane-row.selected { background: #202a35; box-shadow: inset 3px 0 0 var(--tpi-gold); }
.tpi-lane-row:focus-visible { z-index: 2; }
.tpi-lane-label { min-width: 0; padding-right: 10px; }
.tpi-lane-label strong, .tpi-lane-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpi-lane-label strong { font-size: 13px; font-weight: 650; }
.tpi-lane-label small { margin-top: 2px; color: var(--tpi-muted); font: 11px/1.3 "IBM Plex Mono", monospace; }
.tpi-lane-track { position: relative; height: 20px; overflow: hidden; border: 1px solid rgba(226, 234, 243, 0.27); background: repeating-linear-gradient(135deg, #232c37 0 4px, #19212b 4px 8px); }
.tpi-lane-segment { position: absolute; top: 0; bottom: 0; min-width: 1px; }
.tpi-lane-segment.up { background: #267b62; }
.tpi-lane-segment.down { background: #8a3e43; }
.tpi-lane-segment.neutral { background: #526170; }
.tpi-lane-segment.missing { background: transparent; }
.tpi-lane-cursor { position: absolute; top: -2px; bottom: -2px; width: 1px; background: rgba(232, 237, 243, 0.72); pointer-events: none; }
.tpi-lane-now { padding-left: 9px; color: var(--tpi-muted); font: 10px/1.25 "IBM Plex Mono", monospace; text-align: right; text-transform: uppercase; }
.tpi-lane-now.rule-needed { color: #d7bd83; }
.tpi-lane-now.up { color: var(--tpi-green); }.tpi-lane-now.down { color: var(--tpi-red); }.tpi-lane-now.neutral { color: #aab4c0; }.tpi-lane-now.missing { color: #697482; }
.tpi-lane-row.candidate .tpi-lane-label strong::after { content: " shadow"; margin-left: 6px; color: var(--tpi-gold); font: 9px/1 "IBM Plex Mono", monospace; text-transform: uppercase; }
.tpi-lane-row.blocked { cursor: default; opacity: 0.82; }
.tpi-lane-empty { padding: 28px; color: var(--tpi-muted); text-align: center; }

.tpi-inspector { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.tpi-inspector-empty { display: grid; min-height: 260px; align-content: center; gap: 5px; padding: 30px; color: var(--tpi-muted); text-align: center; }
.tpi-inspector-empty strong { color: var(--tpi-text); }
.tpi-inspector-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--tpi-line); }
.tpi-inspector-head h2 { margin: 8px 0 3px; font: 600 18px/1.2 "Outfit", sans-serif; }
.tpi-inspector-head code { display: block; color: var(--tpi-muted); font-size: 10px; overflow-wrap: anywhere; }
.tpi-icon-button { width: 40px; height: 40px; border: 1px solid var(--tpi-line); background: transparent; color: var(--tpi-muted); cursor: pointer; }
.tpi-authority-chip { display: inline-flex; padding: 3px 6px; border: 1px solid var(--tpi-line-strong); color: var(--tpi-muted); font: 9px/1.2 "IBM Plex Mono", monospace; text-transform: uppercase; }
.tpi-authority-chip.exact { border-color: rgba(52, 185, 138, 0.45); color: var(--tpi-green); }
.tpi-authority-chip.candidate { border-color: rgba(210, 170, 85, 0.45); color: var(--tpi-gold); }
.tpi-authority-chip.blocked { border-color: rgba(225, 106, 104, 0.45); color: var(--tpi-red); }
.tpi-inspector-facts { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-bottom: 1px solid var(--tpi-line); }
.tpi-inspector-facts div { padding: 10px 12px; border-right: 1px solid var(--tpi-line); border-bottom: 1px solid var(--tpi-line); }
.tpi-inspector-facts div:nth-child(2n) { border-right: 0; }
.tpi-inspector-facts div:nth-last-child(-n+2) { border-bottom: 0; }
.tpi-inspector-facts dt { color: var(--tpi-muted); font-size: 10px; text-transform: uppercase; }
.tpi-inspector-facts dd { margin: 3px 0 0; font: 11px/1.35 "IBM Plex Mono", monospace; overflow-wrap: anywhere; }
.tpi-inspector-section { padding: 14px 16px; border-bottom: 1px solid var(--tpi-line); }
.tpi-inspector-section:last-child { border-bottom: 0; }
.tpi-inspector-section h3 { margin: 3px 0 8px; font: 600 14px/1.2 "Outfit", sans-serif; }
.tpi-inspector-section p { margin: 0 0 12px; color: var(--tpi-muted); font-size: 12px; }
.tpi-inspector-section-head { display: flex; justify-content: space-between; gap: 10px; }
.tpi-live-preview-meta { display: grid; justify-items: end; gap: 6px; }
.tpi-live-preview-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--tpi-text); font-size: 11px; cursor: pointer; }
.tpi-live-preview-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--tpi-gold); }
.tpi-draft-status { color: var(--tpi-muted); font: 9px/1.2 "IBM Plex Mono", monospace; text-transform: uppercase; }
.tpi-draft-status.modified { color: var(--tpi-gold); }
.tpi-draft-status.error { color: var(--tpi-red); }
.tpi-settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tpi-setting-field span { display: block; margin-bottom: 4px; color: var(--tpi-muted); font-size: 10px; }
.tpi-setting-field input, .tpi-setting-field select { width: 100%; min-height: 36px; padding: 7px 8px; border: 1px solid var(--tpi-line-strong); border-radius: 3px; background: #090d12; color: var(--tpi-text); }
.tpi-settings-empty { grid-column: 1 / -1; padding: 12px; border: 1px dashed var(--tpi-line-strong); color: var(--tpi-muted); font-size: 11px; }
.tpi-settings-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tpi-verification-notes { margin: 0; padding-left: 17px; color: var(--tpi-muted); font-size: 12px; }
.tpi-verification-notes li { margin-bottom: 7px; }

.tpi-foundry { margin: 0 0 12px; border: 1px solid var(--tpi-line-strong); background: #0c1219; }
.tpi-compare-tray { margin: 0 0 12px; border: 1px solid var(--tpi-line-strong); background: #0c1219; }
.tpi-compare-tray-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 11px 13px; border-bottom: 1px solid var(--tpi-line); }
.tpi-compare-tray-head h2 { margin: 3px 0 0; font: 600 16px/1.2 "Outfit", sans-serif; }
.tpi-compare-tray-head p { max-width: 610px; margin: 4px 0 0; color: var(--tpi-muted); font-size: 11px; }
.tpi-compare-tray-actions { display: flex; align-items: center; gap: 9px; }
.tpi-compare-tray-actions .tpi-button { min-height: 30px; white-space: nowrap; }
.tpi-basket-builder { display: flex; align-items: end; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.tpi-basket-builder > label > span { display: block; margin-bottom: 4px; color: var(--tpi-muted); font-size: 9px; }
.tpi-basket-builder select { min-height: 34px; padding: 6px 8px; border: 1px solid var(--tpi-line-strong); background: #080c11; color: var(--tpi-text); }
.tpi-basket-builder .tpi-button { min-height: 34px; white-space: nowrap; }
.tpi-basket-components-toggle { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--tpi-line); color: var(--tpi-muted); font-size: 10px; cursor: pointer; }
.tpi-basket-components-toggle input { margin: 0; accent-color: var(--tpi-gold); }
.tpi-basket-summary { min-height: 35px; padding: 9px 12px; border-bottom: 1px solid var(--tpi-line); background: #101720; color: var(--tpi-muted); font-size: 10px; }
.tpi-basket-summary strong { color: var(--tpi-text); font-family: "IBM Plex Mono", monospace; }
.tpi-comparison-tray { display: flex; min-height: 50px; align-items: center; gap: 7px; padding: 8px 12px; overflow-x: auto; }
.tpi-comparison-original, .tpi-comparison-chip { display: inline-flex; flex: 0 0 auto; min-height: 32px; align-items: center; border: 1px solid var(--tpi-line-strong); background: #111923; color: var(--tpi-text); }
.tpi-comparison-original { gap: 7px; padding: 6px 9px; font-size: 10px; }
.tpi-comparison-original i { width: 13px; height: 2px; background: var(--tpi-green); }
.tpi-comparison-chip.active { border-color: rgba(138, 164, 255, 0.72); background: #182333; }
.tpi-comparison-chip button { min-height: 30px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.tpi-comparison-chip button:first-child { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 10px; }
.tpi-comparison-chip button[data-compare-earlier] { padding: 0 7px; border-left: 1px solid var(--tpi-line); color: #aebee0; font: 9px/1 "IBM Plex Mono", monospace; }
.tpi-comparison-chip button:last-child { width: 28px; border-left: 1px solid var(--tpi-line); color: var(--tpi-muted); }
.tpi-comparison-chip i { width: 13px; height: 2px; background: var(--series-color); }
.tpi-comparison-chip small { color: var(--tpi-muted); font: 9px/1 "IBM Plex Mono", monospace; }
.tpi-comparison-empty { color: var(--tpi-muted); font-size: 10px; }
.tpi-foundry-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 15px 16px; }
.tpi-foundry-head h2 { margin: 3px 0 4px; font: 600 18px/1.2 "Outfit", sans-serif; }
.tpi-foundry-head p { max-width: 760px; margin: 0; color: var(--tpi-muted); font-size: 12px; }
.tpi-foundry-body { border-top: 1px solid var(--tpi-line); }
.tpi-foundry-body[hidden] { display: none; }
.tpi-foundry-controls { display: grid; grid-template-columns: auto 170px 210px minmax(190px, 1fr); gap: 10px; align-items: end; padding: 11px 12px; border-bottom: 1px solid var(--tpi-line); background: #101720; }
.tpi-foundry-controls label > span { display: block; margin-bottom: 5px; color: var(--tpi-muted); font-size: 10px; }
.tpi-foundry-controls select, .tpi-foundry-controls input { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid var(--tpi-line-strong); border-radius: 3px; background: #080c11; color: var(--tpi-text); }
.tpi-foundry-model { display: flex; min-height: 38px; border: 1px solid var(--tpi-line-strong); }
.tpi-foundry-model button { min-height: 36px; padding: 7px 11px; border: 0; border-right: 1px solid var(--tpi-line); background: transparent; color: var(--tpi-muted); cursor: pointer; }
.tpi-foundry-model button:last-child { border-right: 0; }
.tpi-foundry-model button.active { background: #202a36; color: var(--tpi-text); box-shadow: inset 0 -2px 0 #8aa4ff; }
.tpi-foundry-summary { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--tpi-line); background: #0b1016; }
.tpi-foundry-summary > span { min-height: 40px; padding: 10px 13px; border-right: 1px solid var(--tpi-line); color: var(--tpi-muted); font-size: 11px; }
.tpi-foundry-summary strong { margin-right: 4px; color: var(--tpi-text); font-family: "IBM Plex Mono", monospace; }
.tpi-foundry-summary .tpi-foundry-progress { width: 100%; color: #c4cede; }
.tpi-foundry-summary .tpi-foundry-error { width: 100%; color: var(--tpi-red); }
.tpi-foundry-workspace { display: grid; grid-template-columns: minmax(520px, 0.92fr) minmax(560px, 1.08fr); min-height: 520px; }
.tpi-foundry-queue { min-width: 0; border-right: 1px solid var(--tpi-line); }
.tpi-foundry-column-head, .tpi-foundry-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(110px, 0.65fr) minmax(130px, 0.8fr) 88px; align-items: center; }
.tpi-foundry-column-head { min-height: 30px; padding: 0 11px; border-bottom: 1px solid var(--tpi-line); color: #778392; font: 9px/1 "IBM Plex Mono", monospace; letter-spacing: 0.06em; text-transform: uppercase; }
.tpi-foundry-rows { max-height: 690px; overflow: auto; }
.tpi-foundry-row { width: 100%; min-height: 52px; padding: 6px 11px; border: 0; border-bottom: 1px solid rgba(226, 234, 243, 0.11); background: #0e151d; color: var(--tpi-text); text-align: left; cursor: pointer; }
.tpi-foundry-row:nth-child(even) { background: #111923; }
.tpi-foundry-row:hover { background: #182331; }
.tpi-foundry-row.selected { background: #1d2936; box-shadow: inset 3px 0 0 #8aa4ff; }
.tpi-foundry-row > span { min-width: 0; padding-right: 8px; }
.tpi-foundry-name strong, .tpi-foundry-name small, .tpi-foundry-similarity strong, .tpi-foundry-similarity small, .tpi-foundry-behaviour strong, .tpi-foundry-behaviour small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpi-foundry-name strong { font-size: 12px; }.tpi-foundry-name small, .tpi-foundry-similarity small, .tpi-foundry-behaviour small { color: var(--tpi-muted); font-size: 9px; }
.tpi-foundry-similarity strong, .tpi-foundry-behaviour strong { font: 600 11px/1.4 "IBM Plex Mono", monospace; }
.tpi-foundry-review { justify-self: start; padding: 4px 6px; border: 1px solid var(--tpi-line); color: var(--tpi-muted); font: 8px/1 "IBM Plex Mono", monospace; text-transform: uppercase; }
.tpi-foundry-review.watch, .tpi-foundry-review.compare { border-color: rgba(210, 170, 85, 0.45); color: var(--tpi-gold); }
.tpi-foundry-review.shadow { border-color: rgba(52, 185, 138, 0.45); color: var(--tpi-green); }
.tpi-foundry-review.reject { border-color: rgba(225, 106, 104, 0.45); color: var(--tpi-red); }
.tpi-foundry-no-match { padding: 28px; color: var(--tpi-muted); text-align: center; }
.tpi-foundry-detail { min-width: 0; max-height: 720px; overflow: auto; background: #0b1118; }
.tpi-foundry-empty { display: grid; min-height: 320px; place-content: center; gap: 5px; padding: 30px; color: var(--tpi-muted); text-align: center; }
.tpi-foundry-empty strong { color: var(--tpi-text); }
.tpi-foundry-detail-head { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--tpi-line); }
.tpi-foundry-detail-head h3 { margin: 7px 0 2px; font: 600 17px/1.2 "Outfit", sans-serif; }
.tpi-foundry-detail-head code { color: var(--tpi-muted); font-size: 10px; }
.tpi-foundry-detail-head a { color: #aebee0; font-size: 11px; }
.tpi-foundry-detail-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; }
.tpi-foundry-detail-actions .tpi-button { min-height: 34px; padding: 6px 9px; font-size: 10px; }
.tpi-foundry-detail-facts { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--tpi-line); }
.tpi-foundry-detail-facts span { min-width: 0; padding: 10px 12px; border-right: 1px solid var(--tpi-line); }
.tpi-foundry-detail-facts span:last-child { border-right: 0; }
.tpi-foundry-detail-facts small, .tpi-foundry-detail-facts strong { display: block; }
.tpi-foundry-detail-facts small { color: var(--tpi-muted); font-size: 9px; }
.tpi-foundry-detail-facts strong { margin-top: 3px; font: 600 13px/1.2 "IBM Plex Mono", monospace; }
.tpi-foundry-evidence-block, .tpi-foundry-review-block, .tpi-foundry-key-dates { padding: 13px 16px; border-bottom: 1px solid var(--tpi-line); }
.tpi-foundry-evidence-block h4, .tpi-foundry-review-block h4, .tpi-foundry-key-dates h4 { margin: 3px 0 5px; font: 600 14px/1.2 "Outfit", sans-serif; }
.tpi-foundry-evidence-block p, .tpi-foundry-key-dates p { margin: 4px 0 0; color: var(--tpi-muted); font-size: 10px; }
.tpi-foundry-block-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tpi-foundry-anchor-status { color: #b8c6dc; font: 10px/1.3 "IBM Plex Mono", monospace; text-align: right; }
.tpi-foundry-settings { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tpi-foundry-settings span { display: inline-flex; gap: 6px; align-items: center; padding: 5px 7px; border: 1px solid var(--tpi-line); background: #101821; }
.tpi-foundry-settings code { color: var(--tpi-muted); font-size: 9px; }.tpi-foundry-settings strong { font: 600 10px/1 "IBM Plex Mono", monospace; }
.tpi-foundry-lookbacks { color: #c5b27f !important; }
.tpi-foundry-review-block { display: grid; gap: 9px; }
.tpi-foundry-decisions { display: flex; flex-wrap: wrap; gap: 5px; }
.tpi-foundry-decisions button { min-height: 34px; padding: 6px 9px; border: 1px solid var(--tpi-line-strong); background: transparent; color: var(--tpi-muted); cursor: pointer; }
.tpi-foundry-decisions button.active { border-color: var(--tpi-gold); background: #242116; color: var(--tpi-text); }
.tpi-foundry-review-block label span { display: block; margin-bottom: 4px; color: var(--tpi-muted); font-size: 10px; }
.tpi-foundry-review-block textarea { width: 100%; resize: vertical; padding: 8px; border: 1px solid var(--tpi-line-strong); border-radius: 3px; background: #080c11; color: var(--tpi-text); font: 12px/1.45 "IBM Plex Sans", sans-serif; }
.tpi-foundry-review-block small { color: var(--tpi-muted); font-size: 9px; }
.tpi-foundry-key-dates { padding-right: 0; padding-left: 0; }
.tpi-foundry-key-dates > div:first-child { padding: 0 16px 10px; }
.tpi-foundry-key-head, .tpi-foundry-key-rows > button { display: grid; grid-template-columns: 82px minmax(140px, 1.2fr) 118px 104px 104px 68px minmax(118px, 0.9fr); align-items: center; min-width: 850px; }
.tpi-foundry-key-head { min-height: 27px; padding: 0 10px; border-top: 1px solid var(--tpi-line); border-bottom: 1px solid var(--tpi-line); color: #778392; font: 8px/1 "IBM Plex Mono", monospace; text-transform: uppercase; }
.tpi-foundry-key-rows { max-height: 330px; overflow: auto; }
.tpi-foundry-key-rows > button { width: 100%; min-height: 38px; padding: 4px 10px; border: 0; border-bottom: 1px solid rgba(226, 234, 243, 0.09); background: transparent; color: var(--tpi-text); text-align: left; cursor: pointer; }
.tpi-foundry-key-rows > button:hover { background: #17212d; }
.tpi-foundry-key-rows time { color: var(--tpi-muted); font: 9px/1 "IBM Plex Mono", monospace; }
.tpi-foundry-key-rows strong { overflow: hidden; padding-right: 8px; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tpi-foundry-key-rows span { font: 9px/1.25 "IBM Plex Mono", monospace; }.tpi-foundry-key-rows span.up { color: var(--tpi-green); }.tpi-foundry-key-rows span.down { color: var(--tpi-red); }.tpi-foundry-key-rows span.neutral { color: #aab4c0; }.tpi-foundry-key-rows span.missing { color: #5f6a77; }
.tpi-foundry-key-rows span > small { display: block; margin-top: 3px; }
.tpi-state-path { display: inline-flex; gap: 3px; }
.tpi-state-path i { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid var(--tpi-line); border-radius: 2px; font: normal 700 8px/1 "IBM Plex Mono", monospace; }
.tpi-state-path i.up { border-color: rgba(52,185,138,.45); background: var(--tpi-green-soft); color: #68d8b0; }
.tpi-state-path i.down { border-color: rgba(225,106,104,.45); background: var(--tpi-red-soft); color: #f08b89; }
.tpi-state-path i.neutral { color: #c0c8d2; }
.tpi-state-path i.missing { color: #5f6a77; }
.tpi-foundry-key-rows small { color: var(--tpi-muted); font-size: 7px; }
.tpi-foundry-inventory { border-top: 1px solid var(--tpi-line); }
.tpi-foundry-inventory summary { padding: 11px 13px; color: var(--tpi-muted); font-size: 11px; cursor: pointer; }
.tpi-foundry-inventory > div { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--tpi-line); }
.tpi-foundry-inventory section { min-width: 0; padding: 12px; border-right: 1px solid var(--tpi-line); }.tpi-foundry-inventory section:last-child { border-right: 0; }
.tpi-foundry-inventory h3 { margin: 0 0 8px; font-size: 11px; }.tpi-foundry-inventory h3 span { color: var(--tpi-muted); }
.tpi-foundry-inventory-row { display: grid; gap: 1px; padding: 6px 0; border-top: 1px solid rgba(226, 234, 243, 0.08); }
.tpi-foundry-inventory-row strong { font-size: 10px; }.tpi-foundry-inventory-row span { color: var(--tpi-muted); font-size: 9px; }

@media (max-width: 1180px) {
  .tpi-lab-layout { grid-template-columns: 1fr; }
  .tpi-inspector { position: static; max-height: none; }
  .tpi-lab-summary { grid-template-columns: repeat(3, 1fr); }
  .tpi-summary-cell:nth-child(3) { border-right: 0; }
  .tpi-summary-cell:nth-child(-n+3) { border-bottom: 1px solid var(--tpi-line); }
  .tpi-event-context { grid-template-columns: 1fr 1fr; }
  .tpi-event-context > div:nth-child(2) { border-right: 0; }
  .tpi-event-context > div:nth-child(-n+2) { border-bottom: 1px solid var(--tpi-line); }
  .tpi-foundry-workspace { grid-template-columns: 1fr; }
  .tpi-foundry-queue { border-right: 0; border-bottom: 1px solid var(--tpi-line); }
  .tpi-foundry-rows { max-height: 430px; }
}

@media (max-width: 820px) {
  .tpi-lab-shell { padding: 10px; }
  .tpi-lab-header, .tpi-lab-header-actions, .tpi-authority-bar, .tpi-auth-notice { align-items: flex-start; flex-direction: column; }
  .tpi-lab-header-actions { width: 100%; }
  .tpi-lab-status { max-width: none; text-align: left; }
  .tpi-toolbar { grid-template-columns: 1fr; }
  .tpi-event-picker, .tpi-event-controls { align-items: stretch; flex-direction: column; }
  .tpi-event-controls { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .tpi-event-controls label { min-width: 0; }
  .tpi-event-controls .tpi-button { grid-column: 1 / -1; }
  .tpi-lane-axis, .tpi-lane-row { grid-template-columns: 180px minmax(260px, 1fr) 96px; }
  .tpi-lanes-section { overflow-x: auto; }
  .tpi-lane-list, .tpi-lane-axis { min-width: 620px; }
  .tpi-state-key { display: none; }
  .tpi-foundry-head { align-items: flex-start; flex-direction: column; }
  .tpi-compare-tray-head { align-items: flex-start; flex-direction: column; }
  .tpi-basket-builder { width: 100%; justify-content: flex-start; }
  .tpi-compare-tray-actions { width: 100%; align-items: flex-start; flex-direction: column; }
  .tpi-foundry-controls { grid-template-columns: 1fr 1fr; }
  .tpi-foundry-model, .tpi-foundry-search { grid-column: 1 / -1; }
  .tpi-foundry-inventory > div { grid-template-columns: 1fr; }
  .tpi-foundry-inventory section { border-right: 0; border-bottom: 1px solid var(--tpi-line); }
}

@media (max-width: 560px) {
  .tpi-lab-summary { grid-template-columns: repeat(2, 1fr); }
  .tpi-summary-cell:nth-child(2n) { border-right: 0; }
  .tpi-summary-cell:nth-child(3) { border-right: 1px solid var(--tpi-line); }
  .tpi-summary-cell:nth-child(-n+4) { border-bottom: 1px solid var(--tpi-line); }
  .tpi-price-chart { height: 300px; }
  .tpi-panel-heading { align-items: flex-start; flex-direction: column; }
  .tpi-output-select { width: 100%; }
  .tpi-settings-form { grid-template-columns: 1fr; }
  .tpi-inspector-section-head { align-items: flex-start; }
  .tpi-event-context { grid-template-columns: 1fr; }
  .tpi-event-context > div { border-right: 0; border-bottom: 1px solid var(--tpi-line); }
  .tpi-event-context > div:last-child { border-bottom: 0; }
  .tpi-foundry-controls { grid-template-columns: 1fr; }
  .tpi-foundry-model, .tpi-foundry-search { grid-column: auto; }
  .tpi-foundry-column-head { display: none; }
  .tpi-foundry-row { grid-template-columns: minmax(0, 1fr) 72px; gap: 5px; }
  .tpi-foundry-behaviour { grid-column: 1; }.tpi-foundry-review { grid-column: 2; grid-row: 2; }
  .tpi-foundry-detail-facts { grid-template-columns: 1fr 1fr; }
  .tpi-foundry-detail-facts span:nth-child(2) { border-right: 0; }
  .tpi-foundry-detail-facts span:nth-child(-n+2) { border-bottom: 1px solid var(--tpi-line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
