/* Pinch analysis — on top of calc.css */
main.pn .tabs { grid-template-columns: repeat(3, 1fr); }
main.pn .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.pn .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: 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 composite curves */
.pn-plot { fill: var(--surface); stroke: var(--faint); stroke-width: 1; }
.pn-grid { fill: var(--fill-1); stroke: none; }
.pn-tick { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.pn-axt { font-size: 11.5px; fill: var(--text-3); }
.pn-hot { fill: none; stroke: var(--x-b5482d, #b5482d); stroke-width: 2.2; stroke-linejoin: round; }
.pn-cold { fill: none; stroke: var(--moment); stroke-width: 2.2; stroke-linejoin: round; }
.pn-qh { fill: color-mix(in srgb, var(--x-b5482d, #b5482d) 7%, transparent); stroke: none; }
.pn-qc { fill: color-mix(in srgb, var(--moment) 7%, transparent); stroke: none; }
.pn-pinch { fill: none; stroke: var(--x-8a5a0e, #8a5a0e); stroke-width: 1.2; stroke-dasharray: 4 3; }
.pn-pdot { stroke: var(--halo); stroke-width: 1.2; }
.pn-pdot.h { fill: var(--x-b5482d, #b5482d); } .pn-pdot.c { fill: var(--moment); }
.pn-pl { fill: none; stroke-width: 1; stroke-dasharray: 4 3; }
.pn-pl.h { stroke: var(--x-b5482d, #b5482d); } .pn-pl.c { stroke: var(--moment); }
.pn-ll { font-size: 11px; font-weight: 500; fill: var(--text-3); }
.pn-ll.h { fill: var(--x-9a3b24, #9a3b24); } .pn-ll.c { fill: var(--x-2c4a91, #2c4a91); }
.pn-snr { fill: var(--surface); stroke-width: 1; } .pn-snr.h { stroke: color-mix(in srgb, var(--x-b5482d, #b5482d) 45%, transparent); } .pn-snr.c { stroke: color-mix(in srgb, var(--moment) 45%, transparent); }
.pn-sn { font-size: 11.5px; font-weight: 600; } .pn-sn.h { fill: var(--x-9a3b24, #9a3b24); } .pn-sn.c { fill: var(--x-2c4a91, #2c4a91); }
.pn-snm { cursor: text; } .pn-snm:hover .pn-snr, .pn-snm:focus .pn-snr { stroke: var(--sel); } .pn-snm:focus { outline: none; }
.pn-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.pn-nm { cursor: text; }
.pn-nm:hover .pn-name, .pn-nm:focus .pn-name { fill: var(--sel); }
.pn-nm:focus { outline: none; }
#view .handle.hc { cursor: ew-resize; }
#view .handle.hs { 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.hp rect { stroke: color-mix(in srgb, var(--x-b5482d, #b5482d) 50%, transparent); } #view .pill.hp text { fill: var(--x-9a3b24, #9a3b24); font-weight: 600; }
#view .pill.cp rect { stroke: color-mix(in srgb, var(--moment) 50%, transparent); } #view .pill.cp text { fill: var(--x-2c4a91, #2c4a91); font-weight: 600; }
#view .pill.dp rect { stroke: color-mix(in srgb, var(--sel) 40%, transparent); } #view .pill.dp text { fill: var(--x-1d4fbf, #1d4fbf); font-weight: 600; }
#view .pill.pp rect { stroke: color-mix(in srgb, var(--x-8a5a0e, #8a5a0e) 45%, transparent); } #view .pill.pp text { fill: var(--wip-ink); font-weight: 600; }
#view .pill.sh text { fill: var(--x-9a3b24, #9a3b24); } #view .pill.sc text { fill: var(--x-2c4a91, #2c4a91); }
#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; }
.pn-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); }
.pn-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.pn-edit-name input { width: 180px; text-align: center; }
.pn-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.pn-seg { margin-bottom: 6px; }
#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); }
.pn-pts { width: 100%; border-collapse: collapse; margin: 4px 0 8px; font-size: 12.5px; }
.pn-pts th { font-weight: 500; color: var(--text-3); text-align: left; padding: 2px 4px; }
.pn-pts td { padding: 2px 4px; }
.pn-pts input { width: 100%; box-sizing: border-box; font: inherit; font-variant-numeric: tabular-nums; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--surface); }
.pn-pts input[readonly] { color: var(--text-3); background: var(--bg); }
.pn-del { font-size: 14px; line-height: 1; padding: 2px 8px; }

/* summary */
.pn-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.pn-big { font-weight: 600; }
.pn-big.h { color: var(--x-9a3b24, #9a3b24); }
.pn-big.c { color: var(--x-2c4a91, #2c4a91); }

/* charts and the tank table */
.pn-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pn-two > :only-child, .pn-two > .card:not([hidden]):last-child:nth-child(odd):not(:first-child) { grid-column: 1 / -1; }
#gccChart, #tgtChart, #costChart { touch-action: none; user-select: none; }
.fb-chart .cdrag { cursor: ew-resize; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }
#ptable { width: 100%; }
#ptable td, #ptable th { font-variant-numeric: tabular-nums; }
#ptable tr.pin td { background: color-mix(in srgb, var(--amber) 10%, transparent); font-weight: 600; }
#ptable tr.hu td { color: var(--text-3); }

@media (max-width: 1100px) { .pn-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; }
  #ptable { font-size: 12px; }
}
@media print { .pn-edit { display: none !important; } }

/* the stream editor in the panel */
.pn-st { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 4px; margin-bottom: 8px; }
.pn-st.hot { background: color-mix(in srgb, var(--x-b5482d, #b5482d) 3%, transparent); } .pn-st.cold { background: color-mix(in srgb, var(--moment) 3%, transparent); }
.pn-st-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pn-nm, .pn-unm { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; width: 110px; background: var(--surface); }
.pn-unm { width: 100%; box-sizing: border-box; font-weight: 500; }
.pn-st.hot .pn-nm { color: var(--x-9a3b24, #9a3b24); } .pn-st.cold .pn-nm { color: var(--x-2c4a91, #2c4a91); }
.pn-kind { font-size: 11.5px; color: var(--text-3); flex: 1; }
.pn-del { font-size: 14px; line-height: 1; padding: 2px 8px; }
.pn-add { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }

/* 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-8a5a0e: #c89e6a; --x-9a3b24: #de8974;
    --x-b5482d: #ed8e76;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1d4fbf: #749ff5; --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-9a3b24: #de8974;
    --x-b5482d: #ed8e76;
  }
}
/* theme-auto:end */
