/* =========================================================================
 * EV Spend — design tokens + components
 * Palette: pastel purple #C5ADC5, light steel blue #B2B5E0, neutral accents.
 * Light + dark themes, WCAG AA text contrast, reduced-motion aware.
 * ========================================================================= */

:root {
  /* Brand */
  --purple: #C5ADC5;
  --steel: #B2B5E0;
  --purple-ink: #6B4E71;   /* text-safe deep tone of the purple */
  --steel-ink: #4A4F92;    /* text-safe deep tone of the steel blue */

  /* Neutrals */
  --bg: #F6F4F8;
  --bg-grad-a: #EFE7F0;
  --bg-grad-b: #E9EAF7;
  --surface: #FFFFFF;
  --surface-2: #FAF8FC;
  --border: #E4DFEA;
  --text: #24202B;
  --text-2: #5D566A;
  --text-3: #8A8396;
  --shadow: 0 1px 2px rgb(40 30 60 / .05), 0 8px 24px -8px rgb(70 50 110 / .14);
  --shadow-hover: 0 2px 4px rgb(40 30 60 / .06), 0 16px 32px -12px rgb(70 50 110 / .22);
  --focus: #6E74C0;

  /* Provider series (harmonised with palette, distinguishable incl. CVD) */
  --prov-shell: #9C6FA3;
  --prov-sp: #6E74C0;
  --prov-cdg: #D29A6B;
  --prov-chargeplus: #4F9A94;

  /* Status */
  --ok: #2F7D5B;
  --warn: #9A6A12;
  --danger: #B3364A;
  --danger-bg: #FCEFF1;

  --radius: 18px;
  --radius-sm: 12px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --purple-ink: #DCC6DC; --steel-ink: #C4C7F0;
    --bg: #15131A; --bg-grad-a: #1E1824; --bg-grad-b: #171A2A;
    --surface: #1F1C26; --surface-2: #26222F; --border: #34303F;
    --text: #F1EEF5; --text-2: #BDB6C9; --text-3: #8E879B;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .5);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / .4), 0 16px 32px -12px rgb(0 0 0 / .6);
    --focus: #B2B5E0;
    --prov-shell: #C49BCB; --prov-sp: #969CE6; --prov-cdg: #E3B48D; --prov-chargeplus: #74BDB6;
    --ok: #6FC79E; --warn: #E2B45A; --danger: #F07A8C; --danger-bg: #3A1F26;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --purple-ink: #DCC6DC; --steel-ink: #C4C7F0;
  --bg: #15131A; --bg-grad-a: #1E1824; --bg-grad-b: #171A2A;
  --surface: #1F1C26; --surface-2: #26222F; --border: #34303F;
  --text: #F1EEF5; --text-2: #BDB6C9; --text-3: #8E879B;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .5);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / .4), 0 16px 32px -12px rgb(0 0 0 / .6);
  --focus: #B2B5E0;
  --prov-shell: #C49BCB; --prov-sp: #969CE6; --prov-cdg: #E3B48D; --prov-chargeplus: #74BDB6;
  --ok: #6FC79E; --warn: #E2B45A; --danger: #F07A8C; --danger-bg: #3A1F26;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
section, .provider__head, .filter-banner { scroll-margin-top: 104px; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-grad-a), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, var(--bg-grad-b), transparent 55%);
  background-attachment: fixed;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
.muted { color: var(--text-2); }
.tabular { font-variant-numeric: tabular-nums; }
kbd { font-family: inherit; font-size: .85em; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar__inner {
  max-width: 1200px; margin: 0 auto; padding: 12px var(--gutter);
  display: grid; grid-template-columns: 1fr minmax(0, 560px) 1fr; align-items: start; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; padding-top: 8px; }
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  color: #fff; background: linear-gradient(135deg, var(--purple), var(--steel));
  box-shadow: 0 4px 12px -4px rgb(110 116 192 / .6);
}
.brand__mark svg { color: #3B2F52; }
.topbar__end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 6px; }

