/* EVeryWatt design system - "instrument" direction B (petrol ink + filament amber).
   Order: tokens, base, icons, header, layout, controls, instrument panel, summary/sheet, menu,
   then one section per page. Colours are used by ROLE, never by hue name:
     ink / on-dark   the dark instrument surfaces and their text
     signal          the amber glow: charge level, selected charge, the wordmark's "EV"  (dark surfaces only)
     action          primary buttons (ink) - amber is too pale for text/buttons on the light page
     series          the one chart line colour on light cards (a deeper bronze, validated >= 3:1)
     ok / soon / over  status; always paired with an icon and a word, never colour alone                */

:root {
  --font-ui: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", "Arial Narrow", sans-serif;

  --ink: #0e2430;            /* petrol ink: header, panels, text */
  --ink-2: #15323f;          /* raised dark surface */
  --cell-off: #1c3c4b;       /* an unlit battery cell */
  --on-dark: #e6eef2;
  --on-dark-muted: #8fa6b2;
  --dark-line: rgba(230, 238, 242, .14);

  --bg: #e8edf0;             /* page */
  --card: #f7f9fa;           /* light card / sheet surface */
  --tint: #e3ecef;           /* selected / hover wash on light */
  --track: #d9e1e6;          /* segmented-control track */
  --line: #d3dce1;
  --muted: #5b6f7a;
  --muted-strong: #4c606b;   /* muted text that sits on --track */

  --signal: #f2a93b;
  --signal-soft: rgba(242, 169, 59, .42);
  --action: #0e2430;
  --action-ink: #fff;
  --series: #b26a00;         /* chart line / dots / wash on light cards */

  --ok: #1b6b4f;    --ok-bg: #dcefe6;
  --soon: #b4410c;  --soon-bg: #fce3d6;   --soon-on-dark: #ffb38a;
  --over: #b91c1c;  --over-bg: #fbe0e0;
  --focus: #1d4ed8; --focus-on-dark: #8ab4ff;

  --r-panel: 18px;
  --r-card: 14px;
  --r-ctl: 10px;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { font-size: 105%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
:where(button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* the menu moves focus around when it opens/closes; show that ring only to keyboard users (body.kbd, set in app.js) */
body:not(.kbd) .menu-btn:focus-visible, body:not(.kbd) .nav-item:focus-visible { outline: none; }
.topbar :focus-visible, .panel :focus-visible { outline-color: var(--focus-on-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-weight: 400; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 14px; letter-spacing: .005em; }
.view[hidden] { display: none; }

/* icons: one stroke weight everywhere (the sprite lives at the top of index.html) */
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.btn svg.i { width: 16px; height: 16px; margin: -2px 4px 0 -2px; }

/* ---------- header: a slim ink bar with the wordmark ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--ink); color: var(--on-dark); position: sticky; top: 0; z-index: 5;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.brandmark { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.mono { width: 38px; height: 22px; color: var(--on-dark); }
.word { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; letter-spacing: .02em; line-height: 1; color: var(--on-dark); }
.word b { color: var(--signal); font-weight: 700; }
.word .light { font-weight: 600; }
.menu-btn {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; position: relative;
  border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--on-dark); cursor: pointer;
}
.menu-btn:hover { background: var(--ink-2); }
.menu-dot { position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--signal); border: 2px solid var(--ink); }
.menu-dot[hidden] { display: none; }

.user-wrap { position: relative; }
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--signal); background: transparent; color: var(--signal);
  font-weight: 700; font-size: 1.05rem; cursor: pointer;
}
.avatar svg.i { width: 20px; height: 20px; }
.avatar[hidden], .user-menu[hidden] { display: none; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 6; min-width: 190px; padding: 6px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(14, 36, 48, .25);
}
.user-menu button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-weight: 600; text-align: left; color: var(--ink); cursor: pointer; }
.user-menu button:hover { background: var(--tint); }
body[data-vehicle="false"] .vehicle-only { display: none; }

/* ---------- layout ---------- */
main { max-width: 980px; margin: 0 auto; padding: 18px 20px 28px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; }
.card.empty { text-align: center; padding: 40px 20px; }
.empty-ico { color: var(--muted); margin-bottom: 8px; }
.empty-ico svg.i { width: 40px; height: 40px; stroke-width: 1.4; }

.vehicle-banner { display: flex; align-items: center; gap: 12px; margin: 2px 2px 14px; }
.vehicle-banner img { width: 34px; height: 34px; object-fit: contain; }
.vehicle-banner b { display: block; font-size: 1.1rem; font-weight: 600; }
.vehicle-banner span { color: var(--muted); font-size: .9rem; }

/* ---------- controls ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--track); border-radius: var(--r-ctl); padding: 3px; margin-bottom: 14px; }
.tab { padding: 9px; font: inherit; font-weight: 600; cursor: pointer; border: 0; background: transparent; color: var(--muted-strong); border-radius: 8px; }
.tab.active { background: var(--ink); color: var(--on-dark); }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label, .label { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
input[type=number], input:not([type]), input[type=text], input[type=email], input[type=password], input[type=time], input[type=date], select {
  width: 100%; padding: 9px 10px; font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.link-btn { background: none; border: 0; padding: 8px 0 0; font: inherit; font-size: .9rem; color: var(--ink); text-decoration: underline; cursor: pointer; }
.link-btn[hidden] { display: none; }
.auth-notice { background: var(--bg); padding: 10px 12px; border-radius: 8px; font-size: .92rem; margin: 0 0 12px; }
.auth-error { color: var(--over); font-weight: 600; font-size: .92rem; margin: 0 0 12px; }
select:disabled, input:disabled { background: var(--bg); color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--track); padding: 4px; border-radius: var(--r-ctl); margin-bottom: 12px; }
.seg button { border: 0; background: transparent; padding: 8px; font: inherit; font-weight: 600; border-radius: 7px; cursor: pointer; color: var(--muted-strong); }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(14, 36, 48, .2); }

.speeds { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.speed { flex: 1; min-width: 70px; padding: 10px 6px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: var(--r-ctl); color: var(--ink); }
.speed.active, .chip.active, .brand.active { border-color: var(--ink); background: var(--tint); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--ink); }

.btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.btn.primary { background: var(--action); color: var(--action-ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.wide { width: 100%; padding: 12px 16px; }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.danger { color: var(--over); border-color: #fecaca; margin-right: auto; }
.btn[hidden] { display: none; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.stat { background: var(--bg); border-radius: var(--r-ctl); padding: 10px 12px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }
.stats.three { grid-template-columns: repeat(3, 1fr); margin: 0; }
@media (max-width: 480px) { .stats.three { grid-template-columns: 1fr; } }
.notice { background: var(--tint); color: var(--ink); border-radius: var(--r-ctl); padding: 10px 12px; font-size: .92rem; margin-top: 10px; }
.notice.warn { background: var(--soon-bg); color: var(--soon); }
.assume { font-size: .8rem; color: var(--muted); margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.form-error { color: var(--over); font-size: .9rem; margin: 4px 0 0; }
.dlg-sub { font-size: .92rem; margin: 16px 0 8px; color: var(--muted); }

dialog { border: 0; border-radius: 16px; padding: 24px; width: min(560px, 94vw); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(14, 36, 48, .35); }
dialog::backdrop { background: rgba(14, 36, 48, .55); }
dialog h2 { font-size: 1.3rem; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.brands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; color: var(--ink); }
.brand img { width: 34px; height: 34px; object-fit: contain; }

/* ---------- the instrument panel: the charging hero (and the savings headline) ---------- */
.panel { background: var(--ink); color: var(--on-dark); border-radius: var(--r-panel); padding: 18px 16px 16px; }
.panel .muted { color: var(--on-dark-muted); }

.bat-track { position: relative; height: 56px; margin: 46px 12px 50px 4px; }
.bat-body { position: absolute; inset: 0; border: 2px solid rgba(230, 238, 242, .28); border-radius: 12px; overflow: hidden; background: var(--cell-off); }
/* the 20 cells: gaps painted over the fills every 5%, so positions still resolve to 1% */
.bat-body::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(5% - 3px), var(--ink) calc(5% - 3px), var(--ink) 5%);
}
.bat-nub { position: absolute; right: -9px; top: 50%; width: 5px; height: 20px; margin-top: -10px; background: rgba(230, 238, 242, .28); border-radius: 0 3px 3px 0; }
.bat-seg { position: absolute; top: 0; bottom: 0; transition: left .15s, width .15s; pointer-events: none; }
.dragging .bat-seg { transition: none; }
.seg-have { background: var(--signal); }
.seg-add { background: repeating-linear-gradient(135deg, var(--signal-soft) 0 8px, rgba(255, 255, 255, .07) 8px 16px); background-size: 22.6px 22.6px; animation: flow 1s linear infinite; }
@keyframes flow { to { background-position: 22.6px 0; } }
@media (prefers-reduced-motion: reduce) { .seg-add { animation: none; } }
.seg-trip { background: rgba(230, 238, 242, .36); }   /* a calm pale overlay: charge the trip will use */
.seg-taper { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .28) 0 5px, transparent 5px 10px); border-left: 2px dashed rgba(230, 238, 242, .6); }
.bat-seg[hidden] { display: none; }

