/* Schildi Care (hel) - one stylesheet. Palette from static/brand/schildicare-source.jpeg, Nunito (OFL, self-hosted).
   Light theme in :root; dark theme in [data-theme="dark"] and, when no theme is chosen, under prefers-color-scheme.
   The two dark blocks must stay identical (tests/test_style.py). No inline styles. */
@font-face {
  font-family: "Nunito"; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url("../fonts/nunito-latin-ext-wght-normal.ffdc8b0c86fb.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url("../fonts/nunito-latin-wght-normal.166202cc391c.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #F2F8EF; --surface: #FFFFFF; --surface-2: #E4F1DE; --text: #10352A; --muted: #4A675B;
  --border: #CFE2C7; --border-strong: #6F9A80;
  --accent: #1F6B4A; --on-accent: #FFFFFF; --accent-soft: #D8EDCB; --link: #1B6544; --focus: #2F7D55;
  --brand-dark: #0C483C; --brand-mid: #5E9E45; --brand-light: #A6D07A;
  --good: #2C7337; --mid: #8A5300; --bad: #B3261E;
  --heat-0: #EEF6EA; --heat-1: #D3EBC2; --heat-2: #A6D07A; --heat-3: #6FAE55; --heat-4: #2F7D4F; --heat-5: #0C483C;
  --heat-text-low: #10352A; --heat-text-high: #FFFFFF;
  --chart-1: #1F6B4A; --chart-2: #6A4C93; --chart-3: #C2571A; --chart-4: #2E86AB; --chart-5: #C2185B; --chart-6: #5B6B61; --chart-7: #0E8A8A; --chart-8: #7A8F1E;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-card: 20px; --r-btn: 14px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(12, 72, 60, 0.06), 0 4px 14px rgba(12, 72, 60, 0.06);
  --tap: 48px;
  --bar-h: 64px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0A1511; --surface: #11201A; --surface-2: #183026; --text: #E3F1E6; --muted: #A3BFAF;
  --border: #24402F; --border-strong: #5F8A70;
  --accent: #8FCB6E; --on-accent: #0A1511; --accent-soft: #1E3A2A; --link: #A6D884; --focus: #A6D884;
  --brand-dark: #CDE8BC; --brand-mid: #8FCB6E; --brand-light: #A6D07A;
  --good: #7FD58E; --mid: #F0C05A; --bad: #FF8F86;
  --heat-0: #15271F; --heat-1: #1F3D2B; --heat-2: #2E5C38; --heat-3: #3B6E36; --heat-4: #86C165; --heat-5: #C9EAA8;
  --heat-text-low: #E3F1E6; --heat-text-high: #0A1511;
  --chart-1: #8FCB6E; --chart-2: #B9A3E3; --chart-3: #F2A365; --chart-4: #7CC6E8; --chart-5: #F48FB1; --chart-6: #A9B8AE; --chart-7: #5FD1C9; --chart-8: #D4E157;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0A1511; --surface: #11201A; --surface-2: #183026; --text: #E3F1E6; --muted: #A3BFAF;
  --border: #24402F; --border-strong: #5F8A70;
  --accent: #8FCB6E; --on-accent: #0A1511; --accent-soft: #1E3A2A; --link: #A6D884; --focus: #A6D884;
  --brand-dark: #CDE8BC; --brand-mid: #8FCB6E; --brand-light: #A6D07A;
  --good: #7FD58E; --mid: #F0C05A; --bad: #FF8F86;
  --heat-0: #15271F; --heat-1: #1F3D2B; --heat-2: #2E5C38; --heat-3: #3B6E36; --heat-4: #86C165; --heat-5: #C9EAA8;
  --heat-text-low: #E3F1E6; --heat-text-high: #0A1511;
  --chart-1: #8FCB6E; --chart-2: #B9A3E3; --chart-3: #F2A365; --chart-4: #7CC6E8; --chart-5: #F48FB1; --chart-6: #A9B8AE; --chart-7: #5FD1C9; --chart-8: #D4E157;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5; font-weight: 500;
}
a { color: var(--link); text-underline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 var(--s3); font-weight: 800; }
h3 { font-size: 0.95rem; margin: var(--s3) 0 var(--s2); color: var(--muted); font-weight: 700; }
p { margin: 0 0 var(--s3); }
strong { font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.icon { width: 24px; height: 24px; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- brand ---------- */
/* Schildi's vector logo: the light and the dark drawing, one shown per theme (cookie or device) */
img.logo-dark { display: none; }
[data-theme="dark"] img.logo-light { display: none; }
[data-theme="dark"] img.logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.logo-light { display: none; }
  :root:not([data-theme="light"]) img.logo-dark { display: block; }
}
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; padding: 0 var(--s2) var(--s4); }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; flex: none; }
.brand-name { font-weight: 900; font-size: 1.63rem; letter-spacing: -0.01em; color: var(--brand-dark); }
.brand-name span { color: var(--brand-mid); }
.topbar .brand-mobile { display: flex; align-items: center; gap: var(--s2); }
.topbar .brand-mobile .brand-mark { width: 39px; height: 39px; border-radius: 12px; }

