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

/* the anode, the structure, the soil */
.cp-steel { fill: var(--steel-300); stroke: var(--steel-700); stroke-width: 1.1; }
.cp-anode { fill: var(--steel-350); stroke: var(--x-4f5864, #4f5864); stroke-width: 1.2; }
.cp-anode.zn { fill: var(--steel-400); }
.cp-anode.mg { fill: var(--line-2); }
.cp-core { fill: none; stroke: var(--steel-700); stroke-width: 2.2; }
.cp-final { fill: none; stroke: var(--bad); stroke-width: 1.2; stroke-dasharray: 5 3; pointer-events: none; }
.cp-req { fill: none; stroke: var(--steel-550); stroke-width: .9; stroke-dasharray: 2 3; pointer-events: none; }
.cp-water { fill: var(--steel-blue); stroke: none; }
.cp-surf { fill: none; stroke: var(--blue); stroke-width: 1.2; }
.cp-soil { fill: var(--soil-2); stroke: none; }
.cp-ground { fill: none; stroke: var(--x-6f6655, #6f6655); stroke-width: 1.4; }
.cp-backfill { fill: var(--soil); stroke: var(--soil-line); stroke-width: 1; stroke-dasharray: 3 2; }
.cp-pipe { fill: var(--steel-150); stroke: var(--x-4f5864, #4f5864); stroke-width: 1.4; }
.cp-coat { fill: none; stroke: var(--good); stroke-width: 2.2; }
.cp-cable { fill: none; stroke: var(--warn); stroke-width: 1.2; }
.cp-dim { stroke: var(--steel-550); stroke-width: .9; fill: none; }
.cp-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.cp-role { font-size: 11px; fill: var(--text-3); }
.cp-nm { cursor: text; }
.cp-nm:hover .cp-name, .cp-nm:focus .cp-name { fill: var(--sel); }
.cp-nm:focus { outline: none; }
.cp-cap { font-size: 11px; fill: var(--text-3); }

/* zones in the panel */
.cp-zone { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 4px; margin: 0 0 8px; }
.cp-zone-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cp-zone-h input { flex: 1; min-width: 0; font: inherit; font-size: 13px; font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; background: transparent; color: var(--text); }
.cp-zone-h input:hover, .cp-zone-h input:focus { border-color: var(--line-2); }
.cp-zone-h .sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.cp-zone-h button { border: 0; background: none; color: var(--text-3); font-size: 16px; cursor: pointer; padding: 2px 6px; line-height: 1; }

/* 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.fn rect { stroke: color-mix(in srgb, var(--bad) 45%, transparent); } #view .pill.fn text { fill: var(--bad-ink); }
#view .pill.am rect { stroke: rgba(23, 24, 26, .35); } #view .pill.am text { fill: var(--text); 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; }

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

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

.cp-seg { margin-bottom: 6px; }
.cp-row2 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0 6px; }
.cp-row2 .btn { font-size: 12px; }
#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); }
#panel select { max-width: 100%; }

.cp-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.cp-big { font-weight: 600; color: var(--text); }
.cp-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; }

.cp-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#prChart, #nChart { touch-action: none; user-select: none; }
#prChart .cdrag, #nChart .cdrag { cursor: ew-resize; }
svg.fb-chart .ch-g { fill: var(--fill-1); }
#checks td.note { white-space: normal; min-width: 200px; line-height: 1.4; }

@media (max-width: 1100px) { .cp-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: "required "; 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 { .cp-edit { display: none !important; } }
.chk-row { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); margin: 6px 0; }
@media (max-width: 760px) { .cp-zone-h { flex-wrap: wrap; } .cp-zone-h input { flex: 1 1 70%; } .cp-zone-h .sub { order: 3; flex-basis: 100%; padding-left: 6px; } }
#panel .f.nm { grid-template-columns: 96px minmax(0, 1fr); }
#panel .f.nm > label { grid-template-columns: 0 minmax(0, 1fr); }

/* 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-4f5864: #919aa5; --x-6e7177: #85827f; --x-6f6655: #928a7c;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-4f5864: #919aa5; --x-6e7177: #85827f; --x-6f6655: #928a7c;
  }
}
/* theme-auto:end */
