/* ==========================================================================
   CarExpense — vizuální systém (redesign 2026-09-28)

   Nový základ nad komponentami z modern.css: tokeny, typografie, kostra
   aplikace (boční panel / spodní lišta), karty, tlačítka, pole a Přehled.
   Načítá se PO modern.css, takže přebíjí jeho starší primitiva; starší
   názvy tokenů (--panel, --muted, --brand…) jsou tu namapované na nové,
   aby komponenty z modern.css převzaly stejnou paletu.

   Barva patří datům: rozhraní je neutrální grafit, akce nese písmo/inverze.
   Kategoriální paleta grafů (--s1…--s4) je ověřená validátorem pro obě
   schémata (adjacentní CVD ΔE ≥ 8,4; kontrast ≥ 3 : 1 v tmavém režimu).
   ========================================================================== */

/* Geist (Vercel, OFL-1.1) z balíčku @fontsource-variable/geist 5.3.0 —
   hostováno lokálně jako ostatní písma, bez externího požadavku. */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./fonts/geist-latin.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./fonts/geist-latin-ext.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Tokeny: tmavý režim je výchozí ------------------------------------ */
:root {
  color-scheme: dark;
  --c-bg: #0b0c0d;
  --c-surface: #151718;
  --c-surface-2: #1b1d1f;
  --c-surface-3: #232628;
  --c-line: #26292c;
  --c-line-2: #34383b;
  --c-ink: #f2f3f1;
  --c-ink-2: #b8bdb9;
  --c-ink-3: #90968f;
  --c-acc: #f2f3f1;
  --c-acc-ink: #0b0c0d;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s1-t: #14253a;
  --s2-t: #321d13;
  --s3-t: #0f2a20;
  --s4-t: #2d2410;
  --c-good: #45c272;
  --c-good-bg: #132a1c;
  --c-warn: #e9b64e;
  --c-warn-bg: #2c2412;
  --c-bad: #ef6b69;
  --c-bad-bg: #2c1716;
  --c-info: #78aef0;
  --c-info-bg: #14223a;
  --c-over: #e66767;
  --c-under: #3987e5;
  --c-grid: #202325;
  --c-axis: #3a3e41;
  --c-scrim: rgba(0, 0, 0, .62);
  --c-shadow: 0 1px 0 rgba(255, 255, 255, .02);
  --c-pop: 0 18px 48px rgba(0, 0, 0, .5);
  --r-card: 18px;
  --r-ctl: 12px;
  --font-ui: 'Geist', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Starší názvy z modern.css → nový systém. */
  --bg: var(--c-bg);
  --bg-soft: var(--c-surface-2);
  --panel: var(--c-surface);
  --panel-strong: var(--c-surface);
  --border: var(--c-line);
  --text: var(--c-ink);
  --muted: var(--c-ink-3);
  --soft: var(--c-ink-2);
  --brand: var(--s1);
  --brand-2: var(--s1);
  --brand-text: var(--c-good);
  --brand-ink: var(--c-acc-ink);
  --warn: var(--c-warn);
  --bad: var(--c-bad);
  --field: var(--c-surface-2);
  --shadow: var(--c-pop);
  --chart-1: var(--s1);
  --chart-2: var(--s2);
  --chart-3: var(--s3);
  --chart-4: var(--s4);
  --chart-5: var(--c-over);
  --chart-6: #8f7fe0;
  --chart-7: var(--c-ink-3);
}

