:root { color-scheme: light dark;
  --fg: #16202b; --muted: #5b6673; --bg: #eef1f5; --card: #ffffff; --line: #dfe4ea; --soft: #f4f6f8;
  --accent: #0f766e; --accent-soft: #e6f4f1; --ink-dark: #16202b; --on-dark: #ffffff;
  --err: #b3261e; --ok: #1c6b3a; --ok-soft: #e8f5ee; --hi: #9a3f0c; --hi-soft: #fff3ee; --hi-line: #f3c9b8; --lo: #1d6fb8; --lo-soft: #e8f1fb;
  --att: #d14d4d; --ks: #f5c04a; --per: #d6688a; --per-soft: #e8a0b4;
  --oura: #6b4fbb; --air: #2a9d8f; --wth: #d97706; --wx: #0ea5e9; --eco: #4f46e5; --hae: #475569;
  --shadow: 0 1px 2px rgba(22,32,43,.06), 0 4px 14px rgba(22,32,43,.04); --radius: 18px; --radius-s: 12px; }
@media (prefers-color-scheme: dark) { :root { --fg: #e6e8eb; --muted: #a2a9b4; --bg: #14171b; --card: #1d2127; --line: #2f353e; --soft: #262b33;
  --accent: #5fd3c4; --accent-soft: #143733; --ink-dark: #0e1114; --on-dark: #ffffff; --err: #ff8a80; --ok: #9be0b5; --ok-soft: #12301f; --hi: #ffb27a; --hi-soft: #3a2415; --hi-line: #6b3a1d; --lo: #7db9ff; --lo-soft: #14283d;
  --shadow: 0 1px 2px rgba(0,0,0,.4); } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body { margin: 0; min-height: 100%; font: 16px/1.5 -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: .4rem 0; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
button, .action { font: inherit; color: inherit; cursor: pointer; }
button { padding: .65rem 1rem; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--card); min-height: 44px; }
button.primary, form button[type=submit].primary { background: var(--ink-dark); border-color: var(--ink-dark); color: var(--on-dark); font-weight: 700; }
button.danger { color: var(--err); border-color: var(--err); }
button.ghost { background: transparent; border-color: transparent; color: var(--accent); font-weight: 700; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font-weight: 700; font-size: .95rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
label { display: block; margin: .6rem 0; font-size: .9rem; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; font: inherit; color: inherit; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; }
textarea { min-height: 3rem; }
details { margin-top: .5rem; } summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
ul { padding: 0; list-style: none; margin: 0; } li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; } li:last-child { border-bottom: 0; }
li button { padding: .25rem .6rem; font-size: .8rem; min-height: 36px; }
#msg { min-height: 1.5rem; margin: 0; padding: 0 16px; color: var(--err); font-size: .9rem; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
#msg:empty { display: none; }
.card { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin: .75rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin: 1.4rem 0 .6rem; }
.section-head.tight { margin: 0 0 .5rem; }
.row { display: flex; gap: .6rem; align-items: end; margin: .5rem 0; flex-wrap: wrap; } .row .grow { flex: 1 1 10rem; } .row label { margin: 0; }
.row input[type=date] { width: auto; flex: 1; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .5rem .8rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); margin: .75rem 0; padding: .5rem .8rem .8rem; } legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }

/* Brand */
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: inline-block; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 7px; border-radius: 3px; border: 2.5px solid #fff; border-left: 0; border-top: 0; transform: rotate(-45deg) translate(-2px, -2px); }

/* Login */
#view-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 16px; }
.login-card { width: 100%; max-width: 24rem; background: var(--card); border-radius: 22px; padding: 1.6rem 1.4rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; }
.login-card .primary { width: 100%; }