/* ---------- layout ---------- */
.sidebar { display: none; }
.page { padding: var(--s4) var(--s4) calc(var(--bar-h) + 96px); min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.topbar-title { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); z-index: 20;
  border-radius: var(--r-card) var(--r-card) 0 0; box-shadow: var(--shadow);
}
.bottombar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tap); color: var(--muted); text-decoration: none; font-size: 0.78rem; font-weight: 700;
}
.bottombar a[aria-current="page"] { color: var(--accent); }
.bottombar a[aria-current="page"] .icon { background: var(--accent-soft); border-radius: var(--r-pill); width: 48px; padding: 0 12px; }
.only-desktop { display: none; }

@media (min-width: 1024px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: 248px; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--border); padding: var(--s4) var(--s3) 0;
  }
  .sidebar ul { list-style: none; margin: 0; padding: 0; }
  .sidebar li.nav-sep { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--border); }
  .sidebar a:not(.brand), .sidebar .navbtn {
    display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3);
    border-radius: var(--r-pill); color: var(--text); text-decoration: none; width: 100%; font-weight: 700;
  }
  .sidebar a:not(.brand):hover, .sidebar .navbtn:hover { background: var(--surface-2); }
  .sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
  .sidebar a[aria-current="page"] .icon { color: var(--accent); }
  .sidebar-wave { margin-top: auto; height: 64px; background: url("../brand/wave.c1067dcf2bd1.svg") bottom / 100% 100% no-repeat; opacity: 0.9; flex: none; }
  .page { margin-left: 248px; padding: var(--s5) var(--s6) var(--s6); }
  .topbar .brand-mobile { display: none; }
  .bottombar { display: none; }
  .only-mobile { display: none; }
  .only-desktop { display: block; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); align-items: start; }
  .charts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
  .chart-box { height: 320px; }
  .actions.sticky { position: static; }
  .medlist { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
}
/* wide screens (round 2): no fixed right edge, more columns instead */
@media (min-width: 1800px) {
  .charts { grid-template-columns: repeat(3, 1fr); }
  .chart-box { height: 360px; }
  .overview-box { height: 1000px; }
}
@media (min-width: 2400px) {
  .charts { grid-template-columns: repeat(4, 1fr); }
  .cols { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- cards and lists ---------- */
.cards { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: var(--s4); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: var(--s4); margin-bottom: var(--s3); box-shadow: var(--shadow); }
.cards .card { margin-bottom: 0; display: flex; flex-direction: column; align-items: flex-start; }
.cards .card .btn { margin-top: auto; }
.list { list-style: none; margin: 0 0 var(--s4); padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li > a, .morelist .navbtn {
  display: flex; flex-direction: column; gap: 2px; min-height: var(--tap); padding: var(--s3) var(--s2);
  color: var(--text); text-decoration: none;
}
.morelist li > a, .morelist .navbtn { flex-direction: row; align-items: center; gap: var(--s3); font-weight: 700; }
.morelist .icon { color: var(--accent); }
/* menu groups (round 2): entering | looking at | lists and settings */
.morelist > li.nav-sep { border-top: 1px solid var(--border); margin-top: var(--s4); }
.daylist { list-style: none; padding: 0; margin: 0; }
.daylist a {
  display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s3); padding: var(--s3) var(--s2);
  border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; min-height: var(--tap);
}
.daylist .vals { grid-column: 1 / -1; color: var(--muted); font-variant-numeric: tabular-nums; }
.status { font-weight: 700; }
.status-done { color: var(--good); }
.status-open { color: var(--mid); }
.hintbar { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-card); border: 1px solid var(--border-strong); margin-bottom: var(--s4); background: var(--surface-2); }
.hintbar p { margin: 0; }
.hintbar .icon { color: var(--accent); }
.tags { font-size: 0.875rem; color: var(--muted); }
.foods { overflow-wrap: anywhere; }

/* ---------- "Was ist das?" box ---------- */
.help { background: var(--surface-2); border-radius: var(--r-card); margin-bottom: var(--s4); border: 1px solid var(--border); }
.help > summary { padding: 0 var(--s4); font-weight: 800; color: var(--text); gap: var(--s2); list-style: none; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary .icon { color: var(--accent); }
.help > summary::after { content: "+"; margin-left: auto; font-size: 1.25rem; color: var(--muted); }
.help[open] > summary::after { content: "–"; }
.help-body { padding: 0 var(--s4) var(--s3); }
.help-body p:last-child { margin-bottom: 0; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 700; font-size: 0.875rem; }
.table-wrap th, .table-wrap td { white-space: normal; overflow-wrap: anywhere; padding: var(--s2); }  /* judge F13 */

/* ---------- day class ---------- */
.cls-gut { color: var(--good); }
.cls-mittel { color: var(--mid); }
.cls-schlecht { color: var(--bad); }
.cls-none { color: var(--muted); }

/* ---------- buttons ---------- */
.btn, .navbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s4); border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.navbtn { border: 0; background: none; padding: 0 var(--s3); justify-content: flex-start; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--bad); border-color: var(--bad); }
.btn-danger.confirming { background: var(--bad); color: var(--on-accent); }
.btn-link { border-color: transparent; background: none; color: var(--link); }
.btn-small { min-height: 40px; padding: 0 var(--s3); font-size: 0.9375rem; }
.btn-icon { padding: 0; width: var(--tap); }
.nav-gap { visibility: hidden; }  /* keeps the place of a missing arrow (judge F11) */
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }
.actions.sticky {
  position: sticky; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + var(--s2));
  background: var(--bg); padding: var(--s2) 0; z-index: 10;
}
.actions.sticky .btn-primary { flex: 1 1 160px; }
.toolbar, .inline-form, .row-form { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; }
.row-form { padding: var(--s3) 0; }
.grow { flex: 1 1 200px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--s1); border: 0; margin: 0 0 var(--s4); padding: 0; min-width: 0; font-weight: 700; }
legend, .field > summary { font-weight: 800; padding: 0; margin-bottom: var(--s2); }
details.field > summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--link); }
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="date"],
input[type="time"], select, textarea {
  font: inherit; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-btn); min-height: var(--tap); padding: var(--s2) var(--s3); width: 100%;
}
textarea { resize: vertical; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.error { color: var(--bad); margin: var(--s1) 0 0; font-weight: 700; }
.banner { padding: var(--s3); border: 1px solid var(--bad); border-radius: var(--r-btn); }
.check { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); font-weight: 600; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s2); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.narrow { max-width: 640px; }
.medform { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 var(--s3); align-items: end; margin-bottom: var(--s4); }

