/* =========================================================================
   EV Charge — Kirsebærvegen 15
   Design system + app styles
   © AEDANI Studio AS
   ========================================================================= */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  /* Brand — sampled from the app icon (orange → red bolt) */
  --brand-1:      #FFA23A;
  --brand-2:      #F4623F;
  --brand-3:      #E8453C;
  --brand:        #F5673F;
  --brand-soft:   rgba(244, 98, 63, 0.16);
  --brand-line:   rgba(244, 98, 63, 0.34);
  --grad-brand:   linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 52%, var(--brand-3) 100%);

  --electric:     #00A3FF;

  /* Semantic */
  --ok:           #6FB4FF;
  --ok-soft:      rgba(111, 180, 255, 0.14);
  --ok-line:      rgba(111, 180, 255, 0.32);
  --warn:         #FFC24B;
  --warn-soft:    rgba(255, 194, 75, 0.14);
  --warn-line:    rgba(255, 194, 75, 0.32);
  --danger:       #FF6B61;
  --info:         #6FB4FF;

  /* Surfaces */
  --bg:           #0A0C11;
  --bg-2:         #0E1118;
  --surface:      #151A23;
  --surface-2:    #1C222D;
  --surface-3:    #242B38;
  --line:         rgba(255, 255, 255, 0.075);
  --line-strong:  rgba(255, 255, 255, 0.14);

  /* Text */
  --text:         #F3F6FB;
  --text-2:       #B8C2D2;
  --muted:        #8894A6;
  --faint:        #5F6B7D;

  /* Shape & motion */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --pad: 18px;
  --tap: 56px;                       /* minimum comfortable touch target */
  --ease: cubic-bezier(0.34, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);

  --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 14px 34px rgba(0, 0, 0, 0.45);
  --shadow-brand: 0 8px 26px rgba(232, 69, 60, 0.38);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- 2. Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

h1, h2, h3, p, figure { margin: 0; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
img { display: block; max-width: 100%; }
[hidden], .hidden { display: none !important; }

:focus-visible {
  outline: 3px solid var(--brand-1);
  outline-offset: 3px;
  border-radius: 6px;
}

/* visually hidden, still read out */
.sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- 3. Ambient background --------------------------------------- */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, #1A1520 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 45%);
}
.app-bg i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.30;
}
.app-bg i:nth-child(1) { width: 62vw; height: 62vw; top: -20vw; left: -18vw; background: #F4623F; }
.app-bg i:nth-child(2) { width: 48vw; height: 48vw; top: 22vh;  right: -22vw; background: #A8324C; opacity: 0.20; }
.app-bg i:nth-child(3) { width: 70vw; height: 70vw; bottom: -30vw; left: 10vw;  background: #23304A; opacity: 0.35; }

/* Aurora drifts only while the car is actually charging */
body.is-charging .app-bg i:nth-child(1) { animation: drift 14s ease-in-out infinite alternate; }
body.is-charging .app-bg i:nth-child(2) { animation: drift 18s ease-in-out infinite alternate-reverse; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vw, 4vh, 0) scale(1.14); }
}

/* ---------- 4. Layout ---------------------------------------------------- */
.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 14px calc(var(--safe-b) + 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.012) 100%), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad);
  box-shadow: var(--shadow-1);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  flex: 1;
  min-width: 0;
}
.card-head .ic { color: var(--brand-1); flex: none; }

/* Collapsible card — the head stays, the body folds away */
.card-fold .card-head { margin-bottom: 0; cursor: pointer; }
.card-fold .card-head .hint { text-align: right; }

.fold-btn { margin: -4px -4px -4px 0; }
.fold-btn .ic { color: var(--text-2); transition: transform 0.3s var(--ease-out); }
.card-fold.is-open .fold-btn .ic { transform: rotate(180deg); }

.fold-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.34s var(--ease-out);
}
.card-fold.is-open .fold-body { grid-template-rows: 1fr; }
.fold-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.22s var(--ease-out);
}
.card-fold.is-open .fold-inner { opacity: 1; transition-delay: 0.08s; }
.fold-inner > :first-child { margin-top: 14px; }

.hint     { font-size: 13px; color: var(--muted); font-weight: 400; }
.muted    { color: var(--muted); }
.muted-xs { color: var(--faint); font-size: 12.5px; }

