/* Fokus · Gestaltung
   Stein statt Creme, Tinte statt Schwarz, om3-Rot nur für das, was gerade läuft oder zu tun ist.
   Kategorien tragen ihre eigene, ruhige Farbe (Pflanzen- und Erdtöne, kein Blau). */
@font-face {
  font-family: 'Literata';
  src: url('/fonts/literata-latin-opsz-normal.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Literata';
  src: url('/fonts/literata-latin-opsz-italic.woff2') format('woff2-variations');
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  --stein: #e8e9e4;
  --flaeche: #f5f5f2;
  --tinte: #1f211e;
  --grau: #646861;
  --hell: #8d9189;
  --linie: #d2d4cd;
  --rot: #e73b1f;
  --rot-zart: #e73b1f1f;
  --schatten: 0 18px 40px -24px #1f211e55;
  --serif: 'Literata', 'Iowan Old Style', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --rand: 16px;
  --oben: env(safe-area-inset-top, 0px);
  --unten: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --stein: #1e201d; --flaeche: #272925; --tinte: #ecede8; --grau: #a7aaa2; --hell: #80847c;
    --linie: #393c36; --rot-zart: #e73b1f33; --schatten: 0 18px 40px -24px #000a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--stein); color: var(--tinte);
  font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--rot); outline-offset: 2px; border-radius: 4px; }
.verborgen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Rahmen ---------- */
.seite {
  max-width: 560px; margin: 0 auto;
  padding: calc(var(--oben) + 14px) var(--rand) calc(var(--unten) + 96px);
}
.kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.kopf h1 { font: 500 28px/1.1 var(--serif); letter-spacing: -0.01em; margin: 0; }
.kopf .datum { color: var(--grau); font-size: 14px; }

.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--stein) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--linie);
  padding: 6px 8px calc(var(--unten) + 6px);
}
.leiste nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.leiste a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px;
  color: var(--grau); text-decoration: none; font-size: 12px; border-radius: 10px;
}
.leiste a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.leiste a[aria-current='page'] { color: var(--tinte); }
.leiste a[aria-current='page'] svg { stroke: var(--rot); }

/* ---------- Jetzt: Zifferblatt ---------- */
.zifferblatt { position: relative; width: min(78vw, 330px); aspect-ratio: 1; margin: 6px auto 10px; }
.zifferblatt svg { width: 100%; height: 100%; overflow: visible; }
.zifferblatt .tag-ring { fill: none; stroke: var(--linie); }
.zifferblatt .stunde { stroke: var(--hell); stroke-width: 1; }
.zifferblatt .bogen { fill: none; stroke-linecap: butt; }
.zifferblatt .jetzt-strich { stroke: var(--rot); stroke-width: 2; stroke-linecap: round; }
.zifferblatt .fortschritt { fill: none; stroke: var(--rot); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.zifferblatt .atem { fill: var(--rot-zart); transform-origin: 50% 50%; transform-box: fill-box; }
.zifferblatt .mitte {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; padding: 0 18%;
}
.uhr { font: 300 clamp(46px, 15vw, 66px)/1 var(--serif); font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.02em; }
.uhr.ruhig { color: var(--grau); font-size: clamp(34px, 11vw, 46px); }
.mitte .was { margin-top: 8px; font-size: 14px; color: var(--grau); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitte .wofuer { font-size: 12px; color: var(--hell); margin-top: 2px; }

.aktionen { display: flex; justify-content: center; gap: 10px; margin: 2px 0 20px; min-height: 48px; }
.knopf {
  border: 1px solid var(--linie); background: var(--flaeche); border-radius: 999px;
  padding: 12px 22px; min-height: 48px; font-weight: 500;
}
.knopf.haupt { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.still { background: transparent; }
.knopf:disabled { opacity: .45; cursor: default; }

.spruch { margin: 0 4px 24px; font: italic 400 17px/1.55 var(--serif); color: var(--grau); text-wrap: pretty; }
.spruch cite { display: block; font: normal 13px/1.4 var(--sans); color: var(--hell); margin-top: 4px; }

.hinweis {
  border-left: 3px solid var(--rot); background: var(--flaeche); padding: 12px 14px; margin: 0 0 18px;
  border-radius: 0 10px 10px 0;
}
.hinweis p { margin: 0 0 10px; }
.hinweis .reihe { display: flex; gap: 8px; flex-wrap: wrap; }
.hinweis .knopf { padding: 8px 14px; min-height: 40px; font-size: 14px; }

/* Projektwahl als Zeile mit Schaltflächen */
.projektwahl { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 calc(var(--rand) * -1); padding-left: var(--rand); scrollbar-width: none; }
.projektwahl::-webkit-scrollbar { display: none; }
.marke {
  flex: none; border: 1px solid var(--linie); background: transparent; border-radius: 999px;
  padding: 7px 14px; font-size: 14px; color: var(--grau); display: inline-flex; align-items: center; gap: 7px;
}
.marke[aria-pressed='true'] { background: var(--tinte); border-color: var(--tinte); color: var(--stein); }
.punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--f, var(--hell)); flex: none; }

/* Kategorienliste: Zeilen, keine Kacheln */
.liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--linie); }
.liste li { border-bottom: 1px solid var(--linie); }
.zeile {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 4px; background: none; border: 0; text-align: left;
  min-height: 56px;
}
.zeile .name { flex: 1; font-size: 17px; }
.zeile .art { color: var(--hell); font-size: 14px; font-variant-numeric: tabular-nums; }
.zeile.kind { padding-left: 26px; }
.zeile.kind .name { font-size: 16px; color: var(--grau); }
.zeile[aria-current='true'] .name { color: var(--rot); }
.zeile .pfeil { color: var(--hell); font-size: 18px; width: 20px; text-align: center; }
.mit-kindern { display: flex; align-items: stretch; }
.mit-kindern .zeile { flex: 1; }
.aufklapp { background: none; border: 0; border-left: 1px solid var(--linie); padding: 0 14px; min-width: 56px; color: var(--grau); font-variant-numeric: tabular-nums; }

