/* Zeit – Stil. Farb-Token ganz oben (hell + dunkel nach Systemeinstellung). */
:root {
  --bg: #f3f4f7; --karte: #ffffff; --karte2: #eceef3; --tinte: #14161b; --tinte2: #5b6270; --linie: #dde0e8;
  --akzent: #2347c8; --akzent-text: #ffffff; --plus: #17803f; --minus: #c63a2d; --stopp: #d2412f; --warn: #b36b00;
  --plus-bg: #e3f4e9; --minus-bg: #fbe6e3; --warn-bg: #fdf0d9;
  --schatten: 0 1px 2px rgba(20, 22, 27, .06), 0 6px 18px rgba(20, 22, 27, .06);
  --oben: env(safe-area-inset-top, 0px); --unten: env(safe-area-inset-bottom, 0px);
  --hoehe: 100dvh;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --karte: #1a1d23; --karte2: #242830; --tinte: #eceef2; --tinte2: #9aa1af; --linie: #2b303a;
    --akzent: #7b96ff; --akzent-text: #0c1020; --plus: #4cc38a; --minus: #ff7b6b; --stopp: #ef6a58; --warn: #f0b252;
    --plus-bg: #14291f; --minus-bg: #33191a; --warn-bg: #33270f; --schatten: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tinte); overflow: hidden;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body.seite-login { overflow: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
.sym { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

/* ── Gerüst ── */
.app { height: var(--hoehe); display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; }
.kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: calc(var(--oben) + 14px) 20px 6px; }
.kopf h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.sync { font-size: 12px; color: var(--tinte2); white-space: nowrap; }
.sync.warn { color: var(--warn); font-weight: 600; }
.inhalt { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 24px; overscroll-behavior: contain; }
.tabs { display: flex; border-top: 1px solid var(--linie); background: var(--karte); padding: 6px 8px calc(var(--unten) + 6px); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 50px;
  color: var(--tinte2); font-size: 11px; font-weight: 600; border-radius: 12px; }
.tabs button.aktiv { color: var(--akzent); }

/* ── Karten & Bausteine ── */
.karte { background: var(--karte); border-radius: 18px; padding: 16px; box-shadow: var(--schatten); margin-bottom: 14px; }
.karte h2 { margin: 0 0 4px; font-size: 17px; }
.karte p { margin: 4px 0 12px; color: var(--tinte2); font-size: 14px; }
.klein { font-size: 13px; color: var(--tinte2); }
.plus { color: var(--plus); } .minus { color: var(--minus); } .null { color: var(--tinte2); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--karte2); color: var(--tinte2); }
.chip.frei { background: var(--plus-bg); color: var(--plus); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.hinweis { background: var(--warn-bg); color: var(--warn); border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.hinweis button { display: block; margin-top: 8px; font-weight: 700; color: inherit; text-decoration: underline; }

.primaer, .sekundaer, .gefahr { min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 650; width: 100%; }
.primaer { background: var(--akzent); color: var(--akzent-text); }
.sekundaer { background: var(--karte2); }
.gefahr { background: var(--minus-bg); color: var(--minus); }
button:disabled { opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }

input[type=text], input[type=password], input[type=number], input[type=time], select {
  width: 100%; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--linie); background: var(--bg); font-size: 17px; }
input[type=time] { min-width: 0; }
label.feld { display: block; font-size: 13px; font-weight: 600; color: var(--tinte2); margin: 10px 0 4px; }
.reihe { display: flex; gap: 10px; align-items: flex-end; }
.reihe > * { min-width: 0; }
.reihe > .gleich { flex: 1 1 0; }

.segment { display: flex; background: var(--karte2); border-radius: 12px; padding: 3px; gap: 2px; }
.segment button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--tinte2); padding: 0 4px; }
.segment button.aktiv { background: var(--karte); color: var(--tinte); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

/* ── Heute ── */
.heute-kopf { text-align: center; margin: 6px 0 2px; }
.heute-kopf .datum { font-size: 15px; color: var(--tinte2); font-weight: 600; margin-bottom: 6px; }
.grosz { text-align: center; margin: 8px 0 0; }
.grosz .etikett { font-size: 14px; font-weight: 650; color: var(--tinte2); text-transform: uppercase; letter-spacing: .06em; }
.grosz .zahl { font-size: 76px; line-height: 1.02; font-weight: 700; letter-spacing: -.035em; margin: 2px 0; }
.grosz .zeile { font-size: 15px; color: var(--tinte2); min-height: 22px; }
.knopf-wrap { position: relative; width: 236px; height: 236px; margin: 18px auto 20px; }
.knopf-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-spur { fill: none; stroke: var(--karte2); stroke-width: 9; }
.ring-fort { fill: none; stroke: var(--akzent); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring-fort.fertig { stroke: var(--plus); }
.zentral { position: absolute; inset: 20px; border-radius: 50%; background: var(--akzent); color: var(--akzent-text);
  font-size: 34px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; justify-content: center; flex-direction: column;
  box-shadow: 0 8px 24px rgba(35, 71, 200, .35); transition: transform .12s, background .2s; }
.zentral:active { transform: scale(.96); }
.zentral.laeuft { background: var(--stopp); color: #fff; box-shadow: 0 8px 24px rgba(210, 65, 47, .35); }
.zentral.weiter { background: var(--karte); color: var(--akzent); box-shadow: inset 0 0 0 3px var(--akzent); }
.zentral small { font-size: 13px; font-weight: 600; opacity: .85; margin-top: 2px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kachel { background: var(--karte); border-radius: 16px; padding: 12px 10px; text-align: center; box-shadow: var(--schatten); }
.kachel .k-etikett { font-size: 12px; font-weight: 650; color: var(--tinte2); text-transform: uppercase; letter-spacing: .05em; }
.kachel .k-zahl { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.ergebnis { background: var(--karte); border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--schatten); }
.ergebnis b { font-weight: 700; }

/* ── Monat ── */
.monatskopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.monatskopf button.pfeil { width: 44px; height: 44px; border-radius: 12px; background: var(--karte); font-size: 22px; box-shadow: var(--schatten); }
.monatskopf .mname { font-size: 19px; font-weight: 700; text-align: center; }
.monatskopf .mname small { display: block; font-size: 13px; font-weight: 500; color: var(--tinte2); }
.tag { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 14px; background: var(--karte);
  border-bottom: 1px solid var(--linie); min-height: 56px; }
.tag:first-child { border-radius: 16px 16px 0 0; } .tag:last-child { border-radius: 0 0 16px 16px; border-bottom: 0; }
.tag:only-child { border-radius: 16px; }
.tag .t-dat { width: 46px; flex: none; text-align: center; line-height: 1.15; }
.tag .t-dat b { display: block; font-size: 19px; } .tag .t-dat span { font-size: 12px; color: var(--tinte2); font-weight: 600; }
.tag .t-mitte { flex: 1 1 auto; min-width: 0; }
.tag .t-mitte div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag .t-diff { flex: none; font-weight: 700; font-size: 17px; text-align: right; min-width: 64px; }
.tag.frei { background: transparent; box-shadow: none; opacity: .6; min-height: 44px; }
.tag.heute .t-dat b { color: var(--akzent); }
.tag.zukunft { opacity: .5; }
.liste { border-radius: 16px; box-shadow: var(--schatten); overflow: hidden; margin-bottom: 14px; }

/* ── Blatt (Dialog) ── */
.schleier { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.schleier[hidden] { display: none; }
.blatt { width: 100%; max-width: 560px; max-height: calc(var(--hoehe) - var(--oben) - 12px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 22px 22px 0 0; animation: hoch .22s ease; }
@keyframes hoch { from { transform: translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }
.blatt-kopf { display: flex; align-items: center; justify-content: space-between; flex: none; padding: 14px 18px 8px; }
.blatt-kopf h2 { margin: 0; font-size: 19px; }
.blatt-kopf button { font-weight: 650; color: var(--akzent); min-height: 44px; padding: 0 4px; }
.blatt-inhalt { flex: 0 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 18px 18px; }
.blatt-fusz { flex: none; padding: 10px 18px calc(var(--unten) + 14px); display: flex; gap: 10px; border-top: 1px solid var(--linie); }
.blatt-fusz > * { flex: 1; }
.abschnitt { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.abschnitt .x { flex: none; width: 44px; height: 46px; border-radius: 12px; background: var(--minus-bg); color: var(--minus); font-size: 20px; }
.vorschau { background: var(--karte); border-radius: 14px; padding: 12px 14px; margin-top: 14px; font-size: 15px; }
.fehlertext { color: var(--minus); font-size: 14px; font-weight: 600; min-height: 20px; margin-top: 8px; }

/* Datumswahl */
.kal-kopf { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 8px; }
.kal-kopf button { width: 44px; height: 44px; border-radius: 12px; background: var(--karte); font-size: 22px; }
.kal-kopf b { font-size: 17px; }
.kal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kal .wt { text-align: center; font-size: 12px; font-weight: 650; color: var(--tinte2); padding: 4px 0; }
.kal button { aspect-ratio: 1 / 1; min-height: 42px; border-radius: 12px; background: var(--karte); font-weight: 600; position: relative; }
.kal button.we { color: var(--tinte2); }
.kal button.ft { color: var(--plus); }
.kal button.heute { box-shadow: inset 0 0 0 2px var(--akzent); }
.kal button.gewaehlt { background: var(--akzent); color: var(--akzent-text); }
.kal button.punkt::after { content: ''; position: absolute; bottom: 5px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; opacity: .7; }
.kal .leer { visibility: hidden; }

/* Saldofeld */
.saldofeld { display: flex; gap: 8px; align-items: flex-end; }
.saldofeld .vz { flex: none; width: 96px; }
.saldofeld .einheit { display: flex; align-items: center; gap: 6px; flex: 1 1 0; min-width: 0; }
.saldofeld .einheit span { color: var(--tinte2); font-size: 14px; }
.zeilen button { width: 100%; text-align: left; }
.korr { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linie); }
.korr:last-child { border-bottom: 0; }
.korr .mitte { flex: 1; min-width: 0; } .korr .mitte div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.korr .del { width: 40px; height: 40px; border-radius: 10px; color: var(--minus); font-size: 18px; background: var(--minus-bg); }

.toast { position: fixed; left: 50%; bottom: calc(var(--unten) + 84px); transform: translate(-50%, 20px); background: var(--tinte); color: var(--bg);
  padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 30; max-width: 90%; text-align: center; }
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }

/* Anmeldung */
.anmeldung { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.anmeldung .karte { width: 100%; max-width: 380px; text-align: center; padding: 28px 22px; }
.anmeldung .marke { width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 16px; background: var(--akzent); color: var(--akzent-text); display: flex; align-items: center; justify-content: center; }
.anmeldung h1 { margin: 0 0 4px; }
.anmeldung input { margin-bottom: 12px; text-align: center; }
.anmeldung .meldung { color: var(--minus); font-size: 14px; min-height: 20px; margin-top: 10px; font-weight: 600; }
.anmeldung button { background: var(--akzent); color: var(--akzent-text); width: 100%; min-height: 48px; border-radius: 14px; font-weight: 650; }

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