:root {
  /* Dark is the product default now (per the Figma redesign) -- explicit
     data-theme="light" (set by the toggle, see dashboard.js) is what opts
     back into the light palette below. */
  --bg: #0b0f17;
  --surface: #131a24;
  --border: #232b3a;
  --text: #f2f5fa;
  --text-dim: #8a94a6;
  --accent: #2dd4bf;
  --accent-contrast: #052422;
  --danger: #ef4444;
  --ok: #22c55e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  /* Read by dashboard.js and handed to Chart.js, which doesn't pick up CSS
     custom properties on its own -- ticks/gridlines are canvas-drawn, not DOM. */
  --chart-text: #8a94a6;
  --chart-grid: rgba(255, 255, 255, 0.08);
  /* Card radii per the Figma redesign: 14px for KPI/stat cards, 16px for
     the larger chart/panel containers. */
  --radius-card: 14px;
  --radius-panel: 16px;

  /* "Inset" elements (chart header bar, live stat strip, legend bar,
     Settings button) render as a fixed white chip regardless of theme --
     the redesign uses them as a deliberate light-on-dark contrast motif,
     not as "light theme colors", so they don't flip with data-theme. */
  --inset-bg: #ffffff;
  --inset-text: #16181d;
  --inset-text-dim: #6b7280;
  --inset-border: #e2e5ea;

  /* Energy-flow chart palette -- shared between dashboard.js (Chart.js
     datasets, read via getComputedStyle) and the CSS gradient behind the
     canvas. Kept distinct from the generic SERIES colors used in the
     bar-chart views since the diverging chart has its own fixed legend
     (Generation / Solar->house / Grid->house / Surplus / SOC), though the
     two share the same generation/usage greens for a consistent identity
     across tabs.
     Follows the site's fixed color convention -- generation is green, grid
     draw is red, energy leaving to the grid/battery is blue -- every hex
     below is a *validated* slot (dataviz skill's validate_palette.js), not
     an eyeballed pick: this exact 5-color set (Generation/Solar->house/
     Grid->house/Surplus/SOC, all visible on this chart at once) clears the
     lightness band, chroma floor, CVD-separation and normal-vision-
     separation checks against this chart's fixed dark-navy surface. A
     literal red+green pair, or a too-saturated "grass green" for
     Solar->house, both collapse toward each other under deuteranopia/
     protanopia specifically because Grid->house and Solar->house are
     stacked directly against each other here -- re-run the validator
     against any change to this block. */
  --c-generation: #06795c;
  --c-solar-house: #39ac73;
  --c-grid-house: #d55e00;
  --c-surplus: #0072b2;
  --c-soc: #c84180;
  --chart-navy-top: #1b2138;
  --chart-navy-bottom: #0a0d16;
}

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #16181d;
  --text-dim: #6b7280;
  --accent: #2dd4bf;
  --accent-contrast: #052422;
  --chart-text: #4b5563;
  --chart-grid: rgba(16, 24, 40, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0b0f17;
  --surface: #131a24;
  --border: #232b3a;
  --text: #f2f5fa;
  --text-dim: #8a94a6;
  --accent: #2dd4bf;
  --accent-contrast: #050d14;
  --chart-text: #8a94a6;
  --chart-grid: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 0 0 2.5rem;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---- login ---- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(360px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.3rem;
}

.login-sub {
  margin: 0 0 0.4rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.login-card input {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.login-card button {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 1rem;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

/* ---- dashboard shell ---- */

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--accent);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.live-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}

/* .live-badge / .chart-live-badge / .chart-stat-strip all set an
   unconditional `display` above -- an author-origin declaration, which
   beats the UA default `[hidden] { display: none }` rule regardless of
   selector specificity. Without this, setting el.hidden = true in JS has
   no visible effect on these three. */
.live-badge[hidden],
.chart-live-badge[hidden],
.chart-stat-strip[hidden] {
  display: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* Settings reads as a solid white pill in the redesign, standing out from
   the plain ghost buttons either side of it (theme toggle, log out). */
.btn-inset {
  background: var(--inset-bg);
  color: var(--inset-text);
  border-color: var(--inset-border);
  font-weight: 600;
}

.btn-inset:hover {
  color: var(--inset-text);
  border-color: var(--inset-text-dim);
}

/* ---- KPI row (period totals + headline stats, merged) ---- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0;
  margin: 1.25rem 1.5rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kpi-tile {
  padding: 0.85rem 1.25rem;
  border-left: 1px solid var(--border);
}

.kpi-tile:first-child {
  border-left: none;
}

.kpi-tile .kpi-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.kpi-tile .kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.kpi-tile .kpi-value .unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 0.15rem;
}

.kpi-tile .kpi-sub {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.kpi-tile .kpi-sub.kpi-sub-up { color: var(--ok); }
.kpi-tile .kpi-sub.kpi-sub-down { color: var(--danger); }

.card-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- controls ---- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.view-tabs {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.view-tabs button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.view-tabs button.active {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

.date-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.date-nav button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1rem;
}

.period-label-btn {
  min-width: 8rem;
  text-align: center;
  color: var(--text-dim);
  font-weight: 500;
  background: none;
  border: none;
  font-size: 0.85rem;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
}

.period-label-btn:hover {
  background: var(--border);
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- main dashboard layout: chart card + tariff sidebar ---- */

.dashboard-main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 1rem;
  align-items: start;
  margin: 1rem 1.5rem 0;
}

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  padding: 0.85rem;
  position: relative;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--inset-bg);
  color: var(--inset-text);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
}

