/* Earth fault loop — on top of calc.css */
main.eloop .tabs { grid-template-columns: repeat(3, 1fr); }
main.eloop .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.eloop .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 .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob, #view .handle:focus .knob { fill: var(--sel); }
#view .handle:focus { outline: none; }

/* single-line diagram */
.el-w { fill: none; stroke: var(--steel-750); stroke-width: 1.4; stroke-linecap: round; }
.el-w.hv { stroke: var(--violet); }
.el-bus { stroke: var(--ink); stroke-width: 4.5; stroke-linecap: butt; }
.el-bus.hv { stroke: var(--violet); stroke-width: 3.5; }
.el-grid { fill: var(--surface); stroke: var(--steel-750); stroke-width: 1.3; }
.el-hatch { fill: none; stroke: var(--steel-500); stroke-width: .8; }
.el-coil { fill: color-mix(in srgb, var(--surface) 85%, transparent); stroke: var(--steel-750); stroke-width: 1.4; }
.el-coil.hv { stroke: var(--violet); }
.el-sym { fill: none; stroke: var(--steel-750); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.el-earth { fill: none; stroke: var(--steel-750); stroke-width: 1.1; }
.el-cab { fill: none; stroke: var(--steel-750); stroke-width: 2.6; stroke-linecap: round; }
.el-cab.al { stroke: var(--x-8f979f, #8f979f); }
.el-cab.hv { stroke: var(--violet); }
.el-tick { stroke: var(--steel-750); stroke-width: 1.2; }
.el-motor { fill: var(--steel-50); stroke: var(--steel-750); stroke-width: 1.3; }
.el-mtext { font-size: 12px; font-weight: 600; fill: var(--steel-750); }
.el-mtext.s { font-size: 9.5px; font-weight: 500; }
.el-board { fill: var(--steel-50); stroke: var(--steel-700); stroke-width: 1.1; }
.el-bolt { fill: var(--load, #e0562b); stroke: none; }
.el-flow { fill: none; stroke: var(--load, #e0562b); stroke-width: 1.8; }
.el-flowh { fill: var(--load, #e0562b); stroke: none; }
.el-name { font-size: 12px; font-weight: 600; fill: var(--text); }
.el-role { font-size: 11px; fill: var(--text-3); }
.el-nm { cursor: text; }
.el-nm:hover .el-name, .el-nm:focus .el-name { fill: var(--sel); }
.el-nm:focus { outline: none; }
.el-off { opacity: .35; }

/* 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.ik rect { stroke: color-mix(in srgb, var(--load) 55%, transparent); } #view .pill.ik text { fill: var(--x-b0421f, #b0421f); font-weight: 600; }
#view .pill.part rect { stroke: color-mix(in srgb, var(--load) 35%, transparent); } #view .pill.part text { fill: var(--x-b0421f, #b0421f); }
#view .pill.eq rect { stroke: rgba(23, 24, 26, .3); } #view .pill.eq text { fill: var(--text); font-weight: 600; }
#view .pill.hvp rect { stroke: color-mix(in srgb, var(--violet) 45%, transparent); } #view .pill.hvp text { fill: var(--x-57467a, #57467a); }
#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; }
.el-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); }
.el-edit input { width: 82px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.el-edit-name input { width: 180px; text-align: center; }
.el-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.el-seg { margin-bottom: 6px; }
.el-lab { font-size: 12px; color: var(--text-3); margin: 8px 0 4px; }
.el-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.el-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; }
.el-chip:hover { border-color: var(--line-2); }
.el-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.el-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin: 6px 0; cursor: pointer; }
.el-check input { margin: 0; }
.el-sub { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 4px; }
#panel input.bad { color: var(--bad); }
#panel .num:has(input.bad) input { border-color: var(--bad); }
#panel .small-note a { color: inherit; }
#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 */
.el-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 36ch; }
.el-big { font-weight: 600; color: var(--x-b0421f, #b0421f); }
.el-tag { display: inline-block; font-size: 10.5px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; white-space: nowrap; line-height: 1.5; }

/* charts */
.el-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#zsChart, #tcChart { touch-action: none; user-select: none; }
#zsChart .cdrag { cursor: ew-resize; }
.el-sw { display: inline-block; width: 14px; border-top: 1.5px dashed; vertical-align: middle; margin-right: 4px; }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 1100px) { .el-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 { .el-edit { display: none !important; } }

/* the circuit */
.el-src { fill: var(--surface); stroke: var(--steel-750); stroke-width: 1.4; }
.el-w { fill: none; stroke: var(--steel-750); stroke-width: 1.5; stroke-linecap: round; }
.el-w.n { stroke: var(--x-6e7177, #6e7177); }
.el-w.pe { stroke: var(--x-3f8a5c, #3f8a5c); }
.el-cab { fill: none; stroke: var(--steel-750); stroke-width: 3; stroke-linecap: round; }
.el-cab.pe { stroke: var(--x-3f8a5c, #3f8a5c); }
.el-box { fill: var(--steel-50); stroke: var(--steel-700); stroke-width: 1.1; }
.el-app { fill: var(--steel-150); stroke: var(--steel-700); stroke-width: 1.4; }
.el-earth { fill: none; stroke: var(--steel-750); stroke-width: 1.2; }
.el-ground { fill: none; stroke: var(--x-8f979f, #8f979f); stroke-width: 1.2; stroke-dasharray: 2 4; }
.el-loop { fill: none; stroke: var(--load, #e0562b); stroke-width: 1.6; stroke-dasharray: 6 4; opacity: .8; pointer-events: none; }
.el-looph { fill: var(--load, #e0562b); stroke: none; }
.el-lmax { stroke: var(--text-2); stroke-width: 1.1; stroke-dasharray: 3 3; }
.el-lmaxt { font-size: 11px; fill: var(--text-2); }
#view .pill.good rect { stroke: color-mix(in srgb, var(--good) 55%, transparent); } #view .pill.good text { fill: var(--olive); font-weight: 600; }
#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; }

/* 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-3f8a5c: #84c098; --x-57467a: #a395c5; --x-6e7177: #85827f; --x-8f979f: #61676d; --x-b0321f: #ef8470;
    --x-b0421f: #eb8c6f;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-3f8a5c: #84c098; --x-57467a: #a395c5; --x-6e7177: #85827f; --x-8f979f: #61676d; --x-b0321f: #ef8470;
    --x-b0421f: #eb8c6f;
  }
}
/* theme-auto:end */
