/* Preventee 2.0: vizuální jazyk převzatý z preventee.cz (Source Serif 4 + Work Sans, bílá, magenta #C80E6C) */
:root {
  --paper: #ffffff;
  --surface: #F6F6F6;
  --sunk: #EFEFEF;
  --ink: #111111;
  --muted: #4A4A4A;
  --subtle: #8C8C8C;
  --line: #E4E4E4;
  --accent: #C80E6C;
  --accent-dark: #A80858;
  --accent-soft: #FBE7F1;
  --good: #1E9E6A; --good-soft: #DDF3E7; --good-ink: #12734A;
  --warn: #E39B2E; --warn-soft: #FCEBD2; --warn-ink: #8A5300;
  --bad: #D9473B;  --bad-soft: #FBDDDB;  --bad-ink: #A3221A;
  --none-soft: #F1F1F1;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Work Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px;
  --shadow: 0 1px 2px rgba(17,17,17,.04), 0 8px 24px rgba(17,17,17,.06);
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
/* Tmavý režim: aplikuje se přes data-theme=dark (nastaví JS podle volby nebo systému) */
:root[data-theme="dark"] {
  --paper: #17171A; --surface: #0F0F11; --sunk: #222226; --ink: #F3F3F3; --muted: #B9B9BE; --subtle: #85858C;
  --line: #2C2C31; --accent: #F0479A; --accent-dark: #FF6BB0; --accent-soft: #3A1426;
  --good: #3CC78C; --good-soft: #14301F; --good-ink: #7EE0B1;
  --warn: #F0B04E; --warn-soft: #33260F; --warn-ink: #F4C77C;
  --bad: #F06A5E;  --bad-soft: #3A1715;  --bad-ink: #FF9C93;
  --none-soft: #1E1E22;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--surface);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.ic { width: 22px; height: 22px; flex: none; }
.ic-sm { width: 18px; height: 18px; }
.ic-lg { width: 28px; height: 28px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- Typografie ---------- */
.display { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 7vw, 52px); line-height: 1.05; letter-spacing: -.015em; margin: 0; }
.display .accent { color: var(--accent); }
.h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.h3 { font-size: 17px; font-weight: 600; margin: 0; }
.lead { color: var(--muted); font-size: 17px; margin: 10px 0 0; max-width: 34em; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); font-size: 14px; }
.num { font-family: var(--serif); font-variant-numeric: lining-nums tabular-nums; }

/* ---------- Tlačítka ---------- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 999px; padding: 13px 22px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, background .15s ease, opacity .15s;
  background: var(--ink); color: var(--paper); white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--sunk); }
.btn-soft { background: var(--sunk); color: var(--ink); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: var(--bad-soft); color: var(--bad-ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 16px; font-size: 14px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--paper); width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink); flex: none;
}
.icon-btn:hover { background: var(--sunk); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 500; }
.link-accent { color: var(--accent); }

/* ---------- Formuláře ---------- */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-sm);
  padding: 13px 14px; font-size: 16px; min-height: 50px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--sunk); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); margin: 6px 0 18px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 1px 0 0; flex: none; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--ink); }
