/* Heat exchanger — on top of calc.css */
main.hx .tabs { grid-template-columns: repeat(3, 1fr); }
main.hx .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.hx .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.hx { 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); }

/* exchanger */
.hx-wall { fill: none; stroke: var(--steel-750); stroke-width: 1.3; stroke-linejoin: round; }
.hx-tube { fill: none; stroke: var(--steel-750); stroke-width: 1.1; }
.hx-ghost { fill: var(--steel-50); stroke: var(--steel-500); stroke-width: 1; }
.hx-baffle { fill: none; stroke: var(--steel-700); stroke-width: 1.6; }
.hx-frame { fill: var(--steel-250); stroke: var(--steel-750); stroke-width: 1.1; }
.hx-plate { stroke: var(--steel-700); stroke-width: .7; }
.hx-bar { fill: none; stroke: var(--steel-750); stroke-width: 2.2; }
.hx-port { fill: var(--surface); stroke: var(--steel-750); stroke-width: 1.2; }
.hx-fin { fill: none; stroke: var(--x-8f979f, #8f979f); stroke-width: .6; }
.hx-ctube { fill: none; stroke: var(--x-6e7780, #6e7780); stroke-width: 1.4; }
.hx-dim { fill: none; stroke: var(--steel-550); stroke-width: 1; }
.hx-req { fill: none; stroke-width: 2.2; }
.hx-run { fill: none; stroke-width: 1.6; stroke-dasharray: 3 13; stroke-linecap: round; pointer-events: none; }
.hx-run.hot { stroke: var(--x-e98a7e, #e98a7e); }
.hx-run.cold { stroke: var(--x-8fb0ea, #8fb0ea); }
.hx-name { font-size: 12.5px; font-weight: 600; }
.hx-nm { cursor: text; }
.hx-nm:hover .hx-name, .hx-nm:focus .hx-name { fill: var(--sel) !important; }
.hx-nm:focus { outline: none; }
#view .handle.hy { cursor: ns-resize; }

/* 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.hot rect { stroke: color-mix(in srgb, var(--bad) 45%, transparent); } #view .pill.hot text { fill: var(--x-a23224, #a23224); font-weight: 600; }
#view .pill.cold rect { stroke: color-mix(in srgb, var(--x-2f63c9, #2f63c9) 45%, transparent); } #view .pill.cold text { fill: var(--x-2350a8, #2350a8); font-weight: 600; }
#view .pill.outp rect { stroke-dasharray: 3 2; }
#view .pill.miss rect { stroke: var(--bad); stroke-width: 1.4; }
#view .pill.flowp text { font-weight: 500; }
#view .pill.area rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); } #view .pill.area text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#view .pill.req.good text { fill: var(--good); } #view .pill.req.warn text { fill: var(--x-9a6a12, #9a6a12); } #view .pill.req.bad rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); } #view .pill.req.bad text { fill: var(--x-b0321f, #b0321f); font-weight: 600; }
#view .pill.target rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); } #view .pill.target text { fill: var(--x-1e4fbf, #1e4fbf); }
#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; }
.hx-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); }
.hx-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.hx-edit-name input { width: 180px; text-align: center; }
.hx-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

/* live strip and flags */
.hx-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; }
.hx-live b { font-weight: 500; color: var(--text-3); margin-right: 5px; }
.hx-live i { font-style: normal; color: var(--text-3); }
.hx-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.hx-flags span { font-size: 11.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.hx-flags span.bad, .hx-flags span.hx-err { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); white-space: normal; }

/* panel */
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel .small-note a { color: inherit; }
#panel .f.sel select { width: 100%; min-width: 0; }
.hx-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
.hx-seg { margin-bottom: 6px; flex-wrap: wrap; }
#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, charts, links */
.hx-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 36ch; }
.hx-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#eChart { touch-action: none; user-select: none; }
#eChart .edrag { cursor: ew-resize; }
.hx-links { display: flex; flex-wrap: wrap; gap: 6px; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 1100px) { .hx-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; }
}
@media print { .hx-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-1e4fbf: #749ff5; --x-2350a8: #749eeb; --x-2f63c9: #79a7fd; --x-6e7177: #85827f; --x-6e7780: #788087;
    --x-8f979f: #61676d; --x-8fb0ea: #afcbfb; --x-9a6a12: #d0a66a; --x-a23224: #e58474; --x-b0321f: #ef8470;
    --x-b08d57: #d1b488; --x-c3c9cf: #3f4347; --x-e98a7e: #fdb0a5;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1e4fbf: #749ff5; --x-2350a8: #749eeb; --x-2f63c9: #79a7fd; --x-6e7177: #85827f; --x-6e7780: #788087;
    --x-8f979f: #61676d; --x-8fb0ea: #afcbfb; --x-9a6a12: #d0a66a; --x-a23224: #e58474; --x-b0321f: #ef8470;
    --x-b08d57: #d1b488; --x-c3c9cf: #3f4347; --x-e98a7e: #fdb0a5;
  }
}
/* theme-auto:end */