.bat-leave { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 3px solid var(--soon-on-dark); pointer-events: none; z-index: 2; }
.bat-leave.over { border-color: #ff8a80; }

.bat-handle { position: absolute; top: -8px; height: calc(100% + 16px); width: 44px; margin-left: -22px; cursor: ew-resize; touch-action: none; z-index: 3; outline: none; }
.bat-handle::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 5px; margin-left: -2.5px; background: #fff; border-radius: 3px;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 4px rgba(255, 255, 255, .35);
}
.bat-handle:focus-visible::before { outline: 3px solid var(--focus-on-dark); outline-offset: 5px; }
/* both tags sit above the gauge; when handles are close, or at an edge, the tags slide outward (see battery.js) */
.bat-tag {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); white-space: nowrap; z-index: 4;
  background: var(--ink-2); color: var(--on-dark); border: 1px solid rgba(230, 238, 242, .3);
  font-size: .85rem; font-weight: 600; line-height: 1.25; padding: 2px 10px; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.tag-bottom { background: var(--signal); color: var(--ink); border-color: transparent; font-weight: 700; }
.bat-tag.out-left { transform: translateX(calc(-100% - 2px)); }   /* tag ends at its handle */
.bat-tag.out-right { transform: translateX(2px); }              /* tag starts at its handle */
.bat-scale { position: absolute; left: 0; right: 0; top: calc(100% + 8px); height: 30px; pointer-events: none; }
.bat-scale span { position: absolute; top: 0; width: 1px; height: 7px; background: rgba(230, 238, 242, .35); }
.bat-scale span.maj { height: 11px; background: rgba(230, 238, 242, .6); }
.bat-scale em { position: absolute; top: 13px; transform: translateX(-50%); font-style: normal; font-family: var(--font-display); font-weight: 600; font-size: .95rem; color: var(--on-dark-muted); letter-spacing: .02em; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 12px; justify-content: center; font-size: .8rem; color: var(--on-dark-muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.lg-have { background: var(--signal); }
.lg-add { background: var(--signal-soft); }
.lg-trip { background: rgba(230, 238, 242, .36); border: 1px solid rgba(230, 238, 242, .5); }
.lg-taper { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .45) 0 2px, transparent 2px 4px); border: 1px solid rgba(230, 238, 242, .5); }
.lg-leave { background: var(--soon-on-dark); width: 3px !important; border-radius: 0 !important; margin-right: 8px !important; }

