/* =====================================================================
   Vzhled aplikace. Barvy a rozměry jsou na jednom místě nahoře.
   Rozvržení funguje od telefonu po velký monitor.
   ===================================================================== */
:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --border: #e4e3df;
  --border-strong: #cfcdc7;
  --text: #1b1b1a;
  --text-2: #55534e;
  --muted: #8a8780;
  --primary: #2a63c4;
  --primary-hover: #214f9f;
  --primary-soft: #eaf0fb;
  --denni: #fff6d6;
  --denni-head: #fbe7a1;
  --plan: #e7f0ff;
  --plan-head: #c9dcfb;
  --missing: #fde6e4;
  --missing-strong: #c23b31;
  --ok: #1d7a46;
  --ok-soft: #e4f4ea;
  --today: #fffbe9;
  --closed: #f1f0ec;
  --neg: #b3261e;
  --series-1: #2a78d6;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 8px; font-weight: 650; line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
code { background: #f0efeb; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
code.big { font-size: 16px; padding: 3px 8px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.neg { color: var(--neg); }
.warn { color: var(--missing-strong); }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }
.mt { margin-top: 18px; }

/* ---------- Horní lišta a menu ---------- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px 24px; flex-wrap: wrap; padding: 0 20px;
}
.topbar-row { display: contents; }
.brand { font-weight: 700; color: var(--text); font-size: 15px; padding: 10px 0; order: 1; white-space: nowrap; display: inline-flex; align-items: center; gap: 9px; }
.brand img { width: 32px; height: 28px; display: block; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; order: 2; align-items: center; }
.nav a { padding: 7px 11px; border-radius: 7px; color: var(--text-2); white-space: nowrap; }
.nav a:hover { background: #f1f0ec; text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.sub { font-size: 13px; }
.nav-sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; flex: none; }
.who { margin-left: auto; display: flex; gap: 14px; align-items: center; color: var(--text-2); order: 3; white-space: nowrap; }
.role { font-size: 11px; background: #f0efeb; padding: 2px 7px; border-radius: 10px; margin-left: 4px; }
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }

.main { padding: 20px; max-width: 1560px; margin: 0 auto; }

/* ---------- Tlačítka, formuláře ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: #f4f3ef; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; color: var(--text-2); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.form-actions { display: flex; gap: 8px; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .picker select, .monthnav select, .monthnav input[type=date] {
  padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 7px; font: inherit; background: #fff; color: var(--text); min-height: 36px;
}
.monthnav select, .monthnav input[type=date] { padding: 5px 8px; min-height: 32px; font-size: 13px; }
.form h2 { margin-top: 8px; }
.picker { display: flex; gap: 8px; align-items: center; }
.picker label { display: flex; gap: 8px; align-items: center; color: var(--text-2); }

.auth-box { max-width: 400px; margin: 48px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.auth-box.wide { max-width: 640px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-ok { background: #e8f5ec; border-color: #b9e0c6; color: #17532f; }
.alert-info { background: #eef3fb; border-color: #c9d8f2; }
.alert-error { background: var(--missing); border-color: #f2b8b2; color: #7d1d16; }
.alert-warn { background: #fff4dc; border-color: #f0d590; }

/* ---------- Hlavička stránky ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.monthnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.monthnav strong { min-width: 110px; text-align: center; font-size: 15px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { margin: 22px 0 10px; font-size: 17px; }

/* ---------- Ukazatele (dlaždice) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; min-width: 0; }
.kpi span { color: var(--text-2); font-size: 12px; }
.kpi strong { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { color: var(--muted); font-size: 11px; }
.kpi small.neg { color: var(--neg); }
.kpi small.warn { color: var(--missing-strong); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.card.tight { padding: 12px 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cards-grid .card { margin: 0; }

.legend { color: var(--text-2); font-size: 13px; display: flex; gap: 6px 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border-strong); }
.sw-denni { background: var(--denni); }
.sw-plan { background: var(--plan); }
.sw-chybi { background: var(--missing); border-color: #f2b8b2; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #f0efeb; color: var(--text-2); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-bad { background: var(--missing); color: var(--missing-strong); font-weight: 600; }
a.tag:hover { text-decoration: none; filter: brightness(.97); }

/* ---------- Tabulky ---------- */
.tablewrap { overflow: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.tablewrap.short { max-height: 520px; }
.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.tbl th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; z-index: 2; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl.numtable th:not(:first-child) { text-align: right; }
.tbl tfoot td { font-weight: 650; border-top: 2px solid var(--border-strong); background: var(--surface-2); }
.tbl tbody tr:hover td { background: #fafaf6; }
.tbl tr.today td { background: var(--today); }
.tbl tr.inactive td { color: var(--muted); }
.tbl .actions { display: flex; gap: 6px; }
.tbl.simple { margin: 12px 0; }
.tbl.compact td, .tbl.compact th { padding: 4px 10px; }
.tbl .missing-cell { color: var(--missing-strong); background: var(--missing); font-size: 12px; }
.tbl tr.sub-row td { border-bottom: 1px solid var(--border); padding-top: 0; white-space: normal; }
.sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.tbl th.sticky { z-index: 3; background: var(--surface-2); }
.tbl tfoot td.sticky { background: var(--surface-2); }
.card.tight .tbl th, .card.tight .tbl td { padding: 6px 8px; }

/* Zápis – tabulka jako v Excelu */
.tablewrap.tall { max-height: calc(100vh - 300px); min-height: 360px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tablewrap.tall.fit { min-height: 0; }
.tbl.zapis td, .tbl.zapis th { padding: 3px 8px; }
.tbl.zapis th { white-space: normal; min-width: 64px; vertical-align: bottom; line-height: 1.2; text-align: right; }
.tbl.zapis th.sticky { text-align: left; min-width: 60px; }
.tbl.zapis th.narrow { min-width: 0; text-align: center; }
.tbl.zapis th.h-denni { background: var(--denni-head); }
.tbl.zapis th.h-plan { background: var(--plan-head); }
.tbl.zapis th.h-stav { background: #ecebe6; }
.tbl.zapis td.in { padding: 2px 3px; }
.tbl.zapis td.in-denni { background: var(--denni); }
.tbl.zapis td.in-plan { background: var(--plan); }
.tbl.zapis td.in-stav { background: #f6f5f1; text-align: center; }
.tbl.zapis td.in span { display: block; padding: 3px 5px; text-align: right; }
.tbl.zapis td.in.txt span { text-align: left; }
.tbl.zapis td.in.chk span { text-align: center; color: var(--text-2); }
.tbl.zapis td.in input:not([type=checkbox]) {
  width: 92px; padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: rgba(255,255,255,.6);
  font: inherit; text-align: right; font-variant-numeric: tabular-nums; color: var(--text);
}
.tbl.zapis.kpi-tbl td.in input:not([type=checkbox]) { width: 76px; }
.tbl.zapis td.in.txt input { width: 180px; text-align: left; }
.tbl.zapis td.in input[type=checkbox] { width: 16px; height: 16px; margin: 4px; cursor: pointer; }
.tbl.zapis td.in input:not([type=checkbox]):hover { border-color: var(--border-strong); }
.tbl.zapis td.in input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px rgba(42,99,196,.18); }
.tbl.zapis td.in input.changed { border-color: #e0a400; background: #fff; }
.tbl.zapis td.in.chk.changed { box-shadow: inset 0 0 0 2px #e0a400; }
.tbl.zapis td.ro { color: var(--text-2); }
.tbl tr.weekend td.date, .tbl tr.weekend td:nth-child(2) { color: var(--text-2); }
.tbl tr.missing td.date { background: var(--missing); color: var(--missing-strong); font-weight: 650; box-shadow: inset 3px 0 0 var(--missing-strong); }
.tbl tr.today td.date { box-shadow: inset 3px 0 0 var(--primary); font-weight: 650; }
.tbl tr.closed td { color: var(--muted); }
.tbl tr.closed td.date { background: var(--closed); text-decoration: line-through; }
.tbl tr.preopen td { color: var(--muted); background: #fbfbfa; }
.tbl td.date { min-width: 60px; }
.tbl.zapis tr.konec-tydne td { border-bottom: 2px solid var(--border-strong); }
.tbl.zapis td.tyden-cislo { font-weight: 600; color: var(--text-2); }
.tbl td.note { max-width: 260px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

.savebar { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 12px 0; flex-wrap: wrap; }
.savebar .hint { font-size: 12px; margin-right: auto; }
.dirty-msg { color: #8a6100; font-weight: 600; }

/* Vyplnění plánu podle dne v týdnu */
.planfill { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
.planfill summary { padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--primary); }
.planfill-body { padding: 0 14px 14px; }
.planfill-grid { display: grid; grid-template-columns: 90px repeat(7, minmax(70px, 1fr)); gap: 6px; align-items: center; overflow-x: auto; }
.planfill-grid strong { text-align: center; font-size: 12px; color: var(--text-2); }
.planfill-grid span { font-size: 12px; color: var(--text-2); }
.planfill-grid input { width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 6px; font: inherit; text-align: right; background: var(--plan); }
.planfill-actions { display: flex; gap: 14px; align-items: center; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Grafy ---------- */
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chart-legend { display: flex; gap: 16px; color: var(--text-2); font-size: 12px; }
.chart-legend i { display: inline-block; vertical-align: middle; margin-right: 4px; }
.lg-bar { width: 10px; height: 12px; background: var(--series-1); border-radius: 3px 3px 0 0; }
.lg-plan { width: 16px; height: 2px; background: var(--text); }
.chart { width: 100%; max-width: 820px; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .ref { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .axis.wknd { fill: var(--text-2); font-weight: 600; }
.chart .axis.today { fill: var(--primary); font-weight: 700; }
.chart .lbl { fill: var(--text-2); font-size: 12px; }
.chart .val { fill: var(--text); font-size: 12px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .bar { fill: var(--series-1); }
.chart .plan { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.chart .miss { fill: var(--missing-strong); font-size: 12px; font-weight: 700; }
.chart .hit { fill: transparent; }
.chart .bar-row:hover .hit, .chart .bar-row:focus .hit { fill: #f3f6fc; }
.chart .bar-row:focus { outline: none; }

/* ---------- PnL ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px 0 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.grid-pnl { grid-template-columns: auto minmax(0, 1fr); }
.tabs .tab-akce { margin-left: auto; display: flex; gap: 16px; align-items: center; font-size: 13px; padding: 0 4px; }
.tabs .tab-akce a, .tabs .tab-akce button { padding: 8px 0; border: 0; color: var(--primary); font-size: 13px; }
.print-hlava { display: none; }
.trend-tbl td.sticky { min-width: 170px; }
.trend-tbl th a { color: inherit; }
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }

.pnl-tbl td, .pnl-tbl th { padding: 5px 12px; }
.pnl-tbl tr.sum-row td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.pnl-tbl tr.key-row td { background: var(--primary-soft); }
.pnl-tbl tr.sum-row td.sticky { background: var(--surface-2); }
.pnl-tbl tr.key-row td.sticky { background: var(--primary-soft); }
.pnl-tbl th a { color: inherit; }

.pnl-card { max-width: 640px; }
details.blok > summary { cursor: pointer; display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; list-style: none; }
details.blok > summary::-webkit-details-marker { display: none; }
details.blok > summary::before { content: '▸'; color: var(--muted); width: 10px; transition: transform .12s; display: inline-block; }
details.blok[open] > summary::before { transform: rotate(90deg); }
details.blok > summary h2 { margin: 0; }
details.blok[open] > summary { margin-bottom: 12px; }
details.blok .souhrn { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
details.sub-blok { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
details.sub-blok > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
details.sub-blok[open] > summary { margin-bottom: 8px; }
.tbl.zapis tfoot td { padding: 6px 8px; text-align: right; }
.tbl.zapis tfoot td.sticky { text-align: left; }
.pavouk summary { cursor: pointer; }
.pavouk[open] summary { margin-bottom: 10px; }

.tbl.zapis.kv, .tbl.zapis.fit { width: auto; }
.tbl.zapis.kv td:first-child { padding-right: 16px; color: var(--text-2); }
.tbl.zapis.kv tr.gap td { border-top: 8px solid var(--surface); }
.tbl.zapis td.in input.w-wide { width: 240px; text-align: left; }
.tbl.zapis td.in input.w-mid { width: 120px; text-align: left; }
.tbl.zapis td.in input.w-date { width: 96px; text-align: left; }
.tbl.zapis td.in input.w-pct, input.w-pct { width: 64px; }
.tbl.zapis td.in select {
  padding: 3px 4px; border: 1px solid transparent; border-radius: 4px; background: rgba(255,255,255,.6); font: inherit; color: var(--text); max-width: 220px;
}
.tbl.zapis td.in select:hover { border-color: var(--border-strong); }
.tbl.zapis td.in select:focus { outline: none; border-color: var(--primary); background: #fff; }
.tbl.zapis td.in select.changed { border-color: #e0a400; background: #fff; }
.tbl.zapis th.left { text-align: left; }
.proc-tbl { width: auto; }
.proc-tbl td.in-plan { background: var(--plan); }
.proc-tbl input { padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 4px; font: inherit; text-align: right; }
.warn-soft { color: #8a6100; }
.inline-akce { margin-top: 10px; }
.checks-dole { align-self: end; padding-bottom: 8px; }
.pridat-rest { max-width: 640px; }
.havi-pdf { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.havi-stav { flex-basis: 100%; display: flex; flex-direction: column; gap: 4px; }
.havi-stav:empty { display: none; }
.havi-zprava { font-size: 13px; padding: 6px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.havi-zprava.ok { background: var(--ok-soft); border-color: #b9e0c6; color: #17532f; font-weight: 600; }
.havi-zprava.pozor { background: #fff4dc; border-color: #f0d590; }
.havi-zprava.chyba { background: var(--missing); border-color: #f2b8b2; color: #7d1d16; }
details.blok.drag { outline: 2px dashed var(--primary); outline-offset: -6px; }
.proc-tbl input.w-mid-num { width: 110px; }
.pismena-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.saved-at { color: var(--ok); font-size: 13px; font-weight: 600; }
.draft-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.draft-bar span { margin-right: auto; }

/* Nenápadná kontrola tržeb: šedá tečka, po najetí / ťuknutí ukáže součet z denního reportingu */
.tip-dot { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-left: 6px; vertical-align: middle; cursor: help; }
.tip-dot.off { background: #e0a400; }
.tip-dot:focus { outline: none; box-shadow: 0 0 0 3px rgba(42,99,196,.2); }
.tip-dot::after {
  content: attr(data-tip); position: absolute; left: 14px; top: -6px; z-index: 20; white-space: nowrap;
  background: var(--text); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .12s;
}
.tip-dot:hover::after, .tip-dot:focus::after { opacity: 1; }

/* =====================================================================
   Tablet a telefon
   ===================================================================== */
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body { font-size: 14px; }
  .main { padding: 12px; }
  .topbar { padding: 0 12px; gap: 0 12px; }
  .brand { padding: 10px 0; }
  .who { gap: 10px; font-size: 13px; }
  .who-name .role { display: none; }
  /* Menu na celou šířku pod logem, posouvá se do strany */
  .nav { order: 4; width: calc(100% + 24px); margin: 0 -12px; padding: 0 8px 8px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  h1 { font-size: 19px; }
  .pagehead { align-items: stretch; }
  .pagehead > * { width: 100%; }
  .picker select { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 8px 10px; }
  .kpi strong { font-size: 17px; }
  .kpis-collapse .kpi:nth-child(n+5) { display: none; }
  .card { padding: 12px; border-radius: 8px; }
  .card.tight { padding: 10px; }
  .section-title { margin-top: 16px; }
  .tbl th, .tbl td { padding: 6px 7px; }
  .mobile-tbl { font-size: 12.5px; }
  .mobile-tbl th, .mobile-tbl td { padding: 6px 5px; }
  .mobile-tbl th { white-space: normal; line-height: 1.15; vertical-align: bottom; }
  .tablewrap.tall { max-height: calc(100vh - 210px); min-height: 300px; }
  .savebar { position: sticky; bottom: 0; background: var(--bg); margin: 0 -12px; padding: 10px 12px; border-top: 1px solid var(--border); z-index: 5; }
  .savebar .hint { display: none; }
  .m-hide { display: none; }
  .pnl-tbl td.sticky { white-space: normal; min-width: 120px; max-width: 150px; line-height: 1.2; }
  .savebar .btn { flex: 1; }
  .form-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-box { margin: 16px auto; padding: 20px; }
}

@media (max-width: 400px) {
  .who-name { display: none; }
  .monthnav strong { min-width: 0; flex: 1; }
}

/* =====================================================================
   Měsíční souhrn + tisk
   ===================================================================== */
.mesicni-souhrn { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.mesicni-souhrn h2 { margin: 22px 0 8px; font-size: 15px; }
.mesicni-souhrn .tbl { margin-bottom: 6px; }
.mesicni-souhrn .tbl th:first-child, .mesicni-souhrn .tbl td:first-child { text-align: left; }
.souhrn-hlava { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--text); }
.souhrn-hlava img { width: 40px; height: auto; }
.souhrn-hlava div { display: flex; flex-direction: column; }
.souhrn-hlava strong { font-size: 17px; }
.souhrn-hlava small { margin-left: auto; }

.rocni h2 { margin-top: 18px; }
.mesice-tbl th, .mesice-tbl td { padding-left: 5px; padding-right: 5px; }
.mesicni-souhrn .tbl tfoot td:first-child { text-align: left; }

@media print {
  @page { margin: 10mm; }
  @page siroka { size: A4 landscape; }
  .mesicni-souhrn { page: siroka; }
  .rocni .nova-strana { break-before: page; }
  .mesice-tbl th, .mesice-tbl td { font-size: 9px; padding: 3px 3px; }
  body { background: #fff; font-size: 10.5px; }
  .topbar, .no-print, .alert, .pagehead, .tabs, .kpis, .pavouk, .toolbar { display: none !important; }
  .main { padding: 0; max-width: none; }
  .mesicni-souhrn { border: 0; padding: 0; }
  .mesicni-souhrn h2 { font-size: 13px; margin-top: 14px; }
  .print-hlava { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 2px solid #000; }
  .print-hlava div { display: flex; flex-direction: column; }
  .print-hlava strong { font-size: 15px; }
  .print-hlava small { margin-left: auto; color: #555; }
  .card { border: 0; padding: 0; margin: 0; }
  .pnl-card { max-width: none; }
  .tablewrap { overflow: visible; max-height: none; }
  .pnl-tbl td, .pnl-tbl th { padding: 2px 8px; font-size: 11px; }
  .pnl-tbl tr.sum-row td, .pnl-tbl tr.key-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl th { position: static; background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tbl th, .tbl td { padding: 3px 6px; }
  .tbl tbody tr:hover td { background: none; }
  .sticky { position: static; }
  a { color: inherit; }
}

/* ---------- Mzdy z docházky ---------- */
.tag-odhad { background: #fff4dc; color: #8a6100; font-weight: 600; }
.mzdy-prevzit { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: 10px 0; }
.mzdy-detail summary { cursor: pointer; color: var(--text-2); margin: 6px 0; }
.mzdy-tbl td.txt, .mzdy-tbl th.txt { text-align: left; white-space: nowrap; }
.mzdy-tbl tr.vynechan td { color: var(--text-2); }
.mzdy-tbl tfoot td { font-weight: 600; }
[data-mzdy-varovani] { margin: 8px 0; padding-left: 26px; }
[data-mzdy-drop].nad { outline: 2px dashed var(--border); outline-offset: 4px; border-radius: 6px; }

/* ---------- Kniha transferů ---------- */
.rb { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: .92em; white-space: nowrap; background: #eef0f3; }
.rb-14  { background: #fbe9a6; }   /* KV1 */
.rb-92  { background: #c8ebc0; }   /* KV2 */
.rb-126 { background: #f6c9d0; }   /* Cheb */
.rb-144 { background: #5aa7e8; color: #fff; }   /* Varyáda */
.rb-165 { background: #c97fd0; color: #fff; }   /* Ostrov */
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.tr-grid .tr-siroke { grid-column: span 2; }
.tr-grid label { display: flex; flex-direction: column; gap: 4px; }
.tr-grid label.check { flex-direction: row; align-items: center; }
.tr-tlacitka { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: 12px; }
.tr-potvrdit { display: flex; gap: 6px; align-items: center; }
.tr-ceka { border-left: 4px solid #e8b400; }
.tr-typ { font-weight: 600; font-size: .9em; padding: 1px 6px; border-radius: 4px; }
.tr-typ.vydej { background: #fde3e3; color: #a32020; }
.tr-typ.prijem { background: #e1f3e1; color: #1d6b2a; }
.tr-kniha td { white-space: nowrap; }
[data-tr-teplota].vypnuto { opacity: .45; }
@media (max-width: 560px) { .tr-grid .tr-siroke { grid-column: auto; } }
@media print {
  .rb, .tr-typ { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tr-kniha { font-size: 11px; }
}

/* ---------- Testovací verze ---------- */
.prostredi { background: #b3261e; color: #fff; text-align: center; font-weight: 600; font-size: 13px; padding: 4px 8px; }
.copybox { display: flex; gap: 6px; margin-top: 8px; }
.copybox input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 6px; }
.btn-danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn-danger:hover { background: #8f1e18; }

/* ---------- Můj přehled ---------- */
.domu-dlazdice { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.domu-dlazdice .card { margin: 0; }
a.domu-dlazdice-1 { display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; }
a.domu-dlazdice-1:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
a.domu-dlazdice-1 strong { font-size: 16px; }
.domu-ukoly { border-left: 4px solid #e8b400; }
.domu-ukoly ul { margin: 0; padding-left: 20px; }
.domu-ukoly li { margin: 4px 0; }
.domu-auta { display: flex; flex-direction: column; gap: 6px; }
a.domu-auto { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text); padding: 6px 0; }
a.domu-auto:hover { text-decoration: none; background: var(--primary-soft); }

/* ---------- Vozový park ---------- */
.plate { display: inline-flex; align-items: stretch; border: 2px solid #1b1b1a; border-radius: 4px; background: #fff; color: #111; height: 28px; overflow: hidden; font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .06em; width: max-content; flex-shrink: 0; }
.plate i { background: var(--primary); color: #fff; font-style: normal; font-size: 9px; font-weight: 600; width: 16px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; letter-spacing: 0; }
.plate em { font-style: normal; padding: 0 8px; display: flex; align-items: center; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: #f0efeb; color: var(--text-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: #fff4dc; color: #8a6100; }
.pill.bad { background: var(--missing); color: var(--missing-strong); }
.pill.info { background: var(--primary-soft); color: var(--primary); }
.fl-radek { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.fl-radek h1 { margin: 0; }
.fl-filtry { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; color: var(--text); }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.chip .n { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.chip.on { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chip.on .n { color: var(--primary); }
.chip.dashed { border-style: dashed; }
.fl-hledat { margin-left: auto; min-width: 220px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; }
.fl-skupina-hlava { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.fl-skupina-hlava h2 { margin: 0; font-size: 16px; }
.vrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text); }
.fl-skupina-hlava + .vrow { border-top: 0; }
.vrow:hover { background: var(--primary-soft); text-decoration: none; }
.vrow.retired { opacity: .55; }
.vrow .veh { display: flex; flex-direction: column; min-width: 0; }
.vrow .veh small { color: var(--muted); }
.vrow .pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.vrow .go { color: var(--muted); font-size: 13px; white-space: nowrap; }
.fl-karty { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.fl-karty .card { margin: 0; }
a.fl-karta { display: flex; flex-direction: column; gap: 8px; color: var(--text); }
a.fl-karta:hover { border-color: var(--primary); text-decoration: none; }
a.fl-karta .btn { align-self: flex-start; }
.fl-velke, .fl-km { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fl-km.neg { color: var(--neg); }
.fl-caste { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.fl-caste button { border: 1px dashed var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.fl-caste button:hover { border-color: var(--primary); border-style: solid; }
.fl-pole { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.fl-pole .siroke { grid-column: span 2; }
.fl-pole label.check { align-self: end; padding-bottom: 8px; }
.fl-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; margin-bottom: 8px; }
.fl-sloupce { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
.fl-mezera td { background: #fff4dc; color: #8a6100; font-size: 13px; }
.fl-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 14px; }
.fl-kv dt { color: var(--muted); }
.fl-kv dd { margin: 0; overflow-wrap: anywhere; }
.fl-pridat { margin-top: 12px; }
.fl-pridat summary { list-style: none; display: inline-flex; }
.fl-pridat summary::-webkit-details-marker { display: none; }
.fl-pridat[open] summary { margin-bottom: 12px; }
.fl-vykaz { background: #fff; color: #000; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.fl-vykaz h1 { font-size: 24px; margin: 0 0 8px; }
.fl-vykaz h2 { font-size: 16px; margin: 18px 0 8px; }
.fl-vykaz table { border-collapse: collapse; width: 100%; font-size: 12px; }
.fl-vykaz th, .fl-vykaz td { border: 1px solid #888; padding: 4px 6px; text-align: left; }
.fl-vykaz th { background: #fafaf8; font-size: 11px; }
.fl-vykaz td.num { text-align: right; }
.fl-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; margin: 10px 0 14px; font-size: 13px; }
.fl-mezera-tisk { font-style: italic; }
.fl-pata { font-size: 11px; color: #555; margin-top: 12px; }
.fl-podpisy { display: flex; gap: 48px; margin-top: 36px; font-size: 12px; }
.fl-podpisy div { border-top: 1px solid #000; padding-top: 4px; min-width: 220px; }
@media (max-width: 900px) { .fl-sloupce { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .vrow { grid-template-columns: auto minmax(0, 1fr); }
  .vrow .pills { grid-column: 1 / -1; justify-content: flex-start; }
  .vrow .go { display: none; }
  .fl-hledat { margin-left: 0; width: 100%; min-width: 0; }
  .fl-pole .siroke { grid-column: auto; }
}
@media print {
  .fl-vykaz { border: 0; padding: 0; }
  .prostredi { display: none; }
  .plate i, .pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
