/* fatigue — on top of calc.css */
main.fat .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.fat .stage-bar .hist { margin-left: auto; }
main.fat .stage-bar .seg button sub { font-size: .75em; line-height: 0; }
#lineSeg[hidden] { display: none; }
.ft-hero { display: flex; flex-direction: column; min-width: 0; overflow: hidden; position: relative; }
#view { display: block; width: 100%; height: auto; flex: 1; min-height: 0; user-select: none; -webkit-user-select: none; touch-action: none; }
#view.dragging, #view.dragging * { cursor: grabbing !important; }
#view .hit, #sn .hit { fill: transparent; stroke: none; }
#view .handle.pt, #sn .handle.pt { cursor: grab; }
#view .handle.line { cursor: grab; }
#view .handle.vline { cursor: ew-resize; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob { fill: var(--sel); }
#view .handle.pt:hover circle:last-child, #sn .handle.pt:hover circle:last-child { stroke: var(--sel); }
.ch-t { font-size: calc(10.5px * var(--tk, 1)); fill: var(--text-3); font-variant-numeric: tabular-nums; }
.ch-a { font-size: calc(11px * var(--tk, 1)); fill: var(--text-2); }
.ch-l { font-size: calc(11px * var(--tk, 1)); font-weight: 600; }
#sn .ch-t, #sn .ch-a, #sn .ch-l, .ft-hg .ch-t, .ft-hg .ch-a { --tk: 1; }

/* pills in the drawings (sized from the measured text) */
.pill rect { fill: var(--on-accent); stroke: var(--steel-300); }
.pill text { font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .pill text { font-size: calc(11.5px * var(--tk, 1)); }
#sn .pill text { font-size: 11px; }
.pill.editable { cursor: text; }
.pill.editable:hover rect { stroke: var(--sel); stroke-width: 1.4; }
.pill.editable:focus { outline: none; }
.pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.6; }
.pill.ax text { fill: var(--text-2); }
.pill.cur text, .pill.res text { font-weight: 600; }
.pill.good rect { stroke: color-mix(in srgb, var(--good) 55%, transparent); } .pill.good text { fill: var(--good); }
.pill.warn rect { stroke: color-mix(in srgb, var(--warn) 60%, transparent); } .pill.warn text { fill: var(--x-9a6a12, #9a6a12); }
.pill.bad rect { stroke: color-mix(in srgb, var(--bad) 60%, transparent); } .pill.bad text { fill: var(--bad); }
.pill.res rect { fill: var(--surface); }

.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: 34px; align-items: center; }
.ft-live b { font-weight: 500; color: var(--text-3); margin-right: 4px; }
.ft-live .x-ok { color: var(--good); font-weight: 500; }
.ft-live .x-no { color: var(--bad); font-weight: 500; }

/* in-place editor */
.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: 92px; 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); }

/* examples menu */
.ex-wrap { position: relative; }