/* ---------- Search ---------- */
.search { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search__field {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.search__field:focus-within { border-color: var(--steel); box-shadow: 0 0 0 4px color-mix(in srgb, var(--steel) 35%, transparent), var(--shadow); }
.search[data-invalid="true"] .search__field { border-color: var(--danger); }
.search__lead {
  position: absolute; left: 6px; width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: transparent; color: var(--text-3); cursor: pointer; z-index: 1;
}
.search__lead:hover { color: var(--steel-ink); background: var(--surface-2); }
/* Hidden native date input: only used to open the OS calendar picker */
.date-pick { position: absolute; left: 12px; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.search input {
  flex: 1; min-width: 0; height: 46px; border: 0; background: transparent; outline: none;
  padding: 0 40px 0 44px; font-size: 15px; letter-spacing: .02em;
}
.search input::placeholder { color: var(--text-3); letter-spacing: 0; }
.search__clear {
  position: absolute; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
}
.search__clear:hover { background: var(--surface-2); color: var(--text); }
.search__go {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  color: #2E2540;
  background: linear-gradient(135deg, var(--purple), var(--steel));
  box-shadow: 0 6px 16px -6px rgb(110 116 192 / .7);
  transition: transform .15s, box-shadow .15s;
}
.search__go:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -8px rgb(110 116 192 / .8); }
.search__go:active { transform: translateY(0) scale(.97); }
.search__hint, .search__error { grid-column: 1 / -1; font-size: 12.5px; padding-left: 18px; min-height: 0; }
.search__hint { color: var(--text-3); }
.search__error { color: var(--danger); font-weight: 600; }
.search__error:empty { display: none; }
.search[data-invalid="true"] .search__hint { display: none; }

/* ---------- Buttons / badges ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--primary { color: #2E2540; background: linear-gradient(135deg, var(--purple), var(--steel)); }
.btn--ghost { background: var(--surface); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { color: #fff; background: var(--danger); }
.btn--danger:hover { filter: brightness(1.05); }
.btn--danger-outline { color: var(--danger); background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn--danger-outline:hover:not(:disabled) { background: var(--danger-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge--live { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip--partial { color: var(--warn); }
.chip--unavailable { color: var(--text-3); }
.chip--receipts { color: var(--steel-ink); }
.chip--available, .chip--connected { color: var(--ok); }

/* ---------- Layout ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 24px var(--gutter) 48px; display: grid; gap: 32px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel__title { font-size: 16px; }
.panel__meta { color: var(--text-3); font-size: 13px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; }
.section-head__actions { display: flex; gap: 8px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--text-2); }

/* ---------- Filter banner ---------- */
.filter-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--steel) 28%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--steel) 60%, var(--border));
  color: var(--steel-ink); font-weight: 600;
}