.result { border-top: 1px solid var(--dark-line); padding-top: 14px; text-align: left; }
.big { font-family: var(--font-display); font-weight: 700; font-size: 2.7rem; line-height: 1; letter-spacing: .01em; margin: 6px 0 2px; }
.big.time { font-size: 5.4rem; margin: 2px 0 6px; }
.big.time .u { font-size: 2rem; color: var(--on-dark-muted); margin: 0 .55rem 0 .15rem; letter-spacing: .02em; }
.finish { font-size: 1.05rem; color: var(--on-dark); }
.finish b { color: var(--signal); font-weight: 700; }
.panel .stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; margin: 16px 0 0; border-top: 1px solid var(--dark-line); }
.panel .stat { background: transparent; border-radius: 0; padding: 12px 8px 0 0; }
.panel .stat + .stat { padding-left: 12px; border-left: 1px solid var(--dark-line); }
.panel .stat b { font-size: 2rem; line-height: 1; color: #fff; }
.panel .stat b small { font-size: 1rem; color: var(--on-dark-muted); margin-left: 3px; }
.panel .stat span { display: block; margin-top: 3px; font-size: .78rem; line-height: 1.25; color: var(--on-dark-muted); }
.panel .notice { background: rgba(255, 255, 255, .07); color: var(--on-dark); }
.panel .notice.warn { background: rgba(255, 153, 102, .14); color: var(--soon-on-dark); }
.panel .assume { color: var(--on-dark-muted); border-top-color: var(--dark-line); text-align: left; }
.cost-hint { margin: 12px 0 0; font-size: .88rem; color: var(--on-dark-muted); }

/* ---------- phone: settings are ruled rows that open a full-screen sheet ---------- */
.summary, .sheet-bar { display: none; }
@media (max-width: 760px) {
  main { padding: 14px 14px 24px; }
  .summary { display: block; margin: 8px 2px 4px; }
  .sum-row {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label chev" "val chev"; align-items: center;
    width: 100%; padding: 12px 0; font: inherit; text-align: left; background: transparent; border: 0;
    border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer;
  }
  .sum-label { grid-area: label; font-size: .82rem; color: var(--muted); }
  .sum-val { grid-area: val; font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
  .chev { grid-area: chev; color: var(--muted); }

  .grid { display: none; }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .grid { display: flex; flex-direction: column; align-items: stretch; gap: 16px; margin: 0; position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--bg); padding: 0 14px 28px; }
  .sheet-bar { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 1; margin: 0 -14px; padding: 12px 14px; background: var(--ink); color: var(--on-dark); }
  .sheet-bar b { font-size: 1.15rem; }
  .sheet-bar .btn.primary { background: var(--signal); color: var(--ink); }
  .grid h2 { display: none; } /* the sheet bar already carries the title */
  .grid .chips { margin-top: 10px; }
  .grid[data-sheet="levels"] #chargerCard, .grid[data-sheet="charger"] #levelsCard { display: none; }
}

/* ---------- category menu ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(8, 22, 30, .55); }
.scrim[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 31; width: min(300px, 84vw); display: flex; flex-direction: column;
  background: var(--card); box-shadow: 6px 0 30px rgba(8, 22, 30, .3); padding: 14px 10px; padding-bottom: max(14px, env(safe-area-inset-bottom)); overflow-y: auto;
  transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .2s ease; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer.open { transition: none; } }
.drawer-head { display: flex; align-items: center; gap: 9px; padding: 4px 8px 10px; }
.drawer-head .mono { color: var(--ink); }
.drawer-head .word { color: var(--ink); }
.drawer-head .word b { color: #c98a1c; }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer li.grp { margin: 14px 10px 4px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 10px; border: 0; border-radius: var(--r-ctl); background: transparent; font: inherit; font-weight: 600; font-size: 1.05rem; text-align: left; color: var(--ink); cursor: pointer; position: relative; }
.nav-item svg.i { color: var(--muted); }
.nav-item:hover { background: var(--tint); }
.nav-item.active { background: var(--tint); }
.nav-item.active svg.i { color: var(--ink); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--signal); }
.badge { margin-left: auto; min-width: 22px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: var(--on-dark); font-size: .8rem; font-weight: 700; text-align: center; }
.badge[hidden] { display: none; }
.drawer-vehicle { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: block; }
.drawer-vehicle[hidden] { display: none; }
.drawer-vehicle .label { display: block; color: var(--muted); font-weight: 600; font-size: .8rem; margin-bottom: 6px; }

/* ---------- charger card: primary charger + price ---------- */
.primary-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .95rem; }
.primary-row svg.i { width: 16px; height: 16px; color: var(--signal); margin: -2px 2px 0 0; }
.primary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.primary-actions .btn { padding: 7px 12px; font-size: .92rem; }
.tariff-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
.sum-val svg.i, .row-star { width: 15px; height: 15px; color: var(--signal); margin: -3px 2px 0 0; }

