/* feh-home: Gestaltung nach Konzept Kapitel 7 und dem Mockup vom 24.09.2026.
   Hell oder dunkel folgt der iPhone-Einstellung, der Schalter setzt data-thema auf <html>.
   Keine Inline-Styles, damit die CSP ohne 'unsafe-inline' auskommt. */

@font-face { font-family: "Sora"; src: url("schriften/sora.0d0e5e4d2f9f.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("schriften/manrope.938c6e8019b6.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light dark;
  --bg: light-dark(#F2F4F3, #0B0E11);
  --flaeche: light-dark(#FFFFFF, #151A1F);
  --flaeche2: light-dark(#EEF1F2, #1F2630);
  --linie: light-dark(#DDE3E5, #222A31);
  --text: light-dark(#0E1417, #F2F5F4);
  --text2: light-dark(#3A454C, #C3CCCE);
  --leise: light-dark(#56626A, #9AA5A8);
  --blass: light-dark(#8A949A, #5A6670);
  --auf-akzent: light-dark(#FFFFFF, #0B0E11);
  /* Personen und Gemeinsames (Konzept 7), hell jeweils dunkler für genug Kontrast */
  --mint: light-dark(#0E9F6E, #5CF2B0);
  --koralle: light-dark(#D9483B, #FF8A7A);
  --lila: light-dark(#5B4BD6, #B9B0FF);
  --gelb: light-dark(#A86400, #FFC04D);
  --gelb-grund: light-dark(#FFF4DE, #2A2412);
  --ampel-gruen: light-dark(#15803D, #4ADE80);
  --ampel-rot: light-dark(#C62828, #FF6B6B);
  --schatten: light-dark(rgb(14 20 23 / 0.10), rgb(0 0 0 / 0.45));
  --ich: var(--mint);
}
:root[data-thema="hell"] { color-scheme: light; }
:root[data-thema="dunkel"] { color-scheme: dark; }

.person-mint { --ich: var(--mint); }
.person-koralle { --ich: var(--koralle); }
.farbe-mint { --person: var(--mint); }
.farbe-koralle { --person: var(--koralle); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 500 16px/1.45 "Manrope", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .zahl, .marke { font-family: "Sora", system-ui, sans-serif; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ich); outline-offset: 2px; }
.leise { color: var(--leise); }
.klein { font-size: 13px; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprung { position: absolute; left: -9999px; }
.sprung:focus { left: 12px; top: 12px; z-index: 20; background: var(--flaeche); padding: 10px 14px; border-radius: 14px; }

/* Seite */
.seite {
  width: 100%; max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 22px) 18px calc(env(safe-area-inset-bottom) + 108px);
  display: flex; flex-direction: column; gap: 16px;
}
.kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.kopf .datum { font-size: 13px; font-weight: 600; color: var(--leise); }
.kopf h1 { margin: 2px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kopf-aktionen { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ich); color: var(--auf-akzent);
  display: grid; place-items: center; font: 700 16px "Sora", sans-serif; text-decoration: none;
}

/* Hell/Dunkel-Schalter */
.thema { margin: 0; }
.thema button {
  height: 44px; padding: 0 14px 0 10px; border-radius: 22px; border: 1px solid var(--linie);
  background: var(--flaeche); display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.schalter { width: 32px; height: 20px; border-radius: 10px; background: var(--flaeche2); border: 1px solid var(--linie); position: relative; }
.schalter-punkt { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transition: transform 0.2s ease; }
.nur-dunkel { display: none; }
:root[data-thema="dunkel"] .nur-dunkel { display: inline; }
:root[data-thema="dunkel"] .nur-hell { display: none; }
:root[data-thema="dunkel"] .schalter-punkt { transform: translateX(12px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-thema]) .nur-dunkel { display: inline; }
  :root:not([data-thema]) .nur-hell { display: none; }
  :root:not([data-thema]) .schalter-punkt { transform: translateX(12px); }
}

/* Karten */
.kacheln { display: flex; flex-direction: column; gap: 14px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 24px; padding: 18px; }
.karte h2 { margin: 0; font-size: 15px; font-weight: 600; }
.karten-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.karte .stand { margin-top: 10px; font-size: 12px; color: var(--blass); }
.leer { display: flex; flex-direction: column; gap: 6px; }
.leer .symbol { width: 44px; height: 44px; border-radius: 14px; background: var(--flaeche2); display: grid; place-items: center; margin-bottom: 4px; }
.leer .symbol svg { width: 22px; height: 22px; fill: none; stroke: var(--leise); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* "Jetzt handeln" in Gelb (Konzept 7) */
.karte.handeln { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--gelb-grund); border-color: color-mix(in srgb, var(--gelb) 45%, transparent); }
.karte.handeln h2 { color: var(--gelb); }
.karte.handeln p { margin-top: 3px; color: var(--text2); }
.karte.handeln .knopf { background: var(--gelb); color: var(--auf-akzent); flex-shrink: 0; }

/* Erholung */
.erholung { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 116px; height: 116px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-grund { fill: none; stroke: var(--flaeche2); stroke-width: 11; }
.ring-wert { fill: none; stroke: var(--person, var(--ich)); stroke-width: 11; stroke-linecap: round; }
.ring-mitte { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-mitte .zahl { font-size: 32px; font-weight: 700; line-height: 1; color: var(--person, var(--ich)); }
.ring-mitte .einheit { font-size: 12px; font-weight: 700; color: var(--leise); }
.erholung-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.erholung-text .coach { font-size: 14px; color: var(--text2); }
.ampel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; font-weight: 700; font-size: 14px; }
.ampel .leise { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ampel::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.ampel-gruen { color: var(--ampel-gruen); }
.ampel-gelb { color: var(--gelb); }
.ampel-rot { color: var(--ampel-rot); }
.diagramm { width: 100%; height: auto; display: block; margin-top: 12px; }
.diagramm .achse { fill: var(--leise); font: 700 9px "Manrope", sans-serif; text-anchor: middle; }
.balken-schlaf { fill: var(--lila); }
.balken-hrv { fill: var(--ich); }
.schnittlinie { stroke: var(--text2); stroke-width: 1; stroke-dasharray: 3 3; }
.ampel-text-gruen { color: var(--ampel-gruen); }
.ampel-text-gelb { color: var(--gelb); }
.ampel-text-rot { color: var(--ampel-rot); }
.verlauf-zeile { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.verlauf { display: block; }
.balken-gruen { fill: var(--ampel-gruen); }
.balken-gelb { fill: var(--gelb); }
.balken-rot { fill: var(--ampel-rot); }
.kurz { display: flex; align-items: center; gap: 14px; }
.kurz .punkt-gross { width: 44px; height: 44px; border-radius: 50%; background: var(--person); color: var(--auf-akzent); display: grid; place-items: center; font: 700 16px "Sora", sans-serif; }
.kurz .zahl { margin-left: auto; font-size: 26px; font-weight: 700; color: var(--person); white-space: nowrap; }

/* Messwerte */
.messwert { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.messwert .zahl { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.plakette { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px; background: var(--flaeche2); color: var(--text2); }
.phasen { width: 100%; height: 12px; border-radius: 6px; overflow: hidden; display: block; margin: 12px 0 10px; }
.phase-tief { fill: var(--lila); }
.phase-rem { fill: var(--ich); }
.phase-leicht { fill: var(--blass); }
.phase-wach { fill: var(--gelb); }
.legende { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text2); }
.legende li { display: inline-flex; align-items: center; gap: 6px; }
.legende li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.legende .tief::before { background: var(--lila); }
.legende .rem::before { background: var(--ich); }
.legende .leicht::before { background: var(--blass); }
.legende .wach::before { background: var(--gelb); }
.werte { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.werte div { background: var(--flaeche2); border-radius: 16px; padding: 10px 12px; min-width: 0; }
.werte dt { font-size: 12px; color: var(--leise); font-weight: 600; }
.werte dd { margin: 2px 0 0; font: 700 20px "Sora", sans-serif; white-space: nowrap; }
.werte dd small { font: 600 12px "Manrope", sans-serif; color: var(--leise); }

/* Knöpfe */
.knopf {
  min-height: 50px; padding: 0 22px; border-radius: 25px; border: 1px solid transparent;
  font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.knopf.haupt { background: var(--text); color: var(--bg); }
.knopf.zweitrangig { background: var(--flaeche2); border-color: var(--linie); }
.knopf:disabled { opacity: 0.45; cursor: not-allowed; }
.liste { margin: 8px 0 0; padding-left: 18px; color: var(--text2); display: flex; flex-direction: column; gap: 4px; }
.meldungen { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.meldungen li { background: var(--gelb-grund); color: var(--text); border-radius: 16px; padding: 12px 14px; font-weight: 600; }

/* Untere Leiste: Heute · Essen · ＋ · Zuhause · Wir (Konzept 7) */
.leiste {
  position: fixed; z-index: 5; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 10px);
  max-width: 536px; margin: 0 auto; padding: 6px; gap: 4px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  border-radius: 30px; border: 1px solid var(--linie);
  background: color-mix(in srgb, var(--flaeche) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px var(--schatten);
}
.leiste a {
  height: 56px; border-radius: 24px; color: var(--text2); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 700;
}
.leiste svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.leiste a[aria-current="page"] { background: var(--text); color: var(--bg); }
.leiste a.plus { width: 56px; justify-self: center; border-radius: 50%; background: var(--ich); color: var(--auf-akzent); }
.leiste a.plus svg { width: 26px; height: 26px; stroke-width: 2.4; }
.leiste a.plus span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.leiste .marke { display: none; }

/* Am PC: dieselben Bereiche als Seitenleiste (Konzept 7) */
@media (min-width: 960px) {
  .leiste {
    top: 24px; bottom: 24px; left: 24px; right: auto; width: 232px; max-width: none; margin: 0;
    grid-template-columns: 1fr; align-content: start; gap: 6px; padding: 18px 12px; border-radius: 28px;
  }
  .leiste .marke { display: block; order: -2; font-size: 20px; font-weight: 700; padding: 4px 14px 18px; text-decoration: none; }
  .leiste a { height: 48px; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; font-size: 15px; font-weight: 600; }
  .leiste a.plus { order: -1; width: auto; justify-self: stretch; border-radius: 24px; margin-bottom: 8px; font-weight: 800; }
  .leiste a.plus svg { width: 22px; height: 22px; }
  .leiste a.plus span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .seite { max-width: 860px; margin: 0 0 0 280px; padding: 40px 40px 48px; }
  .kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

/* Freigaben: drei Stufen als Segmente */
.freigaben { display: flex; flex-direction: column; gap: 14px; }
fieldset.karte { margin: 0; min-width: 0; }
fieldset legend { padding: 0; float: left; width: 100%; font: 600 15px "Sora", sans-serif; }
fieldset legend + * { clear: both; }
.stufen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 10px 0 8px;
  border-radius: 16px; background: var(--flaeche2); }
.stufe { position: relative; }
.stufe input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.stufe span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px;
  font-weight: 700; font-size: 14px; color: var(--text2); }
.stufe input:checked + span { background: var(--text); color: var(--bg); }
.stufe input:focus-visible + span { outline: 3px solid var(--ich); outline-offset: 1px; }
fieldset:disabled .stufe span { opacity: 0.55; }
fieldset:disabled .stufe input { cursor: not-allowed; }
.vorschau { margin-bottom: 10px; }

/* Formulare, Listen, Codes */
.formular { display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; }
.formular label { font-size: 13px; font-weight: 700; color: var(--text2); }
.formular input {
  min-height: 50px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--linie);
  background: var(--flaeche2); color: var(--text); font: 600 17px "Manrope", sans-serif;
}
.formular input:focus-visible { outline: 3px solid var(--ich); outline-offset: 1px; }
.formular .knopf { margin-top: 4px; }
.fehler { color: var(--ampel-rot); font-weight: 700; font-size: 14px; }
.karte.zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; }
.karte.zeile svg { width: 22px; height: 22px; fill: none; stroke: var(--leise); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.karte.zeile p { margin-top: 2px; }
.geraete { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; }
.geraete li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--linie); }
.geraete li:last-child { border-bottom: 0; }
.geraete li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.knopf.klein-knopf { min-height: 40px; padding: 0 14px; font-size: 13px; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 10px; }
.codes { margin: 14px 0; padding-left: 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 20px; }
.codes code { font: 700 17px "Sora", ui-monospace, monospace; letter-spacing: 0.04em; }
.nur-druck { display: none; }

@media print {
  .leiste, .kopf-aktionen, .sprung, .nicht-drucken { display: none !important; }
  .seite { margin: 0; padding: 0; max-width: none; }
  .karte { border: 0; padding: 0; }
  .nur-druck { display: block; font-weight: 700; margin: 8px 0; }
  body { background: #fff; color: #000; }
}

/* Anmeldung und Einmal-Link */
.anmeldung {
  min-height: 100dvh; max-width: 420px; margin: 0 auto; padding: 32px 24px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center;
}
.anmeldung h1 { margin: 12px 0 0; font-size: 24px; }
.anmeldung form { width: 100%; }
.anmeldung .knopf { width: 100%; margin-top: 12px; }
.marke-gross { font: 700 40px "Sora", sans-serif; letter-spacing: -0.03em; }
.marke-gross .punkt, .marke .punkt { color: var(--lila); }
.hinweis { font-size: 13px; color: var(--leise); max-width: 320px; }
