/* Layout: one phone-first column. A meter-style readout of the current zone, a 7-day zone grid, an appliance planner, a tariff calculator, a price editor and sources. */
:root {
  --bg: #edf0f3;
  --surface: #ffffff;
  --ink: #15202b;
  --muted: #5a6673;
  --line: #d3dae1;
  --accent: #2346c4;
  --accent-soft: #e3e9fb;
  --lcd: #dde4d0;
  --lcd-ink: #1d2617;
  --z0: #13865f; --z0-soft: #d4eee3; --z0-ink: #0c6447;
  --z1: #c48a12; --z1-soft: #f5e6c3; --z1-ink: #7e5500;
  --z2: #c93b2b; --z2-soft: #f6d9d3; --z2-ink: #a12a1c;
  --zf: #7b8794; --zf-soft: #e2e7ec; --zf-ink: #44505c;
  --f-display: "Geologica", "IBM Plex Sans", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1418; --surface: #172028; --ink: #e3e9ee; --muted: #9aa7b3; --line: #2a3742;
    --accent: #8aa5ff; --accent-soft: #1d2a4d; --lcd: #1f2a1c; --lcd-ink: #d3e6c4;
    --z0: #34b884; --z0-soft: #13342a; --z0-ink: #6fdcb0;
    --z1: #d9a43a; --z1-soft: #3a2d10; --z1-ink: #f0c568;
    --z2: #e8604d; --z2-soft: #3e1b16; --z2-ink: #ff9283;
    --zf: #7f8c99; --zf-soft: #24303a; --zf-ink: #b8c3cd;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1418; --surface: #172028; --ink: #e3e9ee; --muted: #9aa7b3; --line: #2a3742;
  --accent: #8aa5ff; --accent-soft: #1d2a4d; --lcd: #1f2a1c; --lcd-ink: #d3e6c4;
  --z0: #34b884; --z0-soft: #13342a; --z0-ink: #6fdcb0;
  --z1: #d9a43a; --z1-soft: #3a2d10; --z1-ink: #f0c568;
  --z2: #e8604d; --z2-soft: #3e1b16; --z2-ink: #ff9283;
  --zf: #7f8c99; --zf-soft: #24303a; --zf-ink: #b8c3cd;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
[hidden] { display: none !important; }
.wrap { max-width: 780px; margin: 0 auto; padding-inline: 16px; padding-block: 18px 48px; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
h2 { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.005em; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; display: block; }
.brand h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.badge { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.seg-ctrl { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-ctrl button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.seg-ctrl button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.lede { color: var(--muted); max-width: 62ch; }

/* Install banner */
.install { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.install img { width: 40px; height: 40px; border-radius: 9px; flex: none; }
.install-text { flex: 1 1 14rem; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-text b { font-family: var(--f-display); font-weight: 700; }
.install-actions { display: flex; gap: 8px; }

/* Picker */
.pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 0.82rem; font-weight: 600; }
select, input[type="number"] { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
input[type="number"] { font-family: var(--f-mono); }
.hint { font-size: 0.8rem; color: var(--muted); }
.inline-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.inline-opts label { display: flex; gap: 8px; align-items: flex-start; font-size: 0.86rem; font-weight: 400; cursor: pointer; }
.inline-opts input { margin-top: 4px; }
details > summary { cursor: pointer; font-weight: 600; font-size: 0.88rem; }
details[open] > summary { margin-bottom: 10px; }
.note { font-size: 0.84rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
.pick-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* Now readout */
.now { border: 2px solid var(--zf); background: var(--zf-soft); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.now[data-lv="0"] { border-color: var(--z0); background: var(--z0-soft); }
.now[data-lv="1"] { border-color: var(--z1); background: var(--z1-soft); }
.now[data-lv="2"] { border-color: var(--z2); background: var(--z2-soft); }
.now-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.now-zone { font-family: var(--f-display); font-weight: 700; font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.015em; color: var(--zf-ink); }
.now[data-lv="0"] .now-zone { color: var(--z0-ink); }
.now[data-lv="1"] .now-zone { color: var(--z1-ink); }
.now[data-lv="2"] .now-zone { color: var(--z2-ink); }
.lcd { font-family: var(--f-mono); font-weight: 600; background: var(--lcd); color: var(--lcd-ink); padding: 3px 9px; border-radius: 5px; font-size: 0.95rem; letter-spacing: 0.04em; border: 1px solid color-mix(in srgb, var(--lcd-ink) 18%, transparent); }
.now-price { font-family: var(--f-mono); font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.now-price small { font-size: 0.78rem; font-weight: 400; color: var(--muted); font-family: var(--f-body); }
.now-next { font-size: 0.95rem; }
.now-next b { font-weight: 600; }
.now-tariff { font-size: 0.82rem; color: var(--muted); border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); padding-top: 8px; }
.lv-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--zf); }
.dot[data-lv="0"] { background: var(--z0); } .dot[data-lv="1"] { background: var(--z1); } .dot[data-lv="2"] { background: var(--z2); }

/* Week grid */
.grid-scroll { overflow-x: auto; }
.week { display: grid; grid-template-columns: 4.6rem repeat(24, minmax(9px, 1fr)); gap: 2px; min-width: 330px; }
.week .hr { font-family: var(--f-mono); font-size: 0.66rem; color: var(--muted); grid-column: span 3; }
.week .day { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.week .day.today { color: var(--ink); font-weight: 600; }
.week .day .hol { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.cell { height: 22px; border-radius: 3px; background: var(--zf); }
.cell[data-lv="0"] { background: var(--z0); } .cell[data-lv="1"] { background: var(--z1); } .cell[data-lv="2"] { background: var(--z2); }
.cell.past { opacity: 0.35; }
.cell.cur { outline: 2px solid var(--ink); outline-offset: 1px; position: relative; z-index: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.84rem; color: var(--muted); }
.leg { display: inline-flex; gap: 5px; align-items: center; }

/* Zones & schedule */
.zones { display: flex; flex-direction: column; gap: 10px; }
.zone-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 10px; align-items: baseline; }
.zone-row .dot { transform: translateY(1px); }
.zone-name { font-weight: 600; }
.zone-price { font-family: var(--f-mono); font-size: 0.92rem; text-align: right; white-space: nowrap; }
.sched { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.sched th, .sched td { text-align: left; padding: 7px 8px 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
.sched th { font-weight: 600; width: 34%; }
.sched td .zl { display: flex; gap: 6px; align-items: baseline; }
.sched td .zl + .zl { margin-top: 2px; }

/* Planner */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 0.86rem; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.plan-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plan-out { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 10px; background: var(--accent-soft); }
.plan-out .big { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; }

/* Calculator */
.drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.btn { border: 1px solid var(--ink); background: var(--ink); color: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; font-size: 0.88rem; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.data-sum { font-size: 0.86rem; }
.data-sum.sample { color: var(--muted); }
.res { display: flex; flex-direction: column; gap: 12px; }
.res-row { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) 6.6rem; gap: 6px 12px; align-items: center; }
.res-row .g { font-family: var(--f-mono); font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.res-row .g .tag { font-family: var(--f-body); font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.res-row .g .tag.best { color: var(--z0-ink); }
.res-row .cost { font-family: var(--f-mono); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.res-row .cost small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 0.74rem; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.costbar { height: 10px; border-radius: 5px; background: var(--ink); opacity: 0.85; }
.res-row.is-best .costbar { background: var(--z0); opacity: 1; }
.share { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 1px; }
.share span { background: var(--zf); }
.share span[data-lv="0"] { background: var(--z0); } .share span[data-lv="1"] { background: var(--z1); } .share span[data-lv="2"] { background: var(--z2); }
.share-txt { font-size: 0.74rem; color: var(--muted); }
.verdict { padding: 12px 14px; border-radius: 10px; background: var(--z0-soft); color: var(--ink); }
.verdict.same { background: var(--zf-soft); }
.verdict b { font-family: var(--f-mono); }
.skipped { font-size: 0.82rem; color: var(--muted); }

/* Prices */
.ptable { display: flex; flex-direction: column; gap: 12px; }
.pgroup { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 8px 12px; align-items: start; padding-top: 10px; border-top: 1px solid var(--line); }
.pgroup .g { font-family: var(--f-mono); font-weight: 600; padding-top: 6px; }
.pzones { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.pz { display: flex; flex-direction: column; gap: 4px; width: 8.6rem; }
.pz label { font-size: 0.76rem; color: var(--muted); }
.pz .dist { font-size: 0.72rem; color: var(--muted); font-family: var(--f-mono); }
.prow { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }

/* Sources, footer, toast */
.src { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.foot { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 0.8rem; color: var(--muted); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 10; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 10px 12px 10px 16px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: 0.9rem; box-shadow: 0 6px 24px rgb(0 0 0 / 0.2); }
.toast .btn { background: var(--surface); color: var(--ink); border-color: var(--surface); }

@media (max-width: 560px) {
  .pick, .plan-in { grid-template-columns: 1fr; }
  .now-zone { font-size: 1.45rem; }
  .res-row { grid-template-columns: 4.4rem minmax(0, 1fr) 5.8rem; }
  .sched th { width: 40%; }
}
@media (prefers-reduced-motion: no-preference) {
  .now, .cell { transition: background-color .25s ease, border-color .25s ease; }
}