:root[data-theme="light"] {
  color-scheme: light;
  --c-bg: #f3f4f1;
  --c-surface: #ffffff;
  --c-surface-2: #f6f7f4;
  --c-surface-3: #eceeea;
  --c-line: #e3e5e0;
  --c-line-2: #d2d5cf;
  --c-ink: #111416;
  --c-ink-2: #474e54;
  --c-ink-3: #646d74;
  --c-acc: #111416;
  --c-acc-ink: #ffffff;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s1-t: #e8f0fb;
  --s2-t: #fdeee7;
  --s3-t: #e2f4ec;
  --s4-t: #fbf1da;
  --c-good: #0b7a34;
  --c-good-bg: #e4f2e8;
  --c-warn: #8a5a00;
  --c-warn-bg: #fbf0d6;
  --c-bad: #c4312f;
  --c-bad-bg: #fbe9e8;
  --c-info: #1c5cab;
  --c-info-bg: #e8f0fa;
  --c-over: #e34948;
  --c-under: #2a78d6;
  --c-grid: #eceeea;
  --c-axis: #c6cac3;
  --c-scrim: rgba(17, 20, 22, .45);
  --c-shadow: 0 1px 2px rgba(17, 20, 22, .05), 0 8px 24px rgba(17, 20, 22, .05);
  --c-pop: 0 18px 48px rgba(17, 20, 22, .16);
  --chart-6: #6a58c9;
}

/* --- Základ -------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }
.tnum, .metric-value, .journal-amount, .kv-val { font-variant-numeric: tabular-nums; }
.muted { color: var(--c-ink-3); }
.eyebrow {
  margin: 0 0 4px;
  color: var(--c-ink-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
h1, h2, h3, h4 { letter-spacing: -.015em; }
a { color: inherit; }

/* --- Kostra: boční panel (desktop) / spodní lišta (mobil) ------------------ */
.app { min-height: 100vh; }
.sidebar { display: none; }
.main-col { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 10px 16px 4px;
}
.veh-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  min-width: 0;
  padding: 4px 12px 4px 4px;
  border-radius: 14px;
}
.veh-switch:hover { background: var(--c-surface); }
.veh-switch select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}
.veh-switch select:focus-visible + .veh-mark { outline: 2px solid var(--s1); outline-offset: 2px; }
.veh-mark, .brand-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 25%;
  background: var(--c-acc);
  color: var(--c-acc-ink);
}
.veh-mark svg, .brand-mark svg { width: 64%; height: 64%; display: block; }
.veh-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.veh-text strong { font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh-text span { font-size: 12px; color: var(--c-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.veh-chev { width: 18px; height: 18px; color: var(--c-ink-3); flex: none; }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.sync-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-ink-3); flex: none; }
.sync-pill.is-fresh i { background: var(--c-good); }
.sync-pill.is-stale i { background: var(--c-warn); }
.sync-pill[hidden] { display: none; }
@media (max-width: 520px) { .sync-label { display: none; } }

.modern-shell {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 4px 16px calc(112px + env(safe-area-inset-bottom));
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 2px 14px;
}
.view-head h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.08; }
.view-sub { margin: 5px 0 0; font-size: 13px; color: var(--c-ink-3); }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.view-actions .m-input { width: auto; min-width: 150px; }

/* Spodní lišta (mobil) */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--c-line);
  background: color-mix(in srgb, var(--c-surface) 94%, transparent);
  backdrop-filter: blur(16px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 2px 0;
  border: 0;
  background: none;
  color: var(--c-ink-3);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--c-ink); font-weight: 600; }
.tab.active svg { stroke-width: 2.1; }
.tab-add {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 18px;
  background: var(--c-acc);
  color: var(--c-acc-ink);
  cursor: pointer;
}
.tab-add svg { width: 24px; height: 24px; }
.tab-add:active { transform: scale(.96); }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 256px minmax(0, 1fr); }
  .tabbar { display: none; }
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100vh;
    padding: 20px 14px 18px;
    border-right: 1px solid var(--c-line);
    background: var(--c-surface);
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 8px 22px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.02em;
  }
  .side-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--c-ink-2);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
  }
  .side-item svg { width: 22px; height: 22px; }
  .side-item:hover { background: var(--c-surface-2); color: var(--c-ink); }
  .side-item.active { background: var(--c-surface-3); color: var(--c-ink); font-weight: 600; }
  .side-sub { display: flex; flex-direction: column; margin: 0 0 6px 23px; padding-left: 12px; border-left: 1px solid var(--c-line); }
  .side-sub button {
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--c-ink-3);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
  }
  .side-sub button:hover { color: var(--c-ink); background: var(--c-surface-2); }
  .side-sub button.active { color: var(--c-ink); font-weight: 600; }
  .side-spacer { flex: 1; }
  .side-add { width: 100%; margin-top: 10px; }
  .topbar { padding: 18px 32px 4px; }
  .modern-shell { padding: 4px 32px 48px; }
  .scan-toast { bottom: 24px; }
}

