/* Filters — on top of calc.css */
main.filt .tabs { grid-template-columns: repeat(3, 1fr); }
main.filt .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.filt .stage-bar .hist { margin-left: auto; }
#view { display: block; width: 100%; height: auto; user-select: none; }
#bodeChart .hit { fill: transparent; stroke: none; }
#bodeChart .handle { cursor: move; }
#bodeChart .handle.hx { cursor: ew-resize; }
#bodeChart .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#bodeChart .handle:hover .knob, #bodeChart .handle:focus .knob { fill: var(--sel); }
#bodeChart .handle:hover .cc-pill rect, #bodeChart .handle:focus .cc-pill rect { fill: var(--x-eef3fe, #eef3fe); }
#bodeChart .handle:focus { outline: none; }
#bodeChart { touch-action: none; user-select: none; }
.ft-forb { fill: color-mix(in srgb, var(--bad) 9%, transparent); stroke: color-mix(in srgb, var(--bad) 45%, transparent); stroke-width: 1; }

/* stage chips */
.ft-stages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px 0; }
.ft-stages[hidden] { display: none; }
.ft-st { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 11px 3px 8px; font-size: 12px; line-height: 1; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.ft-st b { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--fill-1); font-size: 11px; font-weight: 600; color: var(--text-2); }
.ft-st:hover { border-color: var(--line-2); }
.ft-st.on { border-color: var(--sel); color: var(--text); }
.ft-st.on b { background: var(--sel); color: var(--on-accent); }
.ft-arrow { color: var(--text-3); font-size: 12px; }

/* the circuit */
.ft-w { fill: none; stroke: var(--steel-750); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.ft-part { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ft-plate { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.ft-amp { fill: var(--steel-50); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.ft-pm { font-size: 13px; font-weight: 600; fill: var(--text-2); }
.ft-dot { fill: var(--ink); }
.ft-term { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.ft-tlab { font-size: 12px; font-weight: 600; fill: var(--text-2); }
.ft-title { font-size: 12.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill.eq rect { stroke: rgba(23, 24, 26, .3); }
#view .pill.eq text { fill: var(--text); font-weight: 600; }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect, #view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }
.stage { position: relative; }
.ft-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.ft-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.ft-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* live strip and flags */
.ft-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 38px; align-items: center; }
.ft-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.ft-live i { font-style: normal; color: var(--text-3); }
.ft-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ft-flags span { font-size: 11.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; line-height: 1.4; }
.ft-flags span.bad, .ft-flags span.ft-err { color: var(--bad-ink, #b83225); border-color: color-mix(in srgb, var(--bad) 35%, transparent); white-space: normal; }

/* panel */
.ft-seg { margin-bottom: 6px; }
.ft-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
.ft-chips, .ft-order { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.ft-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.ft-order .ft-chip { min-width: 30px; }
.ft-chip:hover { border-color: var(--line-2); }
.ft-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.ft-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin: 6px 0; cursor: pointer; }
.ft-check input { margin: 0; }
.linkb { border: 0; background: none; padding: 0; color: var(--sel); cursor: pointer; font: inherit; text-decoration: underline; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel.fade-b { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
#panel.fade-t { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px); mask-image: linear-gradient(to bottom, transparent, #000 28px); }
#panel.fade-t.fade-b { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, #000 28px, #000 calc(100% - 32px), transparent); }

/* summary */
.ft-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.ft-big { font-weight: 600; color: var(--x-2b5ea7, #2b5ea7); }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

/* step chart and tables */
.ft-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.ft-tab, .ft-parts { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ft-tab th, .ft-parts th { font-size: 11.5px; font-weight: 500; color: var(--text-3); text-align: right; padding: 0 8px 6px; white-space: nowrap; }
.ft-tab th.l, .ft-tab td.l, .ft-parts th.l, .ft-parts td.l { text-align: left; }
.ft-tab td, .ft-parts td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: top; }
.ft-tab tr[data-stage] { cursor: pointer; }
.ft-tab tr[data-stage]:hover td { background: var(--bg); }
.ft-tab tr.sel td, .ft-parts tr.sel td { background: var(--x-eef3fe, #eef3fe); }
.ft-parts td small { color: var(--text-3); font-size: 11px; }
.ft-parts tr:not(.first) td { border-top-color: var(--fill-1); }

@media (max-width: 1100px) { .ft-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  #checks thead { display: none; }
  #checks, #checks tbody { display: block; width: 100%; }
  #checks tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  #checks td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; }
  #checks td.chk { grid-column: 1; grid-row: 1; }
  #checks td:nth-child(5) { grid-column: 2; grid-row: 1; align-self: center; }
  #checks td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  #checks td:nth-child(3) { grid-column: 2; grid-row: 2; font-size: 12.5px; text-align: right; }
  #checks td:nth-child(2)::before { content: "actual "; color: var(--text-3); }
  #checks td:nth-child(3)::before { content: "allowed "; color: var(--text-3); }
  #checks td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; font-size: 12px; color: var(--text-3); min-width: 0; }
  .ft-parts td, .ft-parts th { padding-left: 4px; padding-right: 4px; font-size: 12px; white-space: normal; }
  .ft-parts th:nth-child(5), .ft-parts th:nth-child(6) { white-space: normal; }
}
@media print { .ft-edit { display: none !important; } }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-2b5ea7: #79a5e5; --x-6e7177: #85827f; --x-b0321f: #ef8470; --x-d98b80: #f3b1a7; --x-eef3fe: #25282f;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-2b5ea7: #79a5e5; --x-6e7177: #85827f; --x-b0321f: #ef8470; --x-d98b80: #f3b1a7; --x-eef3fe: #25282f;
  }
}
/* theme-auto:end */