/* segmented radio rows */
.seg { display: flex; gap: var(--s1); }
.seg-wrap { flex-wrap: wrap; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg-opt span {
  display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap);
  padding: 0 var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: var(--surface); cursor: pointer; font-weight: 700;
}
.seg-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.scale .seg .seg-opt span { padding: 0; min-width: 44px; }
.scale .seg .seg-opt.seg-legacy span { padding: 0 var(--s2); min-width: 64px; border-style: dashed; }
.scale-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.scale-label { color: var(--muted); margin: var(--s1) 0 0; min-height: 1.5em; font-weight: 600; }
.seg-links { flex-wrap: wrap; margin-bottom: var(--s3); }
.seg-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s4); border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; background: var(--surface); font-weight: 700;
}
.seg-link[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.stepper { display: flex; gap: var(--s2); align-items: center; max-width: 240px; }
.stepper input { text-align: center; font-weight: 800; font-size: 1.1rem; }
.stepper .btn-icon { font-size: 1.4rem; }

.hint { color: var(--muted); font-weight: 600; font-size: 0.9rem; margin: 0 0 var(--s2); }
label.field > .hint { margin: 0; }
.help-inline { margin-bottom: var(--s3); }
.help-inline > summary { min-height: 44px; font-weight: 700; }
.bristol .seg-opt span { flex-direction: column; min-width: 64px; padding: var(--s1) var(--s2); line-height: 1.15; border-radius: var(--r-btn); }
.bristol .seg-opt span small { font-size: 0.7rem; font-weight: 600; max-width: 9ch; text-align: center; }
.bristol .seg-opt input:checked + span small { color: inherit; }

/* meal picker and medication picker */
.chips, .chiprow { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips { margin-bottom: var(--s3); min-height: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: var(--s1); min-height: 40px; padding: 0 var(--s1) 0 var(--s3);
  border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); border: 0; font: inherit; font-weight: 700;
}
.chip button { min-width: 40px; min-height: 40px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.pick { min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.search { display: block; margin-bottom: var(--s3); }
.newfood { border: 1px dashed var(--border-strong); border-radius: var(--r-card); padding: var(--s3); margin-top: var(--s3); }
.medpick-results { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }

/* toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 80px); z-index: 30; }
.toast { background: var(--text); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--r-pill); margin-top: var(--s2); font-weight: 700; }
@media (min-width: 1024px) { .toasts { top: var(--s4); bottom: auto; } }

/* ---------- charts ---------- */
/* Neuer Eintrag (Matthias (g)): date picker and button on Heute and Einträge */
.newentry { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s4); font-weight: 700; }
.newentry input[type="date"] { width: auto; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.chart-head h2 { margin: 0; }
.chart-box { position: relative; height: 260px; margin-bottom: var(--s2); }
.chart-tall { height: 420px; }
.chart-card { min-width: 0; display: flex; flex-direction: column; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0; }
.legend-chip {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
}
.legend-chip .swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.legend-chip .swatch.mark-line { width: 18px; height: 4px; border-radius: 2px; }
.legend-chip[aria-pressed="false"] { color: var(--muted); border-style: dashed; text-decoration: line-through; }
.legend-chip[aria-pressed="false"] .swatch { opacity: 0.25; }
.chart-empty { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 160px; padding: var(--s4); border: 1px dashed var(--border-strong); border-radius: var(--r-btn); color: var(--muted); font-weight: 600; }
.sw-1 { background: var(--chart-1); } .sw-2 { background: var(--chart-2); } .sw-3 { background: var(--chart-3); } .sw-4 { background: var(--chart-4); }
.sw-5 { background: var(--chart-5); } .sw-6 { background: var(--chart-6); } .sw-7 { background: var(--chart-7); } .sw-8 { background: var(--chart-8); }

/* fullscreen: the card itself (Fullscreen API) or, without it, a fixed overlay */
.chart-card:fullscreen, .chart-card.is-fs { background: var(--bg); padding: var(--s4); margin: 0; border-radius: 0; overflow: auto; }
.chart-card.is-fs { position: fixed; inset: 0; z-index: 50; padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s3) calc(var(--s3) + env(safe-area-inset-bottom)); }
.chart-card:fullscreen .chart-box, .chart-card.is-fs .chart-box { flex: 1 1 auto; height: auto; min-height: 60vh; }
body.fs-open { overflow: hidden; }

/* Gesamtbild */
.overview-controls { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s3); }
.overview-controls .field { margin: 0; }
.overview-controls input[type="date"] { width: auto; }
.lag { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); font-weight: 700; flex-wrap: wrap; }
.lag input[type="range"] { width: 180px; accent-color: var(--accent); min-height: var(--tap); }
.overview-box { position: relative; height: 720px; }
.sliders { display: flex; flex-wrap: wrap; gap: 0 var(--s5); }
.overview-controls .seg-links { margin: 0; }
@media (max-width: 600px) { .overview-box { height: 560px; } }

