:root {
  --pozadi: #f5f6f8;
  --plocha: #ffffff;
  --text: #1d2430;
  --tlumeny: #5d6675;
  --okraj: #dfe3e9;
  --modra: #1f4e8c;
  --modra-svetla: #e8eef7;
  --cervena: #b3261e;
  --cervena-pozadi: #fbe3e1;
  --zluta: #8a5a00;
  --zluta-pozadi: #fdf0cc;
  --zelena: #2e6b30;
  --zelena-pozadi: #e2f1e2;
  --seda-pozadi: #eceef1;
  --stin: 0 1px 2px rgb(0 0 0 / 6%), 0 1px 6px rgb(0 0 0 / 4%);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--pozadi);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--modra); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 1.75rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
small, .tlumeny { color: var(--tlumeny); }

/* --- horní lišta --- */
.lista {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  background: #17304f; color: #fff; padding: .55rem 1.25rem;
  position: sticky; top: 0; z-index: 10;
}
.lista a { color: #dbe6f5; }
.lista .logo { font-weight: 700; color: #fff; font-size: 1.05rem; white-space: nowrap; }
.lista nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.lista nav a { padding: .35rem .65rem; border-radius: 6px; }
.lista nav a:hover, .lista nav a.aktivni { background: rgb(255 255 255 / 12%); color: #fff; text-decoration: none; }
.lista .vpravo { display: flex; gap: .9rem; align-items: center; font-size: .92rem; }
.lista .vpravo form { margin: 0; }
.lista .vpravo button { background: none; border: 0; color: #dbe6f5; cursor: pointer; font: inherit; padding: 0; }
.odznak {
  display: inline-block; min-width: 1.3rem; padding: 0 .35rem; margin-left: .2rem;
  border-radius: 999px; background: #f2b84b; color: #2b1d00; font-size: .78rem; font-weight: 700; text-align: center;
}

main { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.hlavicka { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* --- zprávy --- */
.zpravy { list-style: none; padding: 0; margin: 0 0 1rem; }
.zpravy li { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: .4rem; background: var(--modra-svetla); }
.zpravy .success { background: var(--zelena-pozadi); color: var(--zelena); }
.zpravy .error { background: var(--cervena-pozadi); color: var(--cervena); }
.zpravy .warning { background: var(--zluta-pozadi); color: var(--zluta); }

/* --- karty a dlaždice --- */
.karta { background: var(--plocha); border: 1px solid var(--okraj); border-radius: var(--radius); box-shadow: var(--stin); padding: 1rem 1.15rem; }
.dlazdice { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.dlazdice a { display: block; color: inherit; text-decoration: none; }
.dlazdice .karta { padding: .8rem 1rem; height: 100%; }
.dlazdice .cislo { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.dlazdice .po_terminu .cislo { color: var(--cervena); }
.dlazdice .blizi_se .cislo { color: var(--zluta); }
.dlazdice .ok .cislo { color: var(--zelena); }
.dlazdice a:hover .karta { border-color: var(--modra); }

/* --- tabulky --- */
.tabulka-obal { overflow-x: auto; background: var(--plocha); border: 1px solid var(--okraj); border-radius: var(--radius); box-shadow: var(--stin); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--okraj); vertical-align: top; }
th { font-size: .82rem; color: var(--tlumeny); font-weight: 600; background: #fafbfc; position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: #f8fafd; }
tbody tr:last-child td { border-bottom: 0; }
td.cislo, th.cislo { white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tr.neprovadet td { color: var(--tlumeny); }
.radek-akce { white-space: nowrap; text-align: right; }

/* --- štítky stavu --- */
.stitek { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.stitek.po_terminu { background: var(--cervena-pozadi); color: var(--cervena); }
.stitek.blizi_se { background: var(--zluta-pozadi); color: var(--zluta); }
.stitek.ok { background: var(--zelena-pozadi); color: var(--zelena); }
.stitek.bez_terminu, .stitek.neprovadet { background: var(--seda-pozadi); color: var(--tlumeny); }
.stitek.info { background: var(--modra-svetla); color: var(--modra); }
.stitek.varovani { background: var(--zluta-pozadi); color: var(--zluta); }

/* --- matice --- */
.matice td, .matice th { padding: .3rem .4rem; text-align: center; font-size: .85rem; }
.matice td:first-child, .matice td:nth-child(2), .matice th:first-child, .matice th:nth-child(2) { text-align: left; }
.matice td.bunka a { display: block; border-radius: 4px; padding: .2rem .3rem; color: inherit; white-space: nowrap; }
.matice td.po_terminu a { background: var(--cervena-pozadi); color: var(--cervena); }
.matice td.blizi_se a { background: var(--zluta-pozadi); color: var(--zluta); }
.matice td.ok a { background: var(--zelena-pozadi); color: var(--zelena); }
.matice td.bez_terminu a, .matice td.neprovadet a { background: var(--seda-pozadi); color: var(--tlumeny); }

/* --- formuláře --- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .2rem; }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .45rem .55rem; border: 1px solid #c5ccd6; border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fbbe0; border-color: var(--modra); }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; vertical-align: middle; }
.pole { margin-bottom: .8rem; }
.pole .napoveda { font-size: .8rem; color: var(--tlumeny); margin-top: .15rem; }
.pole .chyba { color: var(--cervena); font-size: .85rem; }
.pole.zaskrtavaci label { display: flex; gap: .45rem; align-items: center; font-weight: 500; }
.mrizka { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 .9rem; }
.filtry { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .8rem; }
.filtry > div { min-width: 140px; }
.filtry label { font-size: .78rem; color: var(--tlumeny); }
.checkboxy ul { list-style: none; padding: 0; margin: 0; }
.checkboxy li label { display: flex; gap: .5rem; align-items: center; font-weight: 500; padding: .2rem 0; }

.tlacitko, button.tlacitko {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 6px;
  border: 1px solid var(--modra); background: var(--modra); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.tlacitko:hover { filter: brightness(1.08); text-decoration: none; }
.tlacitko.vedlejsi { background: #fff; color: var(--modra); }
.tlacitko.nebezpecne { background: #fff; color: var(--cervena); border-color: #e3a7a2; }
.tlacitko.male { padding: .2rem .55rem; font-size: .85rem; font-weight: 500; }
.akce { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.panel-akci {
  position: sticky; bottom: 0; background: var(--plocha); border-top: 1px solid var(--okraj);
  padding: .6rem 1rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; z-index: 5;
}
.panel-akci > div { min-width: 140px; }

/* --- dialog --- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(720px, calc(100vw - 2rem)); box-shadow: 0 10px 40px rgb(0 0 0 / 25%); }
dialog::backdrop { background: rgb(15 25 40 / 45%); }
dialog .dialog-obsah { padding: 1.25rem 1.4rem; max-height: 85vh; overflow: auto; }
dialog .zavrit { float: right; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--tlumeny); }

/* --- kontrola importu --- */
.kontrola { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.kontrola .nahled { position: sticky; top: 4rem; height: calc(100vh - 5.5rem); }
.kontrola .nahled iframe { width: 100%; height: 100%; border: 1px solid var(--okraj); border-radius: var(--radius); background: #fff; }
.blok { background: var(--plocha); border: 1px solid var(--okraj); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .8rem; }
.blok.vypnuto { opacity: .55; }
.blok-hlavicka { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.blok-hlavicka label { display: flex; gap: .5rem; align-items: center; margin: 0; font-size: 1rem; }
.upozorneni { background: var(--zluta-pozadi); color: var(--zluta); padding: .45rem .7rem; border-radius: 6px; font-size: .88rem; margin: .4rem 0; }
.upozorneni.info { background: var(--modra-svetla); color: var(--modra); }
.zavada-radek { display: grid; grid-template-columns: auto 1fr 130px; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--okraj); }
.zavada-radek:first-of-type { border-top: 0; }
.zavada-radek select { margin-top: .3rem; font-size: .85rem; }
details summary { cursor: pointer; color: var(--modra); }
pre.json { background: #f6f8fa; padding: .7rem; border-radius: 6px; overflow: auto; font-size: .78rem; max-height: 400px; }

.historie { margin: .3rem 0 0; padding-left: 1rem; font-size: .88rem; color: var(--tlumeny); }
.prazdne { padding: 1.2rem; text-align: center; color: var(--tlumeny); }
.email-text { white-space: pre-wrap; background: #f6f8fa; padding: .8rem; border-radius: 6px; font-family: inherit; }

@media (max-width: 900px) {
  .kontrola { grid-template-columns: 1fr; }
  .kontrola .nahled { position: static; height: 70vh; }
  main { padding: 1rem; }
  .lista { gap: .6rem; padding: .5rem 1rem; }
}