/* Shell: sidebar on wide screens, bottom nav on phones */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.sidenav { display: none; }
.content { padding: .25rem 16px calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 44rem; width: 100%; margin: 0 auto; min-width: 0; overflow-x: hidden; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(6, 1fr); background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30; }
.nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; border-radius: 10px; padding: 6px 2px; min-height: 52px; font-size: .7rem; font-weight: 600; color: var(--muted); }
.nav-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn.on { color: var(--accent); }
.side-sources { display: none; }
@media (min-width: 900px) {
  .shell { grid-template-columns: 232px 1fr; }
  .sidenav { display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: 100vh; padding: 1.6rem 1rem; background: var(--ink-dark); color: #fff; }
  .sidenav .brand { padding: 0 .5rem 1.2rem; color: #fff; }
  .sidenav .nav-btn { flex-direction: row; justify-content: flex-start; gap: .75rem; padding: .65rem .75rem; font-size: .95rem; color: #c5ccd6; min-height: 44px; }
  .sidenav .nav-btn.on { background: rgba(255,255,255,.1); color: #fff; }
  .sidenav .nav-btn svg { width: 20px; height: 20px; }
  .side-sources { display: flex; flex-direction: column; gap: .3rem; margin-top: auto; padding: .8rem .75rem; border-radius: 12px; background: rgba(255,255,255,.06); font-size: .8rem; color: #c5ccd6; }
  .side-sources div { display: flex; justify-content: space-between; gap: .5rem; } .side-sources .fresh { color: #7fd1b9; } .side-sources .stale { color: #ffb27a; }
  .bottomnav { display: none; }
  .content { padding: 1.5rem 36px 3rem; max-width: 72rem; }
}

/* Day bar */
.daybar { display: flex; gap: .4rem; align-items: center; margin: .5rem 0 .25rem; }
.daybar input { width: auto; flex: 1; max-width: 15rem; margin: 0; background: var(--card); }
.daybar button { padding: 0 .9rem; }
.daybar .ghost { padding: 0 .6rem; }

/* Hero */
.hero { display: flex; flex-direction: column; gap: .9rem; margin-top: .5rem; }
.status-card { display: flex; align-items: center; gap: 1rem; background: var(--card); border-radius: 20px; padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.status-icon { width: 64px; height: 64px; border-radius: 32px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); }
.status-icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: none; }
.status-icon[data-kind=frei] .i-frei, .status-icon[data-kind=past] .i-past, .status-icon[data-kind=att] .i-att, .status-icon[data-kind=ks] .i-ks { display: block; }
.status-icon[data-kind=att] { background: #fbe4e4; color: #b3261e; } .status-icon[data-kind=ks] { background: #fff4d6; color: #8a5a00; } .status-icon[data-kind=past] { background: var(--soft); color: var(--muted); }
@media (prefers-color-scheme: dark) { .status-icon[data-kind=att] { background: #3b171d; color: #ffb1bb; } .status-icon[data-kind=ks] { background: #3a2a0f; color: #ffcf87; } }
.status-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.status-text { display: flex; flex-direction: column; gap: .1rem; font-size: .9rem; min-width: 0; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.action { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-radius: 16px; border: 0; font-weight: 700; font-size: .95rem; min-height: 56px; text-align: left; }
.action svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.action.dark { background: var(--ink-dark); color: var(--on-dark); } .action.light { background: var(--card); box-shadow: var(--shadow); } .action.light svg { color: var(--accent); }
.action.done { background: var(--accent-soft); color: var(--accent); }
.hint { display: flex; gap: .75rem; align-items: flex-start; background: var(--hi-soft); border: 1px solid var(--hi-line); border-radius: var(--radius); padding: .85rem 1rem; margin-top: .9rem; color: var(--hi); font-size: .92rem; }
.hint svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; flex-shrink: 0; margin-top: 2px; }
.hint-title { font-weight: 800; }

/* Key tiles */
.key-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
@media (min-width: 900px) { .key-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.key { background: var(--card); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.key .l { font-size: .82rem; font-weight: 600; color: var(--muted); } .key .v { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.key .v small { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: .15rem; }
.key svg { width: 100%; height: 34px; display: block; }
.key .n { font-size: .8rem; font-weight: 600; } .key .n.ok { color: var(--ok); } .key .n.hi { color: var(--hi); } .key .n.lo { color: var(--lo); } .key .n.na { color: var(--muted); font-weight: 400; }
.key.empty .v { color: var(--muted); }

/* Tiles (day values) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; margin: .5rem 0; }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: .5rem .7rem; min-width: 0; }
.tile .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; } .tile .l { font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; }
.tile.oura { border-left: 3px solid var(--oura); } .tile.air, .mini.air { border-left: 3px solid var(--air); } .tile.wth, .mini.wth { border-left: 3px solid var(--wth); }
.tile.wx, .mini.wx { border-left: 3px solid var(--wx); } .tile.eco, .mini.eco { border-left: 3px solid var(--eco); } .mini.oura { border-left: 3px solid var(--oura); }
#tiles-more h3 { font-size: .85rem; margin: .8rem 0 .3rem; color: var(--muted); }

/* Attacks */
.attacks { display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0; }
.attacks .att { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem .9rem; border-radius: 14px; background: #fbe4e4; color: #7c1d1d; font-size: .9rem; border-left: 4px solid var(--att); }
.attacks .att.ended { border-left-color: transparent; }
@media (prefers-color-scheme: dark) { .attacks .att { background: #3b171d; color: #ffb1bb; } }
.attacks .att button { padding: .3rem .7rem; font-size: .8rem; min-height: 36px; color: inherit; background: rgba(255,255,255,.55); border-color: transparent; }
@media (prefers-color-scheme: dark) { .attacks .att button { background: rgba(255,255,255,.12); } }

/* Segments and chips */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; border-radius: 9px; padding: .45rem .8rem; font-size: .85rem; font-weight: 700; min-height: 38px; background: transparent; color: var(--muted); }
.seg button.on { background: var(--ink-dark); color: var(--on-dark); }
.seg.wide { display: flex; } .seg.wide label { margin: 0; flex: 1; text-align: center; padding: .55rem .4rem; font-size: .85rem; cursor: pointer; border-radius: 9px; }
.seg.wide input { display: none; } .seg.wide label:has(input:checked) { background: var(--ink-dark); color: var(--on-dark); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.chips label { margin: 0; display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; cursor: pointer; min-height: 36px; }
.chips input { display: inline; width: auto; margin: 0; min-height: 0; }
.chips label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Schnell-Check (ein Tipp) */
.quick { background: var(--card); border-radius: 20px; padding: .9rem 1.1rem; box-shadow: var(--shadow); }
.quick-q { font-weight: 800; font-size: 1.05rem; margin-bottom: .6rem; letter-spacing: -.01em; }
.quick-sub { font-weight: 700; font-size: .9rem; margin: .9rem 0 .4rem; }
.quick-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.qs { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 64px; padding: .5rem .3rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--soft); font-weight: 700; font-size: .88rem; }
.qs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.qs[data-status=frei].on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.qs[data-status=kopfschmerz].on { background: #fff4d6; border-color: #e0a92c; color: #8a5a00; }
.qs[data-status=migraene].on { background: #fbe4e4; border-color: var(--att); color: #b3261e; }
@media (prefers-color-scheme: dark) { .qs[data-status=kopfschmerz].on { background: #3a2a0f; color: #ffcf87; } .qs[data-status=migraene].on { background: #3b171d; color: #ffb1bb; } }
.faces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.face { font-size: 1.6rem; line-height: 1; min-height: 52px; padding: 0; border-radius: 14px; background: var(--soft); border: 1.5px solid var(--line); filter: grayscale(.6); opacity: .8; }
.face.on { filter: none; opacity: 1; background: var(--accent-soft); border-color: var(--accent); transform: scale(1.06); }
.quick-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.qc { min-height: 40px; padding: .35rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 600; background: var(--soft); }
.qc.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.quick-summary { display: flex; justify-content: space-between; align-items: center; gap: .75rem; font-weight: 700; min-height: 36px; }
.quick-summary .link { flex-shrink: 0; }
.actions.one { grid-template-columns: 1fr; }
#quick .row { margin-bottom: 0; align-items: center; }

/* Nachtragen: letzte 7 Tage */
.cday { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem; padding: .35rem .1rem; min-height: 60px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--soft); font-size: .72rem; line-height: 1.2; position: relative; }
.cday .d { font-size: 1.05rem; font-weight: 800; } .cday .m { font-size: .66rem; font-weight: 600; white-space: nowrap; }
.cday.none { border-style: dashed; } .cday.none .m { color: var(--muted); font-size: .85rem; }
.cday.frei { background: #cfe5da; border-color: transparent; color: #1c4a30; } .cday.kopfschmerz { background: #fff4d6; border-color: transparent; color: #8a5a00; }
.cday.migraene, .cday.att { background: #fbe4e4; border-color: transparent; color: #7c1d1d; }
@media (prefers-color-scheme: dark) { .cday.frei { background: #12301f; color: #9be0b5; } .cday.kopfschmerz { background: #3a2a0f; color: #ffcf87; } .cday.migraene, .cday.att { background: #3b171d; color: #ffb1bb; } }
.cday.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.cday.sel::after { content: "✓"; position: absolute; top: 2px; right: 5px; font-size: .75rem; font-weight: 800; color: var(--accent); }
.cday.today .d { color: var(--accent); }
.cday.future { visibility: hidden; }
.cday:disabled { opacity: .35; }
/* Nachtrag-Hinweis */
.catch-card { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; margin-top: .7rem; padding: .8rem 1rem; border-radius: 16px; border: 1.5px dashed var(--accent); background: var(--accent-soft); color: var(--fg); min-height: 56px; }
.catch-card.plain { border-style: solid; border-color: var(--line); background: var(--card); box-shadow: var(--shadow); margin: 0 0 .75rem; }
.catch-text { display: flex; flex-direction: column; flex: 1; line-height: 1.3; } .catch-go { font-size: 1.6rem; color: var(--accent); font-weight: 700; }
.catch-dots { display: grid; grid-template-columns: repeat(7, 7px); gap: 3px; flex-shrink: 0; }
.catch-dots i { width: 7px; height: 7px; border-radius: 2px; background: var(--line); }
.catch-dots i.frei { background: #3a9b6a; } .catch-dots i.kopfschmerz { background: var(--ks); } .catch-dots i.migraene, .catch-dots i.att { background: var(--att); } .catch-dots i.none { background: transparent; border: 1.5px dashed var(--muted); }
/* Blatt (Dialog) – am Handy vollflaechig, am Desktop mittig */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(10,14,20,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-box { background: var(--bg); width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 1rem 1.1rem calc(1.2rem + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-box { border-radius: 22px; max-height: 92vh; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; position: sticky; top: -1rem; background: var(--bg); padding: .4rem 0 .5rem; z-index: 1; }
.sheet-x { border: 0; background: var(--card); border-radius: 50%; width: 40px; height: 40px; min-height: 40px; padding: 0; font-size: 1.05rem; }
.sheet-foot { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin-top: 1rem; position: sticky; bottom: calc(-1.2rem - env(safe-area-inset-bottom, 0px)); background: var(--bg); padding: .6rem 0 .4rem; }
button.big { width: 100%; min-height: 54px; font-size: 1.05rem; border-radius: 16px; }
.row.between { justify-content: space-between; align-items: center; }
.cal-head, .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.cal-head { margin-top: .6rem; font-size: .72rem; font-weight: 700; color: var(--muted); text-align: center; }
.cal { margin-top: .3rem; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .6rem; } .cal-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; } .lg.frei { background: #3a9b6a; } .lg.kopfschmerz { background: var(--ks); } .lg.migraene { background: var(--att); } .lg.none { border: 1.5px dashed var(--muted); }
.cal-bar { position: sticky; bottom: calc(-1.2rem - env(safe-area-inset-bottom, 0px)); background: var(--card); border-radius: 18px; padding: .8rem .9rem 1rem; margin-top: .8rem; box-shadow: 0 -4px 18px rgba(22,32,43,.12); }
.cal-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .55rem; }
.cal-details { display: flex; flex-direction: column; gap: .4rem; margin-top: .4rem; }
.cal-details button { text-align: left; }
/* Auswahl-Knoepfe (eine oder mehrere Optionen) */
.opts { display: flex; flex-wrap: wrap; gap: .45rem; }
.opts button { min-height: 44px; padding: .5rem .85rem; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-weight: 600; font-size: .92rem; }
.opts button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.nums button { min-height: 48px; padding: 0; font-weight: 800; font-size: 1.05rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); }
.nums button.on { background: var(--att); border-color: var(--att); color: #fff; }
.err { color: var(--err); min-height: 1em; margin: .3rem 0 0; }
.stale { border: 2px solid var(--att); }
.stale .opts { margin-top: .5rem; }
.end-btn { margin-left: auto; align-self: center; background: var(--att); border-color: var(--att); color: #fff; font-weight: 700; border-radius: 12px; white-space: nowrap; }
.action.slim { width: 100%; min-height: 48px; margin-bottom: .2rem; font-size: .9rem; }


/* Medikamente (mehrere je Anfall) */
.med-list { display: flex; flex-direction: column; gap: .4rem; }
.med { border: 1px solid var(--line); border-radius: 12px; padding: .2rem .7rem .5rem; background: var(--soft); }
.med .row { margin: .3rem 0; } .med-remove { min-height: 44px; padding: 0 .8rem; color: var(--err); }

/* Verlauf */
#range-strip { display: grid; grid-auto-flow: column; gap: 2px; margin: .5rem 0 .25rem; }
#range-strip .cell { height: 22px; border-radius: 3px; background: var(--line); }
#range-strip .cell.att { background: var(--att); } #range-strip .cell.ks { background: var(--ks); } #range-strip .cell.aura { background: #f0a1a1; } #range-strip .cell.frei { background: #cfe5da; }
#range-strip .cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
#range-cycle { display: grid; grid-auto-flow: column; gap: 2px; margin: .3rem 0; } #range-cycle .cell { height: 14px; border-radius: 2px; background: var(--soft); font-size: .58rem; line-height: 14px; text-align: center; color: var(--muted); overflow: hidden; }
#range-cycle .cell.flow.f1 { background: var(--per-soft); } #range-cycle .cell.flow.f2 { background: #e07fa0; } #range-cycle .cell.flow.f3 { background: var(--per); } #range-cycle .cell.start { outline: 1.5px solid #b8325a; outline-offset: 1px; } #range-cycle .cell.expect { border: 1.5px dashed var(--per); background: transparent; }
.legend, #range-cycle-note { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .3rem; }
.legend span { display: inline-flex; align-items: center; gap: .3rem; } .legend i.cell { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--line); }
.legend i.cell.att { background: var(--att); } .legend i.cell.ks { background: var(--ks); } .legend i.cell.aura { background: #f0a1a1; } .legend i.cell.frei { background: #cfe5da; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .7rem; }
.mini { background: var(--card); border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow); }
.mini .t { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: .3rem; } .mini .t span:first-child { font-weight: 600; } .mini .t span:last-child { color: var(--muted); }
.mini svg { width: 100%; height: auto; display: block; }
#chart { width: 100%; height: auto; background: var(--soft); border-radius: 12px; margin-top: .5rem; }
.integration { padding: .4rem 0; }

/* Vor dem Anfall */
.pre-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin: .5rem 0 1rem; }
.pre-table th, .pre-table td { padding: .35rem .4rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.pre-table th:first-child, .pre-table td:first-child { text-align: left; white-space: normal; }
.pre-table th { font-weight: 600; color: var(--muted); } .pre-table td.base { color: var(--muted); } .pre-table td.att0 { font-weight: 700; }
.pre-table .n { opacity: .6; font-size: .7rem; }
.pre-lo { color: var(--lo); } .pre-hi { color: var(--hi); }
.pre-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); padding: .4rem .6rem; box-shadow: var(--shadow); }
#pre-attacks details { margin-top: .6rem; } #pre-attacks summary { font-weight: 700; }

@media (prefers-reduced-motion: no-preference) { .tab { animation: fade .18s ease-out; } @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } } }

/* Diagramme (SVG-Klassen aus app.js) */
#chart .grid { stroke: var(--line); stroke-width: 1; } #chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
#chart .band { fill: var(--accent); opacity: .15; } #chart text { fill: var(--fg); font-size: 10px; }
#chart .attack { fill: var(--err); opacity: .18; } #chart .aura { fill: var(--err); opacity: .08; }
.mini .bar { fill: var(--accent); opacity: .75; } .mini .bar.att { fill: var(--err); }
.mini .line { fill: none; stroke: var(--accent); stroke-width: 1.5; } .mini .dot { fill: var(--accent); } .mini .dot.att { fill: var(--err); }
.mini .grid { stroke: var(--line); stroke-width: 1; } .mini text { fill: var(--fg); font-size: 9px; } .mini .attday { fill: var(--att); opacity: .12; }
.mini .avg { stroke: var(--fg); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.mini.oura .line, .mini.oura .dot { stroke: var(--oura); fill: var(--oura); } .mini.oura .line { fill: none; } .mini.oura .bar { fill: var(--oura); }
.mini.wth .line { stroke: var(--wth); } .mini.wth .dot, .mini.wth .bar { fill: var(--wth); }
.mini.air .line { stroke: var(--air); } .mini.air .dot, .mini.air .bar { fill: var(--air); }
.mini.eco .line { stroke: var(--eco); } .mini.eco .dot, .mini.eco .bar { fill: var(--eco); }
.mini.wx .line { stroke: var(--wx); } .mini.wx .dot, .mini.wx .bar { fill: var(--wx); }
.mini .dot.att, .mini .bar.att { fill: var(--err); }
#range-cycle .cell { cursor: pointer; } #range-strip .cell { cursor: pointer; }
body.noscroll { overflow: hidden; }
.sick-row { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.sick-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .35rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--soft); font-weight: 700; font-size: .88rem; flex-shrink: 0; }
.sick-btn.on { background: #ece6f8; border-color: #7c5cbf; color: #5b3fa0; }
@media (prefers-color-scheme: dark) { .sick-btn.on { background: #2a2140; color: #c7b5f2; } }
.sick-btn.wide { width: 100%; justify-content: center; margin-top: .5rem; }
.cday.is-sick::before, #range-strip .cell.is-sick::before { content: ""; position: absolute; left: 5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #7c5cbf; }
#range-strip .cell { position: relative; } #range-strip .cell.is-sick::before { left: 50%; top: 2px; width: 6px; height: 6px; transform: translateX(-50%); }
.legend .cell.is-sick { position: relative; } .legend .cell.is-sick::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #7c5cbf; }
.lg.sick { background: #7c5cbf; border-radius: 50%; }
.medpicks { display: flex; flex-direction: column; gap: .45rem; }
.medpick { display: flex; align-items: center; gap: .45rem; padding: .3rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); }
.medpick.on { border-color: var(--accent); background: var(--accent-soft); }
.medpick .medname { flex: 1; text-align: left; border: 0; background: transparent; font-weight: 700; min-height: 44px; }
.medpick.on .medname { color: var(--accent); }
.medpick .step { width: 44px; min-width: 44px; padding: 0; font-size: 1.3rem; font-weight: 800; border-radius: 12px; background: var(--card); }
.medpick .medamt { min-width: 4.5rem; text-align: center; font-weight: 800; }
.med-other .dose { flex: 0 1 8rem; }
.medlist-rows { display: flex; flex-direction: column; gap: .4rem; }
.medlist-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 40px 40px; gap: .35rem; align-items: center; padding-bottom: .45rem; border-bottom: 1px solid var(--line); }
.medlist-row > input:first-child { grid-column: 1 / -1; font-weight: 700; }
.medlist-row input, .medlist-row select { margin: 0; min-width: 0; }
.medlist-row button { padding: 0; min-height: 40px; }
.mt { margin-top: .8rem; }
.center-row { justify-content: center; align-items: center; gap: .5rem; }
.wide-btn { width: 100%; margin-top: .4rem; }
.doc-form { margin-top: .8rem; }
.doc-pages { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.doc-pages span { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .4rem .3rem .75rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; }
.doc-pages button { min-height: 30px; padding: 0 .55rem; border: 0; background: transparent; color: inherit; }
.doc-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .9rem; }
.doc { border: 1px solid var(--line); border-radius: 14px; padding: .7rem .8rem; }
.doc-t { font-weight: 800; } .doc-m { color: var(--muted); font-size: .82rem; }
.doc-a { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .5rem; }
.doc-a a, .doc-a button { display: inline-flex; align-items: center; min-height: 38px; padding: .3rem .8rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: .85rem; font-weight: 700; color: inherit; text-decoration: none; }
.doc-a .del.armed { background: var(--err); color: #fff; border-color: var(--err); }
.nav-btn span { white-space: nowrap; }
a.link { color: var(--accent); font-weight: 700; text-decoration: none; }

/* p3r B5: "weiss nicht mehr" - eingetragen, aber unbekannt (grau, durchgezogen, Fragezeichen) */
.quick-btns.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.quick-btns.four .qs { font-size: .8rem; }
.qs.unk { color: var(--muted); }
.cday.unbekannt { background: #e3e6ea; border-color: transparent; color: #4a5260; }
.cday.unbekannt .m { font-size: 1rem; font-weight: 800; }
.catch-dots i.unbekannt, .lg.unbekannt { background: #aab1bb; }
#range-strip .cell.unk, .legend i.cell.unk { background: #c8cdd4; }
@media (prefers-color-scheme: dark) { .cday.unbekannt { background: #2a2f36; color: #c3c9d2; } }

/* p3r B7: "Vor dem Anfall" - Tabelle waagrecht scrollen, erste Spalte (Messgroesse) bleibt stehen */
.pre-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .5rem 0 1rem; max-width: 100%; padding: .4rem 0; }
.pre-table th:last-child, .pre-table td:last-child { padding-right: .7rem; }
.pre-wrap .pre-table { margin: 0; width: max-content; min-width: 100%; }
.pre-table th:first-child, .pre-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); padding-left: .7rem; box-shadow: 1px 0 0 var(--line), 6px 0 8px -6px rgba(0, 0, 0, .18); }
.pre-table thead th:first-child { z-index: 2; }
@media (max-width: 720px) { .pre-table th:first-child, .pre-table td:first-child { min-width: 8.5rem; max-width: 9.5rem; } }

/* p3r B6/B8: KI */
.ai-hint { background: var(--accent-soft); color: var(--fg); border-radius: 12px; padding: .55rem .75rem; margin: .4rem 0; }
.ai-hint.busy::before { content: ""; display: inline-block; width: .8rem; height: .8rem; margin-right: .45rem; vertical-align: -.1rem; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: aispin .8s linear infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }
.ai-sum { margin: .3rem 0 .6rem; font-size: .85rem; } .ai-sum summary { cursor: pointer; font-weight: 700; color: var(--muted); } .ai-sum p { white-space: pre-wrap; margin: .4rem 0 0; }
.ai-text { line-height: 1.5; font-size: .95rem; }
.ai-text h3 { margin: 1.1rem 0 .3rem; font-size: 1.02rem; } .ai-text h3:first-child { margin-top: .3rem; }
.ai-text ul { margin: .2rem 0 .6rem; padding-left: 1.3rem; list-style: disc; } .ai-text li { margin: .25rem 0; padding: 0; border: 0; display: list-item; font-size: inherit; } .ai-text p { margin: .35rem 0; }
#ai-run.busy::before { content: ""; display: inline-block; width: .9rem; height: .9rem; margin-right: .5rem; vertical-align: -.1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: aispin .8s linear infinite; }
