/* Wire size and voltage drop — on top of calc.css */
main.wr .tabs { grid-template-columns: repeat(4, 1fr); }
main.wr .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.wr .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.hy { cursor: ns-resize; }
#view .handle.hd { cursor: nwse-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); }

/* circuit */
.wr-box { fill: var(--steel-50); stroke: var(--steel-700); stroke-width: 1.1; }
.wr-sym { fill: none; stroke: var(--steel-750); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.wr-tiny { font-size: 10.5px; fill: var(--text-3); }
.wr-line { fill: none; stroke: var(--steel-750); stroke-width: 1.4; }
.wr-line.n { stroke: var(--x-7f8a99, #7f8a99); stroke-dasharray: 5 3; }
.wr-brk { fill: var(--surface); stroke: var(--steel-700); stroke-width: 1; }
.wr-contact { fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }
.wr-node { fill: var(--text); }
.wr-cur line { stroke: var(--moment); stroke-width: 1.8; }
.wr-cur path { fill: var(--moment); stroke: none; }
.wr-axis { fill: none; stroke: var(--steel-550); stroke-width: 1; }
.wr-axt { font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.wr-ext { fill: none; stroke: var(--steel-400); stroke-width: .8; }
.wr-dim { fill: none; stroke: var(--text-2); stroke-width: 1; }
.wr-dimh { fill: var(--text-2); stroke: none; }
.wr-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.wr-role { font-size: 11px; fill: var(--text-3); }
.wr-nm, .wr-mt { cursor: pointer; }
.wr-nm:hover .wr-name, .wr-nm:focus .wr-name, .wr-mt:hover .wr-name, .wr-mt:focus .wr-name { fill: var(--sel); }
.wr-nm:focus, .wr-mt:focus { outline: none; }

/* voltage profile */
.wr-plot { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.wr-okband { fill: color-mix(in srgb, var(--good) 7%, transparent); stroke: none; }
.wr-grid { fill: var(--fill-1); stroke: none; }
.wr-lim { fill: none; stroke: var(--bad); stroke-width: 1; stroke-dasharray: 5 3; }
.wr-vline { fill: none; stroke: var(--blue-4); stroke-width: 2; }
.wr-vline.bad { stroke: var(--bad); }
.wr-vext { fill: none; stroke: var(--blue-5); stroke-width: 1.2; stroke-dasharray: 3 3; }
.wr-cross { fill: var(--surface); stroke: var(--text-2); stroke-width: 1.4; }

/* section */
.wr-sec { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.wr-sep { fill: none; stroke: var(--line); stroke-width: 1; }
.wr-cu { fill: var(--x-d9a273, #d9a273); stroke: var(--x-8a5a32, #8a5a32); stroke-width: 1; }
.wr-cuw { fill: var(--x-e8b98d, #e8b98d); stroke: var(--x-9a6a40, #9a6a40); stroke-width: .5; }
.wr-al { fill: var(--x-c4c9cf, #c4c9cf); stroke: var(--steel-650); stroke-width: 1; }
.wr-alw { fill: var(--steel-300); stroke: var(--steel-600); stroke-width: .5; }
.wr-core { font-size: 10.5px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: color-mix(in srgb, var(--surface) 85%, transparent); stroke-width: 3px; pointer-events: none; }
.wr-scale { fill: none; stroke: var(--text-2); stroke-width: 1.2; }

/* 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.cur rect { stroke: color-mix(in srgb, var(--moment) 45%, transparent); } #view .pill.cur text { fill: var(--x-2c4a91, #2c4a91); font-weight: 600; }
#view .pill.desig rect { stroke: color-mix(in srgb, var(--sel) 45%, transparent); } #view .pill.desig text { fill: var(--x-1e4fbf, #1e4fbf); font-weight: 600; }
#view .pill.bad rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); } #view .pill.bad text { fill: var(--x-b0321f, #b0321f); }
#view .pill.lim rect { stroke: color-mix(in srgb, var(--bad) 35%, transparent); } #view .pill.lim text { fill: var(--x-b0321f, #b0321f); }
#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; }
.wr-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); }
.wr-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.wr-edit-name input { width: 180px; text-align: center; }
.wr-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.wr-seg { margin-bottom: 6px; }
.wr-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 8px; }
.wr-chip { display: inline-flex; align-items: center; line-height: 1.2; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; font-family: inherit; }
.wr-chip:hover { border-color: var(--line-2); }
.wr-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.wr-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 2px 0 8px; }
.wr-meth { display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 8px 4px 4px; cursor: pointer; font: inherit; font-size: 11.5px; line-height: 1.3; color: var(--text-3); min-width: 0; }
.wr-meth b { display: block; font-weight: 600; font-size: 12px; color: var(--text-2); }
.wr-meth:hover { border-color: var(--line-2); }
.wr-meth.on { border-color: var(--text); background: var(--surface-2); }
.wr-meth.on b { color: var(--text); }
.wr-picto { flex: none; display: block; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel select { max-width: 100%; }
#panel .f.sel { grid-template-columns: auto minmax(0, 1fr); }
#panel .f.sel select { min-width: 0; width: 100%; }
#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 */
.wr-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.wr-des { font-weight: 600; color: var(--x-1e4fbf, #1e4fbf); }
.wr-tag { display: inline-flex; align-items: center; font-size: 10.5px; line-height: 1; color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); border-radius: 999px; padding: 3px 7px; margin-left: 6px; white-space: nowrap; vertical-align: 1px; }

/* chart, sizes */
#vdChart { touch-action: none; user-select: none; }
#vdChart .cdrag { cursor: ew-resize; }
table.wr-sizes { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.wr-sizes th { font-weight: 500; font-size: 11.5px; color: var(--text-3); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wr-sizes td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wr-sizes th.l, .wr-sizes td.l { text-align: left; }
.wr-sizes tbody tr { cursor: pointer; }
.wr-sizes tbody tr:hover td { background: var(--surface-2); }
.wr-sizes tr.sel td { background: var(--sel-bg); }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 760px) {
  table.wr-sizes thead { display: none; }
  table.wr-sizes, .wr-sizes tbody, .wr-sizes tr, .wr-sizes td { display: block; width: 100%; }
  .wr-sizes tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .wr-sizes td { border: 0; padding: 0; text-align: left; white-space: normal; }
  .wr-sizes td:nth-child(1) { font-weight: 500; }
  .wr-sizes td:last-child { grid-column: 2; grid-row: 1; text-align: right; }
  .wr-sizes td:nth-child(2)::before { content: "tabulated "; color: var(--text-3); }
  .wr-sizes td:nth-child(3)::before { content: "IZ "; color: var(--text-3); }
  .wr-sizes td:nth-child(4)::before { content: "drop "; color: var(--text-3); }
  .wr-sizes td:nth-child(5)::before { content: "longest run "; color: var(--text-3); }
  .wr-sizes.sc td:nth-child(6)::before { content: "withstand "; color: var(--text-3); }
  .wr-methods { grid-template-columns: 1fr; }
  #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 { .wr-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-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-7f8a99: #68717c; --x-8a5a32: #c79c7b;
    --x-8a7b5c: #8c8067; --x-9a6a40: #cea381; --x-b0321f: #ef8470; --x-c4c9cf: #3f4347; --x-c8b98f: #897d5d;
    --x-c98a4b: #e9b381; --x-d9a273: #edbf98; --x-e8b98d: #d2ac89; --x-f3c3b8: #5f3f38; --x-f6e1c6: #3b2e1c;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-1e4fbf: #749ff5; --x-2c4a91: #81a0e0; --x-6e7177: #85827f; --x-7f8a99: #68717c; --x-8a5a32: #c79c7b;
    --x-8a7b5c: #8c8067; --x-9a6a40: #cea381; --x-b0321f: #ef8470; --x-c4c9cf: #3f4347; --x-c8b98f: #897d5d;
    --x-c98a4b: #e9b381; --x-d9a273: #edbf98; --x-e8b98d: #d2ac89; --x-f3c3b8: #5f3f38; --x-f6e1c6: #3b2e1c;
  }
}
/* theme-auto:end */

/* copper in dark, picked by hand (after the generated block, so these win): the rule turned the conductors pale
   peach that glowed and lost the strands; here copper stays a warm metal a step above the paper, strands lit, the
   gaps between them dark */
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --x-d9a273: #a46b3d; --x-8a5a32: #d39b69; --x-e8b98d: #b9804e; --x-9a6a40: #6b4325; --x-c98a4b: #b57a46; } }
@media screen { :root[data-theme="dark"] { --x-d9a273: #a46b3d; --x-8a5a32: #d39b69; --x-e8b98d: #b9804e; --x-9a6a40: #6b4325; --x-c98a4b: #b57a46; } }