/* ---------- Year spotlight ---------- */
.spotlight { display: flex; align-items: center; gap: 12px; min-width: 0; margin-bottom: -16px; }
.spotlight__label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--text-2); flex: none; }
.seg {
  display: inline-flex; gap: 4px; padding: 4px; min-width: 0; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.seg::-webkit-scrollbar { display: none; }
.seg__btn {
  flex: none; height: 34px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--text-2); font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums;
  transition: background .15s, color .15s;
}
.seg__btn:hover { color: var(--text); background: var(--surface-2); }
.seg__btn[aria-pressed="true"] { color: #2E2540; background: linear-gradient(135deg, var(--purple), var(--steel)); box-shadow: 0 4px 10px -4px rgb(110 116 192 / .6); }

.delta {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; vertical-align: 1px; background: rgb(255 255 255 / .55);
}
.delta--up { color: var(--danger); }   /* spending more than last year */
.delta--down { color: var(--ok); }     /* spending less */
:root[data-theme="dark"] .delta { background: rgb(0 0 0 / .25); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .delta { background: rgb(0 0 0 / .25); } }

/* ---------- Dashboard ---------- */
.dashboard { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.panel--hero {
  grid-column: span 7; position: relative; overflow: hidden; padding: 28px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--purple) var(--hero-mix), var(--surface)) 0%, color-mix(in srgb, var(--steel) var(--hero-mix), var(--surface)) 100%);
  border-color: color-mix(in srgb, var(--purple) 50%, var(--border));
}
.panel--hero::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-glow), transparent 70%); pointer-events: none;
}
:root { --hero-glow: rgb(255 255 255 / .45); --hero-mix: 55%; }
:root[data-theme="dark"] { --hero-glow: rgb(197 173 197 / .12); --hero-mix: 30%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hero-glow: rgb(197 173 197 / .12); --hero-mix: 30%; } }
.panel--hero > * { position: relative; z-index: 1; }
.panel--hero .eyebrow { color: color-mix(in srgb, var(--text) 75%, transparent); }
.hero-total { font-size: clamp(40px, 6vw, 60px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-sub { color: color-mix(in srgb, var(--text) 70%, transparent); margin-top: 4px; }
.hero-cta { margin-top: 16px; text-decoration: none; }
.empty a { color: var(--steel-ink); font-weight: 600; }
.share-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; margin-top: 22px; background: rgb(255 255 255 / .5); gap: 2px; }
.share-bar span { display: block; height: 100%; transition: flex-grow .5s ease; }
.legend { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend b { font-variant-numeric: tabular-nums; }

.kpis { grid-column: span 5; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kpi { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.kpi__label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.kpi__value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 2px; }

.panel--chart { grid-column: 1 / -1; position: relative; }
.chart { width: 100%; height: 260px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .axis text { fill: var(--text-3); font-size: 11px; }
.chart .grid line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .bar { transition: opacity .15s; }
.chart .col:hover .bar { opacity: .85; }
.chart .col-hit { fill: transparent; cursor: default; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-hover);
  padding: 10px 12px; font-size: 12.5px;
}
.chart-tip h4 { margin: 0 0 6px; font-size: 13px; }
.chart-tip .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chart-tip .row span { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip .row i { width: 8px; height: 8px; border-radius: 2px; }
.chart-tip .total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-weight: 700; }

/* ---------- Provider accordion ---------- */
.provider-list { display: grid; gap: 12px; }
.provider {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .2s, border-color .2s;
}
.provider:hover { box-shadow: var(--shadow-hover); }
.provider[data-open="true"] { border-color: color-mix(in srgb, var(--steel) 70%, var(--border)); }
.provider[data-empty="true"] { opacity: .6; }
.provider__head {
  width: 100%; display: grid; align-items: center; gap: 16px; text-align: left;
  grid-template-columns: auto 1fr auto auto auto;
  padding: 16px 20px; border: 0; background: transparent; cursor: pointer;
}
.provider__swatch { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.provider__name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.provider__sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.provider__meter { width: 140px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.provider__meter span { display: block; height: 100%; border-radius: inherit; transition: width .5s ease; }
.provider__amount { text-align: right; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; min-width: 110px; }
.provider__amount small { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); }
.provider__chev { color: var(--text-3); transition: transform .25s ease; }
.provider[data-open="true"] .provider__chev { transform: rotate(180deg); }

.provider__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.provider[data-open="true"] .provider__panel { grid-template-rows: 1fr; }
.provider__panel > div { overflow: hidden; }
.provider__inner { padding: 0 20px 20px; }
.provider__note { font-size: 12.5px; color: var(--text-3); margin-bottom: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 700; color: var(--text-2);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; white-space: nowrap;
}
tbody td { padding: 11px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
tbody tr:hover { background: color-mix(in srgb, var(--steel) 10%, transparent); }
td.num, th.num { text-align: right; }
thead th.no-caps { text-transform: none; }
td.loc { white-space: normal; min-width: 160px; color: var(--text-2); }
.idle-fee { color: var(--warn); font-weight: 600; }
.dur-calc { color: var(--text-2); }
.dur-calc::after { content: "*"; color: var(--text-3); margin-left: 1px; }
.table-note { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* Average pricing tiles inside each provider */
.price-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.price-stat {
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--prov, var(--steel)) 9%, var(--surface));
  border-left: 3px solid var(--prov, var(--steel)); min-width: 0;
}
.price-stat dt { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.price-stat dd { margin: 2px 0 0; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.price-stat dd small { font-size: 12px; font-weight: 600; color: var(--text-2); margin-left: 1px; }
.price-stat .price-stat__sub { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); margin-top: 1px; }
@media (max-width: 960px) { .price-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.idle-none { color: var(--text-3); }
tfoot td { padding: 11px 12px; border-top: 2px solid var(--border); font-weight: 800; background: var(--surface-2); }
.empty { padding: 18px; text-align: center; color: var(--text-3); }

/* ---------- Connections ---------- */
.conn-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.conn {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
.conn__dot { width: 12px; height: 12px; border-radius: 4px; }
.conn__name { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn__note { font-size: 12.5px; color: var(--text-3); }

/* Manage stored data: destructive actions tucked into a quiet disclosure */
.manage-data { margin-top: 4px; border-top: 1px dashed var(--border); padding-top: 12px; }
.manage-data > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); padding: 6px 4px; border-radius: 8px; min-height: 36px;
}
.manage-data > summary::-webkit-details-marker { display: none; }
.manage-data > summary:hover { color: var(--text); }
.manage-data__chev { transition: transform .2s ease; color: var(--text-3); flex: none; }
.manage-data[open] .manage-data__chev { transform: rotate(90deg); }
.manage-data__summary { margin-left: auto; font-weight: 500; font-size: 12.5px; color: var(--text-3); text-align: right; }
.manage-data__body { display: grid; gap: 10px; margin-top: 10px; }
.manage-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border));
}
.manage-row .muted { font-size: 12.5px; }
.manage-row__title { font-weight: 700; }
.manage-row .btn { flex: none; }
.manage-row--safe { border-color: var(--border); }
.manage-row__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.manage-row__actions label.btn { cursor: pointer; }
.manage-row__actions label.btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.addr-notice {
  padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border));
}
.addr-notice a { color: inherit; }

/* ---------- Dialog / form ---------- */
.dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-hover); width: min(460px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgb(20 15 30 / .45); backdrop-filter: blur(4px); }
.dialog__body { padding: 24px; display: grid; gap: 14px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; }
.field input {
  height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 400;
}
.field input:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--steel) 35%, transparent); }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.form-error:empty { display: none; }