/* panel */
.tabs.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.f.segf { grid-template-columns: minmax(0, 1fr) auto; }
.f.segf .seg button { padding: 4px 9px; font-size: 12.5px; }
.f.segf.stack { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.f.segf.stack > label:has(span:empty) { display: none; }
.f.segf.stack > label { grid-template-columns: minmax(0, 1fr); }
.f.segf.stack > label i:empty { display: none; }
.f.segf.stack .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.f.segf.stack .seg button { padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; color: var(--text-2); margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; text-align: right; }
.facts b { color: var(--text); font-weight: 600; }
.warn-t { color: var(--warn); }
.src-tag { font-size: 11px; color: var(--text-3); }
.check.crit { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.check.crit .sw { width: 16px; height: 3px; border-radius: 2px; flex: none; }
.check.crit em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ft-dpick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ft-dt { display: grid; justify-items: center; gap: 1px; padding: 6px 8px 7px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.ft-dt svg { width: 100%; max-width: 132px; height: auto; }
.ft-dt b { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.25; }
.ft-dt small { font-size: 11px; color: var(--text-3); }
.ft-dt:hover { border-color: var(--line-2); background: var(--surface-2); }
.ft-dt.on { border-color: var(--sel); background: var(--sel-bg); }
.ft-dt:disabled { opacity: .45; cursor: default; }

/* summary */
.ft-sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.story { padding: 14px 20px; display: grid; align-content: center; gap: 6px; min-width: 0; }
.story p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); max-width: 76ch; }
.story p.sub { font-size: 12.5px; color: var(--text-2); }
.story .mode { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.ft-mini { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); border-left: 1px solid var(--line); }
.ft-mini .stat { border-left: 0; border-top: 1px solid var(--line); }
.ft-mini .stat:nth-child(-n+2) { border-top: 0; }
.ft-mini .stat:nth-child(even) { border-left: 1px solid var(--line); }
@media (max-width: 1320px) {
  .ft-sum { grid-template-columns: minmax(0, 1fr); }
  .ft-mini { grid-template-columns: repeat(4, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--line); }
  .ft-mini .stat { border-top: 0; border-left: 1px solid var(--line); }
  .ft-mini .stat:first-child { border-left: 0; }
}
@media (max-width: 700px) {
  .ft-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ft-mini .stat:nth-child(odd) { border-left: 0; }
  .ft-mini .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
main.fat #summary { min-height: 150px; }

/* margins */
#checks tr[data-check] { cursor: default; }
#checks td.note { white-space: normal; min-width: 180px; color: var(--text-3); }
#checks td.chk { white-space: normal; }
@media (max-width: 700px) {
  #checks th:nth-child(4), #checks td:nth-child(4), #checks th:nth-child(3), #checks td:nth-child(3) { display: none; }
  .margins td, .margins th { padding-left: 4px; padding-right: 4px; }
  .margins .ms { min-width: 54px; padding: 2px 6px; }
}

/* failure preview card */
.ft-pv { position: fixed; z-index: 60; width: 236px; padding: 8px 8px 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(20, 24, 30, .14); pointer-events: none; font-size: 12px; color: var(--text); }
.ft-pv[hidden] { display: none; }
.ft-pv svg { display: block; width: 220px; height: auto; margin: 4px 0 6px; }
.ft-pv .pv-h { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-pv .pv-c { color: var(--text-2); line-height: 1.35; }
.ft-pv .pv-m { margin-top: 4px; }
.ft-pv .pv-t { font-size: 10px; fill: var(--text-3); }
@media print { .ft-pv { display: none !important; } }

/* second row: S-N and the endurance cascade */
.ft-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
#sn { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
@media (max-width: 1040px) { .ft-row { grid-template-columns: minmax(0, 1fr); } }
.ft-wf { display: grid; gap: 7px; margin-top: 4px; }
.ft-wf .r { display: grid; grid-template-columns: 112px minmax(0, 1fr) 86px; grid-template-rows: auto auto; column-gap: 10px; align-items: center; font-size: 13px; }
.ft-wf .k { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.ft-wf .hb { height: 12px; border-radius: 6px; background: var(--fill-1); overflow: hidden; }
.ft-wf .hb i { display: block; height: 100%; background: var(--x-b9c3d9, #b9c3d9); border-radius: 6px; }
.ft-wf .r.fin .hb i { background: var(--moment); }
.ft-wf .r.fin .k, .ft-wf .r.fin .v { color: var(--text); font-weight: 600; }
.ft-wf .r.nom .hb i { background: var(--x-d8dce3, #d8dce3); }
.ft-wf .v { text-align: right; font-variant-numeric: tabular-nums; }
.ft-wf .d { grid-column: 2 / 4; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* variable amplitude */
.ft-sp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 10px; }
.ft-sp-off { margin: 0; }
.ft-sp-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: 20px; align-items: start; }
.ft-sp-l .f { padding: 3px 0; }
.ft-sp-in { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
table.ft-bt { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
.ft-bt th { font-weight: 500; font-size: 12px; color: var(--text-3); text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ft-bt th:first-child { text-align: left; }
.ft-bt td { padding: 3px 4px; border-bottom: 1px solid var(--fill-1); }
.ft-bt td.rn { color: var(--text-3); font-size: 12px; width: 22px; }
.ft-bt input { width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; text-align: right; font: inherit; font-variant-numeric: tabular-nums; background: var(--surface-2); }
.ft-bt input:focus { outline: none; border-color: var(--line-2); background: var(--surface); }
.ft-bt .x { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 15px; border-radius: 6px; padding: 0 6px; }
.ft-spec textarea { width: 100%; box-sizing: border-box; font: 12.5px/1.5 ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.ft-spec textarea:focus { outline: none; border-color: var(--line-2); }
.ft-sp-btns { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.ft-sp-btns .small-note { margin: 0; }
.ft-sp-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.ft-sp-res > div { display: grid; gap: 1px; }
.ft-sp-res .k { font-size: 12px; color: var(--text-3); }
.ft-sp-res b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ft-sp-res .s { font-size: 12px; color: var(--text-2); }
.ft-sp-ch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.ft-sp-ch h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.ft-hg { display: block; width: 100%; max-width: 380px; height: auto; }
.ft-hg .hg-n { font-size: 9.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ft-db { display: grid; gap: 6px; }
.ft-db .r { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: 12px; }
.ft-db .k { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ft-db .hb { height: 10px; border-radius: 5px; background: var(--fill-1); overflow: hidden; }
.ft-db .hb i { display: block; height: 100%; background: var(--bad); opacity: .7; border-radius: 5px; }
.ft-db .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
@media (max-width: 1040px) { .ft-sp-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) { .ft-sp-ch { grid-template-columns: minmax(0, 1fr); } .ft-sp-res { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ft-wf .r { grid-template-columns: 96px minmax(0, 1fr) 78px; } }

/* steps */
details.step.gov > summary .t::after { content: "governs"; margin-left: 10px; font-size: 11px; font-weight: 600; color: var(--bad); letter-spacing: .03em; text-transform: uppercase; }
.step .where { font-size: 12px; color: var(--text-3); margin: 6px 0 0; line-height: 1.6; }
.refs-body .md-src li { margin: 5px 0; }
.sec-tag { font-style: normal; font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
@media (max-width: 700px) { .step .eq .katex { font-size: .86em; } }
/* panel labels wrap to a second line instead of ending in an ellipsis (T029 QA) */
.f > label span { overflow: visible; text-overflow: clip; white-space: normal; line-height: 1.3; }

/* 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-6d4fb3: #ab96ed; --x-6e7177: #85827f; --x-9a6a12: #d0a66a; --x-b9c3d9: #3f4655; --x-cfd3d8: #3e3c38;
    --x-d8dce3: #34363b;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-6d4fb3: #ab96ed; --x-6e7177: #85827f; --x-9a6a12: #d0a66a; --x-b9c3d9: #3f4655; --x-cfd3d8: #3e3c38;
    --x-d8dce3: #34363b;
  }
}
/* theme-auto:end */
