/* Lead kniha – vzhled. Jediný styl celé aplikace, bez inline stylů (CSP). */

:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --povrch: #ffffff;
  --povrch-2: #f7f9fc;
  --pismo: #0f172a;
  --pismo-2: #334155;
  --tlumene: #64748b;
  --cara: #e3e8ef;
  --cara-silna: #cfd6e1;
  --akcent: #2557d6;
  --akcent-tmavy: #1c46b0;
  --akcent-svetly: #e9effc;
  --panel: #13203b;
  --panel-text: #c4cde0;
  --panel-tlumene: #7f8cab;
  --panel-hover: rgba(255, 255, 255, 0.07);
  --ok: #15803d;
  --ok-bg: #e8f6ed;
  --chyba: #b42318;
  --chyba-bg: #fdeceb;
  --pozor: #b45309;
  --pozor-bg: #fff5e6;
  --radius: 12px;
  --radius-s: 8px;
  --stin: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 4px rgba(15, 23, 42, 0.04);
  --stin-vetsi: 0 10px 30px rgba(15, 23, 42, 0.08);
  --pismo-rodina: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--pismo-rodina);
  color: var(--pismo);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--akcent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--akcent-tmavy); }
b, strong { font-weight: 650; }

h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 1.08rem; line-height: 1.3; font-weight: 650; margin: 1.7rem 0 0.8rem; letter-spacing: -0.005em; }
.hlava-stranky + h2, .karta > h2:first-child, .sekce > h2 { margin-top: 0; }
h3 { font-size: 1rem; margin: 0 0 0.6rem; }
p { margin: 0 0 0.8rem; }

/* ---------- rozložení: boční panel + obsah ---------- */

body.s-panelem { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }

.panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.1rem 0.75rem 1rem;
  background: var(--panel); color: var(--panel-text);
}
.logo { display: flex; align-items: center; gap: 0.65rem; padding: 0.2rem 0.55rem; color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; letter-spacing: -0.01em; }
.logo:hover { color: #fff; }
.logo-znak {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #4f8cff 0%, #2557d6 100%);
  color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: 0 2px 6px rgba(37, 87, 214, 0.35);
}

.menu { display: flex; flex-direction: column; gap: 1rem; flex: 1; }
.menu-skupina { display: flex; flex-direction: column; gap: 2px; }
.menu-nadpis { padding: 0 0.65rem 0.3rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--panel-tlumene); }
.menu a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.65rem; border-radius: var(--radius-s);
  color: var(--panel-text); text-decoration: none; font-size: 0.93rem;
  transition: background 0.12s, color 0.12s;
}
.menu a:hover { background: var(--panel-hover); color: #fff; }
.menu a.aktivni { background: var(--akcent); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(37, 87, 214, 0.35); }
.menu a .ikona { opacity: 0.85; }
.menu a.aktivni .ikona { opacity: 1; }
.ikona { flex: none; display: block; }

.odhlasit { margin: 0; padding-top: 0.85rem; border-top: 1px solid rgba(255, 255, 255, 0.09); display: flex; flex-direction: column; gap: 0.25rem; }
.kdo { padding: 0 0.65rem; font-size: 0.8rem; color: var(--panel-tlumene); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.odkaz-panel {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.5rem 0.65rem; border: 0; border-radius: var(--radius-s);
  background: none; color: var(--panel-text); font: inherit; font-size: 0.92rem; cursor: pointer; text-align: left;
}
.odkaz-panel:hover { background: var(--panel-hover); color: #fff; }

.obsah { width: 100%; max-width: 1320px; margin: 0 auto; padding: 1.8rem 2.2rem 3rem; min-width: 0; }
.obsah.a4 { max-width: 820px; background: #fff; }

.hlava-stranky { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.8rem 1.5rem; margin-bottom: 1.4rem; }
.podtitul { margin: 0.3rem 0 0; color: var(--tlumene); font-size: 0.95rem; }
.hlava-akce { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ---------- karty a sekce ---------- */

.karta {
  background: var(--povrch); border: 1px solid var(--cara); border-radius: var(--radius);
  box-shadow: var(--stin); padding: 1.25rem 1.35rem; margin: 0 0 1.25rem;
}
.karta.uzka { max-width: 420px; }
.karta > h2:first-child, .karta > h3:first-child { margin-top: 0; }
.sekce > .tlumene { margin-top: -0.4rem; }
.sekce > .tab-obal { margin-left: -1.35rem; margin-right: -1.35rem; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; }
.sekce > .tab-obal:last-child { margin-bottom: -1.25rem; border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }

/* dlaždice s hlavními čísly */
.dlazdice { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 1rem; margin: 0 0 1.25rem; }
.dlazdice-polozka {
  position: relative; overflow: hidden;
  background: var(--povrch); border: 1px solid var(--cara); border-radius: var(--radius);
  box-shadow: var(--stin); padding: 1rem 1.1rem 1rem 1.25rem;
}
.dlazdice-polozka::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--akcent); opacity: 0.85; }
.dlazdice-polozka.dobre::before { background: var(--ok); }
.dlazdice-polozka.spatne::before { background: var(--chyba); }
.dlazdice-polozka.pozor::before { background: var(--pozor); }
.dlazdice-nazev { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tlumene); }
.dlazdice-hodnota { margin-top: 0.35rem; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dlazdice-pod { margin-top: 0.3rem; font-size: 0.84rem; color: var(--tlumene); }
.dlazdice-polozka.dobre .dlazdice-hodnota { color: var(--ok); }
.dlazdice-polozka.spatne .dlazdice-hodnota { color: var(--chyba); }
.dlazdice-polozka.pozor .dlazdice-pod { color: var(--pozor); }

/* ---------- tabulky ---------- */

.tab-obal { overflow-x: auto; background: var(--povrch); border: 1px solid var(--cara); border-radius: var(--radius); box-shadow: var(--stin); margin: 0 0 1.25rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 0.62rem 0.85rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--cara); }
th {
  background: var(--povrch-2); color: var(--tlumene);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f9fbfe; }
tr.prazdny td { color: var(--tlumene); }
tr.prazdny .zdroj-nazev { font-weight: 500; }
tr.soucet td { background: var(--povrch-2); font-weight: 700; border-top: 1px solid var(--cara-silna); }
tbody tr.soucet:hover td { background: var(--povrch-2); }
td.cislo, th.cislo { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.zacatek, td.zacatek { border-left: 1px solid var(--cara); }
td.datum { white-space: nowrap; color: var(--pismo-2); }
td form { margin: 0; }
.kladne { color: var(--ok); }
.zaporne { color: var(--chyba); }
.ano { color: var(--ok); font-weight: 600; }
.zdroj-nazev { font-weight: 600; }
.kod-zdroje {
  display: inline-block; vertical-align: 1px;
  padding: 0.05rem 0.42rem; border-radius: 6px;
  font: 700 0.72rem/1.45 var(--mono); letter-spacing: 0.02em;
  background: var(--akcent-svetly); color: var(--akcent-tmavy);
}
td .pct { display: block; font-size: 0.76rem; color: var(--tlumene); font-weight: 400; }
.kod { font-family: var(--mono); font-size: 0.86rem; word-break: break-all; }
.kod.velky { display: block; font-size: 1rem; background: #fff8e1; border: 1px solid #f3dfa0; padding: 0.7rem 0.85rem; border-radius: var(--radius-s); }

.souhrn-radek { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 0 0 0.7rem; color: var(--pismo-2); }
.stranky { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.25rem 0 1rem; }

/* ---------- štítky ---------- */

.pilulka {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.14rem 0.55rem; border-radius: 999px;
  font-size: 0.77rem; font-weight: 600; line-height: 1.45; white-space: nowrap;
}
.pilulka::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.pilulka.modry { background: var(--akcent-svetly); color: var(--akcent-tmavy); }
.pilulka.zeleny { background: var(--ok-bg); color: var(--ok); }
.pilulka.cerveny { background: var(--chyba-bg); color: var(--chyba); }
.pilulka.oranzovy { background: var(--pozor-bg); color: var(--pozor); }
.pilulka.sedy { background: #eef2f6; color: #475569; }
.stitek { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: #eef2f6; color: #475569; white-space: nowrap; }
.stitek.var { background: var(--pozor-bg); color: var(--pozor); }

/* třídy leadu z pilota: A zelená, B oranžová, C červená; plus sytější, minus světlejší */
.trida {
  display: inline-block; min-width: 2.4em; text-align: center;
  padding: 0.12rem 0.45rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; line-height: 1.4; white-space: nowrap; letter-spacing: 0.01em; text-transform: none;
}
.trida-Ap { background: #1e8e3e; color: #fff; }
.trida-Am { background: #d3f0dc; color: #0d652d; }
.trida-Bp { background: #e8710a; color: #fff; }
.trida-Bm { background: #feefc3; color: #8a4b00; }
.trida-Cp { background: #d93025; color: #fff; }
.trida-Cm { background: #fbd9d6; color: #a50e0e; }
.trida-x { background: #eef2f6; color: var(--tlumene); font-weight: 500; }
th .trida { font-size: 0.74rem; }
.pruh { display: block; border-radius: 5px; overflow: hidden; }
.legenda { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; align-items: center; margin: 0 0 1rem; font-size: 0.87rem; color: var(--pismo-2); }
.legenda > span { display: inline-flex; align-items: center; gap: 0.25rem; }
.legenda .trida { margin-right: 0.15rem; }

/* ---------- formuláře a tlačítka ---------- */

.mrizka { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem 1.1rem; margin-bottom: 1rem; }
.pole { display: flex; flex-direction: column; gap: 0.32rem; font-size: 0.92rem; }
.pole > span { font-size: 0.83rem; font-weight: 600; color: var(--pismo-2); }
.pole small { color: var(--tlumene); font-size: 0.8rem; line-height: 1.4; }
.pole.zaskrtnuti { flex-direction: row; align-items: center; gap: 0.55rem; }
.pole.zaskrtnuti > span { font-weight: 500; font-size: 0.92rem; }
.filtr { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 0.8rem 1rem; align-items: end; }
.filtr.karta { padding: 1rem 1.2rem; }
.filtr-akce { flex-direction: row; align-items: center; gap: 0.5rem; }
.rada { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.5rem 0; }
.rada form { margin: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file], input:not([type]), select, textarea {
  font: inherit; font-size: 0.93rem; color: var(--pismo);
  min-height: 2.5rem; max-width: 100%; padding: 0.5rem 0.7rem;
  background: #fff; border: 1px solid var(--cara-silna); border-radius: var(--radius-s);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--akcent); box-shadow: 0 0 0 3px rgba(37, 87, 214, 0.16); }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--akcent); }
input[type=file] { padding: 0.4rem; }

button, .tl {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem; padding: 0.5rem 1rem;
  font: inherit; font-size: 0.92rem; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--akcent); border-radius: var(--radius-s);
  background: var(--akcent); color: #fff; cursor: pointer;
  box-shadow: 0 1px 2px rgba(37, 87, 214, 0.25);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
button:hover { background: var(--akcent-tmavy); border-color: var(--akcent-tmavy); color: #fff; }
button:focus-visible, .tl:focus-visible, .menu a:focus-visible, a:focus-visible { outline: 3px solid rgba(37, 87, 214, 0.35); outline-offset: 2px; }
.tl, button.druhotne, .tl.druhotne { background: #fff; color: var(--pismo-2); border-color: var(--cara-silna); box-shadow: var(--stin); }
.tl:hover, button.druhotne:hover { background: var(--povrch-2); color: var(--pismo); border-color: var(--cara-silna); }
.male, button.male, .tl.male { min-height: 2rem; padding: 0.3rem 0.7rem; font-size: 0.84rem; }
.ikonove { width: 2.5rem; padding: 0; font-size: 1.25rem; font-weight: 500; }
button.odkaz { background: none; border: none; box-shadow: none; color: var(--akcent); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; }

.vyber-mesice {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem; background: var(--povrch); border: 1px solid var(--cara);
  border-radius: 11px; box-shadow: var(--stin);
}
.vyber-mesice select { border-color: transparent; min-width: 10rem; font-weight: 600; background-color: transparent; }
.vyber-mesice select:focus { border-color: var(--akcent); }
.vyber-mesice .tl { box-shadow: none; border-color: transparent; background: transparent; }
.vyber-mesice .tl:hover { background: var(--povrch-2); }
.vyber-mesice button { min-height: 2.2rem; padding: 0.35rem 0.8rem; }

/* ---------- hlášky a drobnosti ---------- */

.obsah > .vyber-mesice { display: inline-flex; margin-bottom: 0.4rem; }

.zprava { padding: 0.75rem 1rem; border-radius: 10px; margin: 0 0 1.1rem; border: 1px solid var(--cara); background: #fff; font-size: 0.93rem; }
.zprava.ok { background: var(--ok-bg); border-color: #bfe3cb; color: #14532d; }
.zprava.chyba { background: var(--chyba-bg); border-color: #f5c2bd; color: #7a1a12; }
.zprava.var { background: var(--pozor-bg); border-color: #f6d9a8; color: #7c3a06; }
.chyba-text { color: var(--chyba); }
.tlumene { color: var(--tlumene); font-size: 0.92rem; }
.seznam { padding-left: 1.2rem; margin: 0 0 1rem; }
.seznam li { margin: 0.2rem 0; }

details { margin: 0.5rem 0 1rem; }
summary { cursor: pointer; color: var(--akcent); font-weight: 600; font-size: 0.88rem; }
.vysvetlivky { margin: 1rem 0 0; }
.vysvetlivky ul { margin: 0.6rem 0 0; padding-left: 1.1rem; color: var(--pismo-2); font-size: 0.88rem; }
.vysvetlivky li { margin: 0.3rem 0; }

.pata {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem;
  margin-top: 0.5rem; padding: 0.4rem 0.2rem; color: var(--tlumene); font-size: 0.84rem;
}
.pata form { margin: 0; }
.pata-text > span + span::before { content: " · "; color: var(--cara-silna); }

/* ---------- přihlášení ---------- */

body.prihlaseni {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 10% -10%, #dfe8fb 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e3ecfb 0%, transparent 55%), var(--bg);
}
.prihlaseni .obsah { max-width: 420px; padding: 1.5rem 1rem; }
.prihlaseni-hlava { text-align: center; margin-bottom: 1.25rem; }
.prihlaseni-hlava .logo-znak { width: 52px; height: 52px; font-size: 1.4rem; border-radius: 14px; margin-bottom: 0.8rem; }
.prihlaseni-hlava h1 { font-size: 1.5rem; }
.prihlaseni-hlava p { margin: 0.3rem 0 0; }
.prihlaseni .karta { display: grid; gap: 1rem; padding: 1.5rem; box-shadow: var(--stin-vetsi); }
.prihlaseni .karta .zprava { margin: 0; }
.prihlaseni button { width: 100%; min-height: 2.75rem; }

/* ---------- partner ---------- */

.dva-sloupce { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 1.25rem; align-items: start; }
.mensi { font-size: 0.8rem; }
.pod-tabulkou { margin: -0.3rem 0 0; text-align: center; font-weight: 600; }
.podminky { display: grid; gap: 0.9rem; }
.podminka + .podminka { border-top: 1px solid var(--cara); padding-top: 0.9rem; }
.podminka-hlava { margin-bottom: 0.45rem; font-size: 0.88rem; }
.podminka dl, dl.udaje { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.1rem; margin: 0; }
.podminka dt, dl.udaje dt { color: var(--tlumene); }
.podminka dd, dl.udaje dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.sekce h3 { margin: 0.2rem 0 0.5rem; font-size: 0.95rem; }
.sekce h3 ~ h3 { margin-top: 1.2rem; }
pre.ukazka-api { white-space: pre-wrap; word-break: break-word; background: var(--povrch-2); border: 1px solid var(--cara); border-radius: var(--radius-s); padding: 0.75rem 0.9rem; margin: 0 0 0.6rem; font-size: 0.84rem; }
.odkaz-partnera { display: block; font: 0.92rem/1.4 var(--mono); word-break: break-all; background: var(--akcent-svetly); color: var(--akcent-tmavy); border: 1px solid #c9d7f6; padding: 0.7rem 0.85rem; border-radius: var(--radius-s); margin: 0 0 0.6rem; }

/* ---------- tisková stránka vyúčtování ---------- */

body.tisk { background: var(--bg); }
.obsah.a4 { margin: 0 auto; background: transparent; }
.list { background: var(--povrch); border: 1px solid var(--cara); border-radius: var(--radius); box-shadow: var(--stin); padding: 2rem 2.2rem; }
.list-hlava { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--cara); padding-bottom: 1rem; margin-bottom: 1.4rem; }
.list-logo { display: flex; align-items: center; gap: 0.6rem; font-size: 1.05rem; }
.list h1 { margin-top: 0; }
.list dl.udaje { margin-bottom: 1.4rem; }
.list .tab-obal { box-shadow: none; }

/* ---------- telefon a tablet ---------- */

@media (max-width: 900px) {
  body.s-panelem { display: block; }
  .panel {
    position: sticky; top: 0; z-index: 10; height: auto; overflow: visible;
    flex-direction: row; align-items: center; gap: 0.75rem;
    padding: 0.55rem 0.75rem; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
  }
  .logo span:last-child { display: none; }
  .menu { flex-direction: row; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; flex: 1; }
  .menu::-webkit-scrollbar { display: none; }
  .menu-skupina { display: contents; }
  .menu-nadpis { display: none; }
  .menu a { white-space: nowrap; padding: 0.45rem 0.6rem; font-size: 0.88rem; }
  .menu a .ikona { display: none; }
  .odhlasit { border: 0; padding: 0; flex-direction: row; }
  .kdo { display: none; }
  .odkaz-panel span { display: none; }
  .obsah { padding: 1.1rem 1rem 2.5rem; }
  h1 { font-size: 1.35rem; }
  .hlava-stranky { align-items: stretch; }
  .hlava-akce, .vyber-mesice { width: 100%; }
  .vyber-mesice select { flex: 1; min-width: 0; }
  .dlazdice { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .dlazdice-hodnota { font-size: 1.3rem; }
  .karta { padding: 1rem; }
  .sekce > .tab-obal { margin-left: -1rem; margin-right: -1rem; }
  .sekce > .tab-obal:last-child { margin-bottom: -1rem; }
  .dva-sloupce { grid-template-columns: 1fr; }
  .list { padding: 1.2rem 1rem; }
}

/* ---------- tisk ---------- */

@media print {
  body, body.s-panelem { display: block; background: #fff; }
  .panel, .bez-tisku, .pata, .vyber-mesice, .hlava-akce { display: none !important; }
  .obsah, .obsah.a4 { max-width: none; padding: 0; }
  .karta, .dlazdice-polozka, .tab-obal { box-shadow: none; border-color: #ccc; }
  .tab-obal { overflow: visible; }
  .list { border: 0; padding: 0; }
  .logo-znak { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 18mm; }
}
