/* Pinge: Elektron's colours and parts (tokens, buttons, settings rows, price chart), plus device cards and plan strips. */
:root {
  --bg: #f5f6f3; --card: #ffffff; --ink: #1a1f1c; --muted: #5d6862; --line: #e2e6e2;
  --go: #15803d; --go-bg: #e7f4eb; --wait: #1d4ed8; --wait-bg: #e9effc; --bad: #b42318; --bad-bg: #fdecea;
  --cheap: #3fa463; --normal: #c4ccc6; --pricey: #eea23b; --spike: #d64545;
  --focus: #2563eb; --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 2px 10px rgb(0 0 0 / 0.04);
  --heat-line: #c2410c; --grid: #e7ebe8; --night: rgb(60 90 160 / 0.08); --peak: rgb(214 69 69 / 0.09);
  --z-night: #3f72d6; --z-day: #9aa3ae; --z-flat: #9aa3ae; --z-dayPeak: #d23b3b; --z-restDayPeak: #e0a82a;
  --h0: #fff59d; --h1: #ffca28; --h2: #ff9800; --h3: #f4511e; --h4: #c62828; --h5: #6d1b2b;
  --p-on: #15803d; --p-off: #e3e7e4; --offline: #9aa3ae;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513; --card: #1a201d; --ink: #e9eeea; --muted: #9aa69f; --line: #2a332e;
    --go: #4ade80; --go-bg: #15291d; --wait: #8fb0ff; --wait-bg: #18213a; --bad: #ff8a80; --bad-bg: #3a1a18;
    --cheap: #3c9a5c; --normal: #4a544e; --pricey: #d18f33; --spike: #e05a5a; --shadow: none;
    --heat-line: #fdba74; --grid: #27302b; --night: rgb(150 175 235 / 0.07); --peak: rgb(240 110 110 / 0.10);
    --z-night: #5b8ff0; --z-day: #6f7884; --z-flat: #6f7884; --z-dayPeak: #ef5350; --z-restDayPeak: #e8c04a;
    --h0: #f5e27a; --h1: #f2b51c; --h2: #ee8410; --h3: #e1521f; --h4: #c0352f; --h5: #8f2a3a;
    --p-on: #4ade80; --p-off: #2c3631; --offline: #6f7884;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; max-width: 560px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 4px; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 650; font-size: 18px; }
.brand img { border-radius: 7px; }
.lang { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
main { max-width: 560px; margin: 0 auto; padding: 4px 12px 24px; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.err { color: var(--bad); font-size: 14px; margin: 6px 0 0; }
.okmsg { color: var(--go); font-size: 14px; margin: 6px 0 0; }

/* buttons */
.btn { border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 8px 12px; min-height: 40px; cursor: pointer; font-size: 15px; font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--go); border-color: var(--go); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b1a10; } }
.btn.danger { color: var(--spike); }
.btn.wide { width: 100%; }
.btn.small-btn { min-height: 34px; padding: 4px 10px; font-size: 14px; color: var(--muted); border-radius: 999px; }
.btn.primary.small-btn { color: #fff; }   /* a small primary button keeps the primary's text colour */
@media (prefers-color-scheme: dark) { .btn.primary.small-btn { color: #0b1a10; } }
.btn:disabled { opacity: .5; cursor: default; }

/* login */
.login { max-width: 360px; margin: 40px auto; display: grid; gap: 14px; }
.login h1 { font-size: 24px; }
.login form { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field input { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; min-height: 46px; font-weight: 400; }

/* price now */
.now { padding: 6px 2px 12px; }
.now-label { color: var(--muted); font-size: 14px; }
.now-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.now-price .big { font-size: 42px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.now-price .unit { color: var(--muted); font-size: 17px; }
.word { font-weight: 650; font-size: 17px; padding-left: 4px; }
.word.cheap { color: var(--cheap); } .word.normal { color: var(--muted); } .word.pricey { color: var(--pricey); } .word.spike { color: var(--spike); }
.now-sub { margin-top: 4px; font-size: 14px; }
.banner { background: var(--wait-bg); border-radius: 12px; padding: 12px 14px; font-size: 15px; margin: 0 0 12px; display: grid; gap: 8px; justify-items: start; }
.banner p { margin: 0; }
.banner.bad { background: var(--bad-bg); color: var(--bad); display: block; }

/* device cards */
.devs { display: grid; gap: 12px; }
.dev, .dev-top { background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); border: 1px solid var(--line); border-left: 5px solid var(--line); }
.dev.on, .dev-top.on { border-left-color: var(--go); }
.dev.offline, .dev-top.offline { border-left-color: var(--offline); }
.dev.has-err { border-left-color: var(--bad); }
.dev-head { display: flex; align-items: center; gap: 10px; }
.dev-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-decoration: none; min-height: 44px; }
.dev-name h2 { font-size: 18px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-top h1 { font-size: 22px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.state { color: var(--muted); font-size: 14px; flex: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--p-off); flex: none; border: 1px solid var(--line); }
.dot.on { background: var(--go); border-color: var(--go); }
.dot.offline { background: var(--offline); }
.dev-body { display: block; text-decoration: none; padding: 2px 0 0; }
.dev-rule { margin: 2px 0 8px; color: var(--muted); font-size: 15px; }
.ovr { margin: 8px 0 0; font-size: 14px; color: var(--wait); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tog { position: relative; width: 60px; height: 34px; flex: none; border: 0; padding: 0; background: var(--normal); border-radius: 999px; cursor: pointer; transition: background .15s; }
.tog span { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.tog.is-on { background: var(--go); }
.tog.is-on span { transform: translateX(26px); }
.tog:disabled { opacity: .45; cursor: default; }

/* plan strips */
svg.plan { display: block; width: 100%; height: 10px; overflow: visible; }
svg.plan.under { height: auto; margin: 2px 0 4px; }
svg.plan .p-on { fill: var(--p-on); }
svg.plan .p-off { fill: var(--p-off); }
svg.plan .p-est { opacity: .45; }
svg.plan .p-past { fill: var(--card); opacity: .5; }
svg.plan .p-now { fill: var(--ink); }
.hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.key { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 2px; }
.key .sw { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.key .sw.on { background: var(--p-on); } .key .sw.off { background: var(--p-off); border: 1px solid var(--line); } .key .sw.est { background: var(--p-on); opacity: .45; }
.sum { margin: 0 4px 12px; font-size: 14px; }

/* device page */
.backlink { display: inline-block; margin: 0 0 8px; color: var(--muted); text-decoration: none; font-weight: 600; padding: 6px 0; }
.dev-top { margin-bottom: 14px; }
.dev-top .dev-head { min-height: 44px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px 0 10px; }
.mode { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 8px; min-height: 46px; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mode[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.plans { margin-bottom: 14px; }
.segs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.seg { display: flex; align-items: center; gap: 4px; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; min-height: 34px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.day { margin-bottom: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 4px 2px; box-shadow: var(--shadow); }
.day h3 { font-size: 15px; font-weight: 600; margin: 0 6px 2px; }
.day h3 .small { font-weight: 400; font-size: 13px; }
.readout { min-height: 22px; margin: 6px 4px 0; font-size: 15px; font-variant-numeric: tabular-nums; }

/* price chart (Elektron's) */
svg.chart { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis { stroke: var(--muted); stroke-width: 1; opacity: .5; }
svg.chart .ylab, svg.chart .xlab { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
svg.chart .ylab { text-anchor: end; }
svg.chart .xlab { text-anchor: middle; }
svg.chart .pline { fill: none; stroke: var(--heat-line); stroke-width: 1.5; stroke-linejoin: round; }
svg.chart .past { fill: var(--card); opacity: .55; }
svg.chart .nowline { stroke: var(--ink); stroke-width: 1.2; }
svg.chart .nowdot { fill: var(--ink); stroke: var(--card); stroke-width: 2; }
svg.chart .mm { fill: var(--ink); }
svg.chart .mmlab { fill: var(--ink); font-size: 10px; font-weight: 650; text-anchor: middle; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
svg.chart .xh { stroke: var(--ink); stroke-width: 1; }
svg.chart .xd { fill: var(--card); stroke: var(--ink); stroke-width: 2; }
svg.chart .hit { fill: transparent; cursor: crosshair; }

/* settings */
.set { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.set > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; padding: 12px 0 4px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row .lbl { flex: 1; min-width: 0; }
.row .lbl small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; margin-top: 2px; }
.row input[type=time], .row input[type=text], .row input[type=password], .row select { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 8px; min-height: 40px; max-width: 170px; }
.row input[type=text] { width: 170px; }
.row.stack { flex-wrap: wrap; row-gap: 8px; }
.row.stack .lbl { flex-basis: 100%; }
.row.stack > select, .row.stack > input { max-width: none; width: 100%; }
.pair { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--normal); border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--go); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.zones { list-style: none; margin: 0 0 10px; padding: 10px 12px; background: var(--bg); border-radius: 10px; display: grid; gap: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.set .note { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.set .modes + .note { margin-top: 0; }
.set .actions { padding: 12px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.about { color: var(--muted); font-size: 14px; padding-bottom: 12px; margin: 0; }
details.how { border-top: 1px solid var(--line); padding: 10px 0; }
details.how summary { cursor: pointer; font-weight: 600; min-height: 32px; }
details.how ol { margin: 8px 0 4px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
ul.found { list-style: none; margin: 0 0 10px; padding: 0; }
ul.found li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
ul.found li > span, ul.found li > a { display: grid; min-width: 0; text-decoration: none; }
ul.found small { color: var(--muted); font-size: 13px; }
ul.log { list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; }
ul.log li { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
ul.log time { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; min-width: 92px; }
ul.log li.k-error span { color: var(--bad); }
ul.log li.k-app span { color: var(--wait); }

/* bottom tabs, sheet, toast, footer */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs[hidden] { display: none; }
.tabs a { flex: 0 1 200px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--go); }
.sheet { position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / 0.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--card); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.sheet .panel h2 { font-size: 18px; }
.sheet .panel .btn { width: 100%; min-height: 46px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 15px; z-index: 20; width: max-content; max-width: calc(100vw - 32px); text-align: center; }
.toast[hidden] { display: none; }
.empty { padding: 32px 0; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.foot { margin-top: 22px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }

/* people: sign-in forms, one-time links, household, admin */
.login .row { border-top: 0; padding: 0; }
.login .row input { width: 100%; max-width: none; min-height: 46px; }
.linkish { border: 0; background: none; padding: 0; color: var(--go); text-decoration: underline; cursor: pointer; font: inherit; }
.picker { border-top: 0; padding: 0 2px 10px; }
.picker select { max-width: 70%; }
.once { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--go-bg); border-radius: 12px; padding: 10px; margin: 6px 0 12px; }
.once .once-link { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px; font: 13px/1.3 ui-monospace, Menlo, monospace; }
.once .note { grid-column: 1 / -1; margin: 0; }
ul.found li .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
ul.found li.person { flex-wrap: wrap; }
ul.found li.person.off b { text-decoration: line-through; opacity: .7; }
ul.found li .err { font-size: 13px; }
.set h3 { font-size: 14px; font-weight: 650; margin: 10px 0 0; }
form.inline .row { border-top: 1px solid var(--line); }
.empty h1 { font-size: 20px; color: var(--ink); }
.tabs a[hidden] { display: none; }

/* set-up wizard (computer and phone) */
.wiz { display: grid; gap: 12px; }
.wiz h1 { font-size: 24px; }
.wiz-head { margin: 4px 0 0; font-size: 14px; }
.wiz-dots { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0; flex-wrap: wrap; }
.wiz-dots a { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); text-decoration: none; font-size: 14px; font-weight: 650; color: var(--muted); }
.wiz-dots a.done { background: var(--go-bg); color: var(--go); border-color: var(--go); }
.wiz-dots a.cur { outline: 2px solid var(--ink); outline-offset: 1px; color: var(--ink); }
.help { font-size: 16px; line-height: 1.55; }
.help ol, .help ul { padding-left: 22px; display: grid; gap: 6px; }
.help blockquote { margin: 8px 0 0; padding: 10px 14px; border-left: 3px solid var(--wait); background: var(--wait-bg); border-radius: 0 10px 10px 0; font-size: 15px; }
.help blockquote p { margin: 0; }
.help code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.help a { color: var(--go); }
.wiz-pic { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.wiz-form, .wiz-part { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; box-shadow: var(--shadow); }
.wiz-form .err, .wiz-form .okmsg { display: grid; gap: 8px; justify-items: start; padding-top: 6px; }
.wiz-form .err p, .wiz-form .okmsg p { margin: 0; }
.wiz-part h3 { margin-top: 14px; }
.wiz-url { font-size: 26px; font-weight: 700; margin: 4px 0; overflow-wrap: anywhere; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0 16px; }
.wiz-nav .btn { min-width: 120px; }
@media (min-width: 900px) { main:has(.wiz), body:has(.wiz) .top { max-width: 720px; } }

.set > .row:first-child { border-top: 0; }

/* pictures with numbered markers (docs/playbooks/annotated-screenshots/callouts.css) — numbered markers over a screenshot, and their key (see README.md, "Drawing the markers").
   Fixed colours, not theme tokens: the screenshots themselves are always light. Change #1461cc to the project's accent. */

/* the picture's box shrinks to the picture (display: table), so the markers' percentages land on the picture even when
   a tall, narrow picture is capped in height and narrower than the column */
.shot { margin: 16px 0 20px; }
.shot-img { position: relative; display: table; margin-inline: auto; max-width: 100%; border: 1px solid #d3dbe3; border-radius: 8px; overflow: hidden; background: #fff; }
.shot-img img { display: block; width: auto; max-width: 100%; height: auto; max-height: 80vh; }

/* a marker on its target (a large area): an outlined ring, transparent inside, the number in the accent with a white
   halo, so whatever is under it stays readable */
.callout {
  position: absolute; transform: translate(-50%, -50%); width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box;
  border: 2.5px solid #1461cc; background: transparent; color: #1461cc; font: 800 15px/23px system-ui, sans-serif; text-align: center;
  box-shadow: 0 0 0 1.5px #fff, inset 0 0 0 1.5px #fff; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff;
}
/* a marker moved aside into empty space: a solid disc, joined to its control by the leader line */
.callout.aside { background: #fff; box-shadow: 0 0 0 1.5px #fff, 0 1px 4px rgba(0, 0, 0, .3); text-shadow: none; }
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.leaders line { stroke: #1461cc; stroke-width: 2; filter: drop-shadow(0 0 1px #fff); }
.leaders .end { fill: #1461cc; stroke: #fff; stroke-width: 1.5; }

/* the numbered key under the picture */
.shot figcaption { color: #586674; font-size: 13.5px; margin-top: 8px; }
.shot-key { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14.5px; }
.shot-key li { display: flex; gap: 8px; align-items: baseline; }
.shot-key .n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: #1461cc; color: #fff; font: 700 12px/1 system-ui, sans-serif; }

@media print {
  .shot { break-inside: avoid; }
  .shot-img img { max-height: 190mm; }
}
