/* Moje léky — design system */
:root{
  --bg:#f4f6f9; --surface:#ffffff; --sunken:#eceff4; --line:#e2e6ec; --line-strong:#cfd5de;
  --text:#0f1419; --muted:#5f6b7a; --faint:#96a0ae;
  --brand:#2f6bed; --brand-soft:#e8effd; --brand-ink:#ffffff;
  --ok:#0f9d58; --ok-soft:#e4f6ec; --warn:#d97706; --warn-soft:#fdf1e0; --bad:#d92d3c; --bad-soft:#fdeaec;
  --r-lg:20px; --r-md:14px; --r-sm:10px;
  --sh-1:0 1px 2px rgba(15,20,25,.05), 0 1px 1px rgba(15,20,25,.03);
  --sh-2:0 2px 4px rgba(15,20,25,.05), 0 12px 28px -14px rgba(15,20,25,.22);
  --sh-pop:0 20px 60px -20px rgba(15,20,25,.35);
  --nav-h:64px; --ease:cubic-bezier(.22,.68,.36,1);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0c0e12; --surface:#15181e; --sunken:#1b1f27; --line:#252a33; --line-strong:#333a45;
    --text:#e8ecf2; --muted:#98a3b3; --faint:#6b7686;
    --brand:#5488ff; --brand-soft:#18233b; --brand-ink:#0a0d13;
    --ok:#2fb877; --ok-soft:#12271e; --warn:#e79a3c; --warn-soft:#2a2013; --bad:#f0555f; --bad-soft:#2d1519;
    --sh-1:0 1px 2px rgba(0,0,0,.4);
    --sh-2:0 2px 6px rgba(0,0,0,.4), 0 16px 34px -18px rgba(0,0,0,.8);
    --sh-pop:0 24px 70px -20px rgba(0,0,0,.85);
  }
}
:root[data-theme="dark"]{
  --bg:#0c0e12; --surface:#15181e; --sunken:#1b1f27; --line:#252a33; --line-strong:#333a45;
  --text:#e8ecf2; --muted:#98a3b3; --faint:#6b7686;
  --brand:#5488ff; --brand-soft:#18233b; --brand-ink:#0a0d13;
  --ok:#2fb877; --ok-soft:#12271e; --warn:#e79a3c; --warn-soft:#2a2013; --bad:#f0555f; --bad-soft:#2d1519;
  --sh-1:0 1px 2px rgba(0,0,0,.4);
  --sh-2:0 2px 6px rgba(0,0,0,.4), 0 16px 34px -18px rgba(0,0,0,.8);
  --sh-pop:0 24px 70px -20px rgba(0,0,0,.85);
}
*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI Variable Text","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  font-size:15px; line-height:1.45; -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent; overscroll-behavior-y:none;
}
h1,h2,h3,p,ol,ul{ margin:0; }
ol,ul{ list-style:none; padding:0; }
button{ font:inherit; color:inherit; }
b,strong{ font-weight:650; }
[hidden]{ display:none !important; }
:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; border-radius:6px; }

