/* CRM — vzhled podle administrace ELEKTO (písma Barlow, Barlow Semi Condensed, IBM Plex Mono — licence OFL) */
@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/barlow-regular.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/barlow-medium.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/barlow-semi-bold.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/barlow-bold.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/barlow-semi-condensed-semi-bold.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/barlow-semi-condensed-bold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/ibm-plex-mono-regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/ibm-plex-mono-medium.woff2") format("woff2"); }

/* ---------- barvy a rozměry (podle administrace ELEKTO) ---------- */
:root {
  --grafit: #1A1C20;
  --grafit-2: #3B3E45;
  --grafit-3: #26282D;
  --tlum: #71747C;
  --papir: #F3F3EF;
  --karta: #FFFFFF;
  --hlava: #FAFAF7;
  --linka: #E3E2DB;
  --linka-2: #D2D1C9;
  --zluta: #FFCE00;
  --zluta-tm: #E8BB00;
  --zluta-text: #8A6D00;
  --med: #A9562B;
  --ok: #14804A;
  --ok-bg: #E7F3EC;
  --pozor: #C6402C;
  --pozor-bg: #FBEAE6;
  --varovani: #8A5A00;
  --varovani-bg: #FDF3DC;
  --stin: 0 1px 2px rgba(26, 28, 32, .06);
  --r-karta: 12px;
  --r-pole: 8px;
  --pismo: "Barlow", system-ui, sans-serif;
  --pismo-kond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --pismo-mono: "IBM Plex Mono", ui-monospace, monospace;
  --sidebar: 207px;
  --bottomnav: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--pismo);
  font-size: 15px;
  line-height: 1.45;
  background: var(--papir);
  color: var(--grafit);
}
a { color: var(--med); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--med); outline-offset: 2px; border-radius: 4px; }
h1 { font-family: var(--pismo-kond); font-weight: 700; font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.005em; }
h2 {
  font-family: var(--pismo-kond); font-weight: 700; font-size: 16px; text-transform: uppercase;
  letter-spacing: .04em; margin: 28px 0 10px;
}
p { margin: 0 0 .75em; }
.muted { color: var(--tlum); }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.ico { width: 20px; height: 20px; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- postranní panel (PC) ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  background: var(--grafit); color: #fff;
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px; color: #fff;
  font-family: var(--pismo-kond); font-weight: 700; font-size: 17px; letter-spacing: .02em;
  padding: 2px 6px 18px;
}
.brand:hover { text-decoration: none; }
.brand b { color: var(--zluta); font-weight: 700; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--zluta); color: var(--grafit);
  display: inline-grid; place-items: center;
}
.brand-mark .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-section {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: #8B8E95; padding: 16px 12px 6px;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-pole);
  color: #E4E4E0; font-weight: 600; font-size: 15px;
  border-left: 3px solid transparent;
}
.sidebar nav a .ico { width: 18px; height: 18px; color: #B9BBC0; }
.sidebar nav a:hover { background: var(--grafit-3); text-decoration: none; }
.sidebar nav a[aria-current] { background: var(--grafit-3); border-left-color: var(--zluta); color: #fff; }
.sidebar nav a[aria-current] .ico { color: #fff; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--zluta); color: var(--grafit);
  display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.who { display: flex; flex-direction: column; font-size: 14px; font-weight: 500; line-height: 1.25; min-width: 0; }
.who small { color: #8B8E95; font-size: 12px; }
.sidebar-user form { margin-left: auto; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-pole);
  background: none; border: 0; color: #9A9DA3; cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--grafit-3); color: #fff; }

/* ---------- instalace aplikace (PWA) ---------- */
.sidebar-install {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 12px 0 0; padding: 9px 12px;
  background: none; border: 1px dashed var(--grafit-2); border-radius: var(--r-pole); color: #C9CBCF; font-size: 14px; justify-content: flex-start;
}
.sidebar-install:hover { background: var(--grafit-3); color: #fff; border-color: var(--tlum); }
.sidebar-install .ico { width: 18px; height: 18px; }
.install-banner { display: none; }
.install-help { font-size: 14px; line-height: 1.4; max-width: 280px; }
.install-help p { margin: 6px 0 0; }
.install-help strong { display: block; }

/* ---------- mobil: horní lišta a spodní navigace ---------- */
.topbar, .bottomnav { display: none; }

main { padding: 34px 28px 48px; max-width: 2200px; }   /* PC: celá šířka monitoru (strop jen pro ultraširoké) */
.app main { margin-left: var(--sidebar); }

/* ---------- záhlaví stránky ---------- */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.title-row h2 { margin: 0; }
h2 + .title-row, .title-row + .title-row { margin-top: 0; }
* + .title-row:has(h2) { margin-top: 28px; margin-bottom: 10px; }
.eyebrow, .crumbs { font-size: 13px; color: var(--tlum); margin: 0 0 2px; }
.crumbs a { color: var(--tlum); }
h1 .h1-meta { font-family: var(--pismo); font-size: 14px; font-weight: 500; color: var(--tlum); margin-left: 6px; position: relative; top: -3px; white-space: nowrap; }
.crumbs + .title-row { margin-top: 0; }
.more { font-weight: 600; font-size: 14px; color: var(--med); }

/* ---------- karty ---------- */
.card {
  background: var(--karta); border: 1px solid var(--linka); border-radius: var(--r-karta);
  box-shadow: var(--stin); padding: 18px 20px; margin-bottom: 16px;
}
.card h2:first-child { margin-top: 0; }
.card ol { margin: 0; padding-left: 1.2em; line-height: 1.9; }

/* ---------- tlačítka ---------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; line-height: 1.2;
  min-height: 38px; padding: 8px 15px; border-radius: var(--r-pole);
  border: 1px solid var(--linka-2); background: var(--karta); color: var(--grafit);
  white-space: nowrap; transition: background .12s, border-color .12s;
}
button:hover, .button:hover { border-color: var(--grafit-2); text-decoration: none; }
.button .ico, button .ico { width: 17px; height: 17px; }
.primary { background: var(--zluta); border-color: var(--zluta); color: var(--grafit); }
.primary:hover { background: var(--zluta-tm); border-color: var(--zluta-tm); }
.danger { color: var(--pozor); }
.danger:hover { background: var(--pozor-bg); border-color: var(--pozor); }
button.small, .button.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
td.row-action { text-align: right; width: 1%; white-space: nowrap; }
th.sr-label { font-size: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; }

/* ---------- formuláře ---------- */
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--grafit); background: var(--karta);
  border: 1px solid var(--linka-2); border-radius: var(--r-pole);
  min-height: 38px; padding: 7px 10px; min-width: 0;
}
input:hover, select:hover, textarea:hover { border-color: var(--tlum); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--zluta); outline-offset: -1px; border-color: var(--zluta-tm); }
input[type="checkbox"] { min-height: 0; width: 18px; height: 18px; accent-color: var(--grafit); margin: 0; }
textarea { min-height: 90px; resize: vertical; width: 100%; }
.form { max-width: 1040px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field > span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tlum); }
.field input, .field select { width: 100%; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { min-width: 170px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--pozor); }
.error { color: var(--pozor); font-size: 13px; }
.check:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; font-weight: 500; min-height: 38px; }
.form .actions { padding-top: 4px; }