.chart-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
}

.chart-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--inset-text);
  white-space: nowrap;
}

.chart-live-badge .live-dot {
  background: var(--accent);
}

.chart-reset-zoom-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chart-reset-zoom-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ---- live stat strip (HOUSE / SOLAR / BATTERY / GRID / SOC) ---- */

.chart-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.5rem;
  background: var(--inset-bg);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
}

.chart-stat-strip .stat-item-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--inset-text-dim);
  text-transform: uppercase;
}

.chart-stat-strip .stat-item-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--inset-text);
  margin-top: 0.1rem;
}

.chart-stat-strip .stat-item-value .unit {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--inset-text-dim);
  margin-left: 0.1rem;
}

/* ---- charts ---- */

.chart-canvas-box {
  /* Chart.js is told maintainAspectRatio:false and fills whatever box it's
     given here -- a fixed height (rather than a width-derived aspect ratio)
     keeps the chart readable on narrow screens instead of squashing to a
     sliver. overflow-x stays as a safety net, not the primary sizing method. */
  height: 360px;
  overflow-x: auto;
}

.chart-canvas-box canvas {
  max-width: 100%;
}

/* The diverging power chart gets its own permanently-dark gradient card
   background (independent of the light/dark theme toggle) -- a deliberate
   contrast panel per the redesign, not a themed surface. Chart.js itself
   draws on a transparent canvas, so the CSS gradient shows through. */
.chart-canvas-box--instant {
  background: linear-gradient(180deg, var(--chart-navy-top), var(--chart-navy-bottom));
  border-radius: 10px;
  padding: 0.5rem 0.25rem 0;
}

.chart-canvas-box--soc {
  height: 110px;
  margin-top: 0.5rem;
  background: linear-gradient(180deg, var(--chart-navy-top), var(--chart-navy-bottom));
  border-radius: 10px;
  padding: 0.4rem 0.25rem 0;
}

/* ---- legend row (replaces the old clickable series-toggle chips visually,
   still clickable to hide/show a series) ---- */

.chart-legend-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.1rem;
  background: var(--inset-bg);
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  margin-top: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: none;
  padding: 0;
  font-size: 0.8rem;
  color: var(--inset-text);
}

.chip .swatch {
  width: 1.3rem;
  height: 0.7rem;
  flex-shrink: 0;
}

.chip.off {
  opacity: 0.35;
}

/* ---- values panel (replaces Chart.js's floating tooltip) ---- */

.chart-values {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  min-height: 1.5rem;
}

.chart-values-placeholder {
  color: var(--text-dim);
}

.chart-values-time {
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.chart-values-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.3rem 0.75rem;
}

