:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #1b2624;
  --muted: #5f6b68;
  --line: #e2ded5;
  --accent: #1e5b4b;
  --accent-2: #2a7a64;
  --accent-ink: #ffffff;
  --free-bg: #e6f1ec;
  --free-ink: #1e5b4b;
  --off-bg: #eeece7;
  --off-ink: #8b918e;
  --err: #b42318;
  --err-bg: #fdecea;
  --ok-bg: #e6f1ec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 28, .06), 0 2px 8px rgba(20, 30, 28, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121816;
    --card: #1a2220;
    --ink: #e8eeec;
    --muted: #9aa7a3;
    --line: #2b3633;
    --accent: #2f8a71;
    --accent-2: #3aa085;
    --free-bg: #1d3029;
    --free-ink: #8fd6bd;
    --off-bg: #0e1312;
    --off-ink: #69736f;
    --err: #ff8a80;
    --err-bg: #3a1f1d;
    --ok-bg: #1d3029;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent-2); }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 420px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }

/* Hlavička */
.top { background: var(--accent); color: var(--accent-ink); padding: 28px 0 24px; }
.top h1 { margin: 0; font-size: 1.75rem; line-height: 1.2; letter-spacing: -.01em; }
.eyebrow { margin: 0 0 6px; font-size: .85rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.lead { margin: 12px 0 0; opacity: .92; }

/* Přehled dnů */
.days {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px;
  margin: 0 -16px; padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.days a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; padding: 6px 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); text-decoration: none; text-align: center; line-height: 1.2;
}
.days .d { font-weight: 700; font-size: .95rem; white-space: nowrap; }
.days .f { font-size: .78rem; color: var(--free-ink); margin-top: 2px; }
.days a.full .f { color: var(--off-ink); }

/* Den */
.day { margin: 28px 0 0; }
.day h2 { margin: 0; font-size: 1.3rem; }
.count { margin: 2px 0 12px; color: var(--muted); font-size: .95rem; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* Termín */
.slot {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.slot > summary, li.slot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 58px; padding: 10px 16px;
}
.slot > summary { cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.slot > summary::-webkit-details-marker { display: none; }
.time { font-weight: 650; font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 999px; font-size: .9rem; font-weight: 600; white-space: nowrap;
}
.slot.free .tag { background: var(--free-bg); color: var(--free-ink); }
.slot.free .tag svg { transition: transform .15s; }
.slot.free[open] { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2); }
.slot.free[open] .tag svg { transform: rotate(90deg); }
.slot.free > summary:active { background: var(--free-bg); border-radius: var(--radius); }
li.slot.off { background: var(--off-bg); box-shadow: none; color: var(--off-ink); }
li.slot.off .tag { padding-right: 0; font-weight: 500; }

/* Formulář */
.book { display: grid; gap: 12px; padding: 4px 16px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, select {
  width: 100%; min-height: 50px; padding: 10px 14px;
  font: inherit; font-size: 17px; font-weight: 400; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px;
}
input:focus, select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 20px;
  font: inherit; font-weight: 650; color: var(--accent-ink); text-decoration: none;
  background: var(--accent); border: 0; border-radius: 12px; cursor: pointer;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .6; }
.btn.ghost { background: transparent; color: inherit; border: 1.5px solid currentColor; min-height: 44px; }
.btn.danger { background: transparent; color: var(--err); border: 1.5px solid var(--err); min-height: 44px; }

/* Hlášky */
.alert, .notice, .flash, .form-err { border-radius: 12px; padding: 12px 16px; margin: 16px 0 0; }
.alert, .form-err { background: var(--err-bg); color: var(--err); font-weight: 600; }
.form-err { margin: 0; font-size: .95rem; }
.notice { background: var(--off-bg); color: var(--muted); }
.flash { background: var(--ok-bg); color: var(--free-ink); font-weight: 600; }

/* Potvrzení */
.done {
  margin: 24px 0 16px; padding: 28px 20px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.done-icon {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; background: var(--free-bg); color: var(--free-ink);
}
.done h2 { margin: 0 0 8px; font-size: 1.4rem; }
.done-slot { font-size: 1.15rem; margin: 0 0 16px; }
.done-slot strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.done .btn { width: 100%; max-width: 320px; }
.done .small { margin: 16px 0 0; }

.foot { margin: 28px 0 40px; text-align: center; }

/* ---------- Administrace ---------- */
.admin .top { padding: 18px 0; }
.admin .top h1 { font-size: 1.3rem; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 16px 0 0; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 1.1rem; }
.login { margin-top: 15vh; display: grid; gap: 14px; }
.login h1 { margin: 0; font-size: 1.4rem; }
.stats { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stats > div { flex: 1; min-width: 160px; }
.big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--off-bg); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; background: var(--accent-2); }
.copy { display: flex; gap: 8px; margin: 8px 0 16px; }
.copy input { min-width: 0; font-size: 15px; }
.copy .btn { flex: none; }
.settings { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); }
.admin-slots .slot > summary { min-height: 54px; }
.slot.empty { background: var(--off-bg); box-shadow: none; }
.who { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who strong { overflow-wrap: anywhere; }
.who small { font-size: .78rem; }
.act { font-size: .85rem; font-weight: 600; color: var(--accent-2); }
.slot-body { border-top: 1px solid var(--line); }
.slot-body .book { border-top: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.danger-form { padding: 0 16px 16px; }
.danger-form .btn { width: 100%; }
li.hl .slot { box-shadow: 0 0 0 2px var(--accent-2); }
.history { margin: 28px 0 40px; }
.history > summary { cursor: pointer; list-style: none; }
.history > summary::-webkit-details-marker { display: none; }
.history > summary h2 { display: inline; }
.history > summary::after { content: " ›"; color: var(--muted); }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

@media (max-width: 380px) {
  .row2 { grid-template-columns: 1fr; }
  .days .f { font-size: .72rem; }
}
