/* Relief scenarios — on top of calc.css */
main.rf .tabs { grid-template-columns: repeat(3, 1fr); }
main.rf .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.rf .stage-bar .hist { margin-left: auto; }
#view { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
#view .hit { fill: transparent; stroke: none; }
#view .handle { cursor: grab; }
#view .handle.hv { cursor: ns-resize; }
#view .handle.hh { cursor: ew-resize; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }

/* the scene */
.rf-grade { fill: none; stroke: var(--steel-700); stroke-width: 1.4; }
.rf-ground { fill: url(#rfHatch); stroke: none; }
.rf-fireline { fill: none; stroke: var(--orange); stroke-width: 1.1; stroke-dasharray: 6 4; }
.rf-firezone { fill: color-mix(in srgb, var(--load) 4.5%, transparent); stroke: none; }
.rf-flame { fill: color-mix(in srgb, var(--load) 22%, transparent); stroke: var(--x-d2602f, #d2602f); stroke-width: 1; stroke-linejoin: round; }
.rf-flame.in { fill: color-mix(in srgb, var(--x-f0a03c, #f0a03c) 35%, transparent); stroke: none; }
.rf-shell { fill: var(--steel-50); stroke: var(--steel-700); stroke-width: 1.4; stroke-linejoin: round; }
.rf-liq { fill: color-mix(in srgb, var(--moment) 16%, transparent); stroke: none; }
.rf-wet { fill: none; stroke: var(--x-d2602f, #d2602f); stroke-width: 4.2; stroke-linejoin: round; stroke-linecap: round; opacity: .9; }
.rf-lvl { fill: none; stroke: var(--moment); stroke-width: 1.2; stroke-dasharray: 5 3; }
.rf-sup { fill: none; stroke: var(--steel-700); stroke-width: 1.3; }
.rf-dim { fill: none; stroke: var(--text-4); stroke-width: .9; }
.rf-pipe { fill: none; stroke: var(--steel-750); stroke-width: 1.6; stroke-linejoin: round; }
.rf-pipe.thin { stroke-width: 1.1; }
.rf-valve { fill: var(--surface); stroke: var(--steel-750); stroke-width: 1.3; stroke-linejoin: round; }
.rf-valve.shut { fill: var(--steel-750); }
.rf-valve.open { fill: var(--surface); }
.rf-psv { fill: var(--surface); stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.rf-psv.gov { stroke: var(--sel); }
.rf-hx { fill: var(--steel-50); stroke: var(--steel-750); stroke-width: 1.3; }
.rf-tube { fill: none; stroke: var(--x-8f979f, #8f979f); stroke-width: 1; }
.rf-break { fill: none; stroke: var(--x-d2602f, #d2602f); stroke-width: 1.6; }
.rf-flow { fill: none; stroke: var(--steel-750); stroke-width: 1.3; }
.rf-off { opacity: .38; }
.rf-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.rf-nm { cursor: text; }
.rf-nm:hover .rf-name, .rf-nm:focus .rf-name { fill: var(--sel); }
.rf-nm:focus { outline: none; }
.rf-cap { font-size: 11px; fill: var(--text-3); }
.rf-cap.fire { fill: var(--load-ink); }

/* pills */
#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.dim text { fill: var(--text); }
#view .pill.lv rect { stroke: color-mix(in srgb, var(--moment) 50%, transparent); } #view .pill.lv text { fill: var(--x-2c4a91, #2c4a91); font-weight: 600; }
#view .pill.aw rect { stroke: color-mix(in srgb, var(--x-d2602f, #d2602f) 55%, transparent); } #view .pill.aw text { fill: var(--load-ink); font-weight: 600; }
#view .pill.ps rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); } #view .pill.ps text { fill: var(--x-1d4fbf, #1d4fbf); font-weight: 600; }
#view .pill.sc text { fill: var(--text); }
#view .pill.sc.gov rect { stroke: color-mix(in srgb, var(--sel) 55%, transparent); stroke-width: 1.4; } #view .pill.sc.gov text { font-weight: 600; }
#view .pill.sc.na text { fill: var(--text-3); }
#view .pill.bad rect { stroke: color-mix(in srgb, var(--bad) 55%, transparent); } #view .pill.bad text { fill: var(--x-b0321f, #b0321f); 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; }

/* editors in the drawing */
.stage { position: relative; }
.rf-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); }
.rf-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.rf-edit-name input { width: 180px; text-align: center; }
.rf-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* live strip and flags */
.rf-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; }
.rf-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.rf-live i { font-style: normal; color: var(--text-3); }
.rf-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.rf-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.35; }
.rf-flags span.bad, .rf-flags span.rf-err { color: var(--bad-ink, #b0321f); border-color: color-mix(in srgb, var(--bad) 35%, transparent); white-space: normal; }

/* panel */
.rf-seg { margin-bottom: 6px; }
.rf-seg button { white-space: normal; line-height: 1.25; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel select.rf-sel { display: block; width: 100%; min-width: 0; margin: 2px 0 8px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); font-size: 13px; }
#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); }
.rf-off-note { font-size: 12.5px; color: var(--text-3); margin: 2px 0 6px; }

/* summary */
.rf-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 40ch; }
.rf-big { font-weight: 600; color: var(--x-1d4fbf, #1d4fbf); }

/* scenario table */
.rf-sc { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rf-sc th { font-weight: 500; color: var(--text-3); font-size: 12px; text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rf-sc th.l, .rf-sc td.l { text-align: left; }
.rf-sc td { padding: 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.rf-sc td .why { display: block; color: var(--text-3); font-size: 12px; line-height: 1.4; white-space: normal; font-weight: 400; margin-top: 2px; max-width: 46ch; }
.rf-sc td b { font-weight: 500; }
.rf-sc tr.gov td { background: var(--x-eef3fe, #eef3fe); }
.rf-sc tr.off td { color: var(--text-3); }
.rf-sc tr[data-sc] { cursor: pointer; }
.rf-sc tr[data-sc]:hover td { background: var(--bg); }
.rf-sc tr.gov[data-sc]:hover td { background: var(--sel-bg-2); }
.rf-tag { display: inline-flex; align-items: center; font-size: 11.5px; line-height: 1; border-radius: 999px; padding: 4px 9px; border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.rf-tag.gov { border-color: color-mix(in srgb, var(--sel) 45%, transparent); color: var(--x-1d4fbf, #1d4fbf); font-weight: 600; }
.rf-tag.na { color: var(--text-3); }
.rf-tag.err { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* charts */
.rf-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#lvlChart, #areaChart { touch-action: none; user-select: none; }
#lvlChart .cdrag { cursor: ew-resize; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 1100px) { .rf-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  #checks thead, .rf-sc thead { display: none; }
  #checks, #checks tbody, .rf-sc, .rf-sc 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; }
  .rf-sc tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
  .rf-sc td { display: block; border: 0; padding: 0; text-align: left; }
  .rf-sc td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .rf-sc td:nth-child(6) { grid-column: 2; grid-row: 1; }
  .rf-sc td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  .rf-sc td:nth-child(2)::before { content: "rate "; color: var(--text-3); }
  .rf-sc td:nth-child(3) { grid-column: 2; grid-row: 2; font-size: 12.5px; text-align: right; }
  .rf-sc td:nth-child(4) { grid-column: 1; grid-row: 3; font-size: 12.5px; }
  .rf-sc td:nth-child(4)::before { content: "at "; color: var(--text-3); }
  .rf-sc td:nth-child(5) { grid-column: 2; grid-row: 3; font-size: 12.5px; text-align: right; }
}
@media print { .rf-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-1d4fbf: #749ff5; --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8f979f: #61676d; --x-b0321f: #ef8470;
    --x-d2602f: #fb9a73; --x-eef3fe: #25282f; --x-f0a03c: #fdbd78;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1d4fbf: #749ff5; --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8f979f: #61676d; --x-b0321f: #ef8470;
    --x-d2602f: #fb9a73; --x-eef3fe: #25282f; --x-f0a03c: #fdbd78;
  }
}
/* theme-auto:end */
