/* Gravity sewer and detention — on top of calc.css */
main.sw .tabs { grid-template-columns: repeat(3, 1fr); }
main.sw .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.sw .stage-bar .hist { margin-left: auto; }
#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 { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
.sw-soil { fill: var(--soil-2); stroke: none; }
.sw-ground { fill: none; stroke: var(--x-8a7f6a, #8a7f6a); stroke-width: 1.4; stroke-linejoin: round; }
.sw-bore { fill: var(--surface); stroke: none; }
.sw-pipe { fill: none; stroke: var(--steel-750); stroke-width: 1.5; }
.sw-pipe.sel { stroke: var(--sel); stroke-width: 2; }
.sw-hit { fill: transparent; stroke: none; cursor: pointer; }
.sw-water { fill: var(--water); stroke: none; }
.sw-water.sur { fill: var(--x-f3d3cf, #f3d3cf); }
.sw-surf { fill: none; stroke: var(--blue); stroke-width: 1.3; }
.sw-mh { fill: var(--steel-300); stroke: var(--steel-700); stroke-width: 1.1; }
.sw-fb { fill: none; stroke: var(--steel-550); stroke-width: 1; stroke-dasharray: 6 3; }
.sw-orf { fill: var(--surface); stroke: var(--steel-750); stroke-width: 1.4; }
.sw-flow { fill: none; stroke: var(--blue); stroke-width: 1.8; }
.sw-sc { font-size: 11px; fill: var(--text-3); }
.sw-bar { cursor: pointer; }
.sw-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.sw-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.sw-chip:hover { border-color: var(--line-2); }
.sw-chip.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.sw-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.sw-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); margin: 4px 0 6px; }

/* 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.fl rect { stroke: color-mix(in srgb, var(--blue) 45%, transparent); } #view .pill.fl text { fill: var(--blue-3); }
#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.mh text { fill: var(--text); }
#view .pill.rc.on rect { stroke: var(--sel); }
#view .pill.bad rect { stroke: color-mix(in srgb, var(--bad) 50%, transparent); } #view .pill.bad text { fill: var(--bad-ink); 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; }
.sw-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); }
.sw-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); }
.sw-edit span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

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

/* panel */
.sw-seg { margin-bottom: 6px; }
.sw-empty { font-size: 13px; color: var(--text-3); padding: 10px 2px; line-height: 1.45; }
.sw-ro { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; padding: 6px 0; }
#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); }

/* summary */
.sw-say { margin-top: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; max-width: 40ch; }
.sw-big { font-weight: 600; color: var(--blue-3); }
.sw-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 */
.sw-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#chA, #chB { touch-action: none; user-select: none; }
#chA .cdrag { cursor: ns-resize; }
#chA g.cdrag[data-cdrag="td"], #chA rect.cdrag[data-cdrag="td"] { 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) { .sw-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 { .sw-edit { display: none !important; } }

#panel .f.sel > label { grid-template-columns: minmax(0, 1fr); }
/* a short choice ("Region 2", "10 years") always keeps its text and arrow: a floor under the select that only bites if the
   field is squeezed (every layout gives it 190 px or more) */
#panel .f.sel select { min-width: 76px; }
#panel .f > label:not(:has(i)) { grid-template-columns: minmax(0, 1fr); }
#panel .f > label span { white-space: normal; overflow: visible; line-height: 1.25; }

/* 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-8a7f6a: #7e7565; --x-a89f8c: #655e50; --x-bcd4ee: #304051; --x-f3d3cf: #45302e;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-6e7177: #85827f; --x-8a7f6a: #7e7565; --x-a89f8c: #655e50; --x-bcd4ee: #304051; --x-f3d3cf: #45302e;
  }
}
/* theme-auto:end */