/* ---------- Import receipts ---------- */
.dialog--wide { width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.dialog__body > *, #importStep2 > * { min-width: 0; }
#importStep2 { display: grid; gap: 12px; min-width: 0; }
#importStep2[hidden] { display: none; }
.dialog__titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dropzone {
  display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer;
  padding: 36px 20px; border-radius: var(--radius); border: 2px dashed color-mix(in srgb, var(--steel) 70%, var(--border));
  background: color-mix(in srgb, var(--steel) 10%, var(--surface)); color: var(--steel-ink);
  transition: background .15s, border-color .15s;
}
.dropzone:hover, .dropzone[data-drag="true"] { background: color-mix(in srgb, var(--steel) 22%, var(--surface)); border-color: var(--steel-ink); }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone[data-busy="true"] { opacity: .6; pointer-events: none; }
.dropzone__title { font-weight: 700; color: var(--text); }
.howto { margin-top: 14px; font-size: 13.5px; }
.howto summary { cursor: pointer; font-weight: 600; color: var(--steel-ink); }
.howto ul { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 4px; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 13px; color: var(--ok); }
.privacy-note svg { flex: none; margin-top: 2px; }

.review-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.pill--ok { color: var(--ok); }
.pill--review { color: var(--warn); }
.pill--error { color: var(--danger); }
/* position:relative contains the visually-hidden (absolute) labels inside the scroller */
.review-wrap { max-height: min(52vh, 520px); overflow: auto; position: relative; }
.review-table td { padding: 6px 8px; vertical-align: middle; }
.review-table thead th { z-index: 1; }
.cell-input {
  height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-variant-numeric: tabular-nums; min-width: 0;
}
.cell-input--num { text-align: right; }
.cell-input:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--steel) 35%, transparent); }
td.needs-review .cell-input { border-color: color-mix(in srgb, var(--warn) 60%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.row-status { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.status { font-size: 12px; font-weight: 700; white-space: nowrap; }
.status--ok { color: var(--ok); }
.status--review { color: var(--warn); }
.status--error { color: var(--danger); }
.status--muted { color: var(--text-3); }
.receipt-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.receipt-thumb { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.receipt-thumb:hover { color: var(--steel-ink); text-decoration: underline; }
.receipt-thumb img { width: 28px; height: 40px; object-fit: cover; object-position: top; border-radius: 4px; border: 1px solid var(--border); flex: none; }
.dropzone__progress { font-weight: 700; color: var(--steel-ink); min-height: 1.2em; }
.dropzone[data-busy="true"] { opacity: 1; cursor: progress; }
.dropzone[data-busy="true"] .dropzone__progress::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
tr.is-excluded td:not(:first-child) { opacity: .45; }
.conn__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .conn { grid-template-columns: auto 1fr; } .conn__actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* ---------- Toast / footer ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-hover); max-width: calc(100vw - 32px);
  margin-bottom: env(safe-area-inset-bottom);
}
/* Touch vs pointer copy (e.g. "Drop … or browse" vs "Tap to choose") */
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-touch { display: inline; }
  .only-pointer { display: none; }
}
.footer { text-align: center; color: var(--text-3); font-size: 12.5px; padding-top: 8px; }

/* ---------- Skeleton loading ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .panel--hero, .kpis { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
  .topbar__inner { grid-template-columns: 1fr auto; }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .brand { padding-top: 4px; }
  .topbar__end { padding-top: 0; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .provider__head { grid-template-columns: auto 1fr auto auto; gap: 12px; padding: 14px 16px; }
  .provider__meter { display: none; }
  .provider__amount { min-width: 0; font-size: 16px; }
  .provider__inner { padding: 0 12px 16px; }
  .chart { height: 220px; }
}
/* ---------- Phones ---------- */
@media (max-width: 560px) {
  body { font-size: 15px; background-attachment: scroll; }
  .topbar__inner { padding: 10px max(var(--gutter), env(safe-area-inset-right)) 10px max(var(--gutter), env(safe-area-inset-left)); gap: 10px; }
  .page { gap: 24px; padding: 16px max(var(--gutter), env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left)); }
  .search input { font-size: 16px; } /* ≥16px stops iOS zooming on focus */
  .search__hint { display: none; }    /* the placeholder says it; errors still show */

  .spotlight { flex-direction: column; align-items: stretch; gap: 6px; margin-bottom: -8px; }
  .seg { display: flex; }
  .seg__btn { flex: 1 0 auto; }

  .panel { padding: 16px; }
  .panel--hero { padding: 22px 20px; }
  .hero-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .delta { margin-left: 0; }
  .kpi__value { font-size: 22px; }
  .chart { height: 200px; }

  .section-head { flex-wrap: wrap; }
  .provider__head { grid-template-columns: auto 1fr auto; gap: 10px; padding: 12px 14px; }
  .provider__head .chip { display: none; }
  .provider__chev { display: none; }
  .provider__inner { padding: 0 10px 12px; }

  /* Session tables become stacked cards */
  .table-wrap { border: 0; overflow: visible; }
  .sessions, .sessions tbody, .sessions tfoot { display: block; }
  .sessions thead { display: none; }
  .sessions tbody tr {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 10px;
    grid-template-areas: "date date total" "start end dur" "loc loc loc" "kwh energy idle";
    padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  }
  .sessions tbody td { border: 0; padding: 0; white-space: normal; text-align: left; min-width: 0; }
  .sessions tbody td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
  .sessions td.c-date { grid-area: date; font-weight: 700; }
  .sessions td.c-date::before { display: none; }
  .sessions td.c-start { grid-area: start; }
  .sessions td.c-end { grid-area: end; }
  .sessions td.loc { grid-area: loc; min-width: 0; font-size: 13px; }
  .sessions td.c-total { grid-area: total; text-align: right; align-self: center; font-size: 17px; }
  .sessions td.c-dur { grid-area: dur; }
  .sessions tbody td:nth-child(6) { grid-area: kwh; }
  .sessions tbody td:nth-child(7) { grid-area: energy; }
  .sessions tbody td:nth-child(8) { grid-area: idle; }
  .price-stats { grid-template-columns: 1fr 1fr; }
  .sessions tfoot tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
  .sessions tfoot td { border: 0; padding: 0; background: none; }
  .sessions tfoot .f-sub { display: none; }
  .sessions tfoot .f-total { text-align: right; }

  /* Dialogs become bottom sheets */
  .dialog, .dialog--wide {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0;
    max-height: 92dvh; overflow: auto; padding-bottom: env(safe-area-inset-bottom);
  }
  .dialog__body { padding: 20px 16px; }
  .dialog__actions { flex-wrap: wrap; }
  .dialog__actions .btn { flex: 1 1 auto; justify-content: center; }
  .field input { font-size: 16px; }
  .dropzone { padding: 28px 16px; }

  /* Import review rows become editable cards */
  .review-wrap { max-height: none; overflow: visible; }
  .review-table, .review-table tbody { display: block; }
  .review-table thead { display: none; }
  .review-table tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px;
    margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  }
  .review-table tbody td { border: 0; padding: 0; white-space: normal; min-width: 0; }
  .review-table td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 3px; }
  .review-table .rc-status, .review-table .rc-file, .review-table .rc-location, .review-table .rc-start, .review-table .rc-provider,
  .review-table .rc-ref { grid-column: 1 / -1; }
  .review-table .rc-spacer { display: none; }
  .review-table .receipt-name { max-width: none; overflow: hidden; text-overflow: ellipsis; }
  .review-table .cell-input { width: 100% !important; height: 40px; font-size: 16px; }

  .manage-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .manage-row__actions { justify-content: flex-start; }
  .manage-data__summary { flex-basis: 100%; text-align: left; margin-left: 24px; }
  .manage-data > summary { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .provider__swatch { width: 34px; height: 34px; }
  .provider__amount { font-size: 15px; }
  .kpis { gap: 10px; }
}
/* Bigger touch targets on touch screens */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--sm { min-height: 40px; }
  .icon-btn { width: 44px; height: 44px; }
  .seg__btn { height: 40px; }
  .search__lead { width: 40px; height: 40px; left: 4px; }
  .manage-data > summary { min-height: 44px; }
}
/* ---------- Export button ---------- */
.icon-btn--accent { color: #2E2540; border-color: transparent; background: linear-gradient(135deg, var(--purple), var(--steel)); }
.icon-btn--accent:hover { color: #2E2540; filter: brightness(1.04); }

/* ---------- Print / Export as PDF ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  body { font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .spotlight, .connections, .filter-banner, .section-head__actions, .provider__chev,
  .toast, dialog, .skip-link, .chart-tip, .provider[data-empty="true"], .provider__note { display: none !important; }
  .print-only { display: block; }
  .print-head { border-bottom: 2px solid var(--purple); padding-bottom: 8px; }
  .print-head__title { font-size: 18px; font-weight: 800; }
  .print-head__meta { color: var(--text-2); font-size: 11px; margin-top: 2px; }
  .page { padding: 0; gap: 16px; max-width: none; }
  .panel, .provider { box-shadow: none !important; }
  .panel--hero::after { display: none; }
  .dashboard, .panel--chart, .price-stats, tr, .provider__head { break-inside: avoid; }
  .provider__panel { grid-template-rows: 1fr !important; transition: none !important; }
  .provider__panel > div { overflow: visible; }
  .table-wrap { overflow: visible; }
  thead { display: table-header-group; }
  thead th { position: static; }
  tbody td, thead th, tfoot td { padding: 6px 8px; }
  td.loc { min-width: 0; }
  .price-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