.chart-values-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
}

.chart-values-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- tariff & efficiency panel ---- */

.tariff-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}

.tariff-panel .chart-title {
  color: var(--text);
  background: none;
  padding: 0;
  margin: 0 0 0.85rem;
}

.tariff-split-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.tariff-split-labels .off-peak { color: var(--accent); }
.tariff-split-labels .peak { color: var(--danger); }

.tariff-split-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
}

.tariff-split-bar .fill-offpeak { background: var(--accent); }
.tariff-split-bar .fill-peak { background: var(--danger); }

.tariff-split-note {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.tariff-efficiency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.tariff-efficiency-row .label { color: var(--text-dim); }
.tariff-efficiency-row .value { font-weight: 600; }

.empty-note {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem 1rem 0;
}

/* ---- settings page ---- */

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  max-width: 640px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
}

.setting-label {
  font-weight: 600;
}

.setting-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  max-width: 420px;
}

.settings-note {
  padding: 0.75rem 1.5rem 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.settings-note-success {
  color: var(--ok);
  font-weight: 600;
}

.settings-note-error {
  color: var(--danger);
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border);
  transition: 0.2s;
  border-radius: 999px;
}

.switch-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--surface);
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.switch input:checked + .switch-slider {
  background: var(--accent);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.setting-row-column {
  flex-direction: column;
  align-items: stretch;
}

.export-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.export-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.export-field select,
.export-field input {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.btn-primary {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.9rem;
  height: fit-content;
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: default;
}

/* ---- charging schedule table ---- */

.charge-schedule-table {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Three flex groups (head / times / soc) rather than one shared grid --
   each group can reflow independently (side-by-side on desktop, stacked
   on mobile) without fighting over a single fixed column template. */
.charge-schedule-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.charge-row-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 9rem;
}

.charge-row-times {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}

.charge-day-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.charge-day-to {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.charge-day-start,
.charge-day-end {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  flex: 1 1 0;
  min-width: 0;
}

.charge-day-soc {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  flex: 0 0 auto;
}

.charge-day-soc-input {
  width: 3.5rem;
  padding: 0.4rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.charge-schedule-actions {
  margin-top: 0.85rem;
}

/* ---- mobile ---- */

@media (max-width: 900px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0.9rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topbar-left {
    gap: 0.75rem;
    width: 100%;
    flex-wrap: wrap;
  }

  /* Logo stays on its own line; tabs + date-nav (·.controls·) drop to a
     full-width row below it -- there's no room for all three side by side
     once the tab bar has five buttons on a phone-width screen. */
  .controls {
    flex: 1 1 100%;
  }

  .topbar h1 {
    font-size: 1rem;
  }

  .topbar-actions {
    gap: 0.35rem;
    width: 100%;
    justify-content: space-between;
  }

  .btn-ghost {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
    margin: 1rem 1rem 0;
  }

  .kpi-tile {
    padding: 0.65rem 0.85rem;
  }

  .kpi-tile:nth-child(2n) {
    border-left: 1px solid var(--border);
  }

  .kpi-tile:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }

  .kpi-tile .kpi-value {
    font-size: 1.15rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  /* Five tabs (Year/Month/Day/Hour/5-min) don't all fit comfortably on a
     narrow phone -- scroll horizontally instead of wrapping mid-word or
     shrinking text past legibility. */
  .view-tabs {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .view-tabs button {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Stretch to the same width as .view-tabs above it instead of shrinking
     to its own content width -- prev/next pinned to the edges, label
     filling (and centered in) the space between. */
  .date-nav {
    display: flex;
    width: 100%;
    justify-content: space-between;
    font-size: 0.85rem;
  }

  .period-label-btn {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
  }

  .chip {
    font-size: 0.75rem;
  }

  .chart-header {
    margin-bottom: 0.6rem;
    padding: 0.5rem 0.7rem;
  }

  .chart-title {
    font-size: 0.85rem;
  }

  .chart-live-badge {
    font-size: 0.75rem;
  }

  .chart-wrap {
    margin: 0.85rem 1rem 0;
    padding: 0.65rem;
  }

  .dashboard-main {
    margin: 1rem 1rem 0;
  }

  .chart-stat-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-canvas-box {
    height: 260px;
  }

  .chart-canvas-box--soc {
    height: 90px;
  }

  .chart-reset-zoom-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }

  .chart-values {
    font-size: 0.75rem;
  }

  .settings-list {
    padding: 1rem;
  }

  .setting-row {
    padding: 0.85rem 1rem;
    gap: 1rem;
  }

  .setting-desc {
    max-width: none;
  }

  .export-form {
    flex-direction: column;
    align-items: stretch;
  }

  .export-field select,
  .export-field input,
  .btn-primary {
    width: 100%;
  }

  .charge-schedule-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .charge-row-head,
  .charge-row-times {
    flex: none;
    width: 100%;
  }

  .charge-day-soc {
    justify-content: flex-end;
  }
}

/* ==================== marketing site ====================
   Public pages (home, privacy, terms, feedback) -- reuses the dashboard's
   color tokens (--bg/--surface/--accent/etc.) so the whole site reads as
   one design system, but with its own layout classes (mkt-*) rather than
   forcing the app shell's .topbar/.chart-wrap patterns onto very
   differently-shaped content. */

.mkt-body {
  padding-bottom: 0;
}

.mkt-header {
  padding: 1.1rem 1.5rem 0;
}

.mkt-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
}

.mkt-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.mkt-nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}

.mkt-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
}

.mkt-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.mkt-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
}

.mkt-nav a:hover {
  color: var(--text);
}

.mkt-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.mkt-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: center;
  padding: 3.5rem 0 4.5rem;
}

