:root {
  --accent: var(--brand, #2F5D46);
  --accent-ink: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --bg: #F3F4F1;
  --surface: #FFFFFF;
  --surface-2: #F0F1EE;
  --ink: #18201C;
  --ink-2: #4A534E;
  --muted: #7C847F;
  --line: rgba(20, 30, 25, .09);
  --shadow: 0 1px 2px rgba(20,30,25,.05), 0 6px 20px rgba(20,30,25,.06);
  --pending: #C9810F;
  --pending-soft: #FFF3DC;
  --ok: #23824F;
  --ok-soft: #E3F4EA;
  --bad: #B83C2B;
  --bad-soft: #FBE7E3;
  --neutral-soft: #EDEEEB;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --surface: #1C211E;
    --surface-2: #262C29;
    --ink: #EEF1EF;
    --ink-2: #C3CAC6;
    --muted: #8E9792;
    --line: rgba(255,255,255,.08);
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --accent: color-mix(in srgb, var(--brand, #2F5D46) 55%, #fff);
    --accent-ink: #0E1411;
    --pending: #F0B24A; --pending-soft: #3A2E17;
    --ok: #5FC48C; --ok-soft: #173325;
    --bad: #F08070; --bad-soft: #3B1F1A;
    --neutral-soft: #2A302D;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- Přihlášení ---------- */
.login {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); text-align: center;
}
.login .logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: var(--shadow); }
.login h1 { margin: 18px 0 4px; font-size: 24px; letter-spacing: -.02em; }
.login p { margin: 0; color: var(--muted); font-size: 15px; }
.pin-dots { display: flex; gap: 16px; margin: 30px 0 10px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); transition: background .15s, border-color .15s; }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-msg { min-height: 22px; font-size: 14px; color: var(--bad); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; margin-top: 14px; }
.keypad button {
  width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  font-size: 28px; font-weight: 400; cursor: pointer; transition: transform .08s, background .15s;
}
.keypad button:active { transform: scale(.94); background: var(--surface-2); }
.keypad button.ghost { background: none; box-shadow: none; font-size: 15px; color: var(--muted); }
.login .hint { margin-top: 26px; font-size: 13px; color: var(--muted); }

/* ---------- Hlavní obrazovka ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  padding: calc(10px + var(--safe-top)) 16px 0;
}
.topbar-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.025em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: -2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; position: relative; flex: none;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .badge-dot { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }

.tabs { display: flex; gap: 6px; margin: 12px -16px 0; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--surface); color: var(--ink-2);
  font-size: 14.5px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px;
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.tab .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--pending); color: #fff; font-size: 12px; display: inline-grid; place-items: center; }
.tab .count.zero { background: var(--surface-2); color: var(--muted); }
.tab[aria-selected="true"] .count.zero { background: rgba(255,255,255,.2); color: inherit; }

main.list { padding: 6px 16px calc(110px + var(--safe-bottom)); max-width: 720px; margin: 0 auto; }

.banner {
  display: flex; gap: 12px; align-items: center; padding: 14px; margin: 6px 0 12px; border-radius: 16px;
  background: var(--accent); color: var(--accent-ink);
}
.banner svg { width: 26px; height: 26px; flex: none; }
.banner div { flex: 1; font-size: 14px; line-height: 1.35; }
.banner b { display: block; font-size: 15px; }
.banner button { border: 0; border-radius: 999px; padding: 9px 14px; background: var(--accent-ink); color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; flex: none; }
.banner.ios { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.banner.ios .share { display: inline-block; vertical-align: -3px; width: 17px; height: 17px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.stat { background: var(--surface); border-radius: 14px; padding: 11px 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

.day-head { margin: 18px 4px 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; }
.day-head small { font-weight: 600; text-transform: none; letter-spacing: 0; }

.res {
  display: flex; gap: 14px; padding: 14px; margin-bottom: 10px; border-radius: 18px; background: var(--surface);
  box-shadow: var(--shadow); cursor: pointer; position: relative; overflow: hidden; border: 0; width: 100%; text-align: left;
  transition: transform .1s;
}
.res:active { transform: scale(.985); }
.res.is-new { animation: flash 2.4s ease; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--pending), var(--shadow); } 100% { box-shadow: var(--shadow); } }
.res::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; }
.res.pending::before { background: var(--pending); }
.res.confirmed::before { background: var(--ok); }
.res .time { flex: none; width: 56px; text-align: center; padding-top: 1px; }
.res .time b { display: block; font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.res .time span { font-size: 12px; color: var(--muted); }
.res .body { flex: 1; min-width: 0; }
.res .name { font-size: 16.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.res .note { margin-top: 7px; font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.res .quick { display: flex; gap: 8px; margin-top: 12px; }
.res .quick button { flex: 1; border: 0; border-radius: 12px; padding: 10px; font-weight: 700; font-size: 14.5px; cursor: pointer; }
.res .quick .yes { background: var(--ok); color: #fff; }
.res .quick .no { background: var(--surface-2); color: var(--ink-2); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--neutral-soft); color: var(--ink-2); }
.chip svg { width: 13px; height: 13px; }
.chip.pending { background: var(--pending-soft); color: var(--pending); }
.chip.confirmed, .chip.seated { background: var(--ok-soft); color: var(--ok); }
.chip.declined, .chip.cancelled, .chip.noshow { background: var(--bad-soft); color: var(--bad); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 54px; height: 54px; opacity: .5; }
.empty-state b { display: block; margin-top: 12px; color: var(--ink-2); font-size: 17px; }

.fab {
  position: fixed; right: 18px; bottom: calc(22px + var(--safe-bottom)); z-index: 25; height: 56px; padding: 0 22px 0 18px;
  border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 15.5px;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.22); cursor: pointer;
}
.fab svg { width: 22px; height: 22px; }

/* ---------- Spodní panel (detail, nastavení, formuláře) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10,14,12,.45); opacity: 0; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: calc(100dvh - var(--safe-top) - 24px);
  background: var(--bg); border-radius: 22px 22px 0 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.9,.25,1);
  padding: 0 16px calc(20px + var(--safe-bottom)); max-width: 720px; margin: 0 auto;
}
.sheet.open { transform: none; }
.sheet .grabber { position: sticky; top: 0; z-index: 2; padding: 9px 0 6px; background: var(--bg); display: flex; justify-content: center; }
.sheet .grabber i { width: 38px; height: 5px; border-radius: 3px; background: var(--line); background: color-mix(in srgb, var(--ink) 18%, transparent); }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin: 4px 2px 14px; }
.sheet-head h2 { margin: 0; flex: 1; font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.sheet-head .icon-btn { width: 34px; height: 34px; box-shadow: none; background: var(--surface-2); }
.sheet-head .icon-btn svg { width: 17px; height: 17px; }

.group { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.group-title { margin: 18px 6px 7px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-height: 50px; }
.row + .row { border-top: 1px solid var(--line); }
.row .k { color: var(--muted); font-size: 14.5px; flex: none; width: 92px; }
.row .v { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.row .v.big { font-size: 20px; letter-spacing: -.01em; }
.row button.v { text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.row .ic { width: 22px; height: 22px; color: var(--muted); flex: none; }
.row.switch-row { justify-content: space-between; }

.hero-when { display: flex; gap: 10px; margin-bottom: 14px; }
.hero-when > div { flex: 1; background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.hero-when b { display: block; font-size: clamp(17px, 5.4vw, 22px); white-space: nowrap; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-when span { font-size: 13px; color: var(--muted); }

.guest-note { background: var(--pending-soft); color: var(--ink); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.guest-note small { display: block; font-size: 12px; font-weight: 700; color: var(--pending); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }

.contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.contact-actions a {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); text-decoration: none; font-weight: 650; color: var(--accent);
}
.contact-actions svg { width: 20px; height: 20px; }

.actions { display: grid; gap: 10px; margin: 6px 0 16px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.btn {
  border: 0; border-radius: 14px; padding: 15px; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  text-decoration: none;
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn.ok { background: var(--ok); color: #fff; box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.dark { background: var(--ink); color: var(--bg); box-shadow: none; }
.btn:disabled { opacity: .5; }

.tables { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.tables button { border: 0; border-radius: 10px; padding: 9px 13px; background: var(--surface-2); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.tables button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

textarea.input, input.input {
  width: 100%; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 13px 14px; outline: none; resize: none;
}
.field-row { display: flex; align-items: center; padding: 0 0 0 14px; }
.field-row + .field-row { border-top: 1px solid var(--line); }
.field-row label { width: 92px; flex: none; color: var(--muted); font-size: 14.5px; }
.field-row .input { padding-left: 0; }
.stepper { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 0; margin-left: auto; }
.stepper button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-2); font-size: 20px; cursor: pointer; }
.stepper output { min-width: 34px; text-align: center; font-weight: 700; }

.reasons { display: grid; gap: 8px; margin-bottom: 12px; }
.reasons button { text-align: left; border: 0; border-radius: 14px; padding: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: 15px; cursor: pointer; }
.reasons button[aria-pressed="true"] { outline: 2px solid var(--bad); }

.timeline { padding: 6px 14px; }
.timeline div { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--ink-2); }
.timeline time { color: var(--muted); flex: none; width: 108px; font-variant-numeric: tabular-nums; }

.toggle { position: relative; width: 51px; height: 31px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); transition: background .2s; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.toggle span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s; }
.toggle input:checked + span { background: var(--ok); }
.toggle input:checked + span::after { transform: translateX(20px); }
.help { font-size: 13px; color: var(--muted); margin: -6px 8px 14px; line-height: 1.45; }

/* ---------- Toasty ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(10px + var(--safe-top)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; width: 100%; max-width: 440px; display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.2);
  animation: drop .35s cubic-bezier(.2,1.2,.4,1); cursor: pointer; border: 0; text-align: left;
}
.toast.out { animation: lift .25s ease forwards; }
.toast img { width: 38px; height: 38px; border-radius: 10px; flex: none; }
.toast .t { flex: 1; min-width: 0; font-size: 14px; }
.toast .t b { display: block; font-size: 15px; }
.toast.simple { justify-content: center; font-weight: 600; background: var(--ink); color: var(--bg); max-width: max-content; padding: 11px 18px; }
@keyframes drop { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lift { to { transform: translateY(-30px); opacity: 0; } }

@media (min-width: 760px) {
  .sheet { border-radius: 22px; bottom: 20px; max-height: calc(100dvh - 40px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