/* ---------- 5. Icons ----------------------------------------------------- */
.ic {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ic-fill { fill: currentColor; stroke: none; }
.ic-sm { width: 17px; height: 17px; }
.ic-lg { width: 26px; height: 26px; }
/* Inline with running text — sits on the baseline, scales with font-size */
.ic-inline {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  color: var(--brand-1);
}

/* ---------- 6. Buttons --------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 16.5px;
  letter-spacing: 0.005em;
  transition: transform 0.14s var(--ease), filter 0.16s, opacity 0.16s;
}
.btn:active { transform: scale(0.965); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-lg { min-height: 60px; font-size: 17.5px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
  text-shadow: 0 1px 2px rgba(0,0,0,0.22);
}
.btn-primary:active { filter: brightness(1.08); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-quiet { background: transparent; color: var(--text-2); border: 1px solid var(--line-strong); }
.btn-warn  { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: transform 0.14s var(--ease), background 0.16s, color 0.16s;
}
.icon-btn:active { transform: scale(0.9); background: rgba(255,255,255,0.12); }
.icon-btn.sm { width: 44px; height: 44px; border-radius: 14px; }

/* Round steppers flanking the sliders — deliberately large */
.round-btn {
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: var(--shadow-1);
  transition: transform 0.13s var(--ease), background 0.16s;
}
.round-btn:active { transform: scale(0.88); background: var(--surface-3); }
.round-btn .ic { width: 26px; height: 26px; stroke-width: 2.6; }

/* ---------- 7. Lock screen ---------------------------------------------- */
.lock {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px);
}
.lock-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.5s var(--ease-out) both;
}
.lock-logo {
  width: 106px;
  height: 106px;
  margin: 0 auto 4px;
  border-radius: 26px;
  box-shadow: var(--shadow-2), 0 0 60px rgba(244, 98, 63, 0.34);
}
.lock h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.lock .sub { color: var(--muted); font-size: 15px; margin-top: -8px; }

.pin-input {
  width: 100%;
  height: 68px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  outline-offset: 2px;
}
.pin-input::placeholder { letter-spacing: 0.3em; color: var(--faint); }

.check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  color: var(--text-2);
  min-height: 44px;
  cursor: pointer;
}
.check input { width: 22px; height: 22px; accent-color: var(--brand-2); }

.lock-msg { min-height: 22px; font-size: 14.5px; color: var(--muted); }
.lock-msg.err { color: var(--danger); }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 8. Top bar --------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 0;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.brand-bolt {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 3px 10px rgba(244, 98, 63, 0.55));
}
.brand-txt  { min-width: 0; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub  { font-size: 12.5px; color: var(--muted); line-height: 1.2; }

/* The address doubles as the charger picker */
.site-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  margin-top: 2px;
  padding: 2px 7px 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}
.site-btn > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-btn:active { transform: scale(0.97); background: rgba(255, 255, 255, 0.1); }
.site-chev { width: 15px; height: 15px; flex: none; opacity: 0.75; }

.topbar-actions { display: flex; gap: 8px; }

