/* DriveTrack – webový účet. Střídmý vzhled firemního dashboardu: světlý / grafitový tmavý režim
   podle systému, jemné okraje místo stínů, tabulky, karty s hlavičkou. Barvy shodné s administrací. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --hover: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #98a2b3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --green: #12b76a;
  --orange: #f79009;
  --red: #f04438;
  --purple: #7a5af8;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 20px 40px -8px rgba(16, 24, 40, 0.25);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --surface: #161a22;
    --surface-2: #1b2029;
    --hover: #1f2530;
    --border: #262c38;
    --border-strong: #343b49;
    --text: #e7eaf0;
    --text-2: #a4adbd;
    --text-3: #6b7486;
    --primary: #3b82f6;
    --primary-hover: #5b95f7;
    --primary-soft: rgba(59, 130, 246, 0.14);
    --green: #32d583;
    --orange: #fdb022;
    --red: #f97066;
    --purple: #9b8afb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* Vzhled zvolený v Nastavení (stejně jako v aplikaci): tmavý i při světlém systému. */
:root[data-theme="dark"] {
  --bg: #0f1218;
  --surface: #161a22;
  --surface-2: #1b2029;
  --hover: #1f2530;
  --border: #262c38;
  --border-strong: #343b49;
  --text: #e7eaf0;
  --text-2: #a4adbd;
  --text-3: #6b7486;
  --primary: #3b82f6;
  --primary-hover: #5b95f7;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --green: #32d583;
  --orange: #fdb022;
  --red: #f97066;
  --purple: #9b8afb;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 18px; height: 18px; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.error { color: var(--red); min-height: 1.3em; font-size: 13px; }

/* MARK: Ovládací prvky */

button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px;
  padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.large { width: 100%; height: 42px; font-size: 15px; }
.small-btn { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
:is(button, a):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

input, select, textarea {
  width: 100%; height: 38px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 12px; box-shadow: var(--shadow-sm);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 80px; padding: 9px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
/* Pole bez modrého rámečku po kliknutí (na celém webu): jen jemně tmavší okraj. */
:is(input, select, textarea):is(:focus, :focus-visible) { outline: none; border-color: var(--text-3); box-shadow: var(--shadow-sm); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
/* Dropdowny: bez modrého rámečku po kliknutí, rozevřený seznam zakulacený jako zavřený (Chrome/Edge: base-select). */
select:hover { border-color: var(--text-3); }
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select { display: inline-flex; align-items: center; cursor: pointer; border-radius: 10px; }
  select::picker-icon { display: none; }
  ::picker(select) {
    border: 1px solid var(--border); border-radius: 12px; padding: 5px; margin-top: 6px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto;
  }
  select option { padding: 8px 12px; border-radius: 8px; min-height: 0; font-size: 14px; cursor: pointer; outline: none; }
  select option:hover, select option:focus-visible { background: var(--hover); }
  select option:checked { color: var(--primary); font-weight: 600; background: var(--primary-soft); }
  select option::checkmark { display: none; }
}
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 16px;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 6px; background: var(--surface-2); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding: 3px 0; cursor: pointer; }
.check input { width: 15px; height: 15px; box-shadow: none; accent-color: var(--primary); }

/* MARK: Přihlášení */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card {
  width: min(400px, 100%); display: grid; gap: 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; }
.login-brand img { border-radius: 10px; width: 44px; height: 44px; }
.login-card h1 { font-size: 22px; margin-top: 6px; }
.field-stack { display: grid; gap: 10px; margin-top: 6px; }
.login-card .btn.large { margin-top: 4px; }

/* MARK: Rozvržení */

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }
.nav { display: grid; gap: 1px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 6px; }
.nav-label:first-child { padding-top: 0; }
.tab {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-weight: 500; font-size: 14px; text-align: left;
}
.tab svg { color: var(--text-3); }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tab.active svg { color: var(--primary); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-text { display: grid; min-width: 0; }
.me-text strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
  background-size: cover; background-position: center; }
.sidebar-foot .btn { justify-content: flex-start; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; }
.title-tools { display: flex; gap: 8px; min-width: 0; }
.title-tools select { width: auto; max-width: 200px; padding-top: 6px; padding-bottom: 6px; }
#menu-btn { display: none; }
.sync-note {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px; max-width: 520px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sync-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.sync-note:empty { display: none; }
.content { padding: 28px 32px 56px; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }

/* MARK: Karty */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; overflow: hidden; }
.card > h2 {
  display: flex; align-items: center; gap: 10px; font-size: 15px; padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card > h2 .right { margin-left: auto; font-size: 13px; font-weight: 500; }
.card > :not(h2):not(.list):not(.table-wrap):not(.year-groups) { margin: 16px 18px; }
.card > .list, .card > .table-wrap { margin: 0; }
.card > .kv { margin: 6px 18px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }

/* Souhrnná čísla */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; min-width: 0; }
/* Ikona údaje: barevný symbol v podbarveném čtverci (jako v aplikaci). */
.ti, .ch { display: inline-grid; place-items: center; flex: none; border-radius: 9px; }
.tile-head { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 8px; }
.tile-head .label { line-height: 1.25; overflow-wrap: anywhere; }
.ti { width: 30px; height: 30px; border-radius: 8px; }
.ti svg { width: 16px; height: 16px; }
.ch { width: 28px; height: 28px; border-radius: 8px; }
.ch svg { width: 16px; height: 16px; }
.card .tiles .ti, .modal .tiles .ti, .car-card .ti { width: 26px; height: 26px; border-radius: 7px; }
.card .tiles .ti svg, .modal .tiles .ti svg, .car-card .ti svg { width: 14px; height: 14px; }
.card .tiles .tile-head, .modal .tiles .tile-head, .car-card .tile-head { margin-bottom: 6px; gap: 8px; }
.tile .label { order: 1; color: var(--text-2); font-size: 13px; font-weight: 500; }
.tile .value { order: 2; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { order: 3; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tiles .tile, .modal .tiles .tile, .car-card .tile { box-shadow: none; background: var(--surface-2); padding: 12px 14px; }
.card .tiles .value, .modal .tiles .value, .car-card .value { font-size: 18px; }

/* MARK: Seznamy */

.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); min-height: 56px; }
.row:first-child { border-top: 0; }
.row.click { cursor: pointer; }
.row.click:hover { background: var(--hover); }
.row .main-col { flex: 1; min-width: 0; }
.row .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }
.row > svg.chev, td svg.chev { width: 14px; height: 14px; color: var(--text-3); vertical-align: middle; }
.badge { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; flex: none; color: #fff; }
.badge svg { width: 16px; height: 16px; }
.place-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c)); }
.place-ic svg { width: 16px; height: 16px; }
.empty { color: var(--text-2); padding: 28px 18px; text-align: center; }