:root[data-theme="dark"] .switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { appearance: none; border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.form-error { background: var(--bad-soft); color: var(--bad-ink); padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; margin: 0 0 16px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-wrap .icon-btn { position: absolute; right: 3px; top: 3px; border: 0; background: transparent; }

/* ---------- Přihlášení a registrace ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--paper); }
.auth-side { display: none; }
.auth-main { display: flex; flex-direction: column; padding: 24px 20px 40px; max-width: 480px; width: 100%; margin: 0 auto; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 48px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.auth h1 { margin-bottom: 12px; }
.auth form { margin-top: 32px; }
.auth-foot { margin-top: 28px; font-size: 15px; color: var(--muted); }
.lang-switch { display: inline-flex; gap: 4px; }
.lang-switch button { appearance: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.code-input { font-family: var(--serif); font-size: 32px; letter-spacing: .35em; text-align: center; }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth-side {
    display: flex; flex-direction: column; justify-content: flex-end; padding: 56px; background: var(--surface); position: relative; overflow: hidden;
    border-right: 1px solid var(--line);
  }
  .auth-main { justify-content: center; padding: 48px; }
  .auth-top { position: absolute; top: 32px; right: 48px; margin: 0; }
  .auth { position: relative; }
  .auth-top .brand { display: none; }
}
.auth-side .brand { position: absolute; top: 40px; left: 56px; }
.auth-side .side-quote { font-family: var(--serif); font-size: 40px; line-height: 1.1; max-width: 13em; margin: 0 0 28px; letter-spacing: -.01em; }
.auth-side .side-quote span { color: var(--accent); }
.mini-mosaic { display: grid; grid-template-columns: repeat(7, 34px); gap: 6px; margin-bottom: 40px; }
.mini-mosaic i { width: 34px; height: 34px; border-radius: 9px; background: var(--good-soft); }
.mini-mosaic i.w { background: var(--warn-soft); } .mini-mosaic i.b { background: var(--bad-soft); } .mini-mosaic i.n { background: var(--sunk); }
.mini-mosaic i.g2 { background: var(--good); opacity: .85; }

/* ---------- Kostra aplikace ---------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar .brand img { width: 30px; height: 30px; }
.content { max-width: 640px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + var(--safe-b) + 32px); }
.content.wide { max-width: 1100px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--subtle); font-size: 11px; font-weight: 500; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .ic { color: var(--accent); }
.tabbar .tab-cta .ic-wrap { width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; margin-top: -18px; box-shadow: 0 6px 16px rgba(17,17,17,.22); }
.tabbar .tab-cta .ic { color: var(--paper) !important; }
.sidenav { display: none; }
@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .tabbar, .topbar .brand { display: none; }
  .topbar { padding: 20px 32px 8px; }
  .sidenav {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 28px 18px; border-right: 1px solid var(--line); background: var(--paper);
  }
  .sidenav .brand { margin: 0 10px 32px; }
  .sidenav a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 500; }
  .sidenav a.nav:hover { background: var(--surface); color: var(--ink); }
  .sidenav a.nav[aria-current="page"] { background: var(--surface); color: var(--ink); }
  .sidenav a.nav[aria-current="page"] .ic { color: var(--accent); }
  .sidenav .btn { margin: 20px 0 0; }
  .sidenav .side-foot { margin-top: auto; padding: 12px; font-size: 13px; color: var(--subtle); }
  .content { padding: 8px 32px 64px; }
}

/* ---------- Stránka Dnes ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 24px; }
.datebar { display: flex; align-items: center; gap: 6px; }
.datebar .date-label { font-weight: 600; font-size: 15px; min-width: 0; padding: 0 4px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--ink); margin-bottom: 20px; font-size: 14px; }
.banner .ic { color: var(--accent); }
.banner .link { margin-left: auto; white-space: nowrap; }

.hero-day {
  display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 24px; border-radius: var(--r-xl);
  background: var(--paper); border: 1px solid var(--line); margin-bottom: 14px;
}
.score-ring { position: relative; width: 124px; height: 124px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.score-ring .val b { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1; display: block; }
.score-ring .val small { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.hero-day .h2 { font-size: 24px; }
.hero-day p { margin: 6px 0 16px; color: var(--muted); font-size: 15px; }
.hero-day .actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 420px) { .hero-day { grid-template-columns: 1fr; text-align: left; } .score-ring { width: 108px; height: 108px; } }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper); margin-bottom: 28px; }
.stats-strip > div { padding: 14px 16px; }
.stats-strip > div + div { border-left: 1px solid var(--line); }
.stats-strip b { font-family: var(--serif); font-weight: 400; font-size: 26px; display: block; line-height: 1.1; }
.stats-strip span { font-size: 12.5px; color: var(--muted); }

.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 30px 0 12px; }
.section-title .h3 { font-size: 16px; }

/* Mozaika 12 metrik */
.mosaic { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .mosaic { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .content.wide .mosaic { grid-template-columns: repeat(4, 1fr); } }
.tile {
  appearance: none; text-align: left; border: 1px solid transparent; cursor: pointer; border-radius: 20px; padding: 14px 14px 12px;
  background: var(--none-soft); color: var(--ink); display: flex; flex-direction: column; gap: 14px; min-height: 124px; position: relative;
  transition: transform .12s ease, box-shadow .15s;
}
.tile:hover { box-shadow: var(--shadow); }
.tile:active { transform: scale(.98); }
.tile .t-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.tile .t-name { font-size: 13.5px; font-weight: 500; }
.tile .t-val { margin-top: auto; font-family: var(--serif); font-size: 30px; line-height: 1; letter-spacing: -.01em; }
.tile .t-val small { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.tile .t-empty { margin-top: auto; font-size: 14px; color: var(--subtle); display: flex; align-items: center; gap: 6px; }
.tile .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.tile.good { background: var(--good-soft); } .tile.good .dot { background: var(--good); }
.tile.warn { background: var(--warn-soft); } .tile.warn .dot { background: var(--warn); }
.tile.bad { background: var(--bad-soft); }  .tile.bad .dot { background: var(--bad); }
.tile.none-val { background: var(--paper); border-color: var(--line); }
.tile.off { opacity: .45; }

.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 15px 18px; text-decoration: none; color: inherit; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.list-item + .list-item { border-top: 1px solid var(--line); }
button.list-item:hover, a.list-item:hover { background: var(--surface); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 500; display: block; }
.list-item .li-sub { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.list-item .li-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--ink); flex: none; }
.list-item .chev { color: var(--subtle); }
.date-chip { width: 48px; flex: none; text-align: center; line-height: 1.1; }
.date-chip b { font-family: var(--serif); font-weight: 400; font-size: 24px; display: block; }
.date-chip span { font-size: 12px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: var(--good-soft); color: var(--good-ink); }

/* ---------- Zadávání hodnot ---------- */
.entry { position: fixed; inset: 0; z-index: 50; background: var(--paper); display: flex; flex-direction: column; animation: rise .28s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.entry-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.entry-progress { flex: 1; display: flex; gap: 4px; }
.entry-progress i { flex: 1; height: 4px; border-radius: 4px; background: var(--sunk); transition: background .2s; cursor: pointer; }
.entry-progress i.done { background: var(--ink); opacity: .35; }
.entry-progress i.cur { background: var(--accent); opacity: 1; }
.entry-stage { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; align-items: center; padding: 8px 20px 24px; max-width: 560px; width: 100%; margin: 0 auto; touch-action: pan-y; }
.entry-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; align-self: stretch; justify-content: space-between; }
.entry-q { font-family: var(--serif); font-weight: 400; font-size: clamp(25px, 6vw, 32px); line-height: 1.18; text-align: center; margin: 18px 0 6px; letter-spacing: -.01em; max-width: 18em; }
.entry-hint { color: var(--muted); font-size: 14.5px; text-align: center; margin: 0 0 18px; max-width: 30em; }
.dial { position: relative; width: min(66vw, 260px); aspect-ratio: 1; margin: 6px 0 12px; }
.dial svg { width: 100%; height: 100%; }
.dial .dial-track { stroke: var(--sunk); }
.dial .dial-arc { transition: stroke-dashoffset .35s cubic-bezier(.2,.8,.2,1), stroke .25s; }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dial-value { font-family: var(--serif); font-weight: 400; font-size: clamp(54px, 15vw, 76px); line-height: 1; letter-spacing: -.02em; border: 0; background: transparent; text-align: center; width: 100%; padding: 0; outline: none; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.dial-value::-webkit-outer-spin-button, .dial-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dial-value { -moz-appearance: textfield; }
.dial-unit { color: var(--muted); font-size: 15px; margin-top: 4px; }
.dial-status { margin-top: 10px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.dial-status.good { background: var(--good-soft); color: var(--good-ink); }
.dial-status.warn { background: var(--warn-soft); color: var(--warn-ink); }
.dial-status.bad { background: var(--bad-soft); color: var(--bad-ink); }
.dial-status.none { background: var(--sunk); color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 16px; width: 100%; }
.stepper .icon-btn { width: 56px; height: 56px; }
.range { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; background: var(--sunk); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: grab; }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: grab; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0 4px; }
.chip { appearance: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 9px 16px; font-size: 15px; cursor: pointer; font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.scale10 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; margin-top: 4px; }
.scale10 .chip { padding: 12px 0; border-radius: 14px; font-family: var(--serif); font-size: 20px; }
.entry-bottom { padding: 12px 20px calc(16px + var(--safe-b)); display: flex; gap: 10px; max-width: 560px; width: 100%; margin: 0 auto; }
.entry-bottom .btn { flex: 1; }
.slide-in-r { animation: slR .26s cubic-bezier(.2,.8,.2,1); }
.slide-in-l { animation: slL .26s cubic-bezier(.2,.8,.2,1); }
@keyframes slR { from { transform: translateX(36px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slL { from { transform: translateX(-36px); opacity: 0; } to { transform: none; opacity: 1; } }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; margin: 22px 0; }
.summary-grid .s { border-radius: 14px; padding: 10px; background: var(--none-soft); font-size: 12.5px; }
.summary-grid .s b { display: block; font-family: var(--serif); font-weight: 400; font-size: 20px; }
.summary-grid .s.good { background: var(--good-soft); } .summary-grid .s.warn { background: var(--warn-soft); } .summary-grid .s.bad { background: var(--bad-soft); }

/* ---------- Kalendář a matice ---------- */
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 18px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav .h2 { min-width: 9.5em; text-align: center; text-transform: none; }
.cal { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 12px; color: var(--subtle); text-align: center; padding-bottom: 6px; }
.cal-day {
  appearance: none; border: 0; cursor: pointer; aspect-ratio: 1; border-radius: 14px; background: var(--none-soft); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; position: relative; padding: 0;
}
.cal-day .d { font-size: 15px; font-weight: 500; }
.cal-day .sc { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-day.good { background: var(--good-soft); } .cal-day.good .sc { color: var(--good-ink); }
.cal-day.warn { background: var(--warn-soft); } .cal-day.warn .sc { color: var(--warn-ink); }
.cal-day.bad { background: var(--bad-soft); }  .cal-day.bad .sc { color: var(--bad-ink); }
.cal-day.blank { visibility: hidden; }
.cal-day.future { opacity: .35; cursor: default; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day .visit-dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend .g { background: var(--good-soft); box-shadow: inset 0 0 0 1px var(--good); } .legend .w { background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--warn); }
.legend .b { background: var(--bad-soft); box-shadow: inset 0 0 0 1px var(--bad); } .legend .v { background: var(--accent); border-radius: 50%; width: 8px; height: 8px; }

.matrix-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }
.matrix-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix { border-collapse: separate; border-spacing: 3px; font-size: 12.5px; padding: 10px; }
.matrix th, .matrix td { text-align: center; min-width: 38px; height: 34px; border-radius: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.matrix thead th { color: var(--subtle); font-weight: 500; font-size: 12px; }
.matrix thead th.today { color: var(--ink); font-weight: 700; }
.matrix th.mname { position: sticky; left: 0; z-index: 2; background: var(--paper); text-align: left; padding: 0 12px 0 6px; font-weight: 500; color: var(--ink); min-width: 140px; }
.matrix th.mname small { color: var(--subtle); font-weight: 400; margin-left: 4px; }
.matrix td { background: #FAFAFA; color: var(--muted); cursor: pointer; }
:root[data-theme="dark"] .matrix td { background: #1B1B1F; }
.matrix td.good { background: var(--good-soft); color: var(--good-ink); }
.matrix td.warn { background: var(--warn-soft); color: var(--warn-ink); }
.matrix td.bad { background: var(--bad-soft); color: var(--bad-ink); }
.matrix td.neutral { background: var(--sunk); color: var(--ink); }
.matrix tr.score-row td { font-weight: 600; }
.matrix td.avg { background: transparent; color: var(--ink); font-weight: 600; cursor: default; padding: 0 8px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }

/* ---------- Trendy ---------- */
.metric-picker { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -16px 8px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.metric-picker::-webkit-scrollbar { display: none; }
.metric-picker .chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.metric-picker .chip .ic { width: 16px; height: 16px; }
.chart-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 18px 14px; }
.chart-card .chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.chart-card .big { font-family: var(--serif); font-size: 44px; line-height: 1; }
.chart-card .big small { font-family: var(--sans); font-size: 15px; color: var(--muted); margin-left: 6px; }
.chart { width: 100%; height: 220px; display: block; margin-top: 10px; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .zone { fill: var(--good); opacity: .09; }
.chart .zone-line { stroke: var(--good); stroke-dasharray: 4 4; opacity: .6; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--ink); opacity: .035; }
.chart .pt { stroke: var(--paper); stroke-width: 2; }
.chart .pt.good { fill: var(--good); } .chart .pt.warn { fill: var(--warn); } .chart .pt.bad { fill: var(--bad); } .chart .pt.none { fill: var(--subtle); }
.chart text { fill: var(--subtle); font-size: 11px; font-family: var(--sans); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.kpi b { display: block; font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.1; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; gap: 12px; align-items: center; font-size: 14px; }
.bar-row .track { height: 10px; border-radius: 10px; background: var(--sunk); overflow: hidden; display: flex; }
.bar-row .track i { display: block; height: 100%; }
.bar-row .track .g { background: var(--good); } .bar-row .track .w { background: var(--warn); } .bar-row .track .b { background: var(--bad); }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 420px) { .bar-row { grid-template-columns: 96px 1fr 40px; font-size: 13px; } }

/* ---------- Nastavení ---------- */
.settings-group { margin-bottom: 26px; }
.settings-group > .h3 { margin: 0 0 10px 4px; font-size: 14px; color: var(--muted); font-weight: 500; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .grow { flex: 1; min-width: 0; }
.set-row .grow small { display: block; color: var(--muted); font-size: 13.5px; }
.target-row { padding: 14px 18px; }
.target-row + .target-row { border-top: 1px solid var(--line); }
.target-row .tr-head { display: flex; align-items: center; gap: 12px; }
.target-row .tr-head .grow { flex: 1; font-weight: 500; }
.target-row .tr-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.target-row .tr-body label { font-size: 12.5px; color: var(--muted); }
.target-row .tr-body .input { min-height: 44px; padding: 10px 12px; margin-top: 4px; }
.target-row.off .tr-body { display: none; }
.recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; background: var(--surface); border-radius: var(--r-md); padding: 16px; margin: 12px 0; }
.qr { background: #fff; padding: 12px; border-radius: var(--r-md); width: fit-content; margin: 12px auto; border: 1px solid var(--line); }
.qr img, .qr svg { width: 200px; height: 200px; display: block; image-rendering: pixelated; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 14px; word-break: break-all; background: var(--surface); padding: 10px 12px; border-radius: 10px; text-align: center; }

/* ---------- Sheet (spodní panel) a toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(10,10,12,.38); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--paper); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(24px + var(--safe-b)); animation: sheetUp .3s cubic-bezier(.2,.8,.2,1);
}
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 16px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet .actions .btn { flex: 1; }
@media (min-width: 720px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 28px; padding: 26px 28px 28px; }
  .sheet::before { display: none; }
}
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
@media (min-width: 960px) { .toasts { bottom: 28px; } }
.toast { background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px; font-size: 14.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: toastIn .3s cubic-bezier(.2,.8,.2,1); display: flex; gap: 8px; align-items: center; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--r-xl); background: var(--paper); }
.empty .ic-lg { color: var(--accent); margin: 0 auto 12px; }
.empty p { color: var(--muted); margin: 6px auto 18px; max-width: 26em; }
.skeleton { height: 124px; border-radius: 20px; background: linear-gradient(90deg, var(--sunk), var(--paper), var(--sunk)); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { width: 56px; height: 56px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .6; } }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 120; background: var(--warn); color: #1a1100; text-align: center; font-size: 13px; padding: 4px; font-weight: 600; }

@media print {
  .sidenav, .tabbar, .topbar, .toolbar, .seg, .cal-nav .icon-btn, .page-actions { display: none !important; }
  .app { display: block; } body { background: #fff; } .content { max-width: none; padding: 0; }
  .matrix-wrap { border: 0; } .matrix-scroll { overflow: visible; } .matrix { font-size: 9px; border-spacing: 1px; } .matrix th, .matrix td { min-width: 0; height: 20px; }
}

/* Doladění */
.list > .list-item + .set-row, .list > .set-row + .list-item, .list > .set-row + .set-row { border-top: 1px solid var(--line); }
@media (min-width: 960px) {
  .topbar { display: none; }
  .content { padding-top: 40px; }
  .cal-day { aspect-ratio: 1.35; }
}