/* Přihlášení */
.public main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.login .brand { color: var(--grafit); padding: 0 0 6px; font-size: 22px; }
.login .brand b { color: var(--zluta-text); }
.login .brand-mark { width: 36px; height: 36px; }
.login button { min-height: 44px; }

/* Pole hodin: [−][ číslo ][hod|min][+] */
.hours-input { display: flex; align-items: stretch; border: 1px solid var(--linka-2); border-radius: var(--r-pole); background: var(--karta); }
.hours-input:focus-within { outline: 2px solid var(--zluta); outline-offset: -1px; border-color: var(--zluta-tm); }
.has-error .hours-input { border-color: var(--pozor); }
.hours-input input[name="hours"] { border: 0; outline: 0; flex: 1; min-width: 3.5em; width: 100%; text-align: center; font-family: var(--pismo-mono); background: none; }
.hours-input .step { border: 0; border-radius: 0; min-width: 38px; padding: 0 10px; font-size: 20px; font-weight: 500; color: var(--grafit-2); background: none; }
.hours-input .step:first-child { border-right: 1px solid var(--linka); border-radius: var(--r-pole) 0 0 var(--r-pole); }
.hours-input .step:last-child { border-left: 1px solid var(--linka); border-radius: 0 var(--r-pole) var(--r-pole) 0; }
.hours-input .step:hover, .hours-input .step:active { background: var(--papir); }
.unit { display: flex; align-items: center; padding: 3px; gap: 2px; }
.unit label { position: relative; cursor: pointer; }
.unit input { position: absolute; opacity: 0; pointer-events: none; }
.unit span { display: block; padding: 5px 9px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--tlum); }
.unit input:checked + span { background: var(--grafit); color: #fff; }
.unit input:focus-visible + span { outline: 2px solid var(--med); outline-offset: 1px; }

/* Rychlé zadání hodin */
.quick { display: grid; grid-template-columns: minmax(200px, 1.3fr) 150px 250px minmax(180px, 2fr) auto auto; gap: 10px; align-items: end; }
.quick .check { padding-bottom: 0; }

/* Filtry */
.filters-box > summary { display: none; }
.jen-mobil { display: none !important; }
[hidden] { display: none !important; }
.quicklinks { margin: 0 0 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.filters label:not(.check) { display: inline-flex; align-items: center; gap: 6px; color: var(--tlum); font-size: 13px; font-weight: 500; }
.filters select { max-width: 230px; }
.quicklinks { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.quicklinks a, .tabs a {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linka-2); background: var(--karta);
  color: var(--grafit-2); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.quicklinks a:hover, .tabs a:hover { border-color: var(--grafit-2); text-decoration: none; }
.quicklinks a[aria-current], .tabs a[aria-current] { background: var(--grafit); border-color: var(--grafit); color: #fff; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }

/* ---------- souhrnné dlaždice ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat {
  background: var(--karta); border: 1px solid var(--linka); border-radius: var(--r-karta); box-shadow: var(--stin);
  padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat > span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--tlum); }
.stat strong { font-family: var(--pismo-mono); font-weight: 500; font-size: 23px; letter-spacing: -.01em; line-height: 1.25; margin-top: 6px; white-space: nowrap; }
.stat small { color: var(--tlum); font-size: 13px; }
.stat small.over { color: var(--pozor); }
.stat.highlight { border-color: var(--zluta); box-shadow: inset 0 0 0 1px var(--zluta), var(--stin); }
.stat a { font-weight: 600; }
.stats.compact strong { font-size: 20px; }
.bar { height: 6px; background: var(--papir); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--zluta); }
.bar i.over { background: var(--pozor); }

/* ---------- tabulky ---------- */
.table-wrap { background: var(--karta); border: 1px solid var(--linka); border-radius: var(--r-karta); box-shadow: var(--stin); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--linka); vertical-align: middle; }
th {
  background: var(--hlava); font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--tlum); white-space: nowrap; padding-top: 13px; padding-bottom: 13px;
}
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.num { font-family: var(--pismo-mono); font-size: 14px; font-weight: 500; }   /* 500: tenké číslice (1) na Windows ClearType barevně lemuje */
td.num .muted, td.num span { font-family: var(--pismo-mono); }
tr.clickable { cursor: pointer; }
tbody tr:hover { background: #FBFBF8; }
tr.archived, tr.muted-row { color: var(--tlum); }
th.sel, td.sel { width: 40px; padding-right: 0; }
td a { font-weight: 600; }
td small, td .muted { font-size: 13px; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 16px; }
.details dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tlum); padding-top: 2px; }
.details dd { margin: 0; }
.details-text p { margin: 4px 0; }

/* ---------- výkaz po měsících ---------- */
.report-filters { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.report-filters .quicklinks { margin: 0; }
.report-filters select { min-width: 200px; }
table.months td:first-child { min-width: 180px; }
.month-name { font-weight: 600; text-transform: capitalize; }
.rate-from { font-weight: 600; }
td.strong { font-weight: 600; }
.plus { color: var(--ok); }
.minus { color: var(--pozor); }
.hint { font-size: 13px; color: var(--tlum); margin: 8px 2px 18px; }
tr.selected { background: #FFF8D6; }
tr.selected:hover { background: #FFF3C2; }
tfoot td { background: var(--hlava); font-weight: 600; border-top: 1px solid var(--linka-2); border-bottom: 0; }
tfoot td.num { font-weight: 600; }
.subhead { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tlum); margin: 18px 0 8px; }

.rate-form { display: grid; grid-template-columns: 170px 190px 150px auto; gap: 10px 12px; align-items: end; margin-top: 12px; max-width: 820px; }
.rate-form .rate-title { grid-column: 1 / -1; font-family: var(--pismo-kond); font-size: 16px; }
.rate-form .hint { grid-column: 1 / -1; margin: 0; }

/* IČO + tlačítko ARES */
.ico-field { min-width: 240px; }
.input-with-button { display: flex; gap: 6px; }
.input-with-button input { flex: 1; min-width: 0; }
.input-with-button button { flex-shrink: 0; padding: 7px 11px; font-size: 13px; }
.ares-msg { font-size: 13px; color: var(--tlum); }
.ares-msg:empty { display: none; }
.ares-msg.ok { color: var(--ok); }
.ares-msg.error { color: var(--pozor); }

/* ---------- výkaz pro klienta ---------- */
.export-form { max-width: 900px; display: flex; flex-direction: column; gap: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--linka-2); background: var(--karta); font-weight: 600; font-size: 13px; color: var(--grafit-2); }
.chip:hover span { border-color: var(--grafit-2); }
.chip input:checked + span { background: var(--grafit); border-color: var(--grafit); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--med); outline-offset: 2px; }
.export-checks { display: flex; gap: 6px 24px; flex-wrap: wrap; }
.doc { max-width: 900px; background: var(--karta); border: 1px solid var(--linka); border-top: 4px solid var(--zluta); border-radius: var(--r-karta); box-shadow: var(--stin); padding: 28px 32px; margin-bottom: 16px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.doc-title { font-family: var(--pismo-kond); font-weight: 700; font-size: 30px; line-height: 1.1; }
.doc-supplier { text-align: right; font-size: 14px; color: var(--tlum); }
.doc-supplier strong { color: var(--grafit); }
.doc-info { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px 32px; margin-bottom: 20px; }
.doc-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tlum); margin-top: 6px; }
.doc-label:first-child { margin-top: 0; }
.doc .table-wrap { box-shadow: none; }
.doc-table td { vertical-align: top; }
.doc-table tbody tr[data-id] { cursor: pointer; }
.doc-table tr.excluded td:not(.sel) { opacity: .38; }
.pick-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pick-bar [data-pick-count] { font-weight: 600; margin-right: auto; }
.doc-total { display: flex; gap: 24px; justify-content: flex-end; align-items: baseline; background: var(--grafit); color: #fff; border-radius: var(--r-pole); padding: 12px 16px; margin-top: 10px; }
.doc-total span { margin-right: auto; font-weight: 600; }
.doc-total strong { font-family: var(--pismo-mono); font-weight: 500; font-size: 17px; }
.fakturoid-form { max-width: 900px; display: grid; grid-template-columns: 200px 200px 1fr; gap: 12px; align-items: end; border-color: var(--zluta); box-shadow: inset 0 0 0 1px var(--zluta), var(--stin); }
.fakturoid-form .rate-title, .fakturoid-form .fa-intro, .fakturoid-form .fa-wide { grid-column: 1 / -1; }
.fakturoid-form .fa-intro { margin: 0; font-size: 14px; }
.fakturoid-form button.fa-wide { justify-self: start; }
.invoice-mark { max-width: 900px; display: grid; grid-template-columns: 170px 220px auto; gap: 10px 12px; align-items: end; }
.invoice-mark .rate-title { grid-column: 1 / -1; font-family: var(--pismo-kond); font-size: 16px; }

/* ---------- štítky ---------- */
.badge, .status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap; vertical-align: middle;
  background: var(--papir); color: var(--grafit-2); border: 1px solid var(--linka); font-family: var(--pismo);
}
.badge.ok, .status-aktivni { background: var(--ok-bg); color: var(--ok); border-color: #CFE6D8; }
.badge.ok::before, .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pozastaveny { background: var(--varovani-bg); color: var(--varovani); border-color: #F1E0B5; }
.status-dokonceny { color: var(--tlum); }
h1 .status, h1 .badge { font-size: 13px; position: relative; top: -3px; margin-left: 6px; }

/* ---------- hlášky ---------- */
.flash { padding: 12px 16px; border-radius: var(--r-karta); margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: #CFE6D8; }
.flash-error { background: var(--pozor-bg); color: var(--pozor); border-color: #F2CFC7; }
.flash-warn { background: var(--varovani-bg); color: var(--varovani); border-color: #F1E0B5; }
.flash a { color: inherit; text-decoration: underline; }

/* ---------- hromadné akce ---------- */
.bulk-bar {
  position: sticky; bottom: 16px; margin-top: 12px; z-index: 5;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--grafit); color: #fff; border-radius: var(--r-karta);
  padding: 10px 12px 10px 16px; box-shadow: 0 8px 24px rgba(26, 28, 32, .25);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar [data-selection] { font-weight: 600; margin-right: auto; font-family: var(--pismo-mono); font-size: 14px; }
.bulk-bar select, .bulk-bar input { background: var(--grafit-3); color: #fff; border-color: var(--grafit-2); }
.bulk-bar input[type="date"] { color-scheme: dark; }
.invoice-fields { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.invoice-fields[hidden] { display: none; }
.invoice-fields label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #B9BBC0; }

/* ---------- široký monitor: sekce vedle sebe ---------- */
.wide-split > section > .title-row:first-child { margin-top: 28px; }
@media (min-width: 1500px) {
  main { padding: 34px 36px 48px; }
  .export-layout { display: grid; grid-template-columns: minmax(0, 1fr) 460px; grid-template-areas: "doc settings" "doc fa" "doc mark" "doc ."; grid-template-rows: auto auto auto 1fr; gap: 0 24px; align-items: start; }
  .export-layout .export-form { grid-area: settings; }
  .export-layout .doc { grid-area: doc; max-width: none; }
  .export-layout .fakturoid-form { grid-area: fa; grid-template-columns: 1fr 1fr; }
  .export-layout .invoice-mark { grid-area: mark; grid-template-columns: 1fr 1fr; }
  .export-layout .invoice-mark button { grid-column: 1 / -1; }
  .export-layout .export-form .row { flex-wrap: wrap; }
  .pausal-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(380px, 1fr); gap: 0 28px; align-items: start; }
  .pausal-split .rate-form { grid-template-columns: 1fr 1fr; max-width: none; }
  .pausal-split .rate-form .field:first-of-type, .pausal-split .rate-form button { grid-column: 1 / -1; }
}
@media (min-width: 1700px) {
  .dash-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 0 28px; align-items: start; }
  .detail-split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
}

/* ---------- střední šířka ---------- */
@media (max-width: 1199px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick { grid-template-columns: 1fr 150px 250px; }
  .quick .field:has([name="description"]) { grid-column: 1 / 3; }
  .quick .check { grid-column: auto; }
  .quick button { grid-column: 3; }
}

/* ---------- mobil (do 899 px) ---------- */
@media (max-width: 899px) {
  body { font-size: 16px; }
  .sidebar { display: none; }
  .app main { margin-left: 0; padding: 18px 16px calc(var(--bottomnav) + 28px + env(safe-area-inset-bottom)); }

  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 20; background: var(--grafit); color: #fff;
    padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  }
  .topbar .brand { padding: 0; font-size: 21px; }
  .topbar .brand-mark { width: 36px; height: 36px; border-radius: 9px; }
  .topbar .brand-mark .ico { width: 21px; height: 21px; }
  .topbar .avatar { width: 38px; height: 38px; background: var(--grafit-2); color: #fff; cursor: pointer; list-style: none; font-size: 15px; }
  .topbar .avatar::-webkit-details-marker { display: none; }
  .user-menu { position: relative; }
  .menu-pop {
    position: absolute; right: 0; top: calc(100% + 8px); background: var(--karta); color: var(--grafit);
    border: 1px solid var(--linka); border-radius: var(--r-karta); padding: 12px; min-width: 180px;
    box-shadow: 0 8px 24px rgba(26, 28, 32, .18); display: flex; flex-direction: column; gap: 10px;
  }
  .menu-pop .button { width: 100%; }
  .install-banner:not([hidden]) {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 12px; right: 12px; z-index: 25;
    bottom: calc(var(--bottomnav) + 12px + env(safe-area-inset-bottom));
    background: var(--grafit); color: #fff; border-radius: 16px; padding: 12px 10px 12px 14px;
    box-shadow: 0 10px 30px rgba(26, 28, 32, .35);
  }
  .install-banner .brand-mark { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
  .install-banner .brand-mark .ico { width: 24px; height: 24px; }
  .ib-text { display: flex; flex-direction: column; line-height: 1.25; margin-right: auto; min-width: 0; }
  .ib-text span { font-size: 13px; color: #B9BBC0; }
  .install-banner .primary { min-height: 40px; }
  .ib-close { background: none; border: 0; color: #9A9DA3; font-size: 24px; min-height: 40px; min-width: 36px; padding: 0; }

  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--karta); border-top: 1px solid var(--linka);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    height: var(--bottomnav); color: var(--tlum); font-size: 12px; font-weight: 500;
  }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav .ico { width: 24px; height: 24px; stroke-width: 1.6; }
  .bottomnav a[aria-current] { color: var(--zluta-text); font-weight: 700; }
  .bottomnav a[aria-current] .ico { color: var(--zluta-tm); stroke-width: 2; }

  h1 { font-size: 26px; }
  .title-row { margin-bottom: 14px; }
  .title-row .button.primary { min-height: 44px; padding: 10px 18px; font-size: 15px; }

  /* dotykové ovládání: větší cíle, písmo 16 px */
  input, select, textarea, button, .button { min-height: 44px; font-size: 16px; }
  input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; }
  .check { min-height: 44px; }

  .stats { gap: 10px; }
  .stat { padding: 16px 14px 14px; border-radius: 16px; }
  .stat > span { font-size: 12px; }
  .stat strong { font-size: 20px; }
  .jen-pc { display: none !important; }
  .jen-mobil { display: inline-flex !important; }
  .select-all { margin: 0 0 6px 2px; }
  .stats.compact .stat.highlight:nth-child(odd) { grid-column: 1 / -1; }

  .card { padding: 16px; border-radius: 16px; }
  .row { flex-direction: column; gap: 14px; }
  .row > .field { min-width: 0; }
  .form .actions { flex-direction: column-reverse; align-items: stretch; }
  .form .actions > * { width: 100%; text-align: center; }
  .form .actions a { padding: 10px; }

  .quick { grid-template-columns: 1fr 1fr; }
  .quick .field:first-of-type, .quick .field:has([name="date"]), .quick .field:has([name="description"]), .quick .hours-field { grid-column: 1 / -1; }
  .hours-input .step { min-width: 52px; font-size: 24px; }
  .hours-input input[name="hours"] { font-size: 20px; }
  .unit span { padding: 9px 13px; font-size: 15px; }
  .quick .check { grid-column: 1; }
  .quick button { grid-column: 2; }

  .filters-box { background: var(--karta); border: 1px solid var(--linka); border-radius: 16px; margin-bottom: 14px; box-shadow: var(--stin); }
  .filters-box > summary {
    display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none;
    min-height: 48px; padding: 0 16px; font-weight: 600;
  }
  .filters-box > summary::-webkit-details-marker { display: none; }
  .filters-box > summary::after { content: ""; width: 8px; height: 8px; border: solid var(--tlum); border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -4px; }
  .filters-box[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
  .filters-box .filters { padding: 0 16px 16px; margin: 0; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters > * { width: 100%; max-width: none !important; }
  .filters label:not(.check) { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
  .filters input[type="search"], .filters .quicklinks, .filters > button { grid-column: 1 / -1; }
  .quicklinks, .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; }
  .quicklinks a, .tabs a { padding: 9px 14px; font-size: 14px; }

  /* tabulky -> karty */
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr {
    position: relative; background: var(--karta); border: 1px solid var(--linka); border-radius: 14px;
    box-shadow: var(--stin); padding: 12px 14px; margin-bottom: 10px;
  }
  tbody tr:hover { background: var(--karta); }
  tbody tr:active { background: #FBFBF8; }
  td, tbody tr:last-child td {
    border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
    text-align: right; white-space: normal;
  }
  td > .v { min-width: 0; }
  td::before {
    content: attr(data-label); flex-shrink: 0; text-align: left;
    font-family: var(--pismo); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--tlum);
  }
  td.is-empty, tbody tr:last-child td.is-empty { display: none; }
  td.cell-main, tbody tr:last-child td.cell-main { display: block; text-align: left; font-size: 17px; font-weight: 600; padding: 0 0 6px; font-family: var(--pismo); }
  td.cell-main::before { display: none; }
  td.cell-main .muted { font-size: 14px; }
  td.sel { position: absolute; top: 10px; right: 10px; width: auto; padding: 4px; }
  td.sel::before { display: none; }
  td.sel input { width: 24px; height: 24px; }
  tr:has(td.sel) td.cell-main { padding-right: 40px; }

  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dt { margin-top: 10px; }
  .details dt:first-child { margin-top: 0; }

  table.months td:first-child { min-width: 0; }
  td.cell-main > .v { display: block; }
  .doc { padding: 18px 16px; }
  .doc-table tbody tr td:nth-child(3) { display: block; text-align: left; }
  .doc-table tbody tr td:nth-child(3)::before { display: block; margin-bottom: 2px; }
  .doc-head, .doc-info { display: block; }
  .doc-supplier { text-align: left; margin-top: 8px; }
  .doc-info > div + div { margin-top: 12px; }
  .doc-title { font-size: 26px; }
  .doc-total { flex-wrap: wrap; gap: 4px 16px; }
  .invoice-mark { grid-template-columns: 1fr 1fr; }
  .fakturoid-form { grid-template-columns: 1fr 1fr; }
  .fakturoid-form button.fa-wide { justify-self: stretch; }
  .invoice-mark button { grid-column: 1 / -1; }
  .rate-form { grid-template-columns: 1fr 1fr; }
  .rate-form .field:first-of-type, .rate-form button { grid-column: 1 / -1; }
  td.row-action, tbody tr:last-child td.row-action { width: 100%; justify-content: flex-end; padding-top: 8px; }
  td.row-action::before { display: none; }
  /* prázdné měsíce jen jako úzký řádek */
  table.months tbody tr.muted-row { padding: 9px 14px; margin-bottom: 6px; box-shadow: none; background: transparent; }
  table.months tbody tr.muted-row td.cell-main { padding: 0; font-size: 15px; }
  table.months tbody tr.muted-row td:not(.cell-main) { display: none; }
  tfoot, tfoot tr, tfoot td { display: block; width: 100%; }
  tfoot tr { background: var(--grafit); color: #fff; border-radius: 14px; padding: 12px 14px; }
  tfoot td { background: none; border: 0; padding: 3px 0; display: flex; justify-content: space-between; text-align: right; }
  tfoot td::before { color: #9A9DA3; }
  tfoot td.cell-main { font-size: 17px; }
  .bottomnav { grid-template-columns: repeat(6, 1fr); }
  .bottomnav a { font-size: 11px; }
  .report-filters select { width: 100%; }
  .bulk-bar { bottom: calc(var(--bottomnav) + 10px + env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; }
  .bulk-bar > * { width: 100%; }
  .invoice-fields { flex-direction: column; align-items: stretch; }
  .invoice-fields label { flex-direction: column; align-items: stretch; }
}