.mkt-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.mkt-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.1;
  margin: 0 0 1.25rem;
}

.mkt-hero-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-dim);
  max-width: 34rem;
  margin: 0 0 1.75rem;
}

.mkt-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.mkt-hero-actions .btn-primary,
.mkt-hero-actions .btn-ghost {
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.mkt-hero-visual img {
  width: 100%;
  border-radius: var(--radius-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.mkt-section {
  padding: 3.5rem 0;
}

.mkt-section-alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.mkt-section-title {
  margin-bottom: 2.25rem;
}

.mkt-section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.mkt-section-title h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  margin: 0;
}

.mkt-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.mkt-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.mkt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.mkt-section:not(.mkt-section-alt) .mkt-card {
  background: var(--bg);
}

.mkt-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.mkt-card p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.7;
}

.mkt-screenshot-card {
  display: grid;
  gap: 0.85rem;
}

.mkt-screenshot-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.mkt-screenshot-card img {
  width: 100%;
  border-radius: var(--radius-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.mkt-about-text {
  color: var(--text-dim);
  line-height: 1.8;
  max-width: 60rem;
}

.mkt-contact-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
  max-width: 32rem;
}

.mkt-contact-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
  font-size: 0.9rem;
}

.mkt-contact-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mkt-contact-row span {
  color: var(--text-dim);
}

.mkt-contact-row a {
  color: var(--accent);
  text-decoration: none;
}

.mkt-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 1.5rem;
  margin-top: 2rem;
}

.mkt-footer-content {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.mkt-footer-content a {
  color: var(--text-dim);
}

/* ---- legal / feedback pages ---- */

.mkt-doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  line-height: 1.75;
  color: var(--text-dim);
}

.mkt-doc h1 {
  color: var(--text);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.mkt-doc h2 {
  color: var(--text);
  font-size: 1.2rem;
  margin-top: 2rem;
}

.mkt-doc a {
  color: var(--accent);
}

.mkt-doc-updated {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .mkt-hero {
    grid-template-columns: 1fr;
  }

  .mkt-grid-2,
  .mkt-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .mkt-nav-toggle {
    display: inline-flex;
  }

  .mkt-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 1rem;
    margin-top: 0.75rem;
  }

  .mkt-nav.open {
    display: flex;
  }

  .mkt-hero {
    padding: 2rem 0 3rem;
  }

  .mkt-hero-actions .btn-primary,
  .mkt-hero-actions .btn-ghost {
    width: 100%;
    justify-content: center;
  }
}
