/* Fonts are stored with the app (SIL Open Font License, see fonts/OFL-*.txt) so nothing loads from elsewhere. */
@font-face { font-family: "Libre Franklin"; font-weight: 400; font-display: swap; src: url(fonts/libre-franklin-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-weight: 600; font-display: swap; src: url(fonts/libre-franklin-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Libre Franklin"; font-weight: 700; font-display: swap; src: url(fonts/libre-franklin-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 500; font-display: swap; src: url(fonts/zilla-slab-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 500; font-style: italic; font-display: swap; src: url(fonts/zilla-slab-latin-500-italic.woff2) format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 700; font-display: swap; src: url(fonts/zilla-slab-latin-700-normal.woff2) format("woff2"); }
/*
  Design rules for this app (older eyes and young thumbs):
  - Phone first. One column. Big type (20px base), big buttons (56px), plain words.
  - Contrast of 7:1 or better for text. Color is never the only signal (words and symbols too).
  - Every control has a visible label and a clear focus ring.
  - City colors are variables below so a city can restyle the whole app in one place.
*/
:root {
  --bg: #fbfaf7;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #444444;
  --line: #8a857b;
  --soft-line: #d9d4c9;
  --primary: #0b4f8a;
  --primary-text: #ffffff;
  --primary-hover: #083d6b;
  --header: #0b4f8a;                /* top bar; a city sets it under Colors and logo */
  --header-text: #ffffff;
  --accent: var(--primary);         /* buttons */
  --accent-hover: var(--primary-hover);
  --rule: transparent;              /* stripe under the top bar */
  --brand-sub: #ffffff;
  --heading: var(--text);
  --font-body: "Libre Franklin", "Franklin Gothic Book", "Segoe UI", Arial, sans-serif;
  --font-display: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --ok: #14633a;
  --ok-bg: #e5f4ea;
  --warn: #6b4600;
  --warn-bg: #fff3cf;
  --bad: #9b1c1c;
  --bad-bg: #fde8e8;
  --focus: #ffbf47;
  --radius: 6px;
  --tap: 3.5rem;
  --maxw: 46rem;
  --maxw-wide: 72rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b; --card: #1b2128; --text: #f3f3f3; --muted: #cfd3d8; --line: #8b95a1; --soft-line: #3a434d;
    --primary: #8cc4ff; --primary-text: #08233d; --primary-hover: #b3d8ff; --heading: #f3f3f3;
    --accent: #8cc4ff; --accent-hover: #b3d8ff; --header: #163a5c;
    --ok: #7fd9a1; --ok-bg: #12301f; --warn: #ffd98a; --warn-bg: #3a2c08; --bad: #ffb0b0; --bad-bg: #3d1616;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-size="125"] { font-size: 125%; }
html[data-size="150"] { font-size: 150%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 1.25rem/1.5 var(--font-body);
  overflow-wrap: break-word; /* a long address or code never pushes past the edge of its box */
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: var(--font-display); color: var(--heading); font-weight: 700; }
h1 { font-size: 2.1rem; line-height: 1.15; margin: 0 0 .75rem; }
h2 { font-size: 1.55rem; line-height: 1.25; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.4rem; margin: 1rem 0 .25rem; }
p { margin: 0 0 1rem; max-width: 38rem; }
a { color: var(--primary); text-underline-offset: .15em; }
@media (hover: hover) { a:hover { color: var(--primary-hover); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: .5rem; top: -4rem; background: var(--primary); color: var(--primary-text); padding: .75rem 1rem; border-radius: 8px; z-index: 50; }
.skip:focus { top: .5rem; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--text); }
main:focus { outline: none; }
h1:focus { outline: none; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: .75rem 1rem; background: var(--header); color: var(--header-text); }
/* The top bar and (on wide screens) the menu share one band with the city's stripe under it, like the city website. */
.masthead { position: relative; z-index: 30; background: var(--header); border-bottom: 5px solid var(--rule); box-shadow: 0 3px 0 var(--accent); margin-bottom: 3px; }
.brand { color: var(--header-text); text-decoration: none; display: inline-flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.brand-sub { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.15rem; color: var(--brand-sub); }
.brand:hover { color: var(--header-text); text-decoration: underline; }
.top-tools { display: flex; align-items: center; gap: .75rem; }
.textsize { display: flex; gap: .25rem; }
.textsize button { min-width: 2.75rem; min-height: 2.75rem; border: 2px solid var(--header-text); background: transparent;
  color: var(--header-text); border-radius: 6px; font-weight: 700; cursor: pointer; }
.textsize button:nth-child(1) { font-size: .9rem; } .textsize button:nth-child(2) { font-size: 1.15rem; } .textsize button:nth-child(3) { font-size: 1.45rem; }
.textsize button[aria-pressed="true"] { background: var(--header-text); color: var(--header); }
.linkish { background: none; border: 0; color: inherit; text-decoration: underline; font: inherit; min-height: 2.75rem; padding: 0 .5rem; cursor: pointer; }
.top .linkish { color: var(--header-text); white-space: nowrap; }
.banner { padding: .75rem 1rem; background: var(--warn-bg); color: var(--warn); border-bottom: 2px solid var(--warn); font-weight: 600; }

main { max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem 7rem; }
main.wide { max-width: var(--maxw-wide); }
.loading { color: var(--muted); }

/* buttons */
[hidden] { display: none !important; } /* a class like .btn must never show something marked hidden */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; width: 100%;
  min-height: var(--tap); padding: .5rem 1.5rem; border-radius: var(--radius); border: 3px solid var(--accent);
  background: var(--accent); color: var(--primary-text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
@media (hover: hover) { .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--primary-text); } }
.btn.secondary { background: transparent; color: var(--accent); }
@media (hover: hover) { .btn.secondary:hover { background: var(--accent); color: var(--primary-text); } }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--card); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--soft-line); border-color: var(--soft-line); color: var(--muted); cursor: not-allowed; }
.btn.small { min-height: 3rem; width: auto; padding: .25rem 1rem; }
.actions { display: grid; gap: .75rem; margin: 1rem 0; }
.actions.row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
@media (min-width: 40rem) { .btn { width: auto; min-width: 12rem; } .actions.stack .btn { width: 100%; } }

/* forms */
.field { margin: 0 0 1.25rem; }
label, .label { display: block; font-weight: 700; margin-bottom: .25rem; }
.hint { color: var(--muted); font-size: 1rem; margin: 0 0 .5rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; min-height: var(--tap); padding: .5rem .75rem; font: inherit; color: var(--text); background: var(--card);
  border: 3px solid var(--line); border-radius: 6px;
}
textarea { min-height: 8rem; }
input.code { font-size: 2rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.error { background: var(--bad-bg); color: var(--bad); border: 3px solid var(--bad); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; font-weight: 600; max-width: 48rem; }
.error::before { content: "Problem: "; }
.notice { background: var(--ok-bg); color: var(--ok); border: 3px solid var(--ok); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; font-weight: 600; max-width: 48rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.check { display: flex; align-items: center; gap: 1rem; min-height: var(--tap); font-weight: 600; cursor: pointer; }
.check input { width: 1.75rem; height: 1.75rem; accent-color: var(--primary); flex: none; }
.radio-card { display: flex; gap: 1rem; align-items: center; border: 3px solid var(--soft-line); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; min-height: var(--tap); background: var(--card); cursor: pointer; }
.radio-card input { width: 1.75rem; height: 1.75rem; accent-color: var(--primary); flex: none; }
.radio-card:has(input:checked) { border-color: var(--primary); }

/* cards and lists */
.card { background: var(--card); border: 2px solid var(--soft-line); border-radius: 10px; padding: 1.25rem; margin: 0 0 1rem; position: relative; z-index: 1; }
/* Staff home tiles: the number on top, the words, then the button lined up at the bottom of every tile. */
.grid > .card { display: flex; flex-direction: column; margin: 0; }
.grid > .card > :last-child { margin-top: auto; }
.grid > .card .btn { width: 100%; min-width: 0; }
.grid > .card p { margin-bottom: .75rem; }
.card h2, .card h3 { margin-top: 0; }
.owe { font-size: 2.75rem; font-weight: 800; line-height: 1.1; margin: .25rem 0; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; padding: .25rem .75rem; border-radius: 999px; border: 2px solid currentColor; }
.status.ok { color: var(--ok); background: var(--ok-bg); }
.status.warn { color: var(--warn); background: var(--warn-bg); }
.status.bad { color: var(--bad); background: var(--bad-bg); }
.muted { color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 2px solid var(--soft-line); padding: 1rem 0; }
/* A card inside a list keeps its own frame and room, instead of the plain list spacing. */
.list > li.card { padding: 1.25rem; border: 2px solid var(--soft-line); margin-bottom: 1rem; }
.list > li:last-child { border-bottom: 0; }
.row2 { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.credit { color: var(--ok); }
table.bill { width: 100%; border-collapse: collapse; font-size: 1.1rem; }
table.bill caption { text-align: left; font-weight: 700; padding-bottom: .5rem; }
table.bill th, table.bill td { text-align: left; padding: .5rem .25rem; border-bottom: 2px solid var(--soft-line); vertical-align: top; }
table.bill td.amt, table.bill th.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.bill tfoot td, table.bill tfoot th { font-size: 1.3rem; font-weight: 800; border-bottom: 0; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; padding-left: 3rem; position: relative; margin-bottom: 1rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--primary); color: var(--primary-text); display: grid; place-items: center; font-weight: 800; }

/* bottom menu on phones, tabs on wide screens */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 3px solid var(--primary);
  display: flex; justify-content: space-around; overflow-x: auto; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
#tabs a { flex: 1 0 auto; min-width: 4.75rem; text-align: center; padding: .5rem .5rem; min-height: 3.75rem; display: grid; place-items: center;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1rem; line-height: 1.15; }
#tabs a[aria-current="page"] { background: var(--primary); color: var(--primary-text); }
#tabs[hidden] { display: none; }
@media (min-width: 52rem) {
  /* On wide screens the menu sits in the top band, under the city name. */
  #tabs { position: static; background: var(--header); border: 0; border-top: 1px solid rgba(255, 255, 255, .18);
    justify-content: flex-start; gap: 0; padding: 0 .5rem; overflow: visible; flex-wrap: wrap; }
  #tabs a { flex: 0 0 auto; min-width: 0; min-height: 3.25rem; padding: .5rem 1.1rem; color: var(--header-text); font-size: 1.05rem;
    border-bottom: 4px solid transparent; border-radius: 0; }
  #tabs a:hover { background: rgba(255, 255, 255, .1); color: var(--header-text); }
  #tabs a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: var(--header-text); border-bottom-color: var(--rule-on-header, var(--header-text)); }
  main { padding-bottom: 3rem; }
}
/* Footer: a full-width line, with the words lined up with the page above. */
.foot { margin: 2rem 0 0; padding: 1.25rem max(1rem, calc((100% - var(--maxw)) / 2 + 1rem)) 6rem; color: var(--muted); font-size: 1rem;
  border-top: 2px solid var(--soft-line); background: var(--card); position: relative; z-index: 1; }
@media (min-width: 52rem) { .foot { padding-bottom: 2rem; } }

dialog { width: min(32rem, calc(100vw - 2rem)); border: 3px solid var(--primary); border-radius: 10px; padding: 1.25rem; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }

/* staff tables turn into cards on phones */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { overflow-wrap: anywhere; text-align: left; padding: .5rem .5rem; border-bottom: 2px solid var(--soft-line); vertical-align: top; }
@media (max-width: 47.99rem) {
  .tbl, .tbl tbody { display: block; }
  .tbl thead { position: absolute; left: -9999px; }
  .tbl tr { display: block; border: 2px solid var(--soft-line); border-radius: var(--radius); margin-bottom: .75rem; padding: .5rem .75rem; background: var(--card); }
  .tbl td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; border: 0; padding: .25rem 0; overflow-wrap: anywhere; }
  .tbl td::before { content: attr(data-label); font-weight: 700; color: var(--muted); }
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.big-number { font-size: 2.25rem; font-weight: 800; }

@media (prefers-reduced-motion: no-preference) { .btn { transition: background .15s; } }
@media (forced-colors: active) { .btn, input, select, textarea, .card { border: 2px solid CanvasText; } }
@media print { .top, #tabs, .foot, .actions, .textsize { display: none; } body { background: #fff; color: #000; } }

/* list rows that are whole links: only the main line looks like a link */
.list a.row2 { color: var(--text); text-decoration: none; min-height: var(--tap); align-items: center; }
.list a.row2 strong { color: var(--primary); text-decoration: underline; }
.list a.row2:hover strong { color: var(--primary-hover); }

/* admin screens */
fieldset.roles, fieldset.pf { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
fieldset.pf { border: 2px solid var(--soft-line); padding: 1rem; }
fieldset.roles legend, fieldset.pf legend { font-weight: 800; padding: 0; margin-bottom: .5rem; }
.small { font-size: .9em; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
dl.facts dt { font-weight: 700; color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 30rem) { dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: .5rem; } }
button[aria-pressed="true"].btn.secondary { background: var(--primary); color: #fff; }
.svc-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
input.qty { width: 5rem; min-height: var(--tap); font-size: 1.125rem; padding: .25rem .5rem; margin-left: .5rem; }
.brand-logo { height: 2rem; width: auto; vertical-align: middle; margin-right: .625rem; background: #fff; border-radius: .25rem; padding: .125rem; }
.swatch { display: inline-block; width: 2rem; height: 2rem; border-radius: .25rem; border: 2px solid currentColor; vertical-align: middle; margin-right: .5rem; }
input[type=color], input[type=file] { min-height: var(--tap); width: 100%; font: inherit; padding: .25rem; }

/* Demo mode: a bar at the top and a faint DEMO behind the page. The watermark is decorative and hidden from screen readers. */
.demo-bar { position: sticky; top: 0; z-index: 60; padding: .5rem 1rem; color: #1e2a2e; font-weight: 600;
  background: repeating-linear-gradient(-45deg, #ffd34d 0 22px, #ffc928 22px 44px); border-bottom: 3px solid #1e2a2e; }
.demo-bar strong { font-weight: 800; }
body.is-demo::before { content: "DEMO" / ""; position: fixed; inset: 0; z-index: 0; display: flex; align-items: center; justify-content: center;
  font-size: min(32vw, 14rem); font-weight: 900; letter-spacing: .1em; color: var(--text); opacity: .05; transform: rotate(-24deg); pointer-events: none; user-select: none; }
@media print { .demo-bar { display: none; } }

/* Account page: one row per service or meter, name on the left and its buttons on the right. */
.svc-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.svc-name { display: flex; flex-direction: column; min-width: 12rem; }
.svc-name .muted { font-size: 1rem; }
.svc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.svc-actions .btn, .addgrid .btn { width: auto; min-width: 0; }
.btn.small { min-height: 3rem; padding: .25rem 1rem; font-size: 1.05rem; }
.qty-group { display: inline-flex; align-items: center; gap: .5rem; }
label.inline { display: inline; margin: 0; font-weight: 600; }
.qty-group input.qty { margin: 0; }
.addbox { border-top: 2px solid var(--soft-line); margin-top: 1rem; padding-top: 1rem; }
.addgrid { display: grid; gap: .75rem; align-items: end; }
@media (min-width: 40rem) { .addgrid { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); } .addgrid input.qty { width: 100%; margin: 0; } }
/* A little room between a main button and the line under it. */
.btn + p, .btn + .muted { margin-top: 1rem; }
main.wide ~ .foot { padding-left: max(1rem, calc((100% - var(--maxw-wide)) / 2 + 1rem)); padding-right: max(1rem, calc((100% - var(--maxw-wide)) / 2 + 1rem)); }
.card h3 { margin-top: 1.25rem; }
.card > h3:first-child { margin-top: 0; }
@media (max-width: 51.99rem) {
  /* Phones: the menu wraps into even rows instead of scrolling sideways, and the demo notice stays small and scrolls away. */
  #tabs { display: flex; flex-wrap: wrap; overflow: visible; }
  #tabs a { flex: 1 1 auto; min-width: 0; min-height: 3rem; font-size: .95rem; padding: .5rem .75rem; white-space: nowrap; }
  main { padding-bottom: 9rem; }
  .demo-bar { position: static; font-size: 1rem; padding: .5rem .75rem; }
  .textsize button { min-width: 2.75rem; }
}
details.bill-lines summary { cursor: pointer; color: var(--primary); text-decoration: underline; font-size: 1rem; min-height: 2.75rem; display: flex; align-items: center; }
details.bill-lines ul { margin: .25rem 0 .5rem; padding-left: 1.25rem; font-size: 1rem; }
.logo-preview { max-height: 4rem; background: #fff; padding: .25rem; }

/* Wide staff pages: buttons are as wide as their words, never a banner across the whole screen. */
@media (min-width: 52rem) {
  main.wide .btn { width: auto; min-width: 12rem; }
  main.wide .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
  main.wide .actions .btn { flex: 0 0 auto; }
}
/* The "back" link above a page heading gets a little air. */
#main > div > a:first-child { display: inline-block; margin-bottom: .5rem; }
/* Short pages: the footer still sits at the bottom of the window. */
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
/* Status and date on one line, wrapping as a unit. */
.row-wrap { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: 0 0 1rem; }
/* The payment review sits inside the payment form, set off by a line rather than a second frame. */
.review-box { border-top: 2px solid var(--soft-line); margin-top: 1rem; padding-top: 1rem; }
.review-box h3 { margin-top: 0; }
/* A short number box does not need the whole row. */
input.short { width: 10rem; }

/* A row of choices where one is pressed (Waiting / Done / Declined): one control, not three commands. */
.seg { display: flex; flex-wrap: wrap; gap: 0; margin: 1rem 0; border: 3px solid var(--accent); border-radius: var(--radius); width: fit-content; max-width: 100%; overflow: hidden; }
.seg .btn { flex: 1 1 auto; width: auto; min-width: 6rem; border: 0; border-radius: 0; border-right: 3px solid var(--accent); }
.seg .btn:last-child { border-right: 0; }
.btn.secondary[disabled] { background: transparent; color: var(--muted); border-color: var(--soft-line); }
.check.multi { align-items: flex-start; }
.check.multi input { margin-top: .25rem; }
summary.label { display: list-item; cursor: pointer; }
.flash { margin-left: .75rem; font-size: 1rem; vertical-align: middle; }
.tbl td.lines { padding-top: 0; }
@media (max-width: 47.99rem) { .tbl td:empty { display: none; } .tbl td > details { flex-basis: 100%; } }