.gate{ min-height:100dvh; display:grid; place-items:center; padding:24px; }
.gate__card{
  width:100%; max-width:360px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:32px 26px; box-shadow:var(--sh-2); text-align:center;
}
.gate__logo{
  width:56px; height:56px; margin:0 auto 16px; border-radius:17px; display:grid; place-items:center;
  background:linear-gradient(145deg,var(--brand),#7aa2ff); color:#fff; box-shadow:0 8px 20px -8px var(--brand);
}
.gate__title{ font-size:22px; font-weight:680; letter-spacing:-.02em; }
.gate__sub{ color:var(--muted); font-size:13.5px; margin:6px 0 20px; }
.gate__error{ color:var(--bad); font-size:13px; margin-top:12px; }

.shell{ min-height:100dvh; }
.main{ padding:14px 16px calc(var(--nav-h) + 96px); max-width:640px; margin:0 auto; }
.view{ animation:fade .22s var(--ease); }
@keyframes fade{ from{ opacity:0; transform:translateY(4px);} to{ opacity:1; transform:none;} }

.tabs{
  position:fixed; z-index:40; bottom:0; left:0; right:0; display:flex; align-items:stretch;
  height:calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom:env(safe-area-inset-bottom);
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(14px); border-top:1px solid var(--line);
}
.tabs__brand,.tabs__foot{ display:none; }
.tab{
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  background:none; border:0; cursor:pointer; color:var(--faint);
  font-size:10.5px; font-weight:560; padding:0; transition:color .16s var(--ease);
}
.tab svg{ width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; transition:transform .2s var(--ease); }
.tab.is-active{ color:var(--brand); }
.tab.is-active svg{ transform:translateY(-1px) scale(1.05); }
.tab:active svg{ transform:scale(.9); }
@media (min-width:900px){
  .shell{ display:grid; grid-template-columns:236px minmax(0,1fr); }
  .tabs{
    position:sticky; top:0; left:auto; right:auto; height:100dvh; flex-direction:column;
    align-items:stretch; justify-content:flex-start; gap:4px; padding:22px 14px;
    border-top:0; border-right:1px solid var(--line); background:var(--surface); backdrop-filter:none;
  }
  .tabs__brand{ display:flex; align-items:center; gap:9px; font-size:15.5px; font-weight:670; letter-spacing:-.015em; padding:6px 10px 22px; }
  .tabs__brandmark{ width:30px; height:30px; border-radius:9px; display:grid; place-items:center; flex:none; background:linear-gradient(145deg,var(--brand),#7aa2ff); color:#fff; }
  .tab{ flex:none; flex-direction:row; justify-content:flex-start; gap:11px; padding:10px 12px; border-radius:11px; font-size:14.5px; font-weight:560; }
  .tab.is-active{ background:var(--brand-soft); }
  .tab svg{ width:20px; height:20px; }
  .tabs__foot{ display:flex; align-items:center; gap:7px; margin-top:auto; padding:10px 12px; font-size:12px; color:var(--faint); }
  .main{ padding:26px 28px 80px; max-width:680px; margin:0; }
}
.dot-live{ width:7px; height:7px; border-radius:50%; background:var(--ok); flex:none; }
.dot-live.is-off{ background:var(--bad); }

.daynav{ display:flex; align-items:center; gap:6px; margin-bottom:14px; }
.daynav__label{ flex:1; text-align:center; line-height:1.15; }
.daynav__label strong{ display:block; font-size:16.5px; font-weight:660; letter-spacing:-.015em; }
.daynav__label span{ font-size:12.5px; color:var(--muted); }
.iconbtn{
  width:38px; height:38px; flex:none; display:grid; place-items:center; cursor:pointer;
  background:var(--surface); border:1px solid var(--line); border-radius:11px; color:var(--muted);
  transition:background .15s, color .15s, transform .1s;
}
.iconbtn svg{ width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.iconbtn:hover{ color:var(--text); background:var(--sunken); }
.iconbtn:active{ transform:scale(.93); }

.hero{
  display:flex; align-items:center; gap:18px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:18px 20px; box-shadow:var(--sh-1); margin-bottom:22px;
}
.hero__ring{ position:relative; width:84px; height:84px; flex:none; }
.ring{ width:100%; height:100%; transform:rotate(-90deg); }
.ring circle{ fill:none; stroke-width:8.5; }
.ring__track{ stroke:var(--sunken); }
.ring__value{ stroke:var(--brand); stroke-linecap:round; stroke-dasharray:270.18; stroke-dashoffset:270.18; transition:stroke-dashoffset .7s var(--ease), stroke .3s; }
.ring.is-complete .ring__value{ stroke:var(--ok); }
.ring__pct{ position:absolute; inset:0; display:grid; place-items:center; font-size:15px; font-weight:680; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.hero__text{ min-width:0; }
.hero__count{ font-size:27px; font-weight:700; letter-spacing:-.03em; line-height:1.1; font-variant-numeric:tabular-nums; }
.hero__count span{ font-size:16px; font-weight:520; color:var(--faint); letter-spacing:-.01em; }
.hero__label{ font-size:13px; color:var(--muted); margin-top:2px; }
.hero__next{ font-size:12.5px; color:var(--brand); font-weight:580; margin-top:7px; }
.hero__next:empty{ display:none; }

.timeline{ display:flex; flex-direction:column; }
.slot{ display:grid; grid-template-columns:52px minmax(0,1fr); column-gap:12px; }
.slot__rail{ position:relative; display:flex; flex-direction:column; align-items:center; padding-top:16px; }
.slot__time{ font-size:12.5px; font-weight:640; color:var(--muted); font-variant-numeric:tabular-nums; letter-spacing:-.01em; margin-bottom:8px; }
.slot__dot{ width:11px; height:11px; border-radius:50%; flex:none; z-index:1; background:var(--surface); border:2.5px solid var(--line-strong); }
.slot__line{ flex:1; width:2px; background:var(--line); margin:5px 0 0; border-radius:2px; }
.slot:last-child .slot__line{ background:linear-gradient(var(--line),transparent); }
.slot__card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); margin:10px 0 6px; box-shadow:var(--sh-1); overflow:hidden; transition:border-color .2s, box-shadow .2s, opacity .2s; }
.slot--done .slot__dot{ background:var(--ok); border-color:var(--ok); }
.slot--done .slot__time{ color:var(--ok); }
.slot--skipped .slot__dot{ background:var(--bad); border-color:var(--bad); }
.slot--skipped .slot__time{ color:var(--bad); }
.slot--partial .slot__dot{ background:var(--warn); border-color:var(--warn); }
.slot--due .slot__dot{ background:var(--warn); border-color:var(--warn); animation:pulse 2.1s infinite; }
.slot--due .slot__time{ color:var(--warn); }
.slot--due .slot__card{ border-color:color-mix(in srgb,var(--warn) 45%,var(--line)); box-shadow:var(--sh-2); }
.slot--next .slot__card{ border-color:color-mix(in srgb,var(--brand) 35%,var(--line)); }
.slot--next .slot__dot{ border-color:var(--brand); }
.slot--past.slot--pending .slot__card{ opacity:.85; }
@keyframes pulse{
  0%{ box-shadow:0 0 0 0 color-mix(in srgb,var(--warn) 55%,transparent); }
  70%{ box-shadow:0 0 0 9px transparent; }
  100%{ box-shadow:0 0 0 0 transparent; }
}
.slot__head{ display:flex; align-items:center; gap:8px; padding:12px 14px 0; }
.slot__badge{ font-size:11px; font-weight:620; padding:3px 8px; border-radius:99px; background:var(--sunken); color:var(--muted); }
.slot__badge--due{ background:var(--warn-soft); color:var(--warn); }
.slot__badge--done{ background:var(--ok-soft); color:var(--ok); }
.slot__badge--skipped{ background:var(--bad-soft); color:var(--bad); }
.slot__badge--next{ background:var(--brand-soft); color:var(--brand); }
.slot__sum{ margin-left:auto; font-size:12px; color:var(--faint); font-variant-numeric:tabular-nums; }
.doses{ padding:8px 8px 4px; }
.dose{ width:100%; display:flex; align-items:center; gap:11px; text-align:left; cursor:pointer; background:none; border:0; padding:9px 8px; border-radius:var(--r-sm); transition:background .14s; }
.dose:hover{ background:var(--sunken); }
.dose__check{ width:23px; height:23px; flex:none; border-radius:8px; border:2px solid var(--line-strong); display:grid; place-items:center; transition:background .18s var(--ease), border-color .18s var(--ease); }
.dose__check svg{ width:13px; height:13px; fill:none; stroke:#fff; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; stroke-dasharray:20; stroke-dashoffset:20; }
.dose__pill{ width:8px; height:8px; border-radius:50%; flex:none; background:var(--c,var(--brand)); }
.dose__body{ flex:1; min-width:0; }
.dose__name{ display:block; font-size:14.5px; font-weight:520; letter-spacing:-.005em; }
.dose__name em{ font-style:normal; color:var(--muted); font-weight:450; }
.dose__note{ display:block; font-size:11.5px; color:var(--faint); margin-top:1px; }
.dose__qty{ font-size:14px; font-weight:660; font-variant-numeric:tabular-nums; color:var(--muted); background:var(--sunken); padding:2px 9px; border-radius:8px; flex:none; }
.dose.is-taken .dose__check{ background:var(--ok); border-color:var(--ok); }
.dose.is-taken .dose__check svg{ stroke-dashoffset:0; transition:stroke-dashoffset .3s .05s var(--ease); }
.dose.is-taken .dose__name{ color:var(--muted); }
.dose.is-taken .dose__qty{ color:var(--faint); }
.dose.is-skipped .dose__check{ background:var(--bad); border-color:var(--bad); }
.dose.is-skipped .dose__check svg{ stroke-dashoffset:0; }
.dose.is-skipped .dose__name{ color:var(--faint); text-decoration:line-through; }
.slot__actions{ display:flex; gap:8px; padding:6px 12px 12px; }
.slot__actions .btn--primary{ flex:1; }
.slot__collapsed{ display:flex; align-items:center; gap:9px; width:100%; text-align:left; cursor:pointer; background:none; border:0; padding:13px 14px; font-size:13.5px; color:var(--muted); }
.slot__collapsed b{ color:var(--text); font-weight:560; }
.slot__collapsed .chev{ margin-left:auto; width:16px; height:16px; fill:none; stroke:var(--faint); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid transparent;
  border-radius:11px; padding:0 15px; height:42px; font-size:14.5px; font-weight:600; letter-spacing:-.01em;
  cursor:pointer; white-space:nowrap; background:var(--sunken); color:var(--text);
  transition:background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:active{ transform:scale(.97); }
.btn:disabled{ opacity:.5; cursor:default; }
.btn__i{ width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.btn--primary{ background:var(--brand); color:var(--brand-ink); box-shadow:0 6px 16px -8px var(--brand); }
.btn--primary:hover{ filter:brightness(1.06); }
.btn--ok{ background:var(--ok); color:#fff; }
.btn--ghost{ background:transparent; border-color:var(--line); color:var(--muted); }
.btn--ghost:hover{ background:var(--sunken); color:var(--text); }
.btn--danger{ background:transparent; border-color:var(--line); color:var(--bad); }
.btn--danger:hover{ background:var(--bad-soft); }
.btn--sm{ height:34px; padding:0 12px; font-size:13px; border-radius:9px; }
.btn--block{ width:100%; }

.stack{ display:flex; flex-direction:column; gap:11px; }
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--sh-1); padding:15px 16px; }
.card__title{ font-size:12px; font-weight:640; color:var(--faint); letter-spacing:.04em; text-transform:uppercase; margin-bottom:12px; }
.row{ display:flex; align-items:center; gap:9px; }
.row--end{ justify-content:flex-end; margin-top:14px; }
.vhead{ display:flex; align-items:center; gap:10px; margin-bottom:4px; }
.vhead h2{ font-size:23px; font-weight:700; letter-spacing:-.03em; flex:1; }
.vhead__sub{ font-size:13px; color:var(--muted); margin-bottom:16px; }
.empty{ text-align:center; padding:44px 20px; color:var(--faint); font-size:14px; }
.empty svg{ width:38px; height:38px; fill:none; stroke:currentColor; stroke-width:1.5; opacity:.5; margin-bottom:10px; }

/* léky */
.med{ display:flex; align-items:center; gap:12px; width:100%; text-align:left; cursor:pointer; background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--sh-1); padding:13px 15px; transition:border-color .15s, transform .1s; }
.med:hover{ border-color:var(--line-strong); }
.med:active{ transform:scale(.995); }
.med__bar{ width:4px; align-self:stretch; border-radius:99px; background:var(--c,var(--brand)); flex:none; }
.med__body{ flex:1; min-width:0; }
.med__name{ font-size:15px; font-weight:600; letter-spacing:-.01em; }
.med__name em{ font-style:normal; font-weight:450; color:var(--muted); }
.med__times{ display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.chip{ font-size:11.5px; font-weight:580; padding:2px 8px; border-radius:7px; background:var(--sunken); color:var(--muted); font-variant-numeric:tabular-nums; }
.chip--soon{ background:var(--brand-soft); color:var(--brand); }
.chip--end{ background:var(--bad-soft); color:var(--bad); }
.med__note{ font-size:12px; color:var(--faint); margin-top:5px; }
.med__total{ font-size:13px; font-weight:620; color:var(--muted); font-variant-numeric:tabular-nums; flex:none; }

/* historie */
.segmented{ display:flex; gap:4px; background:var(--sunken); padding:4px; border-radius:12px; margin-bottom:16px; }
.segmented button{ flex:1; height:33px; border:0; background:none; border-radius:9px; cursor:pointer; font-size:13.5px; font-weight:580; color:var(--muted); transition:background .15s, color .15s; }
.segmented button.is-active{ background:var(--surface); color:var(--text); box-shadow:var(--sh-1); }
.statgrid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:18px; }
.stat{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); padding:13px 14px; box-shadow:var(--sh-1); }
.stat__v{ font-size:22px; font-weight:700; letter-spacing:-.03em; font-variant-numeric:tabular-nums; line-height:1.15; }
.stat__l{ font-size:11.5px; color:var(--faint); margin-top:2px; }
.hday{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); box-shadow:var(--sh-1); overflow:hidden; }
.hday__head{ display:flex; align-items:center; gap:10px; width:100%; text-align:left; cursor:pointer; background:none; border:0; padding:13px 15px; }
.hday__date{ font-size:14px; font-weight:600; flex:none; min-width:104px; }
.hday__bar{ flex:1; height:7px; border-radius:99px; background:var(--sunken); overflow:hidden; display:flex; }
.hday__bar i{ display:block; height:100%; }
.hday__bar i.t{ background:var(--ok); }
.hday__bar i.s{ background:var(--bad); }
.hday__bar i.p{ background:var(--line-strong); }
.hday__pct{ font-size:12.5px; font-weight:620; color:var(--muted); font-variant-numeric:tabular-nums; flex:none; }
.hday__body{ border-top:1px solid var(--line); padding:6px 8px 10px; }
.hrow{ display:flex; align-items:center; gap:9px; padding:7px 8px; font-size:13.5px; }
.hrow__time{ font-size:12px; color:var(--faint); font-variant-numeric:tabular-nums; min-width:40px; }
.hrow__name{ flex:1; min-width:0; }
.hrow__tag{ font-size:11px; font-weight:620; padding:2px 7px; border-radius:6px; }
.hrow__tag.t{ background:var(--ok-soft); color:var(--ok); }
.hrow__tag.s{ background:var(--bad-soft); color:var(--bad); }
.hrow__tag.p{ background:var(--sunken); color:var(--muted); }
.hrow__tag.l{ background:var(--warn-soft); color:var(--warn); }

/* formuláře */
.input,select.input,textarea.input{
  width:100%; height:44px; padding:0 13px; font:inherit; font-size:15px; color:var(--text);
  background:var(--surface); border:1px solid var(--line-strong); border-radius:11px; outline:none;
  transition:border-color .15s, box-shadow .15s;
}
textarea.input{ height:auto; padding:11px 13px; resize:vertical; }
.input:focus{ border-color:var(--brand); box-shadow:0 0 0 3px color-mix(in srgb,var(--brand) 18%,transparent); }
.field{ margin-bottom:13px; }
.field__l{ display:block; font-size:12.5px; font-weight:600; color:var(--muted); margin-bottom:5px; }
.field__h{ font-size:11.5px; color:var(--faint); margin-top:5px; }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.swatches{ display:flex; flex-wrap:wrap; gap:7px; }
.swatch{ width:29px; height:29px; border-radius:9px; border:2px solid transparent; cursor:pointer; padding:0; background:var(--c); transition:transform .12s; }
.swatch:hover{ transform:scale(1.1); }
.swatch.is-on{ border-color:var(--text); }
.switch{ display:flex; align-items:center; gap:11px; justify-content:space-between; padding:11px 0; border-bottom:1px solid var(--line); }
.switch:last-child{ border-bottom:0; }
.switch__t{ font-size:14.5px; font-weight:520; }
.switch__d{ font-size:12px; color:var(--faint); margin-top:1px; }
.toggle{ width:46px; height:27px; border-radius:99px; background:var(--line-strong); border:0; cursor:pointer; position:relative; flex:none; transition:background .2s; }
.toggle::after{ content:""; position:absolute; top:3px; left:3px; width:21px; height:21px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .2s var(--ease); }
.toggle.is-on{ background:var(--ok); }
.toggle.is-on::after{ transform:translateX(19px); }
.num{ width:78px; text-align:center; }

/* dialog */
.sheet{
  border:0; padding:0; background:transparent; max-width:100%; max-height:100%;
  width:100%; height:100%; margin:0; overflow:visible;
}
.sheet::backdrop{ background:rgba(8,10,14,.5); backdrop-filter:blur(3px); }
.sheet__inner{
  position:absolute; left:0; right:0; bottom:0; max-height:92dvh; overflow-y:auto;
  background:var(--surface); border-radius:22px 22px 0 0; box-shadow:var(--sh-pop);
  padding:8px 18px calc(22px + env(safe-area-inset-bottom));
  animation:slideup .28s var(--ease);
}
@keyframes slideup{ from{ transform:translateY(100%); } to{ transform:none; } }
.sheet__grab{ width:38px; height:4px; border-radius:99px; background:var(--line-strong); margin:6px auto 14px; }
.sheet__head{ display:flex; align-items:flex-start; gap:12px; margin-bottom:16px; }
.sheet__head h3{ font-size:19px; font-weight:680; letter-spacing:-.02em; flex:1; }
.sheet__head p{ font-size:13px; color:var(--muted); margin-top:2px; }
.sheet__x{ width:32px; height:32px; border-radius:9px; border:0; background:var(--sunken); color:var(--muted); cursor:pointer; display:grid; place-items:center; flex:none; }
.sheet__x svg{ width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; }
.sheet__actions{ display:flex; gap:9px; margin-top:18px; }
.sheet__actions .btn{ flex:1; }
@media (min-width:720px){
  .sheet[open]{ display:grid; place-items:center; }
  .sheet__inner{ position:relative; width:min(520px,100%); border-radius:20px; max-height:88dvh; animation:pop .2s var(--ease); padding-bottom:22px; }
  @keyframes pop{ from{ opacity:0; transform:scale(.96);} to{ opacity:1; transform:none;} }
}
.rules{ display:flex; flex-direction:column; gap:7px; }
.rule{ display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--sunken); border-radius:11px; font-size:13.5px; }
.rule--future{ background:var(--brand-soft); }
.rule--past{ opacity:.55; }
.rule__t{ font-weight:640; font-variant-numeric:tabular-nums; min-width:44px; }
.rule__q{ color:var(--muted); flex:1; }
.rule__v{ font-size:11.5px; color:var(--faint); }
.rule__x{ width:26px; height:26px; border-radius:7px; border:0; background:transparent; color:var(--faint); cursor:pointer; display:grid; place-items:center; flex:none; }
.rule__x:hover{ background:var(--bad-soft); color:var(--bad); }
.rule__x svg{ width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; }

/* alarm lišta */
.alarmbar{
  position:fixed; z-index:50; left:12px; right:12px; bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  display:flex; align-items:center; gap:11px; padding:11px 12px;
  background:var(--warn); color:#fff; border-radius:15px;
  box-shadow:0 14px 34px -12px color-mix(in srgb,var(--warn) 75%,transparent);
  animation:slidein .3s var(--ease);
}
@keyframes slidein{ from{ transform:translateY(120%); opacity:0; } to{ transform:none; opacity:1; } }
.alarmbar__text{ flex:1; min-width:0; line-height:1.2; }
.alarmbar__text b{ display:block; font-size:14.5px; font-weight:680; }
.alarmbar__text span{ font-size:12px; opacity:.9; }
.alarmbar__mute{ width:34px; height:34px; flex:none; border-radius:10px; border:0; background:rgba(255,255,255,.2); color:#fff; cursor:pointer; display:grid; place-items:center; }
.alarmbar__mute svg{ width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.alarmbar__mute.is-muted{ opacity:.55; }
.alarmbar .btn--primary{ background:#fff; color:var(--warn); box-shadow:none; }
@media (min-width:900px){ .alarmbar{ left:auto; right:24px; bottom:24px; width:360px; } }

/* toasty */
.toasts{ position:fixed; z-index:60; left:50%; transform:translateX(-50%); bottom:calc(var(--nav-h) + 76px); display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none; }
@media (min-width:900px){ .toasts{ bottom:24px; left:auto; right:24px; transform:none; align-items:flex-end; } }
.toast{
  background:var(--text); color:var(--bg); font-size:13.5px; font-weight:540;
  padding:10px 15px; border-radius:11px; box-shadow:var(--sh-2); max-width:88vw;
  animation:toastin .25s var(--ease);
}
.toast--bad{ background:var(--bad); color:#fff; }
@keyframes toastin{ from{ opacity:0; transform:translateY(10px) scale(.96);} to{ opacity:1; transform:none;} }

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{ animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}

/* tisk rozpisu */
@media print{
  .tabs,.alarmbar,.toasts,.daynav,.hero,.vhead .btn,.segmented,.row--end{ display:none !important; }
  body{ background:#fff; color:#000; font-size:12px; }
  .main{ padding:0; max-width:none; }
  .card,.med,.slot__card,.hday{ box-shadow:none !important; border-color:#bbb !important; break-inside:avoid; }
}

/* --- opravy zalomeni a prekryvu --- */
.input,select.input{ min-width:0; }
.grid2 > *{ min-width:0; }
.field .input{ width:100%; }
.dose__name em,.med__name em{ white-space:nowrap; }
.dose__name,.med__name{ overflow-wrap:anywhere; }
body.has-alarm .main{ padding-bottom:calc(var(--nav-h) + 160px); }
@media (min-width:900px){
  body.has-alarm .main{ padding-bottom:80px; }
}

/* ================= PLÁN (mřížka lék × čas) ================= */
.tab--desktop{ display:none; }
@media (min-width:900px){ .tab--desktop{ display:flex; } }

.segmented--sm{ margin:0; flex:none; width:auto; }
.segmented--sm button{ flex:none; padding:0 14px; }

.planbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md);
  padding:11px 14px; margin-bottom:14px; box-shadow:var(--sh-1); font-size:13.5px;
}
.planbar__info{ color:var(--muted); }
.planbar__spacer{ flex:1; }
.planbar b{ font-variant-numeric:tabular-nums; }
.planbar .input{ height:36px; width:auto; font-size:14px; }

.planwrap{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md);
  box-shadow:var(--sh-1); overflow-x:auto; overflow-y:hidden; padding-bottom:2px;
}
.plan{ --cells:24.5; --col:42px; --med:168px; min-width:calc(var(--med) + var(--col) * var(--cells)); user-select:none; }

.plan__head{ display:flex; position:sticky; top:0; z-index:3; background:var(--surface); border-bottom:1px solid var(--line); }
.plan__corner{ width:var(--med); flex:none; position:sticky; left:0; z-index:4; background:var(--surface); border-right:1px solid var(--line); }
.plan__hours{ position:relative; height:30px; width:calc(var(--col) * var(--cells)); flex:none; }
.plan__hour{
  position:absolute; top:0; height:30px; width:var(--col); display:grid; place-items:center;
  font-size:11px; font-weight:620; color:var(--faint); font-variant-numeric:tabular-nums;
}
.plan__hour.is-night{ color:color-mix(in srgb,var(--faint) 55%,transparent); }

.plan__row{ display:flex; align-items:stretch; border-bottom:1px solid var(--line); }
.plan__row:last-child{ border-bottom:0; }
.plan__row:hover .plan__med{ background:var(--sunken); }
.plan__med{
  width:var(--med); flex:none; position:sticky; left:0; z-index:2; background:var(--surface);
  border-right:1px solid var(--line); padding:0 11px; display:flex; align-items:center; gap:8px;
  font-size:13px; font-weight:560; min-height:46px; transition:background .14s;
}
.plan__med span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.plan__med em{ font-style:normal; color:var(--faint); font-weight:450; font-size:11.5px; }
.plan__medbar{ width:3px; align-self:stretch; margin:7px 0; border-radius:99px; background:var(--c); flex:none; }
.plan__track{
  position:relative; width:calc(var(--col) * var(--cells)); flex:none; min-height:46px;
  background:
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px var(--col));
}
.plan--edit .plan__track{ cursor:copy; }

.pdot{
  position:absolute; top:50%; transform:translate(-50%,-50%);
  width:27px; height:27px; border-radius:9px; border:2px solid transparent;
  display:grid; place-items:center; font-size:12.5px; font-weight:700; font-variant-numeric:tabular-nums;
  cursor:pointer; padding:0; z-index:1; transition:transform .12s var(--ease), box-shadow .15s;
  background:var(--sunken); color:var(--muted);
}
.pdot:hover{ transform:translate(-50%,-50%) scale(1.12); z-index:2; }
.pdot--plan{ background:color-mix(in srgb,var(--c) 16%,var(--surface)); color:var(--c); border-color:color-mix(in srgb,var(--c) 45%,transparent); }
.pdot--taken{ background:var(--ok); color:#fff; }
.pdot--skipped{ background:var(--bad); color:#fff; }
.pdot--due{ background:var(--warn); color:#fff; box-shadow:0 0 0 0 color-mix(in srgb,var(--warn) 55%,transparent); animation:pulse 2.1s infinite; }
.pdot--wait{ background:var(--surface); color:var(--muted); border-color:var(--line-strong); border-style:dashed; }
.plan--edit .pdot{ cursor:grab; }
.plan--edit .pdot.is-drag{ cursor:grabbing; transform:translate(-50%,-50%) scale(1.18); box-shadow:var(--sh-2); z-index:5; }
.pdot__time{
  position:absolute; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%);
  background:var(--text); color:var(--bg); font-size:11px; font-weight:640; padding:2px 6px;
  border-radius:6px; white-space:nowrap; pointer-events:none;
}
.plan__ghost{ position:absolute; top:50%; transform:translate(-50%,-50%); width:27px; height:27px; border-radius:9px; border:2px dashed var(--line-strong); pointer-events:none; }

.planlegend{ display:flex; flex-wrap:wrap; gap:14px; margin-top:12px; font-size:12px; color:var(--muted); }
.planlegend i{ width:13px; height:13px; border-radius:5px; display:inline-block; vertical-align:-2px; margin-right:5px; }
.plan__empty{ padding:30px; text-align:center; color:var(--faint); }

/* širší obsah v režimu plánu */
@media (min-width:900px){
  body.view-plan .main{ max-width:1260px; }
  body.view-plan .plan{ --med:196px; }
}

/* popisky hodin zarovnat k čáře hodiny, ne na střed sloupce */
.plan__hour{ width:auto; padding:0 4px; transform:translateX(-50%); place-items:center; }

/* ---- větší a pružná mřížka plánu ---- */
.planwrap{ container-type:inline-size; }
.plan{ --col:max(44px, calc((100cqw - var(--med) - 2px) / var(--cells))); }
.plan__hours{ height:34px; }
.plan__hour{ height:34px; font-size:12px; }
.plan__med{ min-height:58px; font-size:13.5px; padding:0 13px; }
.plan__track{ min-height:58px; }
.pdot{ width:32px; height:32px; border-radius:11px; font-size:14px; }
.plan__ghost{ width:32px; height:32px; border-radius:11px; }
.planbar{ padding:13px 16px; font-size:14px; }
@media (min-width:900px){
  body.view-plan .main{ max-width:1440px; }
  body.view-plan .plan{ --med:210px; }
}

/* dřívější (ukončený) rozpis v detailu léku */
.pastrules{ margin-top:12px; }
.pastrules summary{
  cursor:pointer; font-size:12.5px; font-weight:600; color:var(--faint);
  padding:7px 2px; list-style:none; display:flex; align-items:center; gap:6px;
}
.pastrules summary::-webkit-details-marker{ display:none; }
.pastrules summary::before{
  content:""; width:0; height:0; border-left:5px solid currentColor;
  border-top:4px solid transparent; border-bottom:4px solid transparent;
  transition:transform .15s var(--ease);
}
.pastrules[open] summary::before{ transform:rotate(90deg); }
.pastrules summary:hover{ color:var(--muted); }
.pastrules .field__h{ margin:2px 0 8px; }
