/* Školní plán: klidné a čitelné prostředí.
   Pravidla (CLAUDE.md): písmo aspoň 18 px, vysoký kontrast (text AAA), klikací plochy aspoň 44 × 44 px,
   viditelné zaměření z klávesnice, žádné animace ani vyskakovací okna, při zvětšení na 200 % se nic nerozpadne. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1a2330;          /* 15,8 : 1 na bílé */
  --text-muted: #3d4854;    /* 9,3 : 1 na bílé */
  --primary: #1d4f7c;       /* bílý text na něm 8,5 : 1 */
  --primary-dark: #163d60;
  --primary-soft: #e6eef6;
  --border: #d5d9de;        /* jen dekorativní oddělení */
  --border-strong: #6b7785; /* okraje polí a tlačítek, 4,6 : 1 */
  --focus: #a14a00;         /* zaměření z klávesnice, 6 : 1 */
  --ok-bg: #e3f1e6;   --ok-text: #1d5b2b;
  --wait-bg: #fdf1d8; --wait-text: #6b4500;
  --neutral-bg: #eceff2; --neutral-text: #2f3a46;
  --info-bg: #e6eef6; --info-text: #1d4f7c;
  --error-bg: #fbeaea; --error-text: #7a1f1f;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, Arial, sans-serif;
  --radius: 6px;
  --target: 2.75rem;        /* 44 px */
  --space: 1rem;
  --measure: 46rem;         /* šířka textu pro pohodlné čtení */
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.125rem;      /* 18 px */
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 650; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; margin-top: 1.6em; }
h3 { font-size: 1.2rem; margin-top: 1.4em; }
h4 { font-size: 1.1rem; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: 0.3em; }

a { color: var(--primary); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { color: var(--primary-dark); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -10rem;
  background: var(--surface);
  color: var(--primary);
  padding: 0.6rem 1rem;
  border: 2px solid var(--primary);
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Hlavička ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.brand-name {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary);
  text-decoration: none;
  min-height: var(--target);
  display: inline-flex;
  align-items: center;
}
.brand-name:hover { text-decoration: underline; }
.brand-org { font-size: 1.05rem; color: var(--text); }
.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 1rem;
}
.header-meta form { margin: 0; }
.header-user { color: var(--text); }

/* ---------- Rozvržení: menu vlevo, obsah vpravo ---------- */

.shell {
  flex: 1;
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
  align-items: start;
}
.shell--no-nav { grid-template-columns: minmax(0, 1fr); }

.side-nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  min-height: 100%;
}
.side-nav ul { list-style: none; margin: 0; padding: 0; }
.side-nav li + li { margin-top: 0.25rem; }
.side-nav a {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.side-nav a:hover { background: var(--primary-soft); text-decoration: underline; }
.side-nav a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 4px 0 0 var(--primary);
}

main {
  padding: 1.25rem 1.75rem 3rem;
  min-width: 0;
}
.content { max-width: var(--measure); }
.content--wide { max-width: none; }

@media (max-width: 52rem) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side-nav { border-right: 0; border-bottom: 1px solid var(--border); min-height: 0; padding: 0.5rem 1rem; }
  .side-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; }
  .side-nav li + li { margin-top: 0; }
  main { padding: 1rem 1rem 2.5rem; }
}

/* ---------- Drobečková navigace ---------- */

.breadcrumbs ol {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.4rem;
  font-size: 1rem;
  color: var(--text-muted);
}
.breadcrumbs li + li { margin-top: 0; }
.breadcrumbs li + li::before { content: "›"; margin-right: 0.4rem; color: var(--text-muted); }
.breadcrumbs a { display: inline-block; padding: 0.55rem 0; }
.breadcrumbs [aria-current="page"] { display: inline-block; padding: 0.55rem 0; color: var(--text); }