/* Connection strip */
.conn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  margin-top: -4px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.pill .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.pill.is-live   { background: var(--brand-soft); border-color: var(--brand-line); color: #FFC8A6; }
.pill.is-live .dot   { background: var(--brand-1); box-shadow: 0 0 0 0 rgba(255,162,58,0.6); animation: ping 1.7s ease-out infinite; }
.pill.is-ready  { background: var(--ok-soft); border-color: var(--ok-line); color: #A7EBCE; }
.pill.is-ready .dot  { background: var(--ok); }
.pill.is-idle .dot   { background: var(--muted); }
.pill.is-error  { background: rgba(255,107,97,0.14); border-color: rgba(255,107,97,0.34); color: #FFB3AD; }
.pill.is-error .dot  { background: var(--danger); }

@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(255,162,58,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(255,162,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,162,58,0); }
}

/* ---------- 9. Mode toggle ---------------------------------------------- */
.mode-wrap { display: flex; align-items: center; gap: 10px; }

.segmented {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px;
  padding: 5px;
  border-radius: 21px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.seg-thumb {
  position: absolute;
  top: 5px;
  left: 5px;
  width: calc(50% - 7px);
  height: calc(100% - 10px);
  border-radius: 16px;
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
  transition: transform 0.34s var(--ease);
  pointer-events: none;
}
.segmented[data-mode="temporary"] .seg-thumb { transform: translateX(calc(100% + 4px)); }

.seg {
  position: relative;
  z-index: 1;
  min-height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.24s;
  white-space: nowrap;
}
.seg[aria-selected="true"] { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.seg .ic { width: 19px; height: 19px; flex: none; }

/* Keep both labels on one line on narrow screens, with breathing room at the edges */
@media (max-width: 429px) {
  .seg { font-size: 12.25px; gap: 5px; padding: 0 8px; }
  .seg .ic { width: 15px; height: 15px; }
}
@media (max-width: 359px) {
  .seg { font-size: 10.5px; gap: 3px; padding: 0 4px; }
  .seg .ic { width: 13px; height: 13px; }
}

.mode-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
  padding: 0 6px;
  margin-top: -4px;
}
.mode-note[hidden] { display: none; }
.mode-note .ic { width: 16px; height: 16px; margin-top: 2px; color: var(--faint); }

/* ---------- 10. Hero gauge ---------------------------------------------- */
.hero { padding: 10px 16px 18px; overflow: hidden; }

.gauge-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 220 / 180;
}
.gauge { width: 100%; height: 100%; display: block; overflow: visible; }
.gauge path { fill: none; stroke-width: 15; stroke-linecap: round; }
.gauge-track { stroke: rgba(255,255,255,0.07); }
.gauge-fill  { stroke: url(#gGrad); transition: stroke-dasharray 0.7s var(--ease-out); }
.gauge-flow  { stroke: rgba(255,255,255,0.55); opacity: 0; }

body.is-charging .gauge-flow {
  opacity: 0.55;
  animation: march 1.1s linear infinite;
}
@keyframes march { to { stroke-dashoffset: -40px; } }

.gauge-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-bottom: 2%;
  text-align: center;
  pointer-events: none;
  transform: translateY(25px);
}
.car-shot {
  position: relative;
  width: 72px;
  height: 26px;
  margin-top: 4px;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.55));
}
.car-shot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.car-halo {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 190px;
  height: 90px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(244,98,63,0.42), transparent 72%);
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}
body.is-charging .car-halo { opacity: 1; animation: halo 2.4s ease-in-out infinite; }
@keyframes halo {
  0%, 100% { transform: translate(-50%, -50%) scale(0.86); opacity: 0.55; }
  50%      { transform: translate(-50%, -50%) scale(1.1);  opacity: 1; }
}

/* Shortcut from the hero straight to the battery card */
.btn-adjust {
  pointer-events: auto;          /* .gauge-face itself is click-through */
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.14s var(--ease), background 0.16s, color 0.16s;
}
.btn-adjust:active { transform: scale(0.93); background: rgba(255,255,255,0.14); color: var(--text); }
.btn-adjust .ic { width: 17px; height: 17px; color: var(--brand-1); }