/* ---------- EV Savings ---------- */
.sv-hero { text-align: left; }
.sv-hero .big { font-size: 4.4rem; margin: 4px 0 6px; }
.sv-hero .big .per { font-size: 1.5rem; font-weight: 600; letter-spacing: 0; color: var(--on-dark-muted); margin-left: .35rem; }
#svEnv h2 { margin-bottom: 12px; }
.sv-source { margin-bottom: 14px; }
.edit-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label chev" "val chev"; align-items: center; width: 100%; margin: 6px 0 14px; padding: 12px 2px; font: inherit; text-align: left; color: var(--ink); cursor: pointer; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); }
.edit-label { grid-area: label; font-size: .82rem; color: var(--muted); }
.edit-val { grid-area: val; font-weight: 600; font-size: .98rem; }
.edit-chev { grid-area: chev; color: var(--muted); }
#svNote { margin-top: 0; }
.sub-tip { color: var(--muted); }

/* ---------- charging log ---------- */
.log-summary { margin: 14px 0; }
.log-summary .stats { margin: 12px 0 0; }
.log-summary .notice { margin-top: 0; }
.log-summary .notice .sub { display: block; margin-top: 4px; font-size: .8rem; opacity: .85; }
.log-summary .notice.muted { background: var(--bg); color: var(--muted); }
.notice svg.i { width: 17px; height: 17px; margin: -2px 4px 0 0; }
#logList, #bhList { border-top: 1px solid var(--line); }
.log-item { display: block; width: 100%; padding: 13px 2px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.log-item:hover { background: var(--tint); }
.li-top { display: flex; justify-content: space-between; gap: 12px; font-size: 1.1rem; }
.li-top b { font-variant-numeric: tabular-nums; font-weight: 700; }
.li-cost { font-weight: 700; font-variant-numeric: tabular-nums; }
.li-sub { display: block; margin-top: 2px; font-size: .9rem; color: var(--muted); }
#logList .card.empty, #bhList .card.empty { margin-top: 14px; }
#logEff .stats.three { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
#logEff .stat { padding: 8px 10px; }
#logEff .stat span { font-size: .74rem; }
#logEff h2 { margin-bottom: 12px; }
#logEff .notice { margin: 0 0 12px; }

/* ---------- battery health + line chart ---------- */
.bh-card { margin: 14px 0; }
.bh-card .seg { margin-bottom: 14px; }
.bh-head { text-align: center; margin-bottom: 8px; }
.hero-fig { font-family: var(--font-display); font-size: 4.4rem; font-weight: 700; letter-spacing: .01em; line-height: 1; margin: 6px 0; }
.bh-delta { font-weight: 600; }
.bh-delta svg.i { width: 14px; height: 14px; margin: -2px 2px 0 0; }
.bh-rate { font-size: .88rem; margin-top: 2px; }
.bh-hint { text-align: center; margin: 8px 0 0; font-size: .92rem; }
#bhHabits { margin-bottom: 14px; }
#bhHabits h2 { margin-bottom: 12px; }
#bhHabits .stats { margin: 0; }
#bhHabits .assume, .bh-card .assume { margin-top: 12px; }

.vz { --vz-surface: var(--card); --vz-series: var(--series); --vz-grid: var(--line); --vz-muted: var(--muted); --vz-ink: var(--ink); }
.vz-wrap { position: relative; }
.vz svg { display: block; overflow: visible; }
.vz-grid { stroke: var(--vz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.vz-axis { fill: var(--vz-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; font-family: var(--font-ui); }
.vz-line { fill: none; stroke: var(--vz-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.vz-area { fill: var(--vz-series); fill-opacity: .1; stroke: none; }
.vz-ring { fill: var(--vz-surface); }
.vz-dot { fill: var(--vz-series); }
.vz-value { fill: var(--vz-ink); font-size: 13px; font-weight: 700; font-family: var(--font-ui); }
.vz-cross { stroke: var(--vz-muted); stroke-width: 1; shape-rendering: crispEdges; }
.vz-hot { fill: var(--vz-series); stroke: var(--vz-surface); stroke-width: 2; }
.vz svg circle[tabindex]:focus { outline: none; }
.vz svg circle[tabindex]:focus-visible { stroke: var(--focus); stroke-width: 2; }
.vz-tip { position: absolute; z-index: 2; transform: translateX(-50%); pointer-events: none; white-space: nowrap; padding: 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(14, 36, 48, .18); }
.vz-tip[hidden] { display: none; }
.vz-tip b { font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.vz-tip i { display: inline-block; width: 12px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--vz-series); } /* a line key, not a box */
.vz-tip span { display: block; font-size: .8rem; color: var(--muted); }

/* ---------- backup & restore ---------- */
.bk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.bk-note { font-size: .85rem; margin: 6px 0 0; }
#backupDialog input[type=file] { width: 100%; font: inherit; }
#backupDialog .notice { margin: 8px 0 0; }
#backupDialog h3.dlg-sub:first-of-type { margin-top: 8px; }

/* ---------- service & warranty ---------- */
[data-view="service"] > .card { margin-bottom: 14px; }
[data-view="service"] h2 { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.odo-big { font-family: var(--font-display); font-size: 3.4rem; font-weight: 700; letter-spacing: .01em; line-height: 1; }
.odo-form { display: flex; gap: 8px; margin-top: 12px; }
.odo-form input { flex: 1; min-width: 0; }
.sec-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.svc-row { padding: 13px 0; border-top: 1px solid var(--line); }
.svc-row:first-of-type { border-top: 0; padding-top: 0; }
.svc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.svc-name { font-weight: 700; font-size: 1.1rem; }
.svc-interval { font-size: .85rem; color: var(--muted); }
.svc-lines { margin: 6px 0 0; font-size: .95rem; color: var(--ink); }
.svc-lines div + div { margin-top: 2px; }
.svc-lines .muted { font-size: .88rem; }
.svc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-status { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 3px 10px 3px 7px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.chip-status svg.i { width: 15px; height: 15px; stroke-width: 2.2; }
.chip-status.ok { background: var(--ok-bg); color: var(--ok); }
.chip-status.soon { background: var(--soon-bg); color: var(--soon); }
.chip-status.overdue, .chip-status.expired { background: var(--over-bg); color: var(--over); }
.chip-status.unknown { background: var(--bg); color: var(--muted); }
/* meters reuse the battery's cell motif: 20 cells, gaps painted over a plain fill */
.meter-row { margin-top: 8px; font-size: .86rem; color: var(--muted); }
.meter { position: relative; height: 9px; margin-top: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.soon i { background: var(--soon); }
.meter.expired i { background: var(--over); }
.meter::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(5% - 2px), var(--card) calc(5% - 2px), var(--card) 5%); }
.hist-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .95rem; }
.hist-row:first-of-type { border-top: 0; }
.hist-row .muted { font-size: .88rem; }
.x-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.x-btn svg.i { width: 18px; height: 18px; }
.x-btn:hover { color: var(--over); }