/* Kalender: year view, 12 small months */
.year-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.mini-title { display: block; font-weight: 800; margin-bottom: var(--s1); color: var(--text); text-decoration: none; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-day { aspect-ratio: 1; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); }
.mini-empty { border-color: transparent; background: none; }
.mini-day.cls-gut { background: var(--good); border-color: var(--good); }
.mini-day.cls-mittel { background: var(--mid); border-color: var(--mid); }
.mini-day.cls-schlecht { background: var(--bad); border-color: var(--bad); }

/* Medikamente */
.medlist { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); }
.medlist > .card { margin: 0; }
.med-head { display: flex; align-items: center; gap: var(--s3); }
.med-text { display: flex; flex-wrap: wrap; gap: 0 var(--s2); align-items: baseline; min-width: 0; }
.med-star { margin: 0; }
.star { font-size: 1.4rem; color: var(--muted); border-color: transparent; }
.star[aria-pressed="true"] { color: var(--mid); }
.med-hidden .med-text { opacity: 0.6; }
.med-edit > summary { color: var(--link); font-weight: 700; }
/* Gesamtbild legend (judge F7): collapsible groups, no inner scroll */
.chart-legend.legend-grouped { display: block; }
.legend-group { margin: 0 0 var(--s2); }
.legend-group > summary { cursor: pointer; font-weight: 800; padding: var(--s1) 0; }
.legend-group > summary .muted { font-weight: 600; margin-left: 0.4em; }
.legend-group > summary::after { content: "+"; margin-left: 0.5em; color: var(--muted); }
.legend-group[open] > summary::after { content: "–"; }
.legend-group .legend-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s1) 0 var(--s2); }