.soc-big {
  font-size: 46.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff 30%, #C9D2E0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.soc-big small { font-size: 0.42em; font-weight: 500; letter-spacing: 0; margin-left: 2px; }
.soc-label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.09em; text-transform: uppercase; font-weight: 500; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.hstat {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 8px;
  text-align: center;
  min-width: 0;
}
.hstat .k {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}
.hstat .k .ic { width: 14px; height: 14px; }
.hstat .v {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hstat .v small { font-size: 0.62em; font-weight: 500; color: var(--text-2); margin-left: 4px; }

/* ---------- 11. Big sliders --------------------------------------------- */
.bigslider {
  --pct: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 66px;
  background: transparent;
  margin: 0;
  touch-action: pan-y;
  cursor: pointer;
}
/* WebKit / Blink */
.bigslider::-webkit-slider-runnable-track {
  height: 22px;
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      var(--fill-1, var(--brand-1)) 0%,
      var(--fill-mid, var(--fill-2, var(--brand-3))) calc(var(--pct) / 2),
      var(--fill-2, var(--brand-3)) var(--pct),
      rgba(255,255,255,0.09) var(--pct),
      rgba(255,255,255,0.09) 100%);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.bigslider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 52px;
  height: 52px;
  margin-top: -15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #E7ECF4 55%, #C4CDDB 100%);
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: 0 5px 16px rgba(0,0,0,0.55), 0 0 0 6px rgba(244,98,63,0.14);
  transition: transform 0.12s var(--ease), box-shadow 0.16s;
}
.bigslider:active::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 0 12px rgba(244,98,63,0.2);
}
/* Gecko */
.bigslider::-moz-range-track {
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.bigslider::-moz-range-progress {
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    var(--fill-1, var(--brand-1)),
    var(--fill-mid, var(--fill-2, var(--brand-3))),
    var(--fill-2, var(--brand-3)));
}
.bigslider::-moz-range-thumb {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #E7ECF4 55%, #C4CDDB 100%);
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: 0 5px 16px rgba(0,0,0,0.55), 0 0 0 6px rgba(244,98,63,0.14);
}
/* Matches the hero gauge stroke (#gGrad): amber → cyan → blue */
.bigslider.is-battery { --fill-1: #FFB020; --fill-mid: #3FD0E0; --fill-2: #2A7CFF; }
.bigslider.is-paused  { --fill-1: #5F6B7D; --fill-2: #3D4657; }

/* Labels are placed at their true slider position, allowing for the thumb inset */
.ticks {
  position: relative;
  height: 16px;
  margin-top: -6px;
}
.ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s, transform 0.2s;
}
.ticks span.on { color: var(--brand-1); font-weight: 600; transform: translateX(-50%) scale(1.15); }

/* Slider + its ticks share one column so they line up exactly */
.slider-col { width: 100%; }

/* "Recommended" flag above the slider. The arrow sits at the exact amp; the
   label follows it but is clamped in JS so it never runs off a narrow phone. */
.rec-mark {
  position: relative;
  height: 34px;
  margin-bottom: -4px;
}
.rec-lbl {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #8fb4ff;
  background: rgba(23, 47, 105, 0.55);
  border: 1px solid rgba(52, 92, 178, 0.6);
  border-radius: 999px;
  padding: 2px 9px;
  line-height: 1.35;
}
/* The tick that marks "the slider is already on it" — sized to the pill's text */
.rec-lbl .ic {
  width: 13px;
  height: 13px;
  stroke-width: 3;
  margin-left: -1px;
}
.rec-arrow {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  width: 14px;
  height: 16px;
  color: var(--ok);
  transition: left 0.22s var(--ease);
}
.rec-arrow svg { width: 100%; height: 100%; fill: currentColor; display: block; }

/* When the slider already sits on the recommendation, stop nagging for attention */
.rec-mark.is-at .rec-lbl { background: rgba(23, 47, 105, 0.8); }
.rec-mark:not(.is-at) .rec-arrow { animation: rec-bob 1.9s ease-in-out infinite; }
@keyframes rec-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .rec-mark:not(.is-at) .rec-arrow { animation: none; }
  .rec-arrow { transition: none; }
}

