/* Stormwater runoff and culvert — on top of calc.css */
main.cvt .tabs { grid-template-columns: repeat(4, 1fr); }
main.cvt .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.cvt .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 section */
.cv-soil { fill: var(--soil-2); stroke: none; }
.cv-wall { fill: var(--steel-300); stroke: var(--steel-700); stroke-width: 1.1; }
.cv-bore { fill: var(--surface); stroke: none; }
.cv-edge { fill: none; stroke: var(--steel-700); stroke-width: 1.4; stroke-linejoin: round; }
.cv-bank { fill: none; stroke: var(--steel-550); stroke-width: 1; stroke-dasharray: 6 3; }
.cv-water { fill: var(--water); stroke: none; }
.cv-surf { fill: none; stroke: var(--blue); stroke-width: 1.6; }
.cv-tri { fill: none; stroke: var(--blue); stroke-width: 1.1; }
.cv-crit { fill: none; stroke: var(--bad); stroke-width: 1.1; stroke-dasharray: 5 3; pointer-events: none; }
.cv-egl { fill: none; stroke: var(--x-8a5a0e, #8a5a0e); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.cv-name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.cv-role { font-size: 11px; fill: var(--text-3); }
.cv-nm { cursor: text; }
.cv-nm:hover .cv-name, .cv-nm:focus .cv-name { fill: var(--sel); }
.cv-nm:focus { outline: none; }

/* 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.wt rect { stroke: color-mix(in srgb, var(--blue) 55%, transparent); } #view .pill.wt text { fill: var(--blue-3); font-weight: 600; }
#view .pill.cr rect { stroke: color-mix(in srgb, var(--bad) 45%, transparent); } #view .pill.cr text { fill: var(--bad-ink); }
#view .pill.eg rect { stroke: color-mix(in srgb, var(--x-8a5a0e, #8a5a0e) 45%, transparent); } #view .pill.eg text { fill: var(--wip-ink); }
#view .pill.fl rect { stroke: color-mix(in srgb, var(--text) 35%, transparent); } #view .pill.fl 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; }

/* editors in the drawing */
.stage { position: relative; }
.cv-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); }
.cv-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); }
.cv-edit-name input { width: 180px; text-align: center; }
.cv-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.cv-seg { margin-bottom: 6px; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.cv-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.cv-chip:hover { border-color: var(--line-2); }
.cv-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
#panel .f.sel > label { display: block; }
#panel .f.sel.cv-wide { grid-template-columns: minmax(0, 1fr); gap: 4px; }
#panel .f.sel.cv-wide select { width: 100%; }
#panel .f.sel > label span { white-space: normal; overflow: visible; line-height: 1.3; }
#panel .f > label span { white-space: normal; overflow: visible; line-height: 1.3; }
#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 */
.cv-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 38ch; }
.cv-big { font-weight: 600; color: var(--blue-3); }
.cv-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 */
.cv-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#pfChart, #idfChart { touch-action: none; user-select: none; }
#pfChart .cdrag { cursor: ew-resize; }
#idfChart .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) { .cv-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 { .cv-edit { display: none !important; } }


/* the culvert in profile */
.cv-fill { fill: var(--soil-2); stroke: var(--steel-550); stroke-width: 1; stroke-linejoin: round; }
.cv-barrel { fill: var(--surface); stroke: none; }
.cv-wall { fill: none; stroke: var(--steel-700); stroke-width: 1.4; }
.cv-end { stroke: var(--steel-700); stroke-width: 1.4; }
.cv-ring { fill: var(--steel-300); stroke: var(--steel-700); stroke-width: 1; }
.cv-hgl { fill: none; stroke: var(--blue); stroke-width: 1.1; stroke-dasharray: 6 3; pointer-events: none; }
.cv-allow { fill: none; stroke: var(--good); stroke-width: 1.2; stroke-dasharray: 5 3; }
.cv-road { fill: none; stroke: var(--steel-850); stroke-width: 3; stroke-linecap: round; }
.cv-cap { font-size: 11px; fill: var(--text-3); }
#view .pill.hw rect { stroke: color-mix(in srgb, var(--blue) 55%, transparent); } #view .pill.hw text { fill: var(--blue-3); font-weight: 600; }
#view .pill.al rect { stroke: color-mix(in srgb, var(--good) 50%, transparent); } #view .pill.al text { fill: var(--good-ink); }
#view .pill.ex rect { stroke: var(--steel-300); stroke-dasharray: 3 2; } #view .pill.ex text { fill: var(--text-3); }
.cv-area { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 4px; margin: 0 0 8px; }
.cv-ah { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cv-an { flex: 1 1 auto; min-width: 0; border: 0; border-bottom: 1px dashed var(--line-2); background: transparent; font-weight: 600; font-size: 13px; padding: 2px 0; color: var(--text); }
.cv-an:focus { outline: none; border-bottom-color: var(--sel); }
.cv-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.cv-del { border: 0; background: none; color: var(--text-3); font-size: 16px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 6px; }
.cv-del:hover { color: var(--bad-ink); background: var(--bad-bg); }
.cv-add { margin: 2px 0 6px; }
.cv-pts { display: grid; gap: 6px; margin: 4px 0 6px; }
.cv-pt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 6px; align-items: center; }
.cv-pt .num input { width: 100%; }
.cv-flags span.out { color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.cv-flags span.in { color: var(--blue-3); border-color: color-mix(in srgb, var(--blue) 40%, transparent); }

/* 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-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-bcd4ee: #304051; --x-e7efe2: #292e26;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-6e7177: #85827f; --x-8a5a0e: #c89e6a; --x-bcd4ee: #304051; --x-e7efe2: #292e26;
  }
}
/* theme-auto:end */