/* ---------- Tlačítka ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--target);
  min-width: var(--target);
  padding: 0.55rem 1.25rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #ffffff; text-decoration: none; }
.button--secondary { background: var(--surface); color: var(--primary); }
.button--secondary:hover { background: var(--primary-soft); color: var(--primary-dark); }
.button--danger { background: var(--surface); color: var(--error-text); border-color: var(--error-text); }
.button--danger:hover { background: var(--error-bg); color: var(--error-text); }
.button[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Tlačítko, které vypadá jako odkaz (např. „Odhlásit se“ v hlavičce). */
.link-button {
  background: none;
  border: 0;
  padding: 0 0.25rem;
  min-height: var(--target);
  font: inherit;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.link-button:hover { color: var(--primary-dark); text-decoration-thickness: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1.25rem 0; }

/* ---------- Formuláře ---------- */

.field { margin: 0 0 1.25rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field-hint { display: block; color: var(--text-muted); font-size: 1rem; margin-bottom: 0.4rem; }
.field-error { display: block; color: var(--error-text); font-weight: 600; margin-top: 0.3rem; }
input[type="text"], input[type="email"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  min-height: var(--target);
  width: 100%;
  max-width: 32rem;
}
textarea { min-height: 8rem; max-width: var(--measure); line-height: 1.5; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error-text); }

/* ---------- Zprávy, štítky, nápověda ---------- */

.flash {
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin: 0 0 1.25rem;
  max-width: var(--measure);
  border: 1px solid transparent;
}
.flash--ok { background: var(--ok-bg); color: var(--ok-text); border-color: #b9d9c0; }
.flash--info { background: var(--info-bg); color: var(--info-text); border-color: #bcd0e4; }
.flash--chyba { background: var(--error-bg); color: var(--error-text); border-color: #e5bcbc; }
.flash p:last-child { margin-bottom: 0; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--neutral-bg);
  color: var(--neutral-text);
}
.badge--ok { background: var(--ok-bg); color: var(--ok-text); }
.badge--wait { background: var(--wait-bg); color: var(--wait-text); }
.badge--info { background: var(--info-bg); color: var(--info-text); }

.help {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1.5rem;
  max-width: var(--measure);
}
.help > summary {
  cursor: pointer;
  min-height: var(--target);
  display: flex;
  align-items: center;
  padding: 0.4rem 1rem;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.help > div { padding: 0 1rem 0.5rem; }

/* Potvrzení smazání přímo na stránce (bez vyskakovacího okna). */
.confirm > summary { list-style: none; display: inline-flex; }
.confirm > summary::-webkit-details-marker { display: none; }
.confirm-box {
  margin-top: 0.75rem;
  padding: 1rem;
  border: 2px solid var(--error-text);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: var(--measure);
}

/* ---------- Karty a prázdné stavy ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  max-width: 64rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.card h2, .card h3 { margin-top: 0; font-size: 1.2rem; }
.card p { color: var(--text-muted); flex: 1; }
.card a.card-link { align-self: flex-start; min-height: var(--target); display: inline-flex; align-items: center; font-weight: 600; }

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: var(--measure);
}
.empty-state h2 { margin-top: 0; font-size: 1.3rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  max-width: var(--measure);
  margin: 0 0 1.5rem;
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child { margin-bottom: 0; }

.muted { color: var(--text-muted); }
.lead { font-size: 1.25rem; max-width: var(--measure); }

/* ---------- Tabulky ---------- */

table { border-collapse: collapse; margin: 0 0 1.5rem; background: var(--surface); }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }
th { background: var(--neutral-bg); font-weight: 650; }
.table-wrap { overflow-x: auto; max-width: 100%; }

/* ---------- Patička ---------- */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  font-size: 1rem;
  color: var(--text-muted);
}
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; }
.site-footer .footer-links a:not(.button) { display: inline-flex; align-items: center; min-height: var(--target); }
.site-footer .footer-note { margin-left: auto; }

/* Úzké prostředí bez menu (přihlášení, úvodní strana). */
.narrow { max-width: 36rem; }