/* --- Primitiva ------------------------------------------------------------ */
.card, .panel {
  border: 1px solid var(--c-line);
  border-radius: var(--r-card);
  background: var(--c-surface);
  box-shadow: var(--c-shadow);
  overflow: visible;
}
.card { padding: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; min-height: 28px; }
.card-h h2, .card-h h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--c-ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.card-link:hover { color: var(--c-ink); }
.card-link svg { width: 16px; height: 16px; }
.panel-head { padding: 18px 18px 10px; }
.panel h3 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.panel-body { padding: 2px 18px 18px; }

.m-btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  background: var(--c-acc);
  color: var(--c-acc-ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
}
.m-btn:hover { filter: brightness(1.06); }
.m-btn.ghost { background: var(--c-surface-2); border-color: var(--c-line); color: var(--c-ink); }
.m-btn.ghost:hover { background: var(--c-surface-3); filter: none; }
.m-btn.danger { background: var(--c-bad-bg); border-color: transparent; color: var(--c-bad); }
.m-btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.m-btn svg, .m-btn .btn-ic { width: 20px; height: 20px; flex: none; }
.btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.m-input {
  min-height: 46px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-ctl);
  background: var(--c-surface-2);
  color: var(--c-ink);
  padding: 10px 13px;
  font-variant-numeric: tabular-nums;
}
.m-input:focus { border-color: var(--s1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s1) 22%, transparent); }
select.m-input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23909690' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.record-form label, .login-form label { color: var(--c-ink-2); font-size: 13px; font-weight: 500; }

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 13px;
  background: var(--c-surface-3);
}
.segmented button {
  flex: 1;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--c-ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.segmented button.active { background: var(--c-surface); color: var(--c-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 0 0 1px var(--c-line); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--c-line-2);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-ink-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.chip-btn.active { background: var(--c-acc); border-color: var(--c-acc); color: var(--c-acc-ink); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--c-surface-3);
  color: var(--c-ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; stroke-width: 2.2; }
.pill.good { background: var(--c-good-bg); color: var(--c-good); }
.pill.warn { background: var(--c-warn-bg); color: var(--c-warn); }
.pill.bad { background: var(--c-bad-bg); color: var(--c-bad); }
.pill.info { background: var(--c-info-bg); color: var(--c-info); }

.chip { border-color: var(--c-line); background: var(--c-surface-2); color: var(--c-ink-2); font-weight: 500; font-size: 12px; padding: 3px 9px; }
.chip--good { border-color: transparent; background: var(--c-good-bg); color: var(--c-good); }
.chip--warn { border-color: transparent; background: var(--c-warn-bg); color: var(--c-warn); }
.chip--note { font-style: normal; }

/* Seznamové řádky */
.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid var(--c-line);
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
}
.rows > .row-item:first-child { border-top: 0; padding-top: 2px; }
button.row-item, a.row-item { cursor: pointer; }
button.row-item:hover .row-title, a.row-item:hover .row-title { text-decoration: underline; text-decoration-color: var(--c-line-2); text-underline-offset: 3px; }
.row-ic {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--c-surface-3);
  color: var(--c-ink-2);
}
.row-ic svg { width: 21px; height: 21px; }
.row-body { flex: 1; min-width: 0; }
.row-body > span { display: block; }
.row-title { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.row-title small { font-size: 15px; font-weight: 500; color: var(--c-ink-3); }
.row-meta { margin-top: 2px; font-size: 13px; color: var(--c-ink-3); }
.row-val { font-size: 15px; font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-val small { display: block; font-size: 12px; font-weight: 500; color: var(--c-ink-3); }
.row-chev { width: 18px; height: 18px; color: var(--c-ink-3); flex: none; }
.tone-s1 { background: var(--s1-t); color: var(--s1); }
.tone-s2 { background: var(--s2-t); color: var(--s2); }
.tone-s3 { background: var(--s3-t); color: var(--s3); }
.tone-s4 { background: var(--s4-t); color: var(--s4); }
.tone-good { background: var(--c-good-bg); color: var(--c-good); }
.tone-warn { background: var(--c-warn-bg); color: var(--c-warn); }
.tone-info { background: var(--c-info-bg); color: var(--c-info); }
.tone-bad { background: var(--c-bad-bg); color: var(--c-bad); }

/* Čísla */
.num-xl { font-size: 46px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.num-l { font-size: 32px; font-weight: 600; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.num-m { font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.unit { margin-left: 4px; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--c-ink-3); }
.pos { color: var(--c-good); }
.neg { color: var(--c-bad); }
.kv2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.stat-label { margin: 0 0 5px; font-size: 13px; font-weight: 500; color: var(--c-ink-3); }
.stat-meta { margin: 4px 0 0; font-size: 13px; color: var(--c-ink-3); }
.divider { height: 1px; margin: 14px 0; background: var(--c-line); border: 0; }
.note { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: var(--c-ink-3); }
.meter { display: flex; gap: 2px; height: 12px; overflow: hidden; border-radius: 6px; background: var(--c-surface-3); }
.meter i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; color: var(--c-ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }

/* --- Přehled ----------------------------------------------------------------- */
.home-grid { display: grid; gap: 12px; }
@media (min-width: 1024px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .home-grid .span-2 { grid-column: span 2; }
  .home-grid .card { padding: 20px; }
}
@media (min-width: 1360px) {
  .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.battery-quick.card { margin: 0; padding: 16px; }
.battery-quick[hidden] { display: none; }
.hb-main { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.hb-main p, .num-xl, .num-l, .num-m, .stat-label, .stat-meta { margin: 0; }
.stat-label { margin-bottom: 5px; }
.stat-meta { margin-top: 4px; }
.hb-soc { font-size: 46px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.hb-soc small { margin-left: 3px; font-size: 24px; font-weight: 500; color: var(--c-ink-3); letter-spacing: 0; }
.hb-range { padding-bottom: 3px; }
.hb-range strong { display: block; font-size: 21px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hb-range span { font-size: 13px; color: var(--c-ink-3); }
.hb-bar { margin-top: 18px; }
.hb-bar i { background: var(--s1); border-radius: 6px; }
.battery-quick-meta { margin: 10px 0 0; color: var(--c-ink-3); font-size: 12px; line-height: 1.5; }
.hb-rows { margin-top: 12px; border-top: 1px solid var(--c-line); }
.hb-rows .row-item:first-child, .hb-rows #homePlan .row-item { border-top: 0; }
.hb-rows #homePlan:not(:empty) + .row-item { border-top: 1px solid var(--c-line); }
.hb-rows .row-item { padding: 12px 0; }
#batteryQuickToggle[aria-expanded="true"] .hb-toggle-chev { transform: rotate(180deg); }
.hb-quick { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--c-line); }
.hb-quick[hidden] { display: none; }
.battery-quick-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; }
.battery-quick-heading h3 { margin: 0; font-size: 15px; font-weight: 600; }
.battery-quick-inputs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.battery-quick-inputs .m-input { width: 88px; min-width: 0; font-size: 16px; }

.month-bars { position: relative; margin-top: 4px; }
.month-bars svg { display: block; width: 100%; height: auto; overflow: visible; }
.month-bars .b-closed { fill: var(--s1); }
.month-bars .b-open { fill: var(--s1); opacity: .38; }
.month-bars .b-grid { stroke: var(--c-grid); stroke-width: 1; }
.month-bars .b-axis { stroke: var(--c-axis); stroke-width: 1; }
.month-bars .b-hit { fill: transparent; cursor: pointer; }
.month-bars .b-hit:hover, .month-bars .b-hit:focus { fill: color-mix(in srgb, var(--c-ink) 6%, transparent); outline: none; }
.month-bars text { fill: var(--c-ink-3); font-size: 11px; font-family: var(--font-ui); }
.month-bars text.b-val { fill: var(--c-ink); font-weight: 600; font-size: 12px; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--c-ink);
  color: var(--c-bg);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: var(--c-pop);
}
.chart-tip b { display: block; margin-bottom: 2px; font-weight: 600; }
.chart-tip[hidden] { display: none; }

.spark svg { display: block; overflow: visible; }
.spark .sp-line { fill: none; stroke: var(--s1); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.spark .sp-avg { stroke: var(--c-ink-3); stroke-width: 1.2; stroke-dasharray: 3 4; }
.spark .sp-dot { fill: var(--c-surface); stroke: var(--s1); stroke-width: 2.2; }
.spark text { fill: var(--c-ink-3); font-size: 11px; font-family: var(--font-ui); }

.empty-card { padding: 22px 16px; text-align: center; color: var(--c-ink-3); }

/* --- Analýza --------------------------------------------------------------- */
.an-tabs { margin: 0 0 14px; }
.an-pane[hidden] { display: none; }
.an-pane { display: grid; gap: 12px; }
@media (min-width: 1024px) {
  .an-tabs { max-width: 560px; }
  .an-pane { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .an-pane > .span-2 { grid-column: 1 / -1; }
}
.an-pane .panel-body > .metric-row:first-child { padding-top: 4px; }
.an-detail { display: flex; justify-content: flex-end; }

/* --- Vůz --------------------------------------------------------------------- */
.veh-grid { display: grid; gap: 12px; }
@media (min-width: 1024px) {
  .veh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
}
.veh-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin-top: 10px; }
.veh-facts div { display: flex; flex-direction: column; gap: 3px; padding: 12px 0; border-top: 1px solid var(--c-line); }
.veh-facts span { font-size: 12px; color: var(--c-ink-3); }
.veh-facts b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.layout-hint { margin: 8px 0 0; font-size: 12px; color: var(--c-ink-3); }

/* --- Sekce (podstránka) ------------------------------------------------------ */
.section-topbar { display: flex; justify-content: space-between; gap: 10px; margin: 2px 0 12px; }
.section-shell .panel-head { padding-bottom: 4px; }
.section-shell .eyebrow { margin-bottom: 2px; }

/* --- Deník -------------------------------------------------------------------- */
.journal-list { gap: 0; }
.journal-group {
  margin: 18px 2px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: none;
  color: var(--c-ink-3);
}
.journal-item {
  grid-template-columns: 40px minmax(0, 1fr) auto;
  border: 0;
  border-top: 1px solid var(--c-line);
  border-radius: 0;
  background: none;
  padding: 12px 0;
}
.journal-group + .journal-item { border-top: 0; }
.journal-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--s1-t); color: var(--s1); }
.journal-ic.tone-home { background: var(--s1-t); color: var(--s1); }
.journal-ic.tone-ac { background: var(--s4-t); color: var(--s4); }
.journal-ic.tone-dc { background: var(--s2-t); color: var(--s2); }
.journal-ic.tone-fuel, .journal-ic.tone-expense, .journal-ic.tone-neutral { background: var(--c-surface-3); color: var(--c-ink-2); }
.journal-title { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.journal-title small { font-size: 13px; font-weight: 500; }
.journal-mode { font-weight: 500; }
.journal-amount { font-size: 15px; font-weight: 600; }
.journal-meta { font-size: 13px; }
.journal-day { font-weight: 500; }
.journal-day.is-fresh { color: var(--c-ink-2); }
.mini-action { min-height: 34px; padding: 0 12px; border-color: var(--c-line); background: var(--c-surface-2); color: var(--c-ink); font-weight: 500; font-size: 13px; }
.mini-action.danger { color: var(--c-bad); background: var(--c-bad-bg); border-color: transparent; }
.history-expand { min-height: 44px; border-color: var(--c-line); background: var(--c-surface-2); font-weight: 500; }
@media (max-width: 720px) {
  .journal-item { grid-template-columns: 40px minmax(0, 1fr); }
  .journal-ic { width: 40px; height: 40px; }
}
.records-tabs { margin: 0 0 12px; }
.journal-item.is-focus { background: var(--c-surface-3); border-radius: 12px; transition: background .4s; }
.records-pane[hidden] { display: none; }

/* --- Metriky a detailní řádky z modern.css ------------------------------------ */
.metric-row { padding: 12px 0; border-bottom-color: var(--c-line); }
.metric-row strong { font-size: 14px; font-weight: 500; color: var(--c-ink); }
.metric-row span { font-size: 12px; color: var(--c-ink-3); }
.metric-value { font-weight: 600; font-size: 15px; }
.bar-track { height: 8px; background: var(--c-surface-3); }
.bar-fill { background: var(--s1); }
.bar-meta { font-size: 13px; color: var(--c-ink-2); }
.bar-meta strong { color: var(--c-ink); font-weight: 600; }
.detail-section h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.empty-state { border-color: var(--c-line); border-radius: var(--r-card); background: var(--c-surface-2); }

/* --- Drawery, listy, toast ------------------------------------------------------ */
.drawer-backdrop { background: var(--c-scrim); backdrop-filter: none; }
.drawer-card { background: var(--c-surface); border-left: 1px solid var(--c-line); box-shadow: var(--c-pop); }
.drawer-head { padding-bottom: 12px; border-bottom: 1px solid var(--c-line); margin-bottom: 16px; }
.drawer-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.sheet-card { border-color: var(--c-line); border-radius: 24px 24px 0 0; background: var(--c-surface); box-shadow: var(--c-pop); padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-grip { width: 40px; height: 5px; background: var(--c-line-2); }
.sheet-title { margin: 0 4px 10px; font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.sheet-act { min-height: 72px; border-color: var(--c-line); border-radius: 18px; background: var(--c-surface-2); padding: 12px 14px; }
.sheet-act.primary { border-color: var(--c-acc); background: var(--c-acc); color: var(--c-acc-ink); }
.sheet-act.primary .sheet-ic { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }
.sheet-act.primary .sheet-txt span { color: inherit; opacity: .72; }
.sheet-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--c-surface-3); color: var(--c-ink); }
.sheet-ic.tone-s1 { background: var(--s1-t); color: var(--s1); }
.sheet-ic.tone-s2 { background: var(--s2-t); color: var(--s2); }
.sheet-txt strong { font-weight: 600; }
.sheet-txt span { font-size: 13px; }
.sheet-cancel { min-height: 48px; margin-top: 4px; border-radius: var(--r-ctl); background: var(--c-surface-2); color: var(--c-ink); font-weight: 600; font-size: 15px; }
.scan-toast { pointer-events: none; border-color: var(--c-line); background: var(--c-ink); color: var(--c-bg); bottom: calc(100px + env(safe-area-inset-bottom)); box-shadow: var(--c-pop); font-weight: 500; }
@media (max-width: 1023px) {
  .drawer { grid-template-columns: 1fr; }
  .drawer .drawer-backdrop { grid-row: 1; grid-column: 1; }
  .drawer .drawer-card {
    grid-row: 1;
    grid-column: 1;
    align-self: end;
    height: auto;
    max-height: calc(100vh - 40px - env(safe-area-inset-top));
    border-left: 0;
    border-top: 1px solid var(--c-line);
    border-radius: 24px 24px 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .scan-modal .scan-card { border-radius: 24px; align-self: center; }
}

/* --- Přihlášení ------------------------------------------------------------ */
.login-overlay { background: var(--c-bg); }
.login-card { border-radius: 22px; background: var(--c-surface); border-color: var(--c-line); box-shadow: var(--c-pop); }
.wordmark { font-family: var(--font-ui); font-weight: 600; letter-spacing: -.03em; }
.mnav-mark { background: var(--c-acc); color: var(--c-acc-ink); }

.offline-notice { background: var(--c-warn-bg); color: var(--c-warn); border-bottom: 1px solid var(--c-line); }
.loading { background: var(--c-bg); color: var(--c-ink-2); }

/* --- Doladění starších komponent pod novým systémem ----------------------------- */
:root { --font-mono: var(--font-ui); }
.metric-row { grid-template-columns: minmax(0, 1fr) auto; }
.metric-value, .detail-table td, .compact-table td { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.panel-head { flex-wrap: nowrap; align-items: flex-start; }
.panel-head > div { min-width: 0; }
.panel-head h3 { margin: 0; }
.panel-head .eyebrow { margin-bottom: 2px; }
@media (max-width: 1023px) {
  .view-actions { width: 100%; flex-wrap: nowrap; }
  .view-actions .m-input { flex: 1; min-width: 0; width: auto; min-height: 42px; }
}
.ice-savings-wrap { margin: 0; }
.ice-savings-card { border-color: var(--c-line); border-radius: var(--r-card); background: var(--c-surface); box-shadow: var(--c-shadow); }
.ice-strip-sum { min-height: 64px; padding: 12px 16px; }
.ice-strip-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--c-good-bg); color: var(--c-good); }
.ice-strip-main { font-size: 13px; color: var(--c-ink-3); }
.ice-strip-main strong { font-size: 18px; font-weight: 600; }
.ice-strip-total strong { font-size: 15px; font-weight: 600; }
.ice-strip-car { font-weight: 400; }
.ice-savings-label { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--c-ink-3); }
.ice-savings-val { font-size: 24px; font-weight: 600; }
.ice-save-pos { color: var(--c-good); }
.ice-save-neg { color: var(--c-bad); }
.ice-savings-details-sum { font-weight: 600; color: var(--c-ink-2); }
.forecast-page-link { display: none; }
.chip--note a { color: var(--c-info); }
.journal-ic.tone-urcice { background: var(--s3-t); color: var(--s3); }
@media (max-width: 520px) { .row-val small { display: none; } }
/* Rozbor (metric-insights): neutrální navigace, barva zůstává datům. */
.mi-nav button[aria-current] { background: var(--c-acc); border-color: var(--c-acc); color: var(--c-acc-ink); font-weight: 600; }
.metric-insights :is(button, select, input):focus-visible { outline-color: var(--s1); }
.mi-heading .mi-source { color: var(--c-ink-3); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.mi-selection input, .mi-scenario input { accent-color: var(--s1); }
.mi-scenario strong { color: var(--c-ink); }
/* Kniha jízd (journal.js): stejná primitiva jako zbytek aplikace. */
.journal input, .journal select { min-height: 44px; border-color: var(--c-line-2); border-radius: var(--r-ctl); background: var(--c-surface-2); }
.journal button { min-height: 40px; border-color: var(--c-line); border-radius: var(--r-ctl); background: var(--c-surface-2); font-weight: 500; }
.journal button:hover { background: var(--c-surface-3); }
.journal button[aria-pressed="true"] { color: var(--c-ink); border-color: var(--c-ink-3); background: var(--c-surface-3); font-weight: 600; }
.journal-primary { gap: 2px; padding: 3px; border: 0; border-radius: 13px; background: var(--c-surface-3); }
.journal-primary button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--c-ink-2); font-weight: 500; }
.journal-primary button:hover { background: transparent; color: var(--c-ink); }
.journal-primary button[aria-pressed="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 0 0 1px var(--c-line); }
.journal-kpis > div, .journal-row, .journal fieldset { border-color: var(--c-line); border-radius: var(--r-card); background: var(--c-surface); }
.journal-kpis strong { color: var(--c-ink); font-weight: 600; }
.journal td, .journal th { border-bottom-color: var(--c-line); }
.journal-range summary, .journal #journalStatus { color: var(--c-ink-2); }
.journal progress { accent-color: var(--s1); }
.journal-mile-summary strong { font-weight: 600; letter-spacing: -.02em; }
.record-form label.m-btn { flex-direction: row; white-space: normal; text-align: center; color: var(--c-ink); font-size: 15px; font-weight: 600; }