.leer { color: var(--grau); padding: 24px 4px; }

/* ---------- Abschnitte ---------- */
h2 { font: 500 20px/1.25 var(--serif); margin: 28px 0 10px; }
h3 { font: 600 15px/1.3 var(--sans); margin: 18px 0 8px; color: var(--grau); }
.klein { font-size: 13px; color: var(--hell); }

/* Verlauf */
.tag { margin: 22px 0 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tag strong { font: 500 17px/1.3 var(--serif); }
.tag span { color: var(--grau); font-size: 14px; font-variant-numeric: tabular-nums; }
.eintrag { width: 100%; display: grid; grid-template-columns: 74px 1fr auto; gap: 4px 12px; align-items: baseline; background: none; border: 0; text-align: left; padding: 12px 2px; }
.eintrag .von { color: var(--grau); font-size: 14px; font-variant-numeric: tabular-nums; }
.eintrag .wer { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eintrag .wer span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .dauer { font-variant-numeric: tabular-nums; }
.eintrag .zusatz { grid-column: 2 / 4; color: var(--hell); font-size: 13px; }
.eintrag.laeuft .dauer { color: var(--rot); }

/* Auswertung */
.umschalter { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--linie); border-radius: 999px; padding: 3px; background: var(--flaeche); }
.umschalter button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; color: var(--grau); font-size: 14px; }
.umschalter button[aria-pressed='true'] { background: var(--tinte); color: var(--stein); }
.zeitraum { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 6px; }
.zeitraum strong { font: 500 18px/1.3 var(--serif); text-align: center; flex: 1; }
.pfeilknopf { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--linie); background: var(--flaeche); font-size: 18px; }
.summe { font: 300 44px/1.1 var(--serif); font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.zeitbild { margin: 18px 0 6px; }
.zeitbild canvas { width: 100%; height: 220px; display: block; border-radius: 12px; background: var(--flaeche); }
.zeitbild .achse { display: flex; justify-content: space-between; color: var(--hell); font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.balken { list-style: none; margin: 8px 0 0; padding: 0; }
.balken li { padding: 10px 0; border-bottom: 1px solid var(--linie); }
.balken .oben { display: flex; align-items: center; gap: 10px; }
.balken .oben .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balken .oben .wert { font-variant-numeric: tabular-nums; }
.balken .kind .name { padding-left: 20px; color: var(--grau); }
.balken .spur { position: relative; height: 6px; border-radius: 3px; background: var(--linie); margin-top: 8px; overflow: hidden; }
.balken .spur i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--f); border-radius: 3px; }
.balken .spur b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--tinte); }
.balken .soll { font-size: 13px; color: var(--grau); margin-top: 5px; }
.balken .soll.unter { color: var(--rot); }

/* ---------- Formulare und Blätter ---------- */
.blatt-hinter { position: fixed; inset: 0; background: #0006; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.blatt {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--stein);
  border-radius: 20px 20px 0 0; padding: 10px var(--rand) calc(var(--unten) + 20px); box-shadow: var(--schatten);
}
.blatt .griff { width: 40px; height: 5px; border-radius: 3px; background: var(--linie); margin: 0 auto 12px; }
.blatt h2 { margin-top: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .blatt { animation: hoch .22s ease-out; }
  @keyframes hoch { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
.feld { display: block; margin: 0 0 14px; }
.feld > span { display: block; font-size: 14px; color: var(--grau); margin-bottom: 5px; }
.feld input, .feld select, .feld textarea {
  width: 100%; min-height: 46px; border: 1px solid var(--linie); border-radius: 10px; background: var(--flaeche);
  padding: 10px 12px; font-size: 16px;
}
.feld textarea { min-height: 80px; resize: vertical; }
.feld.zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feld.zwei > span { grid-column: 1 / 3; margin-bottom: 0; }
.farben { display: flex; flex-wrap: wrap; gap: 10px; }
.farben button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; background: var(--f); }
.farben button[aria-pressed='true'] { border-color: var(--tinte); box-shadow: inset 0 0 0 2px var(--stein); }
.schalter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--linie); }
.schalter input { width: 22px; height: 22px; accent-color: var(--rot); }
.unten { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-top: 18px; }
.unten .rechts { display: flex; gap: 10px; margin-left: auto; }
.gefahr { color: var(--rot); border-color: currentColor; }
.textknopf { background: none; border: 0; padding: 12px 4px; min-height: 48px; font-size: 15px; }
.zifferblatt + .spruch { margin-top: 18px; }
.fehlertext { color: var(--rot); font-size: 14px; margin: 0 0 12px; }

/* Anmeldung */
.anmelden { max-width: 380px; margin: 0 auto; padding: calc(var(--oben) + 12vh) var(--rand) 40px; }
.anmelden h1 { font: 400 40px/1.1 var(--serif); margin: 0 0 6px; }
.anmelden p { color: var(--grau); margin: 0 0 26px; }
.anmelden .knopf { width: 100%; margin-top: 6px; }

/* Meldung unten */
.meldung {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--unten) + 84px); z-index: 50;
  background: var(--tinte); color: var(--stein); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px);
}
.status-offline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--grau); }
.status-offline::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--hell); }

@media (prefers-reduced-motion: reduce) {
  .zifferblatt .atem { animation: none !important; }
  * { transition: none !important; }
}