/* ---------- 12. Battery card -------------------------------------------- */
.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
}
.big-value {
  flex: 1;
  text-align: center;
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.big-value small { font-size: 0.44em; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.big-value .sep { color: var(--faint); margin: 0 8px; font-weight: 300; }
.big-value .kw  { color: var(--brand-1); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip-vs { color: var(--text-2); font-size: 13px; font-weight: 500; }
.chip {
  min-height: 46px;
  padding: 0 15px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.13s var(--ease), background 0.18s, color 0.18s, border-color 0.18s;
}
.chip:active { transform: scale(0.93); }
.chip[aria-pressed="true"], .chip.on {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: #FFC9AC;
  font-weight: 600;
}
.chips.grow .chip { flex: 1; justify-content: center; padding: 0 8px; }

.sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sub-row .lbl { flex: 1; font-size: 14.5px; color: var(--text-2); }
.sub-row .sub-icon { width: 32px; height: 32px; stroke-width: 1.7; color: var(--brand-1); }

/* ---------- 13. Speed card ---------------------------------------------- */
.speed-card { overflow: hidden; }

.badge {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.temp { background: var(--warn-soft); color: var(--warn); }
.badge.perm { background: var(--ok-soft);   color: var(--ok); }

/* "Currently … A" shrinks 25 %; the amp figure keeps the full badge size */
#speed-badge.perm { font-size: 9.1px; }
#speed-badge.perm b { font-size: 11.5px; }

/* Two lines so the numbers stay big even on a 320 px phone */
.speed-readout {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.sr-main {
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.sr-main small { font-size: 0.44em; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.sr-sub {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 600;
  color: var(--brand-1);
  font-variant-numeric: tabular-nums;
}

.apply-row { display: flex; gap: 10px; margin-top: 14px; }
.apply-row .btn { flex: 1; }
.apply-row .btn-pause { flex: 0 0 auto; width: 88px; padding: 0; }

.apply-msg {
  min-height: 20px;
  margin-top: 9px;
  font-size: 13.5px;
  text-align: center;
  color: var(--muted);
  transition: color 0.2s;
}
.apply-msg.ok  { color: var(--ok); }
.apply-msg.err { color: var(--danger); }

/* --- Off-peak schedule, at the foot of the speed card --------------------- */
.sched { margin-top: 16px; }
.sched-div {
  height: 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
  margin: 0 0 16px;
}
.sched-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}
.sched-head .ic { color: var(--brand-1); }
.sched-head h3 {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.badge.save { background: var(--ok-soft); color: var(--ok); }

.sched-txt { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.sched-txt b { color: var(--text); font-weight: 600; }

.sched-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
}
.sched-pick .lbl { font-size: 14.5px; color: var(--text-2); }
.sched-time {
  flex: 1;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.sched-time::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.6; }

.sched-row { display: flex; gap: 10px; margin-top: 13px; }
.sched-row .btn { flex: 1; min-height: 54px; }
.sched-row .sched-edit { flex: 0 0 auto; padding: 0 18px; }

.sched .tip { margin-top: 13px; }
#sched-msg { margin-top: 8px; }

/* Animated "power flowing" strip */
.flow-strip {
  height: 8px;
  margin: 14px -18px -18px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
  position: relative;
}
.flow-strip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg,
    var(--brand-1) 0 14px, var(--brand-3) 14px 28px, transparent 28px 56px);
  background-size: 120px 100%;
  opacity: 0;
  transition: opacity 0.4s;
}
body.is-charging .flow-strip::after {
  opacity: 0.95;
  animation: slide 0.9s linear infinite;
}
@keyframes slide { to { background-position: 120px 0; } }

/* ---------- 14. Stat grid ------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.stat {
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
  min-width: 0;
}
.stat .k {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat .k .ic { width: 15px; height: 15px; }
.stat .v {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat .v small { font-size: 0.6em; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.stat.accent { background: var(--brand-soft); border-color: var(--brand-line); }
.stat.accent .v { color: #FFD0B4; }
.stat.good   { background: var(--ok-soft); border-color: var(--ok-line); }
.stat.good .v { color: #A7EBCE; }

/* ---------- 15. Price card ---------------------------------------------- */
.rate-now {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
  margin-bottom: 14px;
}
.rate-now.cheap { background: var(--ok-soft);   border-color: var(--ok-line); }
.rate-now.peak  { background: var(--warn-soft); border-color: var(--warn-line); }
.rate-icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.28);
}
.rate-now.cheap .rate-icon { color: var(--ok); }
.rate-now.peak  .rate-icon { color: var(--warn); }
.rate-txt { flex: 1; min-width: 0; }
.rate-txt b { display: block; font-size: 15.5px; font-weight: 600; }
.rate-txt span { font-size: 13px; color: var(--muted); }
.rate-val {
  text-align: right;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rate-val small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; }

/* 24-hour band */
.timeline { margin-bottom: 6px; }
.tl-bars {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  height: 42px;
  align-items: end;
}
.tl-bar {
  position: relative;
  height: 93%;
  border-radius: 3px;
  background: #E66100;
  opacity: 0.34;
  transition: opacity 0.3s, height 0.3s;
}
.tl-bar.cheap  { background: #0C7BDC; height: 42%; }
.tl-bar.charge { opacity: 1; box-shadow: 0 0 10px rgba(212,17,89,0.5); background: linear-gradient(180deg, #E8437A, #D41159); }
.tl-bar.now::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
}
.tl-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.rows { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.row:last-child { border-bottom: 0; }
.row .rk { flex: 1; color: var(--text-2); min-width: 0; }
.row .rk small { display: block; font-size: 12px; color: var(--faint); }
.row .rv { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.total { border-top: 1px solid var(--line-strong); border-bottom: 0; margin-top: 4px; padding-top: 13px; }
.row.total .rk { color: var(--text); font-weight: 600; }
.row.total .rv { font-size: 19px; color: var(--brand-1); }

/* Tip banner */
.tip[hidden] { display: none; }
.tip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  margin-top: 14px;
}
.tip .ic { color: var(--ok); margin-top: 1px; }
.tip-txt { font-size: 14px; line-height: 1.45; color: #CFF0E2; }
.tip-txt b { color: #fff; font-weight: 600; }
.tip-txt b.pct { color: var(--electric); }
.tip.neutral { background: rgba(255,255,255,0.04); border-color: var(--line); }
.tip.neutral .ic { color: var(--info); }
.tip.neutral .tip-txt { color: var(--text-2); }
.tip.alert { background: var(--warn-soft); border-color: var(--warn-line); }
.tip.alert .ic { color: var(--warn); }
.tip.alert .tip-txt { color: #F6E2BC; }

/* "Tap to see why" — jumps to the grid-step card */
.why-link {
  display: flex;              /* block-level, so it sits on its own line */
  width: fit-content;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  padding: 7px 12px 7px 13px;
  border: 1px solid var(--warn-line);
  border-radius: 999px;
  background: rgba(255, 194, 75, 0.1);
  color: var(--warn);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, transform 0.2s var(--ease);
}
.why-link .ic { color: var(--warn); width: 15px; height: 15px; transform: rotate(-90deg); }
.why-link:hover { background: rgba(255, 194, 75, 0.18); }
.why-link:active { transform: scale(0.96); }

/* Same pill, quieter — cancelling a delayed schedule is not a warning */
.why-link.quiet {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
}
.why-link.quiet .ic { color: var(--text-2); width: 14px; height: 14px; transform: none; }
.why-link.quiet:hover { background: rgba(255, 255, 255, 0.12); }

/* Top step — same shape, redder */
.tip.alert.crit { background: rgba(255, 107, 97, 0.14); border-color: rgba(255, 107, 97, 0.34); }
.tip.alert.crit .ic { color: var(--danger); }
.tip.alert.crit .tip-txt { color: #FFD9D2; }
.why-link.crit {
  border-color: rgba(255, 107, 97, 0.38);
  background: rgba(255, 107, 97, 0.12);
  color: var(--danger);
}
.why-link.crit .ic { color: var(--danger); }
.why-link.crit:hover { background: rgba(255, 107, 97, 0.2); }

/* Warning marker in a card head */
.head-warn[hidden] { display: none; }
.head-warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  animation: warn-pulse 2.2s var(--ease-out) infinite;
}
.card-head .head-warn .ic { color: var(--warn); width: 16px; height: 16px; }

.head-warn.crit {
  background: rgba(255, 107, 97, 0.16);
  border-color: rgba(255, 107, 97, 0.36);
  animation-name: warn-pulse-crit;
}
.card-head .head-warn.crit .ic { color: var(--danger); }

@keyframes warn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 194, 75, 0.32); }
  55%      { box-shadow: 0 0 0 7px rgba(255, 194, 75, 0); }
}
@keyframes warn-pulse-crit {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 97, 0.4); }
  55%      { box-shadow: 0 0 0 7px rgba(255, 107, 97, 0); }
}

/* Landing flash after "Tap to see why" */
.card { scroll-margin-top: 16px; scroll-margin-bottom: 16px; }
.card.flash { animation: card-flash 1.8s var(--ease-out); }

@keyframes card-flash {
  0%   { border-color: var(--warn-line); box-shadow: var(--shadow-1), 0 0 0 0 rgba(255, 194, 75, 0.34); }
  18%  { border-color: var(--warn);      box-shadow: var(--shadow-1), 0 0 0 5px rgba(255, 194, 75, 0.20); }
  100% { border-color: var(--line);      box-shadow: var(--shadow-1), 0 0 0 0 rgba(255, 194, 75, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .head-warn, .card.flash { animation: none; }
}

/* ---------- 16. Grid tier ladder ---------------------------------------- */
.ladder { display: flex; flex-direction: column; gap: 7px; }
.rung {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 15px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.rung .rn {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.rung .rl { flex: 1; font-size: 14.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rung .rp { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rung.on {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  transform: scale(1.015);
}
.rung.on .rn { background: var(--grad-brand); color: #fff; }
.rung.on .rl { color: var(--text); font-weight: 500; }
.rung.on .rp { color: var(--brand-1); }
.rung.would { border-color: var(--warn-line); background: var(--warn-soft); }
.rung.would .rn { background: var(--warn); color: #201A0A; }
.rung.top {
  background: rgba(255, 107, 97, 0.14);
  border-color: rgba(255, 107, 97, 0.34);
  transform: scale(1.015);
}
.rung.top .rn { background: var(--danger); color: #2A0F0D; }
.rung.top .rl { color: var(--text); font-weight: 500; }
.rung.top .rp { color: var(--danger); }
.rung .rw { flex: none; width: 17px; height: 17px; color: var(--danger); }

/* Sitting in the step we are trying to hold — this is a good place to be */
.rung.on.good { background: var(--ok-soft); border-color: var(--ok-line); }
.rung.on.good .rn { background: var(--ok); color: #062A1D; }
.rung.on.good .rp { color: var(--ok); }

/* …and the step to come back down to, when the charge has overshot it */
.rung.goal { border-style: dashed; border-color: var(--ok-line); }
.rung.goal .rn { background: var(--ok-soft); color: var(--ok); }
/* Second line inside the label, so a narrow phone never squeezes the row */
.rsub {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ok);
  line-height: 1.3;
}

.meter {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin: 4px 0 12px;
  position: relative;
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad-brand);
  transition: width 0.5s var(--ease-out);
}
/* Step boundaries drawn across the meter, with a small range title each. */
.meter-scale { margin: 4px 0 12px; }
.meter-scale .meter { margin: 0; overflow: visible; }

.meter-titles {
  position: relative;
  height: 12px;
  margin-bottom: 3px;
}
.meter-titles .mt {
  position: absolute;
  top: 0;
  text-align: center;
  font-size: 9px;
  line-height: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
}
.meter-titles .mt.on {
  color: var(--text);
  font-weight: 600;
}

.meter-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.meter-ticks u {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(255,255,255,0.35);
}

/* ---------- 17. Live charger info --------------------------------------- */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.kv { min-width: 0; }
.kv .k { font-size: 12px; color: var(--faint); margin-bottom: 2px; }
.kv .v { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 17b. Fluid labels (fit long strings on narrow screens) ------- */
#speed-title      { font-size: clamp(13.5px, 3.9vw, 16px); }
#sched-btn-label  { font-size: clamp(13px, 3.7vw, 15.5px); }
#stat-done        { font-size: clamp(13px, 4.2vw, 19px); }
#rate-title       { font-size: clamp(12.5px, 3.8vw, 15.5px); }
#kv-mode,
#kv-limit         { font-size: clamp(12px, 3.6vw, 15px); }

/* The "Updated … ago" note gets its own line so the title never wraps */
#soc-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 1px;
}
#soc-head > .ic { grid-area: 1 / 1; }
#soc-head > h2  { grid-area: 1 / 2; white-space: nowrap; }
#soc-fold       { grid-area: 1 / 3; }
#soc-age {
  grid-area: 2 / 2 / 3 / 4;
  font-size: clamp(11.5px, 3vw, 13px);
  min-width: 0;
  text-align: left;
}

/* ---------- 18. Footer --------------------------------------------------- */
.foot {
  text-align: center;
  padding: 18px 0 6px;
  font-size: 11.5px;
  color: var(--text);
  opacity: 0.28;
  letter-spacing: 0.03em;
}
.foot .v { display: block; margin-top: 3px; font-size: 10.5px; opacity: 0.75; }

/* ---------- 19. Modals (bottom sheets) ---------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 6, 10, 0.66);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 61;
  width: min(100%, 480px);
  max-height: 88dvh;
  transform: translate(-50%, 102%);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  transition: transform 0.4s var(--ease-out);
  pointer-events: none;
}
.sheet.open { transform: translate(-50%, 0); pointer-events: auto; }

.sheet-grab {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 10px auto 0;
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 12px;
  flex: none;
}
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; flex: 1; }
.sheet-head .ic-badge {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-1);
  flex: none;
}
.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 18px calc(var(--safe-b) + 22px);
  font-size: 15px;
  line-height: 1.58;
  color: var(--text-2);
}
.sheet-body h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sheet-body h3:first-child { margin-top: 4px; }
.sheet-body p { margin: 0 0 12px; }
.sheet-body ul { margin: 0 0 12px; padding-left: 20px; }
.sheet-body li { margin-bottom: 7px; }
.sheet-body b, .sheet-body strong { color: var(--text); font-weight: 600; }
.sheet-body code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13.5px;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 6px;
}
.note {
  padding: 13px 15px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--brand-2);
  font-size: 14px;
  margin: 0 0 14px;
}
.note.ok   { border-left-color: var(--ok); background: var(--ok-soft); }
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.tbl td { font-variant-numeric: tabular-nums; }
.tbl td:last-child, .tbl th:last-child { text-align: right; }
.tbl td small { color: var(--muted); font-weight: 400; }
.tbl:not(.is-open) .tbl-more { display: none; }
.tbl-toggle {
  display: block;
  margin: -6px 0 14px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.tbl-toggle:hover { text-decoration: underline; }

/* Jump-to navigation list (hamburger sheet) */
.navlist { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 6px; }
.navlink {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--text);
  transition: transform 0.13s var(--ease), background 0.16s;
}
.navlink:active { transform: scale(0.98); background: rgba(255,255,255,0.09); }
.navlink .ic-badge.sm {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-1);
  flex: none;
}
.navlink-txt { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.navlink-txt b { font-size: 15px; font-weight: 600; color: var(--text); }
.navlink-txt small { font-size: 12.5px; color: var(--muted); }
.navlink-go { color: var(--muted); flex: none; }
/* The charger you are already looking at */
.navlink.is-on { background: var(--brand-soft); border-color: var(--brand-line); }
.navlink.is-on .navlink-go { color: var(--brand-1); }

/* ---------- 20. Toast ---------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 20px);
  z-index: 80;
  transform: translate(-50%, 140%);
  max-width: min(92vw, 420px);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2);
  font-size: 14.5px;
  transition: transform 0.4s var(--ease);
}
.toast.show { transform: translate(-50%, 0); }
.toast.ok  { border-color: var(--ok-line); }
.toast.ok .ic  { color: var(--ok); }
.toast.err { border-color: rgba(255,107,97,0.4); }
.toast.err .ic { color: var(--danger); }

/* ---------- 21. Skeleton ------------------------------------------------- */
.sk { color: transparent !important; position: relative; }
.sk::after {
  content: '';
  position: absolute;
  inset: 2px 0;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- 22. Responsive ---------------------------------------------- */
@media (max-width: 359px) {
  :root { --pad: 15px; }
  body { font-size: 16px; }
  .car-shot { width: 59px; height: 21px; }
  .soc-big { font-size: 39px; }
  .round-btn { width: 54px; height: 54px; }
  .sr-main { font-size: 40px; }
  .sr-sub { font-size: 17px; }
  .ticks span { font-size: 10.5px; }
  .hstat .v { font-size: 17px; }
  .chips.grow .chip { font-size: 14px; }
  .btn-adjust { margin-top: 9px; min-height: 34px; padding: 0 13px; font-size: 13.5px; }
}

@media (min-width: 430px) {
  .car-shot { width: 85px; height: 31px; }
  .soc-big { font-size: 52.5px; }
}

/* Desktop / installed-window comfort */
@media (min-width: 900px) and (pointer: fine) {
  .app { max-width: 520px; padding-top: 28px; }
  .card:hover { border-color: var(--line-strong); }
  .icon-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
  .chip:hover { border-color: var(--line-strong); }
  .btn-adjust:hover { background: rgba(255,255,255,0.13); color: var(--text); }
}

/* ---------- 23. Reduced motion ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .app-bg i { animation: none !important; }
  body.is-charging .flow-strip::after { opacity: 0.5; }
  body.is-charging .car-halo { opacity: 0.7; }
}
