:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --ink: #2b2522;
  --ink-2: #6f6560;
  --muted: #9a8f87;
  --line: #eee5dc;
  --accent: #d9694f;
  --accent-ink: #8a3b28;
  --accent-soft: #f8e3d9;
  --sage: #8fa98f;
  --sage-ink: #43604a;
  --sage-soft: #e3ece3;
  --sand-soft: #f3ebe1;
  --danger: #c2412d;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(43, 37, 34, 0.04), 0 6px 20px rgba(43, 37, 34, 0.06);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-display: -apple-system-headline, -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* ---------- Hlavička ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 12px) 20px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 650; font-size: 19px; letter-spacing: -0.02em; }
.brand svg { display: block; }
.me-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; color: var(--accent-ink); cursor: pointer; }

main { padding: 4px 20px calc(var(--safe-b) + 110px); }
.eyebrow { font-size: 13px; color: var(--muted); margin: 6px 0 2px; }
h1 { font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; margin: 0 0 18px; }
h2 { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-2); margin: 26px 0 10px; }

/* ---------- Hero karta ---------- */
.hero { background: var(--accent); color: #fff; border-radius: 26px; padding: 20px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; width: 150px; height: 150px; border-radius: 50%; right: -70px; top: -80px; background: rgba(255, 255, 255, 0.14); }
.hero::before { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -10px; top: -78px; background: rgba(143, 169, 143, 0.4); }
.hero .t { padding-right: 76px; }
.hero .s, .hero .k { padding-right: 70px; }
.hero .k { font-size: 13px; opacity: 0.9; position: relative; }
.hero .t { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 4px 0 6px; position: relative; }
.hero .s { font-size: 14px; opacity: 0.95; position: relative; }
.hero .count { position: absolute; right: 18px; bottom: 16px; text-align: right; }
.hero .count b { display: block; font-family: var(--font-display); font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.hero .count span { font-size: 12px; opacity: 0.9; }
.hero .cta { margin-top: 14px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.2); border: 0; color: #fff; padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; cursor: pointer; position: relative; }
.hero.empty { background: var(--sage-soft); color: var(--sage-ink); }
.hero.empty::before, .hero.empty::after { display: none; }

/* ---------- Seznamy ---------- */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.row + .row { border-top: 1px solid var(--line); }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--muted); margin-top: 1px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row .when { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.row .when.soon { color: var(--accent); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; flex: none; }
.datebox { width: 44px; flex: none; text-align: center; border-radius: 12px; background: var(--sand-soft); padding: 5px 0 4px; }
.datebox b { display: block; font-family: var(--font-display); font-size: 18px; line-height: 1; }
.datebox span { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; }
.tag.bd { background: var(--accent-soft); color: var(--accent-ink); }
.tag.nd { background: var(--sage-soft); color: var(--sage-ink); }
.tag.plain { background: var(--sand-soft); color: var(--ink-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.bd { background: var(--accent); }
.dot.nd { background: var(--sage); }

.empty-state { text-align: center; padding: 34px 20px; color: var(--ink-2); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state .ill { margin: 0 auto 10px; width: 64px; }
.empty-state p { margin: 6px 0 14px; font-size: 14px; }

/* ---------- Kalendář ---------- */
.cal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 12px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.cal-head b { font-family: var(--font-display); font-size: 18px; font-weight: 650; text-transform: capitalize; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--sand-soft); display: grid; place-items: center; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.grid .wd { font-size: 11px; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.day { aspect-ratio: 1; border: 0; background: none; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 15px; cursor: pointer; position: relative; }
.day.out { visibility: hidden; }
.day.today { color: var(--accent); font-weight: 700; }
.day.sel { background: var(--ink); color: #fff; }
.day .dots { display: flex; gap: 3px; height: 6px; }
.day.sel .dot.bd { background: #f3b7a7; }
.day.sel .dot.nd { background: #c6d8c6; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 10px 4px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dayinfo { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

/* ---------- Přání ---------- */
.seg { display: flex; background: var(--sand-soft); border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 8px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(43, 37, 34, 0.1); }
.note { display: flex; gap: 10px; align-items: center; background: var(--sage-soft); color: var(--sage-ink); border-radius: 16px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.wishes { display: grid; gap: 12px; }
.wish { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; gap: 12px; padding: 12px; align-items: flex-start; }
.wish .thumb { width: 64px; height: 64px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; overflow: hidden; }
.wish .thumb img { width: 100%; height: 100%; object-fit: cover; }
.wish .body { flex: 1; min-width: 0; }
.wish .title { font-weight: 600; font-size: 15px; line-height: 1.3; cursor: pointer; }
.wish .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.wish .price { font-weight: 600; color: var(--ink); }
.wish .desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.wish .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.wish.claimed .thumb { background: var(--sage-soft); color: var(--sage-ink); }
.wish.done { opacity: 0.6; }
.link { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-ink); text-decoration: none; font-weight: 500; }

/* ---------- Tlačítka a formuláře ---------- */
.btn { border: 0; border-radius: 999px; padding: 10px 16px; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.soft { background: var(--sand-soft); color: var(--ink); }
.btn.sage { background: var(--sage-soft); color: var(--sage-ink); }
.btn.ghost { background: none; color: var(--ink-2); }
.btn.danger { background: none; color: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; padding: 14px; }
.btn:disabled { opacity: 0.5; }

.field { margin-bottom: 14px; }
.field label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 16px; outline: none; appearance: none; -webkit-appearance: none; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a8f87' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 80px; resize: vertical; }
.cols { display: grid; grid-template-columns: 0.8fr 1.4fr 1fr; gap: 8px; }
.cols2 { display: grid; grid-template-columns: 0.8fr 1.4fr; gap: 8px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 13px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background 0.2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch input:checked { background: var(--sage); }
.switch input:checked::after { transform: translateX(20px); }
.err { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* ---------- Spodní lišta ---------- */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 12px); width: calc(min(520px, 100%) - 32px); display: flex; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px); border-radius: 26px; box-shadow: 0 8px 30px rgba(43, 37, 34, 0.12); padding: 6px; z-index: 10; }
.tabbar button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 7px 0 5px; border-radius: 20px; cursor: pointer; }
.tabbar button.on { color: var(--accent-ink); background: var(--accent-soft); }

.fab { position: fixed; right: max(20px, calc(50% - 240px)); bottom: calc(var(--safe-b) + 96px); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(217, 105, 79, 0.4); cursor: pointer; z-index: 9; }

/* ---------- Spodní panel (sheet) ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(43, 37, 34, 0.32); z-index: 20; opacity: 0; transition: opacity 0.2s; }
.backdrop.show { opacity: 1; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: min(520px, 100%); max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 28px 28px 0 0; padding: 10px 20px calc(var(--safe-b) + 24px); z-index: 21; transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.show { transform: translate(-50%, 0); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.sheet-foot { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 18px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 16px; margin-bottom: 14px; }
.card .row { padding: 12px 0; cursor: default; }

/* ---------- Přihlášení ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 28px calc(var(--safe-b) + 32px); }
.login .logo { margin-bottom: 18px; }
.login h1 { font-size: 40px; margin-bottom: 8px; }
.login .lead { color: var(--ink-2); font-size: 17px; margin: 0 0 32px; }
.login .demo { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 100px); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; opacity: 0; transition: all 0.25s; z-index: 40; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* ---------- Tmavý režim (třída html.dark nastavuje index.html podle volby nebo systému) ---------- */
html.dark {
    --bg: #171412;
    --surface: #221e1b;
    --ink: #f4ede7;
    --ink-2: #c3b8b0;
    --muted: #8f847c;
    --line: #342e2a;
    --accent: #e27a61;
    --accent-ink: #f3b7a7;
    --accent-soft: #3d2620;
    --sage: #8fa98f;
    --sage-ink: #c6d8c6;
    --sage-soft: #26302a;
    --sand-soft: #2c2622;
    --danger: #f08a75;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}
html.dark .tabbar { background: rgba(34, 30, 27, 0.9); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
html.dark .day.sel { background: var(--ink); color: var(--bg); }
html.dark .chip.on { color: var(--bg); }
html.dark .btn.dark { color: var(--bg); }
html.dark .seg button.on { box-shadow: none; }
html.dark .hero { color: #fff; }
html.dark .hero.empty { color: var(--sage-ink); }


.tag.an { background: #f6e9cf; color: #7a5413; }
.dot.an { background: #d9a24f; }
html.dark .tag.an { background: #3a2f1b; color: #ecc98a; }
html.dark .day.sel .dot.an { background: #ecc98a; }

.day.sel .dot.an { background: #f1d6a3; }

.av0 { background: var(--accent-soft); color: var(--accent-ink); }
.av1 { background: var(--sage-soft); color: var(--sage-ink); }
.av2 { background: #f6e9cf; color: #7a5413; }
.av3 { background: #ebe5f3; color: #574a78; }
.av4 { background: #e2edf1; color: #2f5866; }
html.dark .av2 { background: #3a2f1b; color: #ecc98a; }
html.dark .av3 { background: #2e2938; color: #c9bde6; }
html.dark .av4 { background: #1f2f35; color: #a9cfdc; }

.hero { cursor: pointer; }

.tabbar button { position: relative; }
.tab-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.seg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); vertical-align: 2px; margin-left: 2px; }
.tag.new { background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; vertical-align: 2px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text small { font-family: var(--font); font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--muted); margin-top: 2px; }
.login .couple { font-size: 17px; font-weight: 500; color: var(--accent-ink); margin: -2px 0 14px; letter-spacing: 0.01em; }
.login h1 + .couple + .lead { margin-top: 0; }

/* Kalendář: jmeniny pod číslem dne */
.day { aspect-ratio: auto; height: 60px; justify-content: flex-start; padding: 6px 1px 4px; gap: 1px; }
.day .dn { font-size: 15px; line-height: 1.2; }
.day .ndn { font-size: 9.5px; line-height: 1.15; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.day.sel .ndn { color: rgba(255, 255, 255, 0.75); }
.day .dots { margin-top: auto; }
html.dark .day.sel .ndn { color: rgba(23, 20, 18, 0.7); }


/* Šipka „upravit“ v řádcích */
.row .chev { color: color-mix(in srgb, var(--muted) 55%, transparent); display: flex; margin-left: -4px; flex: none; }
.row:hover .chev { color: var(--muted); }

/* ---------- Spodní lišta: tmavý dok (varianta B) ---------- */
.tabbar { background: #2b2522; box-shadow: 0 10px 30px rgba(43, 37, 34, 0.3); }
.tabbar button { color: #d8cec6; }
.tabbar button.on { background: var(--accent); color: #fff; }
.tab-dot { box-shadow: 0 0 0 2px #2b2522; }
html.dark .tabbar { background: #3a332e; border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); }
html.dark .tabbar button { color: #c3b8b0; }
html.dark .tabbar button.on { color: #fff; }
html.dark .tab-dot { box-shadow: 0 0 0 2px #3a332e; }

/* Bez zvětšování dvojitým klepnutím (a bez 300ms prodlevy kliknutí). */
html, body { touch-action: manipulation; }

/* Profilové fotky */
.av.photo { padding: 0; overflow: hidden; background: var(--sand-soft); }
.av.photo img, .me-btn img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.me-btn { padding: 0; overflow: hidden; }
.av-big .av { width: 64px; height: 64px; font-size: 20px; }
