/* UI. Mobil první: navigace je na úzké obrazovce za tlačítkem Menu,
   od 800 px stojí vlevo jako sloupec. */

:root {
  --pozadi: #f5f6f8;
  --karta: #ffffff;
  --text: #1c1f24;
  --tlumeny: #5c6470;
  --akcent: #1f6f5c;
  --akcent-text: #ffffff;
  --okraj: #d9dde3;
  --chyba: #b3261e;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--pozadi);
}

button {
  font: inherit;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--akcent);
  border-radius: 6px;
  background: var(--akcent);
  color: var(--akcent-text);
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }

input,
select,
textarea {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--okraj);
  border-radius: 6px;
  background: var(--karta);
}

:focus-visible { outline: 3px solid #7fb8a8; outline-offset: 2px; }

/* Přihlášení */

.prihlaseni {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.karta {
  width: 100%;
  max-width: 360px;
  padding: 1.5rem;
  background: var(--karta);
  border: 1px solid var(--okraj);
  border-radius: 10px;
  display: grid;
  gap: 0.5rem;
}

.karta h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.karta label { font-weight: 600; margin-top: 0.5rem; }
.karta button { margin-top: 1rem; }

.chyba { color: var(--chyba); margin: 0.5rem 0 0; }

/* Aplikace */

.hlavicka {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--karta);
  border-bottom: 1px solid var(--okraj);
}

.nazev { font-weight: 700; }

.uzivatel {
  margin-left: auto;
  color: var(--tlumeny);
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.odhlasit,
.prepinac-menu {
  background: transparent;
  color: var(--akcent);
}

.navigace {
  display: none;
  flex-direction: column;
  background: var(--karta);
  border-bottom: 1px solid var(--okraj);
}

.navigace.otevrena { display: flex; }

.navigace a {
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  border-left: 4px solid transparent;
}

.navigace a[aria-current="page"] {
  border-left-color: var(--akcent);
  font-weight: 600;
  background: var(--pozadi);
}

.obsah { padding: 1rem; }
.obsah h1 { margin-top: 0; }
.prazdne { color: var(--tlumeny); }

/* Obrazovky */

.obrazovka section { margin: 0 0 2rem; }
.obrazovka h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; }

.druhotne {
  background: var(--karta);
  color: var(--akcent);
}

.nebezpecne {
  background: var(--karta);
  color: var(--chyba);
  border-color: var(--chyba);
}

.tlacitka {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.info { color: var(--akcent); margin: 0.5rem 0; font-weight: 600; }
.napoveda, .drobne { display: block; color: var(--tlumeny); font-size: 0.875rem; }
.napoveda { margin: 0.25rem 0 0; }

.dobre { color: var(--akcent); }
.spatne { color: var(--chyba); }

.stitek {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.875rem;
}

.upozorneni {
  padding: 0.75rem 1rem;
  border: 1px solid #e0b252;
  border-radius: 8px;
  background: #fff8e6;
}

.upozorneni h2 { margin-top: 0; }

/* Formuláře */

.formular {
  margin: 0.75rem 0 1.5rem;
  padding: 1rem;
  background: var(--karta);
  border: 1px solid var(--okraj);
  border-radius: 10px;
}

.formular h2 { margin-top: 0; }

.pole-formulare {
  display: grid;
  gap: 0.75rem;
}

.pole { display: grid; gap: 0.25rem; }
.pole label { font-weight: 600; }

.pole-zaskrtnuti {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pole-zaskrtnuti input {
  width: 1.5rem;
  min-height: 1.5rem;
  margin: 0;
}

textarea { min-height: 4rem; resize: vertical; }

/* Výběr měsíce */

.vyber-mesice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.vyber-mesice .pole-mesice { width: auto; flex: 0 1 11rem; }
.vyber-mesice button { min-width: 44px; padding: 0; font-size: 1.25rem; }
.popis-mesice { color: var(--tlumeny); }

/* Souhrn: dvojice popis a hodnota */

.souhrn {
  display: grid;
  gap: 0.25rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--karta);
  border: 1px solid var(--okraj);
  border-radius: 10px;
}

.souhrn > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.souhrn dt { color: var(--tlumeny); }
.souhrn dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; }
.souhrn .dobre dd { color: var(--akcent); }
.souhrn .spatne dd { color: var(--chyba); }

.veta { font-weight: 600; }

/* Tabulky. Na úzké obrazovce je každý řádek karta a buňka nese popis
   sloupce z data-popis (dom.js). */

.tabulka { width: 100%; border-collapse: collapse; }
.tabulka thead { display: none; }

.tabulka tr {
  display: block;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--karta);
  border: 1px solid var(--okraj);
  border-radius: 10px;
}

.tabulka td {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
  text-align: right;
}

.tabulka td::before {
  content: attr(data-popis);
  color: var(--tlumeny);
  text-align: left;
}

.tabulka td:first-child { font-weight: 600; text-align: left; }
.tabulka td:first-child::before { content: none; }
.tabulka td:first-child > span { flex: 1; }
.tabulka tr.neaktivni { opacity: 0.6; }
.tabulka .cislo { white-space: nowrap; }

.akce {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  width: 100%;
}

@media (min-width: 800px) {
  .obal-tabulky { overflow-x: auto; }

  .tabulka {
    background: var(--karta);
    border: 1px solid var(--okraj);
    border-radius: 10px;
  }

  .tabulka thead { display: table-header-group; }
  .tabulka tr { display: table-row; margin: 0; padding: 0; border: none; border-radius: 0; background: none; }

  .tabulka th,
  .tabulka td {
    display: table-cell;
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--okraj);
  }

  .tabulka th { color: var(--tlumeny); font-weight: 600; font-size: 0.875rem; }
  .tabulka td::before { content: none; }
  .tabulka td:first-child { font-weight: 600; }
  .tabulka .cislo { text-align: right; }
  .tabulka tbody tr:last-child td { border-bottom: none; }
  .akce { justify-content: flex-start; flex-wrap: nowrap; }

  .pole-formulare { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pole-formulare .pole-zaskrtnuti { grid-column: 1 / -1; }
  .souhrn { max-width: 32rem; }
}

@media (min-width: 800px) {
  .aplikace {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }

  .hlavicka { grid-column: 1 / -1; }
  .prepinac-menu { display: none; }

  .navigace,
  .navigace.otevrena {
    display: flex;
    border-bottom: none;
    border-right: 1px solid var(--okraj);
  }

  .obsah { padding: 1.5rem 2rem; }
}
