/* Water bill tool. Keep identical in Projects/regional-directory-site/public/tools-assets/water-bill/ and
   phila-frontend/sites/private-preview/public/tools-assets/water-bill/. Colors come from the site theme. */
/* Theme variables: Phila (--text, --text-muted, --bg-band) or Montco/Bucks (--ink, --muted, --tint), with fallbacks */
.wb { --wb-accent: var(--accent, #1558D6); --wb-accent-soft: var(--accent-soft, #E8F0FE); --wb-ink: var(--text, var(--ink, #0F172A));
  --wb-muted: var(--text-muted, var(--muted, #475569)); --wb-line: var(--line, #E2E8F0); --wb-line-strong: var(--line-strong, #CBD5E1);
  --wb-surface: var(--surface, #fff); --wb-band: var(--bg-band, var(--tint, #EBF1F7)); --wb-sky: #38BDF8;
  --wb-good: #15803D; --wb-good-bg: #DCFCE7; --wb-warn: #B45309; --wb-warn-bg: #FEF3C7;
  color: var(--wb-ink); }
.wb *, .wb *::before, .wb *::after { box-sizing: border-box; }
.wb.wb button, .wb.wb input, .wb.wb select { font: inherit; }
.wb.wb [hidden] { display: none !important; }
/* Neutralize host article styles (Montco/Bucks InfoLayout sets large p/li line-height and margins) */
.wb.wb p, .wb.wb li { line-height: 1.5; }
.wb.wb .wb-live p { margin: 0 0 6px; }
.wb.wb .wb-legend li { line-height: 1.3; }
.wb.wb :focus-visible { outline: 3px solid var(--wb-sky); outline-offset: 2px; }
.wb.wb .wb-intro { color: var(--wb-muted); margin: 0 0 16px; font-size: .95rem; }
.wb.wb .wb-grid { display: grid; gap: 22px; align-items: start; }
@media (min-width: 960px) { .wb.wb .wb-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }

/* Bill-shaped card (our palette; clearly a practice copy, not an official bill) */
.wb.wb .wb-bill { background: var(--wb-surface); border: 1px solid var(--wb-line-strong); border-radius: 18px; box-shadow: 0 14px 40px rgba(15,23,42,.10); overflow: hidden; }
.wb.wb .wb-billhead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 18px 20px 14px; background: linear-gradient(135deg, var(--wb-band), var(--wb-surface)); border-bottom: 1px solid var(--wb-line); }
.wb.wb .wb-billhead h2 { margin: 0; font-size: 1.35rem; color: var(--wb-accent); line-height: 1.2; }
.wb.wb .wb-billhead p { margin: 4px 0 0; color: var(--wb-muted); font-size: .88rem; }
.wb.wb .wb-stamp { flex: none; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--wb-warn); border: 2px dashed var(--wb-warn); border-radius: 8px; padding: 4px 8px; transform: rotate(3deg); }
.wb.wb .wb-box { margin: 14px 16px; border: 1px solid var(--wb-line-strong); border-radius: 14px; }
.wb.wb .wb-box > h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; padding: 10px 14px; font-size: 1.05rem; border-bottom: 1px solid var(--wb-line); background: var(--wb-band); border-radius: 14px 14px 0 0; }
.wb.wb .wb-rows { padding: 4px 14px 10px; }
.wb.wb .wb-input { display: grid; gap: 6px; padding: 10px 0; }
.wb.wb .wb-input > label, .wb.wb .wb-lbl { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wb.wb .wb-stepper { display: flex; align-items: stretch; gap: 6px; }
.wb.wb .wb-stepper input, .wb.wb select, .wb.wb .wb-field { min-height: 48px; padding: 8px 12px; border: 2px solid var(--wb-line-strong); border-radius: 12px; font-size: 1.1rem; background: var(--wb-surface); color: var(--wb-ink); width: 100%; }
.wb.wb .wb-stepper input { width: 8em; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.wb.wb .wb-stepper button { min-width: 48px; border-radius: 12px; border: 2px solid var(--wb-line-strong); background: var(--wb-surface); font-weight: 800; font-size: 1.2rem; cursor: pointer; }
.wb.wb .wb-hint { font-size: .85rem; color: var(--wb-muted); margin: 0; }

/* "This Bill" table: label | estimate | (your bill, only when comparing) */
.wb.wb .wb-switch { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 700; color: var(--wb-accent); cursor: pointer; }
.wb.wb .wb-switch input { width: 20px; height: 20px; accent-color: var(--wb-accent); }
.wb.wb .wb-th, .wb.wb .wb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; }
.wb.wb .wb-th { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--wb-muted); padding: 8px 0 2px; }
.wb.wb .wb-th span:nth-child(2) { text-align: right; }
.wb.wb .wb-row { padding: 10px 0; border-bottom: 1px dashed var(--wb-line-strong); }
.wb.wb .wb-lab { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.wb.wb .wb-amt { font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; }
.wb.wb .wb-row.total { border-top: 2px solid var(--wb-ink); border-bottom: 0; margin-top: 2px; font-weight: 800; }
.wb.wb .wb-row.wb-adj .wb-amt { color: var(--wb-good); }
.wb.wb .wb-row.wb-adj.more .wb-amt { color: var(--wb-warn); }
.wb.wb .wb-cmp { display: none; }
.wb.wb.wb-comparing .wb-th, .wb.wb.wb-comparing .wb-row { grid-template-columns: minmax(0, 1fr) auto 10.5em; }
.wb.wb.wb-comparing .wb-cmp { display: grid; gap: 4px; justify-items: end; }
.wb.wb.wb-comparing .wb-th .wb-cmp { display: block; text-align: right; }
.wb.wb .wb-cmp input { width: 100%; max-width: 8.5em; padding: 6px 8px; border: 2px solid var(--wb-line-strong); border-radius: 10px; text-align: right; font-variant-numeric: tabular-nums; background: #FFFBEB; }
.wb.wb .wb-diff { font-size: .82rem; font-weight: 800; border-radius: 6px; padding: 0 6px; }
.wb.wb .wb-diff:empty { display: none; }
.wb.wb .wb-diff.ok, .wb.wb .wb-diff.less { color: var(--wb-good); background: var(--wb-good-bg); }
.wb.wb .wb-diff.more { color: var(--wb-warn); background: var(--wb-warn-bg); }
@media (max-width: 560px) {
  .wb.wb.wb-comparing .wb-th, .wb.wb.wb-comparing .wb-row { grid-template-columns: minmax(0, 1fr) auto; }
  .wb.wb.wb-comparing .wb-th .wb-cmp { display: none; }
  .wb.wb.wb-comparing .wb-row .wb-cmp { grid-column: 1 / -1; grid-template-columns: auto 1fr; justify-items: start; align-items: center; }
  .wb.wb.wb-comparing .wb-row .wb-cmp::before { content: 'Your bill $'; font-size: .82rem; color: var(--wb-muted); }
}
.wb.wb.wb.wb-comparing .wb-row .wb-cmp:empty { display: none; }
.wb.wb .wb-cmp-msg { padding: 0 14px 10px; }

/* Aqua: consumption lines indented under the Customer Charge; sewer side pane (a separate bill) */
.wb.wb .wb-sub { padding-left: 14px; color: var(--wb-muted); font-size: .95rem; }
.wb.wb .wb-sewer { margin-top: 16px; background: var(--wb-surface); border: 2px dashed #D97706; border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; }
.wb.wb .wb-sewer h3 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.wb.wb .wb-sewer h3::before { content: ''; width: 14px; height: 14px; border-radius: 4px; background: #D97706; }
.wb.wb .wb-err { color: #B91C1C; font-weight: 600; }
.wb.wb .wb-field[aria-invalid="true"] { border-color: #B91C1C; }
/* Aqua: not-listed division or meter, no estimate shown */
.wb.wb #wb-stop p { margin: 0 0 6px; }
.wb.wb.wb-stopped .wb-whatif, .wb.wb.wb-stopped .wb-chip-row { display: none; }

/* Help paying modifier (after the total) */
.wb.wb .wb-help { margin: 4px 14px 14px; padding: 12px; border-radius: 12px; background: var(--wb-band); }
.wb.wb .wb-help-h { margin: 0 0 8px; font-weight: 800; }
.wb.wb .wb-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.wb.wb .wb-seg label, .wb.wb .wb-tiers label { display: flex; align-items: center; gap: 8px; border: 2px solid var(--wb-line-strong); background: var(--wb-surface); border-radius: 12px; padding: 8px 12px; font-weight: 700; cursor: pointer; min-height: 44px; }
.wb.wb .wb-seg input, .wb.wb .wb-tiers input { accent-color: var(--wb-accent); width: 18px; height: 18px; flex: none; }
.wb.wb .wb-seg label:has(input:checked), .wb.wb .wb-tiers label:has(input:checked) { border-color: var(--wb-accent); background: var(--wb-accent-soft); }
.wb.wb .wb-help-body { display: grid; gap: 10px; margin-top: 12px; }
.wb.wb .wb-tiers { display: grid; gap: 6px; }
.wb.wb .wb-tiers label { font-weight: 600; font-size: .95rem; }

.wb.wb .wb-i { display: inline-grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--wb-accent); color: var(--wb-accent); background: var(--wb-surface); font-weight: 800; font-size: 13px; cursor: pointer; font-style: italic; font-family: Georgia, serif; }
.wb.wb .wb-i:hover { background: var(--wb-accent); color: #fff; }

/* Live panel: sticky below the site header; scrolls inside itself instead of being cut off */
.wb.wb .wb-live { background: var(--wb-surface); border: 1px solid var(--wb-line); border-radius: 18px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(15,23,42,.08); }
@media (min-width: 960px) { .wb.wb .wb-live { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain; } }
/* Aqua (SY 2026-10-23): the panel never scrolls inside itself; tighter spacing so it fits a 768 px-tall screen */
@media (min-width: 960px) {
  .wb.wb[data-utility="aqua"] .wb-live { max-height: none; overflow: visible; top: 116px; padding: 12px 16px; } /* below the 108 px sticky site header */
  .wb.wb[data-utility="aqua"] .wb-legend { margin-top: 8px; gap: 4px 14px; }
  .wb.wb[data-utility="aqua"] .wb-legend li { grid-template-columns: 12px 1fr auto; gap: 6px; font-size: .84rem; }
  .wb.wb[data-utility="aqua"] .wb-legend i { width: 12px; height: 12px; }
  .wb.wb[data-utility="aqua"] .wb-chip-row { margin: 8px 0 0; }
  .wb.wb[data-utility="aqua"] .wb-whatif { margin-top: 8px; padding-top: 8px; }
  .wb.wb[data-utility="aqua"] .wb-rate-val { font-size: 1.35rem; }
  .wb.wb[data-utility="aqua"] input[type=range] { height: 24px; }
  .wb.wb[data-utility="aqua"] .wb-live p { margin-bottom: 4px; }
  .wb.wb[data-utility="aqua"] .wb-livehead { flex-wrap: nowrap; }
  .wb.wb[data-utility="aqua"] .wb-btn { min-height: 34px; padding: 4px 10px; }
  .wb.wb[data-utility="aqua"] .wb-total { font-size: 2.5rem; }
  .wb.wb[data-utility="aqua"] .wb-chip { display: inline-block; border-radius: 12px; line-height: 1.35; }
}
.wb.wb .wb-live h2 { margin: 0; font-size: 1rem; color: var(--wb-muted); font-weight: 700; }
.wb.wb .wb-total { font-size: clamp(2.3rem, 6vw, 2.9rem); font-weight: 900; line-height: 1.05; margin: 2px 0 2px; font-variant-numeric: tabular-nums; color: var(--wb-accent); }
.wb.wb .wb-note { margin: 0 0 8px; color: var(--wb-muted); font-size: .88rem; }
.wb.wb .wb-stack { display: block; }
.wb.wb .wb-stack rect, .wb.wb .wb-bars rect, .wb.wb .wb-dot { cursor: pointer; transition: opacity .15s; }
.wb.wb .wb-stack rect:hover, .wb.wb .wb-stack rect:focus { opacity: .85; }
.wb.wb .wb-legend { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px 18px; }
@media (min-width: 960px) { .wb.wb .wb-legend { grid-template-columns: 1fr 1fr; } .wb.wb .wb-legend li { font-size: .88rem; } }
.wb.wb .wb-legend li { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-size: .95rem; }
.wb.wb .wb-legend i { width: 14px; height: 14px; border-radius: 4px; }
.wb.wb .wb-legend b { font-variant-numeric: tabular-nums; }
.wb.wb .wb-chip-row { margin: 10px 0 2px; }
.wb.wb .wb-chip { background: var(--wb-band); border-radius: 999px; padding: 6px 12px; font-size: .85rem; font-weight: 700; }
.wb.wb .wb-src { font-size: .78rem; color: var(--wb-muted); margin: 6px 0 0; }
.wb.wb .wb-whatif { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--wb-line); }
.wb.wb .wb-whatif-h { margin: 0 0 6px; font-weight: 800; font-size: 1.05rem; }
.wb.wb .wb-whatif-tag { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: var(--wb-warn-bg); color: #92400E; border-radius: 6px; padding: 2px 8px; vertical-align: middle; }
.wb.wb .wb-rate-val { font-size: 1.6rem; font-weight: 900; color: #9F1239; }
.wb.wb input[type=range] { width: 100%; accent-color: var(--wb-accent); height: 32px; }
.wb.wb #wb-rate { accent-color: #9F1239; }
.wb.wb .wb-livehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.wb.wb .wb-actions { display: flex; gap: 6px; }
.wb.wb .wb-btn { min-height: 40px; padding: 6px 12px; font-size: .88rem; border-radius: 12px; border: 2px solid var(--wb-accent); background: var(--wb-surface); color: var(--wb-accent); font-weight: 800; cursor: pointer; }
.wb.wb .wb-btn.solid { background: var(--wb-accent); color: #fff; }

/* Charts: drawn in CSS pixels, so these sizes are real on every screen */
.wb.wb .wb-bars, .wb.wb .wb-curve { display: block; max-width: 100%; }
.wb.wb .wb-bars { margin: 8px 0 0; overflow: visible; }
.wb.wb .wb-axis { stroke: var(--wb-line-strong); stroke-width: 1; }
.wb.wb .wb-gridline { stroke: var(--wb-line); stroke-width: 1; }
.wb.wb .wb-break { stroke: var(--wb-warn); stroke-width: 1.5; stroke-dasharray: 4 4; }
.wb.wb .wb-line { fill: none; stroke: var(--wb-accent); stroke-width: 2.5; }
.wb.wb .wb-dot { fill: #D97706; stroke: var(--wb-surface); stroke-width: 2; }
.wb.wb .wb-hair { stroke: var(--wb-muted); stroke-width: 1; }
.wb.wb .wb-val { font-size: 15px; font-weight: 800; fill: var(--wb-ink); stroke: none; }
.wb.wb .wb-cat { font-size: 13px; fill: var(--wb-muted); stroke: none; }

/* Sections below: always open */
.wb.wb .wb-sec { background: var(--wb-surface); border: 1px solid var(--wb-line); border-radius: 16px; margin: 20px 0; padding: 4px 18px 18px; }
.wb.wb .wb-sec > h2 { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; margin: 14px 0 10px; }
.wb.wb .wb-num { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--wb-accent); color: #fff; font-size: .95rem; }
.wb.wb .wb-callout { background: #FFF7ED; border-left: 6px solid #D97706; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.wb.wb .wb-callout.blue { background: var(--wb-accent-soft); border-left-color: var(--wb-accent); }
.wb.wb .wb-big { font-size: 2rem; font-weight: 900; margin: 0; color: var(--wb-warn); font-variant-numeric: tabular-nums; }
.wb.wb .wb-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.wb.wb .wb-fields label { display: grid; gap: 4px; font-weight: 700; font-size: .95rem; align-content: start; }
.wb.wb .wb-sources li { margin: 6px 0; }

/* Modal */
.wb-dialog { border: 0; border-radius: 18px; padding: 0; max-width: min(560px, 92vw); box-shadow: 0 30px 80px rgba(15,23,42,.35); color: var(--text, #0F172A); }
.wb-dialog::backdrop { background: rgba(15,23,42,.55); }
.wb-dialog .wb-dh { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--accent, #1558D6); color: #fff; }
.wb-dialog .wb-dh h2 { margin: 0; font-size: 1.15rem; color: #fff; }
.wb-dialog .wb-dh button { margin-left: auto; min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; background: rgba(255,255,255,.18); color: #fff; font-size: 1.4rem; cursor: pointer; }
.wb-dialog .wb-db { padding: 16px 18px 20px; line-height: 1.55; }
.wb-dialog .wb-db .wb-official { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line, #E2E8F0); font-size: .9rem; }
.wb-info { display: none; }

.wb-tip { position: absolute; z-index: 60; max-width: 260px; background: #0F172A; color: #fff; font-size: 13px; line-height: 1.35; padding: 7px 10px; border-radius: 8px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* Phone: pinned live total, stops short of the site's chat button (bottom right) */
.wb.wb .wb-bar { position: fixed; left: 12px; right: 88px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--wb-accent); color: #fff; border: 0; border-radius: 14px; font-weight: 800; box-shadow: 0 8px 24px rgba(15,23,42,.28); cursor: pointer; text-align: left; }
.wb.wb .wb-bar span { color: inherit; } /* bucks-design.css colors bare spans; keep white on the accent bar */
.wb.wb .wb-bar span:last-child { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .wb.wb .wb-bar { display: none; } }
@media (max-width: 959px) { .wb { padding-bottom: 80px; } }

@media (prefers-reduced-motion: reduce) { .wb *, .wb *::after { transition: none !important; } }
@media print {
  .wb.wb .wb-bar, .wb.wb .wb-actions, .wb.wb .wb-i, .wb.wb .wb-stepper button, .wb.wb .wb-switch, .wb-tip, .wb.wb input[type=range] { display: none !important; }
  .wb.wb .wb-bill, .wb.wb .wb-live { box-shadow: none; }
  .wb.wb .wb-live { position: static; max-height: none; overflow: visible; }
}
/* v3: no empty chip at 0 gallons; action buttons stay on one line */
.wb.wb .wb-chip:empty { display: none; }
.wb.wb .wb-btn { white-space: nowrap; }
