:root {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --ink: #111827;
  --muted: #5B6472;
  --line: #E3E7EC;
  --line-soft: #EEF1F4;
  --field: #D5DBE2;
  --accent: #1D4ED8;
  --accent-dark: #1E3A8A;
  --accent-soft: #EAF0FD;
  --bad: #B42318; --bad-bg: #FDECEC;
  --warn: #9A4A00; --warn-bg: #FFF1E0;
  --ok: #166534; --ok-bg: #E8F5EC;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 96px; }
.app.no-nav { padding-bottom: 24px; }
.loading { text-align: center; color: var(--muted); padding: 80px 20px; }
h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h2.section { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.pad { padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Přihlášení */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.brand-name { font-size: 18px; font-weight: 700; }
.hero { margin: 32px 0 8px; font-size: 30px; line-height: 1.15; }
.lead { font-size: 15px; line-height: 1.5; color: var(--muted); margin-bottom: 24px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--field); }
.legal { margin-top: 28px; text-align: center; font-size: 12px; line-height: 1.5; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #E7EBF0; border-radius: 12px; margin-bottom: 16px; }
.tabs button { height: 40px; border: none; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(17,24,39,.08); }

/* Formuláře */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .legend { font-size: 13px; font-weight: 600; }
.field .opt, .legend .opt { font-weight: 400; color: var(--muted); }
.input { height: 48px; border-radius: 12px; border: 1px solid var(--field); background: var(--surface); padding: 0 14px; font-size: 16px; width: 100%; }
.input[readonly] { background: #EEF1F4; color: #3F4752; border-color: var(--line); }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.error { font-size: 13px; color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px 12px; }
.warn-note { font-size: 12px; color: var(--warn); line-height: 1.45; }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }

/* Tlačítka */
.btn { height: 52px; border-radius: 14px; border: none; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-light { background: var(--surface); color: var(--ink); border: 1px solid var(--field); }
.btn-light:hover { background: #F8FAFC; color: var(--ink); }
.btn-text { height: 44px; background: none; border: none; color: var(--muted); font-size: 15px; font-weight: 500; width: 100%; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #8F1C13; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: none; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.avatar { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--field); background: var(--surface); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--field); background: var(--surface); font-size: 13px; font-weight: 500; }
.chip[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 600; padding: 0 13px; }
.chip.dark[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Přehled */
.topbar { padding: 20px 20px 12px; display: flex; justify-content: space-between; align-items: center; }
.summary { margin: 4px 20px 16px; padding: 16px; border-radius: 18px; background: var(--accent); color: #fff; display: flex; flex-direction: column; gap: 12px; }
.summary-title { font-size: 16px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: rgba(255,255,255,.14); border-radius: 12px; padding: 8px 10px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; }
.filters { padding: 0 20px 8px; }
.list-wrap { padding: 0 20px; }
.card { background: var(--surface); border-radius: 16px; border: 1px solid var(--line); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line-soft); }
.item:last-child { border-bottom: none; }
.item:hover { background: #F8FAFC; color: inherit; }
.item-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.item-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { margin-top: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-right { text-align: right; flex: none; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.item-date { margin-top: 4px; font-size: 12px; color: var(--muted); }
.st-bad .item-icon, .st-bad .pill { background: var(--bad-bg); color: var(--bad); }
.st-warn .item-icon, .st-warn .pill { background: var(--warn-bg); color: var(--warn); }
.st-ok .item-icon, .st-ok .pill { background: var(--ok-bg); color: var(--ok); }
.empty { text-align: center; padding: 40px 24px; color: var(--muted); line-height: 1.5; }
.fab { position: fixed; right: max(20px, calc(50% - 220px)); bottom: 92px; height: 52px; padding: 0 20px 0 16px; border-radius: 26px; background: var(--accent); color: #fff; display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 15px; font-weight: 600; box-shadow: 0 6px 16px rgba(17,24,39,.18); z-index: 5; }
.fab:hover { background: var(--accent-dark); color: #fff; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); z-index: 6; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Formulář dokladu */
.header { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; }
.header h1 { font-size: 22px; }
.reminders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rem { display: flex; flex-direction: column; gap: 2px; min-height: 56px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--field); background: var(--surface); cursor: pointer; }
.rem.on { border: 2px solid var(--accent); background: var(--accent-soft); padding: 7px 9px; }
.rem-top { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; gap: 4px; }
.rem input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.rem-date { font-size: 12px; color: var(--muted); }
.rem.past .rem-date { text-decoration: line-through; }

/* Nastavení */
.settings-card .srow { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; font-size: 15px; background: none; border-left: none; border-right: none; border-top: none; width: 100%; text-align: left; }
.settings-card .srow:last-child { border-bottom: none; }
.settings-card .srow.danger { color: var(--bad); font-weight: 600; }
.profile-row { display: flex; align-items: center; gap: 12px; padding: 14px; text-decoration: none; color: inherit; }
.profile-row .avatar { width: 48px; height: 48px; border-radius: 24px; background: var(--accent-soft); color: var(--accent); border: none; }
.secure-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; line-height: 1.45; color: #3F4752; }
.progress { display: flex; gap: 8px; }
.progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--field); }
.progress span.on { background: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 40px); z-index: 10; box-shadow: 0 6px 16px rgba(17,24,39,.25); }
.cf-turnstile { min-height: 65px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pad > h1:first-child { margin-bottom: 16px; }