/* ---------- day and month navigation, calendar heatmap ---------- */
.monthnav, .daynav { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.monthname, .dayname { font-weight: 800; min-width: 10ch; text-align: center; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s1); }
.cal-head { text-align: center; color: var(--muted); font-size: 0.875rem; font-weight: 700; }
.cal-day, .cal-empty {
  min-height: 56px; border-radius: var(--r-btn); display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--text); border: 1px solid var(--border); background: var(--surface); font-weight: 700;
}
.cal-empty { border-color: transparent; background: none; }
.cal-future { color: var(--muted); opacity: 0.6; }
.cal-val { font-size: 0.8rem; line-height: 1.1; font-weight: 800; }
.cal-num { line-height: 1.2; }
.heat-0 { background: var(--heat-0); color: var(--heat-text-low); }
.heat-1 { background: var(--heat-1); color: var(--heat-text-low); }
.heat-2 { background: var(--heat-2); color: var(--heat-text-low); }
.heat-3 { background: var(--heat-3); color: var(--heat-text-low); }
.heat-4 { background: var(--heat-4); color: var(--heat-text-high); }
.heat-5 { background: var(--heat-5); color: var(--heat-text-high); }
.cal-day.cls-gut { background: color-mix(in srgb, var(--good) 22%, var(--surface)); border-color: var(--good); }
.cal-day.cls-mittel { background: color-mix(in srgb, var(--mid) 22%, var(--surface)); border-color: var(--mid); }
.cal-day.cls-schlecht { background: color-mix(in srgb, var(--bad) 22%, var(--surface)); border-color: var(--bad); }
.cal-sym { font-size: 0.875rem; line-height: 1; }
.heat-legend { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); list-style: none; padding: 0; }
.heat-legend li { display: inline-flex; align-items: center; gap: var(--s1); font-size: 0.875rem; font-weight: 600; }
.heat-legend .swatch { display: inline-block; width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--border); }
.legend { margin-top: var(--s3); }
.metric-form { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s3); }
.metric-form .field { margin: 0; flex: 1 1 220px; }

/* patterns */
.pattern .effect { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; }
.pattern .effect .icon { width: 18px; height: 18px; }
.effect-good { color: var(--good); }
.effect-bad { color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s4); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }

/* settings: theme choice */
.theme-form .seg { flex-wrap: wrap; }

/* login */
body.auth { display: flex; justify-content: center; min-height: 100vh; background: var(--bg) url("../brand/wave.c1067dcf2bd1.svg") bottom / 100% 140px no-repeat; }
.auth-box { width: 100%; max-width: 420px; padding: var(--s6) var(--s4); }
.auth-logo { display: block; width: min(260px, 70vw); height: auto; margin: 0 auto var(--s5); }
.brand-big { font-size: 2.25rem; font-weight: 900; color: var(--brand-dark); margin-bottom: var(--s5); text-align: center; }
.brand-big span { color: var(--brand-mid); }
.qr { margin: var(--s3) 0; text-align: center; }
.qr img { background: #FFFFFF; padding: var(--s2); border-radius: var(--r-btn); max-width: 100%; height: auto; }
.secret { word-break: break-all; }
.pager { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; }
