/* Two themes, one layout: soft grey paper with white cards by day, near-black with charcoal cards by night.
   One brand colour does all the pointing; numbers are set heavy. The valve's card leads with the flow right now. */
@font-face { font-family: Hanken; src: url(/fonts/hanken.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --brand: #5bc97b; --on-brand: #0a120d; --accent-l: #2a7d47; --accent-d: #5bc97b; /* app.js sets these four from the plumber's colour */
  --accent: var(--accent-l);
  --bg: #f1f3f2; --card: #fff; --raise: #eceff0; --line: #e0e5e2; --ink: #0f1412; --muted: #626d67;
  --nav: #fff; --bar: #d3d9d5; --bad: #cf3a2d; --warn: #9a6400;
  --sans: Hanken, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme=dark] {
  --accent: var(--accent-d);
  --bg: #0c0e0d; --card: #161918; --raise: #1f2321; --line: #282d2a; --ink: #f4f6f5; --muted: #8a928e;
  --nav: #121514; --bar: #323835; --bad: #ff6b5e; --warn: #f2c14e;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
#app { max-width: 520px; margin: 0 auto; padding: 0 16px calc(108px + env(safe-area-inset-bottom)); }
h1, h2, h3, p, dl, dd { margin: 0; }
h2 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; margin: 26px 2px 10px; }
h3 { font-size: 17px; font-weight: 600; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.label { color: var(--muted); font-size: 14px; }
.sec { color: var(--muted); font-size: 14px; font-weight: 600; margin: 24px 4px 8px; }
.u { font-size: .7em; font-weight: 500; color: var(--muted); margin-left: .25em; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* headers: a title with a status line on the main screens, a round back button on the others */
.bar { display: flex; align-items: center; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 2px 6px; }
.bar > div { flex: 1; min-width: 0; }
.bar h1 { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.bar p { font-size: 14px; font-weight: 600; }
.bar .logo { height: 36px; max-width: 96px; object-fit: contain; }
.bar.sub h1 { flex: 1; text-align: center; font-size: 20px; }
.round, .avatar { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: var(--ink); text-decoration: none; }
.round { border: 1px solid var(--line); }
span.round { visibility: hidden; }
.avatar { background: var(--raise); font-size: 15px; font-weight: 700; }
.banner { background: color-mix(in oklab, var(--warn), transparent 88%); color: var(--warn); border-radius: 16px; padding: 10px 14px; margin-top: 12px; font-size: 14px; font-weight: 500; }

/* bottom bar: icons only, the current one spelled out in the brand colour */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; display: flex; justify-content: space-around; align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--nav); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
}
.tabs a { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.tabs a span { display: none; }
.tabs a[aria-current] { color: var(--accent); }
.tabs a[aria-current] span { display: inline; }
.tabs .ic { width: 25px; height: 25px; }
.tabs i { position: absolute; top: 8px; left: 30px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--nav); }

/* surfaces */
.card { background: var(--card); border-radius: 24px; padding: 18px; margin: 12px 0; }
.card:has(> .rows) { padding-block: 6px; }
.card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.fig { font-size: 27px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fig small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: color-mix(in oklab, currentColor, transparent 86%); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tile { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--raise); color: var(--accent); }
.ok { color: var(--accent); } .bad { color: var(--bad); } .warn { color: var(--warn); } .dim { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.tiles div { background: var(--card); border-radius: 18px; padding: 14px 6px; text-align: center; }
.tiles b { display: block; font-size: 25px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tiles span { color: var(--muted); font-size: 12.5px; }

/* lists: round icon, two lines, something on the right */
ul.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.rows > .day { padding: 16px 0 4px; font-size: 16px; font-weight: 600; }
.rows > .day + li { border-top: 0; }
.rowi { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 0; padding: 13px 0; background: none; border: 0; border-radius: 0; color: var(--ink); text-align: left; text-decoration: none; font: inherit; }
.tx { flex: 1; min-width: 0; }
.tx b { display: block; font-size: 15.5px; font-weight: 600; }
.tx small { display: block; color: var(--muted); font-size: 13.5px; }
.rt { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.rt .ic { width: 18px; height: 18px; }
.new { font-style: normal; font-size: 11.5px; font-weight: 700; background: var(--bad); color: var(--bg); padding: 2px 9px; border-radius: 999px; }
.more { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }
.more .ic { width: 18px; height: 18px; color: var(--muted); }
.card:has(> .rows) > .more { margin-top: 0; padding-bottom: 12px; }

/* the valve and the house */
.about { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.about h3 { font-size: 19px; }
.line { font-size: 14px; font-weight: 500; color: var(--muted); margin: 2px 0 10px; }
.line.bad { color: var(--bad); font-weight: 600; }
/* an alert headline you tap for the whole alert: a plain line, not a pill button */
button.line.tap { display: block; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 14px; text-align: inherit; line-height: 1.4; cursor: pointer; }
button.line.tap small { display: block; margin-top: 2px; font-weight: 500; color: var(--muted); }
.product { flex: none; width: 150px; height: auto; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .28)); }
.product.off { filter: grayscale(1); opacity: .5; }
/* The house is a picture rendered on the page colour; the soft mask hides where the two do not quite meet. */
.house { margin: 0 -16px; }
.house img { display: block; width: 100%; max-width: 430px; height: auto; margin: -44px auto -54px; -webkit-mask-image: radial-gradient(closest-side, #000 74%, transparent); mask-image: radial-gradient(closest-side, #000 74%, transparent); }
.house.off img { filter: grayscale(1); opacity: .45; }
.house + .center { position: relative; } /* the picture's negative margin runs under the Change picture button; this keeps the button on top */
.install { display: flex; gap: 12px; align-items: center; }
.install img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.install div { flex: 1; font-size: 14px; }
.install b { display: block; font-size: 15px; }
.note { background: var(--raise); border-radius: 14px; padding: 10px 14px; font-size: 14px; margin-top: 10px; }
.two { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; }
.two.even { grid-template-columns: 1fr 1fr; margin-top: 10px; }
dl dt { color: var(--muted); font-size: 12.5px; }
dl dd { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rows.bare .rt { font-size: 15px; font-weight: 600; }

/* buttons are pills; the brand colour marks the one main action */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 15.5px; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .08s; }
button:active:not(:disabled) { transform: scale(.98); }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
button.soft, .btn { background: var(--raise); border-color: var(--raise); }
button.soft[aria-pressed=true] { color: var(--accent); border-color: var(--accent); }
button.small, .btn.small { min-height: 36px; padding: 5px 14px; font-size: 14px; }
button.wide { width: 100%; }
button:disabled { opacity: .45; cursor: default; }
button .ic, .btn .ic { width: 20px; height: 20px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.row.end { justify-content: flex-end; }
.seg { display: flex; gap: 6px; margin: 14px 0 4px; }
.seg button { flex: 1; min-height: 40px; padding: 4px 8px; background: var(--card); border-color: var(--card); color: var(--muted); font-size: 14px; white-space: nowrap; }
.seg button[aria-pressed=true] { background: var(--raise); border-color: var(--line); color: var(--accent); }
.switch i { flex: none; position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line); transition: background .18s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .18s; }
.switch[aria-checked=true] i { background: var(--brand); border-color: var(--brand); }
.switch[aria-checked=true] i::after { transform: translateX(20px); background: var(--on-brand); }
.search { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 0 16px; background: var(--card); border-radius: 999px; color: var(--muted); }
.search:focus-within { outline: 2px solid var(--accent); }
label.search input[type=search] { flex: 1; margin: 0; padding: 14px 0; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; }

/* plumber's console */
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
ul.list > li:last-child { border-bottom: 0; padding-bottom: 0; }
ul.list > li:first-child { padding-top: 0; }
code.addr { display: block; overflow-wrap: anywhere; background: var(--bg); padding: 12px 14px; border-radius: 14px; font-size: 12.5px; margin: 10px 0; }

/* charts: quiet grey bars with the newest one lit, a glowing line for readings */
.chart { display: block; overflow: visible; color: var(--accent); }
.chart .grid { stroke: var(--line); stroke-dasharray: 4 5; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--bar); }
.chart .bar.hot { fill: var(--accent); }
.chart .hit, .chart .scrub { fill: transparent; }
.chart .hit:hover, .chart .hit:focus { fill: color-mix(in oklab, var(--ink), transparent 93%); outline: none; }
.chart .trace { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .cross { stroke: var(--muted); stroke-dasharray: 3 4; }
.chart .dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
#tip { position: fixed; z-index: 5; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 10px; border-radius: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#tip strong { font-size: 14px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14.5px; }
details[open] summary { margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 4px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

/* sign-in */
.hello { padding: calc(64px + env(safe-area-inset-top)) 2px 22px; }
.hello svg { width: 34px; height: 34px; fill: var(--accent); margin-bottom: 18px; }
.hello h1 { font-size: 36px; font-weight: 800; line-height: 1.04; letter-spacing: -.01em; text-transform: uppercase; margin-top: 4px; }

/* dialogs rise from the bottom on a phone, like a native sheet */
dialog { border: 0; padding: 28px 20px calc(20px + env(safe-area-inset-bottom)); width: 100%; max-width: 520px; max-height: 88vh; margin: auto auto 0; border-radius: 28px 28px 0 0; background: var(--card); color: var(--ink); }
dialog::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
dialog[open] { animation: rise .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(48px); opacity: 0; } }
@media (min-width: 600px) { dialog { margin: auto; border-radius: 28px; } dialog::before { display: none; } }
dialog::backdrop { background: rgba(0, 0, 0, .5); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 10px; }
dialog p + p { margin-top: 8px; }
label { display: block; margin: 14px 0 0; font-size: 13.5px; font-weight: 500; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select { display: block; width: 100%; font: inherit; padding: 13px 15px; margin-top: 6px; border: 1px solid var(--line); border-radius: 15px; background: var(--bg); color: var(--ink); }
label.check { display: flex; gap: 10px; align-items: center; color: var(--ink); font-size: 15px; font-weight: 400; }
input[type=checkbox], input[type=radio] { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--brand); }
label.check:has(input[type=radio]) { align-items: flex-start; } /* a choice with a line under it */
/* the home pictures to choose from: the picture is the button, the chosen one gets the brand ring */
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.pics label { margin: 0; text-align: center; color: var(--ink); cursor: pointer; }
.pics input { position: absolute; opacity: 0; }
.pics img { display: block; width: 100%; height: auto; border-radius: 14px; border: 2px solid transparent; background: var(--bg); }
.pics input:checked + img { border-color: var(--brand); }
.pics input:focus-visible + img { outline: 2px dashed var(--muted); outline-offset: 2px; } /* keyboard focus, unlike the chosen ring */
.pics span { display: block; margin-top: 4px; font-size: 13.5px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 20px 0 0; padding: 12px 0 0; }
legend { font-weight: 600; font-size: 15px; padding: 0 10px 0 0; }
legend label.check { margin: 0; font-weight: 600; } /* a rule's on/off switch is its heading */
.err { color: var(--bad); margin-top: 10px; font-size: 14px; }
#toast { position: fixed; z-index: 4; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 16px; max-width: 90vw; font-size: 14px; font-weight: 500; }
#toast:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .stream, dialog[open] { animation: none; } * { transition: none !important; } }

/* The look: no boxes at all. The picture, then hairlines and type. Colour only where something is on.
   shortcut: these override the boxed rules above (hence :root in front); fold the two together when the design settles. */
:root .card { background: none; border-radius: 0; padding: 0; }
:root .bar h1 { font-weight: 600; }
:root h2 { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 34px; }
:root .tile { width: 24px; height: 24px; background: none; border-radius: 0; color: var(--ink); }
:root .tile.bad { color: var(--bad); }
:root .chip { background: none; padding: 0; }
:root button, :root .btn { border-radius: 12px; }
:root button.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
:root .seg button[aria-pressed=true] { color: var(--ink); }
:root .tabs { border-radius: 0; border-width: 1px 0 0; }
:root .tabs a[aria-current] { color: var(--ink); }
:root .tabs a:not([aria-current]) { color: var(--muted); }
.va .house img { margin: -34px auto -30px; }
.va .about { padding: 0 2px; }
.va .about h3 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.va .product { width: 104px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0 6px; }
.quick > * { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; padding: 12px 2px; background: none; border: 0; color: var(--ink); font-size: 12px; font-weight: 500; text-decoration: none; text-align: center; line-height: 1.2; }
.quick .ic { width: 26px; height: 26px; stroke-width: 1.4; }
.quick [aria-pressed=true] { color: var(--accent); }
.plain { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 8px; margin: 10px 0 6px; padding: 18px 2px; border-block: 1px solid var(--line); }
.plain dt { font-size: 12px; }
.plain dd { font-size: 17px; font-weight: 500; }
.va .rowi { padding: 16px 2px; }
.va .more { border-top: 1px solid var(--line); margin-top: 0; padding: 16px 2px; }

.va h3 + .label { margin-top: 2px; }
.thumb { flex: none; width: 66px; height: auto; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25)); }
a.about { color: inherit; text-decoration: none; }
.about h3 .ic { width: 18px; height: 18px; vertical-align: -2px; margin-left: 4px; color: var(--muted); }
.va h2 { display: flex; justify-content: space-between; align-items: baseline; }
.va h2 a { font-size: 13px; letter-spacing: 0; text-transform: none; }
/* the confirm page behind the buttons in an alert email: one card, nothing else on the page */
#app > .card:only-child { padding-top: 56px; }
#app > .card:only-child h2 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--ink); margin: 0 0 10px; }
#app > .card:only-child form { margin: 22px 0 18px; }
#app > .card:only-child button { width: 100%; }
:root dialog h2 { font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; text-transform: none; color: var(--ink); margin: 0 0 10px; }
/* the flow gauge over the product on a valve's page */
.gauge { position: relative; aspect-ratio: 3 / 2; max-width: 340px; margin: 6px auto 14px; }
.gauge svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.gauge path { fill: none; stroke: var(--bar); stroke-width: 9; stroke-linecap: round; }
.gauge .fill { stroke: var(--accent); }
.gauge text { fill: var(--muted); font-size: 11px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.va .gauge .product { position: absolute; left: 26%; top: 36%; width: 48%; }
.gauge p { position: absolute; left: 0; right: 0; bottom: 3%; text-align: center; font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gauge b { font-weight: 600; }
.va .quick:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, 1fr); max-width: 300px; margin-inline: auto; }