/* Tabulky */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2);
  padding: 10px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--hover); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-weight: 500; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
td.dim { color: var(--text-2); }
td .cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
td .cell .badge { width: 26px; height: 26px; border-radius: 7px; }
td .cell .badge svg { width: 14px; height: 14px; }
td .cell .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
td .note { color: var(--text-3); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
tr.group td { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); padding: 8px 18px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.pill.soon { color: var(--orange); background: color-mix(in srgb, var(--orange) 10%, transparent); border-color: color-mix(in srgb, var(--orange) 25%, transparent); }
.pill.overdue { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.pill.unknown { color: var(--text-2); background: var(--surface-2); border-color: var(--border); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Výběr jízd v seznamu a hromadné akce */
th.pick, td.pick { width: 34px; padding-right: 0 !important; cursor: default; }
/* Kulaté zaškrtávátko (jako výběr v iOS). */
td.pick input, th.pick input {
  appearance: none; width: 20px; height: 20px; min-width: 20px; min-height: 20px; padding: 0; flex: none; aspect-ratio: 1;
  margin: 0; border-radius: 50%; border: 2px solid var(--text-3);
  background: transparent; cursor: pointer; vertical-align: middle; display: inline-grid; place-content: center;
  transition: background .15s, border-color .15s;
}
td.pick input:checked, th.pick input:checked, th.pick input:indeterminate { background: var(--primary); border-color: var(--primary); }
td.pick input:checked::after, th.pick input:checked::after {
  content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg);
}
th.pick input:indeterminate::after { content: ""; width: 9px; height: 2.5px; background: #fff; border-radius: 2px; }
td.pick input:focus-visible, th.pick input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
tr.selected td { background: color-mix(in srgb, var(--primary) 10%, transparent); }
/* Hromadné akce úplně vpravo v hlavičce Seznamu jízd. */
.drive-list-card > h2 { flex-wrap: wrap; row-gap: 8px; }
.bulk-bar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-count { margin-right: 4px; font-size: 13px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.bulk-bar b { margin-right: auto; }
.group-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; }
.toolbar input[type="search"] { min-width: 260px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); }
.seg button { border: 0; background: var(--surface); padding: 0 14px; height: 34px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button:hover { background: var(--hover); }
.seg button.on { background: var(--surface-2); color: var(--text); font-weight: 600; }

.kv { display: grid; grid-template-columns: auto 1fr; margin: 0; }
.kv dt, .kv dd { padding: 10px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.kv dt:first-of-type, .kv dd:first-of-type { border-top: 0; }
.kv dt { color: var(--text-2); padding-right: 16px; }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

.year-groups { display: grid; }

/* MARK: Mapy */

.map { position: relative; isolation: isolate; height: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.map.tall { height: calc(100vh - 300px); min-height: 440px; }
.map.small { height: 320px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* MARK: Auta */

.car-card { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
section.card:has(> .car-card) { border: 0; box-shadow: none; background: transparent; overflow: visible; }
section.card:has(> .car-card) > .car-card { margin: 0; }
.car-card h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 2px; }
.car-card h2 .right { margin-left: auto; }
.car-card p { margin-bottom: 14px; }
.car-card .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.car-photo { width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; object-fit: cover; background: var(--surface-2);
  border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); }
.car-photo svg { width: 52px; height: 52px; }

/* MARK: Grafy */

.bars { display: flex; align-items: flex-end; gap: 8px; height: 200px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.bar .fill { width: 100%; max-width: 36px; border-radius: 4px 4px 0 0; background: var(--primary); min-height: 2px; opacity: .9; }
.bar:hover .fill { opacity: 1; }
.bar .lbl { font-size: 11px; color: var(--text-2); white-space: nowrap; }
/* Sbalovací karta (Události v detailu jízdy): klepnutí na hlavičku, šipka vpravo. */
.card.collapsible > h2 { cursor: pointer; user-select: none; }
.card.collapsible.collapsed > h2 { border-bottom: 0; }
.card.collapsible.collapsed > :not(h2) { display: none; }
.collapse-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 4px; }
.collapse-btn .chev { display: inline-block; font-size: 14px; transition: transform .2s; }
.card.collapsible:not(.collapsed) .collapse-btn .chev { transform: rotate(180deg); }
/* Tlačítko „tečky událostí“ na mapě jízdy (zapnuto = barevné tečky, vypnuto = šedé obrysy). */
.maplibregl-ctrl-group .dots-toggle { width: 29px; height: 29px; display: grid; place-items: center; }
.dots-ico { display: grid; grid-template-columns: 6px 6px; gap: 3px; }
.dots-ico i { width: 6px; height: 6px; border-radius: 50%; background: #f79009; }
.dots-ico i:nth-child(2) { background: #f04438; }
.dots-ico i:nth-child(3) { background: #2563eb; }
.dots-ico i:nth-child(4) { background: #12b76a; }
.dots-toggle.off .dots-ico i { background: transparent; box-shadow: inset 0 0 0 1.5px #98a2b3; }
.km-legend { margin: 4px 0 8px; }
.km-car + .km-car { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
/* Čárový graf s popisky os jako text stránky (Kilometry aut celkem). */
.mchart { display: flex; gap: 8px; }
.mchart-ys { position: relative; flex: none; min-width: 44px; }
.mchart-y { position: absolute; right: 0; transform: translateY(-50%); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mchart-main { flex: 1; min-width: 0; }
.mchart-area { position: relative; touch-action: pan-y; }
.mchart-plot { display: block; width: 100%; overflow: visible; }
.mchart-plot .grid { stroke: var(--border); stroke-width: 1; }
.mchart-x { position: relative; height: 22px; }
.mchart-x span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; color: var(--text-2); white-space: nowrap; }
.mchart-x span.first { transform: none; }
.mchart-x span.last { transform: translateX(-100%); }
/* Tankování u auta: tabulka v rámečku s mezerou pod dlaždicemi, tlačítka pod ní. */
.fuel-section > .table-wrap { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; }
.fuel-section > .table-wrap th, .fuel-section > .table-wrap td { padding-left: 14px; padding-right: 14px; }
.fuel-section > .table-wrap tr:last-child td { border-bottom: 0; }
.fuel-section > p.muted { margin: 8px 0 0; }
.fuel-section > .toolbar { margin-top: 12px; }
.card > h2 select.right { width: auto; flex: none; min-width: 0; padding-top: 5px; padding-bottom: 5px; }
.card > h2:has(select.right) { white-space: nowrap; }
.bar .val { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* MARK: Okno */

.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px;
  background: rgba(16, 24, 40, 0.55); }
.modal-card { width: min(1100px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; flex: 1; }
.modal-head .icon-btn { width: 32px; height: 32px; }
.modal-body { padding: 20px; display: grid; gap: 18px; }
.receipt { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); display: block; }

/* MARK: Toast */

.toast { position: fixed; bottom: 24px; right: 24px; z-index: 50; padding: 12px 16px; border-radius: 10px; max-width: 420px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-weight: 500;
  border-left: 3px solid var(--green); animation: toast-in .2s ease-out; }
.toast.bad { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* MARK: Úzké obrazovky: vysouvací menu */

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: 272px; height: 100%;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(16, 24, 40, 0.5); }
  #menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .sync-note { display: none; }
  .content { padding: 20px 16px 48px; }
  .cols, .form-grid { grid-template-columns: 1fr; }
  .car-card { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .toolbar input, .toolbar select, .toolbar input[type="search"] { min-width: 0; width: 100%; }
  .modal { padding: 0; align-items: end; }
  .modal-card { max-height: 92vh; border-radius: 14px 14px 0 0; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  td.hide-sm, th.hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } .toast { animation: none; } }

/* MARK: Detail jízdy, grafy */

.drive-head { display: flex; align-items: center; gap: 16px; }
.drive-title { font-size: 18px; font-weight: 600; }
.score { --c: var(--green); width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-content: center; text-align: center;
  border: 4px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); }
.score b { font-size: 22px; line-height: 1; color: var(--c); }
.score span { font-size: 10px; color: var(--text-2); }
.drive-detail { display: grid; gap: 16px; }
.chart { display: block; width: calc(100% - 36px); height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.sub-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 18px 0 8px; }
.car-card > div > p.muted { margin-bottom: 0; }

/* Tisk / PDF (kniha jízd, servisní knížka): jen tisková část, černá na bílé */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  #print-area { display: block; font: 11pt/1.4 -apple-system, "Segoe UI", Roboto, sans-serif; color: #000; }
  #print-area h1 { font-size: 20pt; margin: 0 0 4pt; }
  #print-area .print-sub { color: #444; margin: 0 0 12pt; }
  #print-area .print-sum { display: grid; grid-template-columns: max-content auto; gap: 2pt 14pt; margin: 0 0 14pt; }
  #print-area .print-sum dt { color: #555; }
  #print-area .print-sum dd { margin: 0; font-weight: 600; }
  #print-area table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  #print-area th { text-align: left; border-bottom: 1.5pt solid #000; padding: 4pt 6pt; }
  #print-area td { border-bottom: 0.5pt solid #bbb; padding: 3pt 6pt; vertical-align: top; }
  #print-area tr { break-inside: avoid; }
  #print-area .print-foot { color: #666; font-size: 8.5pt; margin-top: 14pt; }
  @page { margin: 14mm; }
}

/* Žebříček km mezi přáteli */
.row .rank { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--hover, rgba(255,255,255,.06)); font-weight: 700; font-variant-numeric: tabular-nums; }
.row.me .rank { background: var(--primary); color: #fff; }
.row.me .title { font-weight: 700; }

/* Ukázka (/app?demo) */
body.demo { padding-bottom: 64px; }
.demo-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 14px;
  max-width: calc(100% - 32px); padding: 10px 12px 10px 18px; border-radius: 999px; background: #101828; color: #fff; font-size: 14px;
  box-shadow: 0 12px 32px -8px rgba(16, 24, 40, .45); }
.demo-bar a { flex: none; padding: 6px 12px; border-radius: 999px; background: #2563eb; color: #fff; font-weight: 600; text-decoration: none; }
.demo-bar a:hover { background: #1d4ed8; }
@media (max-width: 560px) { .demo-bar { font-size: 13px; gap: 10px; bottom: 10px; } }

/* Jízda, kterou uživatel neřídil (spolujezdec) */
.row.passenger, tr.passenger { opacity: .65; }
.tag-passenger { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); vertical-align: 1px; }
/* Skupiny jízd */
.tag-group { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); vertical-align: 1px; }
.tag-group.business { color: #f79009; background: color-mix(in srgb, #f79009 14%, transparent); }
.tag-group.personal { color: #14b8a6; background: color-mix(in srgb, #14b8a6 14%, transparent); }
div.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.group-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.group-checks:empty { display: none; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.toolbar .inline-field select { min-width: 140px; }

/* Prozkoumáno po zemích */
.explored-list { display: grid; gap: 10px; }
.explored-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 12px; align-items: center; }
.explored-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explored-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.explored-bar > span { display: block; height: 100%; background: #ef3333; border-radius: 4px; }
.explored-val { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; white-space: nowrap; }
@media (max-width: 520px) { .explored-row { grid-template-columns: 1fr auto; } .explored-bar { grid-column: 1 / -1; order: 3; } }
.badge.meetup-date { flex-direction: column; width: 40px; height: 40px; line-height: 1; gap: 1px; }
.badge.meetup-date b { font-size: 15px; }
.badge.meetup-date small { font-size: 10px; font-weight: 600; text-transform: uppercase; }

/* Servis: další připomenutí k přidání */
.more-reminders { margin-top: 12px; }
.more-reminders summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.chip-group .sub-head { margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: inherit; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--primary); }

/* Víc údajů stejného druhu v jednom řádku (zrychlení, přetížení…) */
.tile.wide { grid-column: 1 / -1; }
.tile.wide .multi { order: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.tile.wide .multi .value { font-size: 22px; }

/* Upravit jízdu */
.edit-drive { display: grid; gap: 18px; }
.set-row { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.set-row .main-col { flex: 1; min-width: 0; }
.set-row .title { font-weight: 500; color: var(--text); }
.set-row .sub { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.set-row.boxed { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; }
.add-row .btn { flex: none; }
.edit-actions { border-top: 1px solid var(--border); padding-top: 16px; }
.chip.toggle { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.chip.toggle svg { width: 13px; height: 13px; }
.chip.toggle.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Přepínač (jako iOS) */
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 42px; height: 25px; padding: 0; margin: 0; border: 0;
  border-radius: 999px; background: var(--border-strong); box-shadow: none; position: relative; cursor: pointer; transition: background-color .18s; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .18s; }
input.switch:checked { background: var(--green); }
input.switch:checked::after { transform: translateX(17px); }
input.switch:focus { box-shadow: none; }

/* Události jízdy: popis po klepnutí */
.event-desc { display: none; color: var(--text-2); font-size: 12.5px; margin-top: 4px; white-space: normal; }
.event-row.active { background: var(--primary-soft); }
.event-row.active .event-desc { display: block; }
.maplibregl-popup.event-popup .maplibregl-popup-content { border-radius: 12px; padding: 12px 14px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); font: inherit; font-size: 13px; }
.event-popup .maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.event-popup .maplibregl-popup-close-button { color: var(--text-3); font-size: 18px; padding: 2px 8px; }
.event-popup .ep-head { display: flex; align-items: center; gap: 10px; padding-right: 14px; }
.event-popup .ep-head .badge { width: 30px; height: 30px; }
.event-popup .ep-value { font-size: 18px; font-weight: 600; margin: 8px 0 2px; }
.event-popup p { margin: 0; color: var(--text-2); }

/* Nastavení aplikace: sekce s řádky (název vlevo, přepínač / číslo / výběr vpravo) jako v aplikaci */
.app-settings { display: grid; gap: 16px; }
.set-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.set-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.set-chip svg { width: 15px; height: 15px; color: var(--text-3); }
.set-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.set-group { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.set-group-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; font-weight: 600; font-size: 14px; }
.set-group-head .ti { width: 26px; height: 26px; border-radius: 7px; }
.set-group-head .ti svg { width: 14px; height: 14px; }
.set-group .set-row { padding: 10px 14px; border-top: 1px solid var(--border); min-height: 50px; background: var(--surface); }
.set-group .set-row .title { font-size: 14px; }
.set-row select { width: auto; min-width: 150px; flex: none; }
.num-unit { display: flex; align-items: center; gap: 6px; flex: none; }
.num-unit input { width: 92px; text-align: right; }
.num-unit span { color: var(--text-3); font-size: 12.5px; min-width: 56px; }
.set-save { display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.set-save .spacer { flex: 1; }
@media (max-width: 900px) { .set-groups { grid-template-columns: 1fr; } }

/* Oblíbená místa */
.card > .places-box { margin: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.places-box .places-map { height: 100%; min-height: 280px; border: 0; border-radius: 0; border-right: 1px solid var(--border); }
.places-box .list { align-self: start; }
@media (max-width: 760px) {
  .card > .places-box { grid-template-columns: 1fr; }
  .places-box .places-map { height: 240px; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
}
.search-results:not(:empty) { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.search-results .row { padding: 9px 12px; min-height: 0; }
.search-results .badge { width: 26px; height: 26px; border-radius: 7px; }
.modal .map.small { margin-top: 12px; height: clamp(320px, 55vh, 520px); }
.place-where { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 13px; color: var(--text-2); }
.place-where svg { width: 16px; height: 16px; color: var(--red); flex: none; }

/* Segmentový přepínač (jako v aplikaci) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); flex: none; max-width: 100%; overflow-x: auto; }
.seg[hidden] { display: none; }
.seg-btn { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px;
  border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); font-weight: 600; }

/* Žebříček */
.lb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lb-head .spacer { flex: 1; }
.lb-head select { width: auto; min-width: 150px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; max-width: 620px; margin-left: auto !important; margin-right: auto !important; }
.podium[hidden] { display: none; }
.podium-item { display: grid; justify-items: center; gap: 2px; text-align: center; min-width: 0; }
.podium-avatar { position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700;
  color: var(--text); background: color-mix(in srgb, var(--m) 18%, var(--surface)); border: 3px solid var(--m); margin-bottom: 6px; }
.podium-avatar b { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%;
  background: var(--m); color: #fff; font-size: 12px; display: grid; place-items: center; border: 2px solid var(--surface); }
.p1 .podium-avatar { width: 70px; height: 70px; font-size: 26px; }
.podium-name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.podium-item.me .podium-name { color: var(--primary); }
.podium-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.podium-sub { color: var(--text-3); font-size: 12px; }
.podium-step { width: 100%; margin-top: 8px; border-radius: 10px 10px 0 0; background: linear-gradient(var(--surface-2), transparent);
  border: 1px solid var(--border); border-bottom: 0; height: 34px; }
.p1 .podium-step { height: 58px; }
.p2 .podium-step { height: 42px; }
.card > .lb-list { border-top: 1px solid var(--border); }
.lb-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.row.me .lb-avatar { background: var(--primary); border-color: var(--primary); color: #fff; }
.row.me { background: var(--primary-soft); }
.lb-bar { height: 5px; border-radius: 3px; background: var(--border); margin-top: 6px; max-width: 320px; overflow: hidden; }
.lb-bar span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.lb-row .meta .sub { color: var(--text-3); font-weight: 400; font-size: 12px; }
.lb-note { margin-top: 12px !important; }
.lb-opts { display: grid; gap: 4px; }
.lb-opts .set-row { padding: 6px 0; flex-wrap: wrap; }
.lb-opts .set-row[hidden] { display: none; }
@media (max-width: 560px) { .podium { gap: 6px; } .podium-avatar { width: 46px; height: 46px; font-size: 18px; } .p1 .podium-avatar { width: 56px; height: 56px; } }
.event-popup .maplibregl-popup-close-button:focus, .event-popup .maplibregl-popup-close-button:focus-visible { outline: none; }

/* Ovládání mapy tmavě (+/−, celá obrazovka, licence): pod tmavou mapu i do tmavého webu. */
.maplibregl-ctrl-group { background: #161a22 !important; border: 1px solid #343b49; box-shadow: 0 2px 8px rgba(0, 0, 0, .35) !important; border-radius: 10px !important; overflow: hidden; }
.maplibregl-ctrl-group button + button { border-top: 1px solid #343b49 !important; }
.maplibregl-ctrl-group button:not(:disabled):hover { background-color: #1f2530 !important; }
.maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1) brightness(.9); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: #161a22 !important; color: #a4adbd; border: 1px solid #343b49; }
.maplibregl-ctrl-attrib.maplibregl-compact a { color: #a4adbd; }
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button { filter: invert(1) brightness(.9); background-color: transparent !important; }
.maplibregl-ctrl-attrib.maplibregl-compact-show { padding-right: 26px; }

/* Srazy na mapě: štítek s datem a názvem místo tečky (jako v seznamu). */
/* společná jízda na živé mapě: cíl a příjezd členů */
.live-session { padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--bg-soft, rgba(22,163,74,.08)); }
.live-session .sub { margin-top: 3px; }
.live-goal { width: 42px; height: 42px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
/* fotka srazu v detailu */
.meetup-photo img { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.meetup-pin { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer;
  background: #161a22; color: #e7eaf0; border: 1px solid #343b49; box-shadow: 0 3px 10px rgba(0, 0, 0, .35); font-size: 12px;
  max-width: 220px; }   /* poloha: maplibregl-marker (absolute) */
.meetup-pin:hover { border-color: var(--c); z-index: 2; }
.meetup-pin .mp-date { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c);
  color: #fff; line-height: 1; text-align: center; }
.meetup-pin .mp-date b { font-size: 12.5px; }
.meetup-pin .mp-date small { display: block; font-size: 8.5px; text-transform: uppercase; opacity: .9; }
.meetup-pin .mp-text { min-width: 0; }
.meetup-pin .mp-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meetup-pin .mp-sub { color: #a4adbd; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meetup-pin::after { content: ""; position: absolute; left: 17px; bottom: -6px; width: 10px; height: 10px; background: #161a22;
  border-right: 1px solid #343b49; border-bottom: 1px solid #343b49; transform: rotate(45deg); }

/* Nastavení: čísla jako zakulacený štítek (hodnota + jednotka uvnitř), sedí k přepínačům. Výběr stejně. */
.set-row .num-unit { gap: 4px; height: 30px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--hover);
  border: 1px solid transparent; cursor: text; transition: border-color .12s; }
.set-row .num-unit:focus-within { border-color: var(--border-strong); }
.set-row .num-unit input { width: 64px; height: 28px; padding: 0 2px; border: 0; background: transparent; box-shadow: none;
  font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.set-row .num-unit input:focus { border: 0; box-shadow: none; }
.set-row .num-unit input::-webkit-inner-spin-button, .set-row .num-unit input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.set-row .num-unit span { min-width: 0; font-size: 12px; white-space: nowrap; }
.set-group .set-row select { height: 30px; min-width: 0; border-radius: 999px; background-color: var(--hover); border-color: transparent;
  box-shadow: none; font-weight: 600; padding-left: 14px; }
.set-group .set-row select:hover, .set-group .set-row select:focus { border-color: var(--border-strong); }

/* Segmentový přepínač: vybraná volba výrazně (modře), ostatní tlumeně. */
.seg-btn.on, .seg button.on { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); }
.seg-btn.on:hover, .seg button.on:hover { background: var(--primary-hover); color: #fff; }

/* Žebříček: fotka uživatele místo písmene */
.lb-avatar, .podium-avatar { overflow: visible; }
.lb-avatar img, .podium-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.podium-avatar img { position: absolute; inset: 0; }

/* Řazení tabulky klepnutím na záhlaví */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sortable .sort-mark { display: inline-block; width: 1em; margin-left: 3px; color: var(--text-3); font-size: 11px; }
th.sortable.sorted { color: var(--text); }
th.sortable.sorted .sort-mark { color: var(--primary); }

/* Zvětšená mapa (detail jízdy): přes celé okno, nad oknem detailu. */
.map.map-expanded { position: fixed; inset: 0; z-index: 1000; height: auto !important; border-radius: 0; border: 0; }
.maplibregl-ctrl-expand .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 8h4v4M12 21H8v-4M21 8l-5 5M8 21l5-5'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-expand.on .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 9v4h4M13 20v-4H9M21 8l-5 5M8 21l5-5'/%3E%3C/svg%3E"); }

/* Skupiny jízdy: čip „+ Nová skupina“ se změní v pole pro název (bez zvláštního pole a tlačítka Přidat) */
.chip.add { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--primary); border-style: dashed; background: transparent; }
.chip.add svg { width: 13px; height: 13px; }
.chip.chip-input { cursor: text; width: 170px; min-width: 0; outline: none; border-color: var(--primary); background: var(--surface); }
.fuel-note { margin: -4px 0 4px; }

/* Lidé na živé mapě: profilová fotka (nebo písmeno) v kroužku barvy role, jako v aplikaci. */
/* Člověk na mapě jako v aplikaci: tenký rámeček barvy role s tmavým obrysem, bez fotky písmeno na šedém. */
.live-pin { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--c, #2563eb); background: #5b6270;
  color: #fff; font-weight: 800; display: grid; place-items: center; overflow: hidden; cursor: pointer;
  box-shadow: 0 0 0 1.5px #23262d, inset 0 0 0 1px #23262d, 0 2px 6px rgba(0, 0, 0, 0.45); }
.live-pin img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Přehrání jízdy */
.replay { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3; pointer-events: none; }
.replay > * { pointer-events: auto; }
.replay-start { box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.replay-bar { background: rgba(22, 26, 34, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid #343b49; border-radius: 14px; padding: 10px 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); }
.map-expanded .replay { left: 50%; right: auto; bottom: 24px; width: min(640px, calc(100% - 32px)); transform: translateX(-50%); }
.replay-row { display: flex; align-items: center; gap: 10px; }
.replay-row.small { font-size: 13px; color: #a4adbd; margin-top: 6px; }
.replay-row .spacer { flex: 1; }
.replay-row input[type=range] { flex: 1; min-width: 0; }
.replay-play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #2563eb; color: #fff; font-size: 14px; cursor: pointer; flex: none; }
.replay-close { border: 0; background: none; color: #a4adbd; font-size: 18px; cursor: pointer; }
.replay-event { font-weight: 600; white-space: nowrap; }
.replay-time { font-variant-numeric: tabular-nums; }
.replay-car { position: relative; width: 46px; height: 46px; }
.replay-car svg { position: absolute; inset: 0; width: 46px; height: 46px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); }
.replay-car .pulse { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: rgba(51, 184, 255, .35); animation: replay-pulse 1.8s ease-out infinite; }
@keyframes replay-pulse { from { transform: scale(.5); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .replay-car .pulse { animation: none; opacity: 0; } }
.replay-row select { width: auto; flex: none; padding: 6px 8px; }

/* Graf: hodnota při najetí myší / prstem */
.chart-wrap { position: relative; touch-action: pan-y; width: calc(100% - 36px); }
.chart-wrap .chart { width: 100%; }
.chart-guide { position: absolute; width: 1px; background: var(--text-3); opacity: .5; pointer-events: none; }
.chart-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); pointer-events: none; }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.12); display: flex; flex-direction: column; align-items: center; }
.chart-tip[hidden], .chart-guide[hidden], .chart-dot[hidden] { display: none; }
.chart-tip span { color: var(--text-3); font-size: 11px; }
/* Přehrání jízdy: Sledovat řidiče */
.replay-follow { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); cursor: pointer; flex: none; display: grid; place-items: center; padding: 0; }
.replay-follow svg { width: 16px; height: 16px; fill: #2563eb; }
.replay-follow.on { background: #2563eb; }
.replay-follow.on svg { fill: #fff; }

/* Odhad opotřebení brzd a pneumatik (Servis) */
.wear-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin: 6px 0 4px; }
.wear-bar span { display: block; height: 100%; border-radius: 3px; }

/* Diagnostika */
.diag-series { margin: 14px 0 6px; }
.diag-series .toolbar { margin-bottom: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
