/* Termine – Erscheinungsbild „Wecker“: Nachtblau + Messing, Kalenderblätter, Rot nur für Kritisches */
:root {
  --grund: #f3f1ec;
  --flaeche: #ffffff;
  --flaeche2: #f8f6f2;
  --text: #18202e;
  --leise: #687083;
  --linie: #e5e0d6;
  --nacht: #16233f;
  --nacht2: #22345a;
  --auf-nacht: #f3efe4;
  --auf-nacht-leise: #a9b3c8;
  --messing: #c4912a;
  --messing-text: #8a6413;
  --messing-hell: #f7ebcd;
  --rot: #cf3d2e;
  --rot-hell: #fbe4e0;
  --gruen: #2c8455;
  --gruen-hell: #dff1e6;
  --schatten: 0 1px 2px rgba(22, 35, 63, .06), 0 4px 14px rgba(22, 35, 63, .06);
  --r-gross: 18px;
  --r: 13px;
  --r-klein: 9px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0d121b;
    --flaeche: #161d2a;
    --flaeche2: #1b2332;
    --text: #e9ebf0;
    --leise: #9aa3b5;
    --linie: #273147;
    --nacht: #0f1a31;
    --nacht2: #1d2b4a;
    --messing: #dcab45;
    --messing-text: #e7bd62;
    --messing-hell: #3a3018;
    --rot: #ee6656;
    --rot-hell: #3b1d1a;
    --gruen: #4fb57e;
    --gruen-hell: #18301f;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden; background: var(--grund); color: var(--text);
  font: 16px/1.45 var(--schrift); font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.ohne-leiste { padding-bottom: 24px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.leise { color: var(--leise); }
.klein { font-size: .86rem; }
.laden { display: grid; place-items: center; min-height: 80vh; color: var(--leise); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }

/* ---------- Kopf ---------- */
.kopf {
  background: var(--nacht); color: var(--auf-nacht);
  padding: calc(14px + env(safe-area-inset-top)) 16px 18px;
  border-radius: 0 0 26px 26px;
}
.kopf-innen { max-width: 1100px; margin: 0 auto; }
.kopf-zeile { display: flex; align-items: center; gap: 10px; }
.kopf-zeile .titel { flex: 1; min-width: 0; }
.kopf .datum { font-size: .82rem; color: var(--auf-nacht-leise); letter-spacing: .04em; text-transform: uppercase; font-weight: 650; }
.kopf h1 { font-size: 1.5rem; font-weight: 760; }
.kopf .zurueck, .kopf .rund {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--nacht2); color: var(--auf-nacht);
  display: grid; place-items: center; font-size: 1.15rem; cursor: pointer; text-decoration: none; flex: none;
}
.kopf .rund.dreht span { display: inline-block; animation: drehen 1s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
.kopf .stand { font-size: .78rem; color: var(--auf-nacht-leise); margin-top: 6px; }
.kopf.schlicht { padding-bottom: 16px; }
.kopf.schlicht h1 { font-size: 1.3rem; }

/* Nächster Termin (im Kopf) */
.naechster {
  margin-top: 16px; display: flex; gap: 14px; align-items: center;
  background: var(--nacht2); border-radius: var(--r-gross); padding: 14px 16px; text-decoration: none;
}
.naechster .uhr { flex: none; text-align: center; min-width: 74px; }
.naechster .uhr b { display: block; font-size: 1.55rem; font-weight: 800; color: var(--messing); line-height: 1.05; }
.naechster .uhr small { font-size: .72rem; color: var(--auf-nacht-leise); text-transform: uppercase; letter-spacing: .06em; }
.naechster .was { min-width: 0; }
.naechster .was .eyebrow { color: var(--auf-nacht-leise); }
.naechster .was strong { display: block; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.naechster .was span { font-size: .86rem; color: var(--auf-nacht-leise); }
.naechster.krit .uhr b { color: #ff8a7a; }

.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--leise); margin: 0 0 2px; }

/* ---------- Inhalt ---------- */
.inhalt { max-width: 1100px; margin: 0 auto; padding: 16px; }
.schmal { max-width: 720px; }
.raster { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.raster > * { min-width: 0; }
@media (min-width: 900px) {
  .raster.zwei { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
  .raster.zwei aside { position: sticky; top: 16px; }
  .kopf { padding-left: 28px; padding-right: 28px; }
  .inhalt { padding: 22px 28px; }
}

/* Reiter */
.reiter { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 2px 16px; }
.reiter::-webkit-scrollbar { display: none; }
.reiter button {
  flex: none; border: 1px solid var(--linie); background: var(--flaeche); border-radius: 999px; padding: 8px 15px;
  font-weight: 650; font-size: .92rem; cursor: pointer; white-space: nowrap;
}
.reiter button.an { background: var(--nacht); border-color: var(--nacht); color: var(--auf-nacht); }
.reiter button .zahl { opacity: .6; font-weight: 600; margin-left: 4px; }

/* Karten & Hinweise */
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-gross); box-shadow: var(--schatten); }
.karte.innen { padding: 16px; }
.karte + .karte { margin-top: 14px; }
.karte h2 { font-size: 1.05rem; margin-bottom: 8px; }
.hinweis { border-radius: var(--r); padding: 13px 14px; margin-bottom: 12px; border: 1px solid transparent; }
.hinweis.gelb { background: var(--messing-hell); border-color: color-mix(in srgb, var(--messing) 35%, transparent); }
.hinweis.rot { background: var(--rot-hell); border-color: color-mix(in srgb, var(--rot) 30%, transparent); }
.hinweis.gruen { background: var(--gruen-hell); }
.hinweis.blau { background: var(--flaeche); border-color: var(--linie); }
.hinweis h3 { font-size: .98rem; margin-bottom: 4px; }
.hinweis p { margin: 4px 0; }
.hinweis .zeile { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--messing) 25%, transparent); }
.hinweis .zeile:first-of-type { border-top: 0; }
.hinweis .zeile .t { flex: 1; min-width: 0; }
.hinweis .zeile .t b { display: block; }
.hinweis a.pfeil { font-weight: 700; text-decoration: none; }

/* Tagesgruppen */
.tag { margin-bottom: 18px; }
.tag-kopf { display: flex; align-items: center; gap: 12px; margin: 0 2px 8px; }
.blatt {
  flex: none; width: 46px; border-radius: 9px; overflow: hidden; background: var(--flaeche); border: 1px solid var(--linie);
  text-align: center; box-shadow: var(--schatten);
}
.blatt i { display: block; font-style: normal; background: var(--nacht); color: var(--auf-nacht); font-size: .62rem; font-weight: 750; letter-spacing: .08em; padding: 2px 0; text-transform: uppercase; }
.blatt b { display: block; font-size: 1.22rem; font-weight: 800; padding: 1px 0 2px; }
.blatt.heute i { background: var(--messing); color: #1e1608; }
.tag-kopf .tag-name { font-weight: 750; font-size: 1.02rem; }
.tag-kopf .tag-name small { display: block; font-weight: 500; color: var(--leise); font-size: .82rem; }

.liste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r-gross); overflow: hidden; box-shadow: var(--schatten); }
.eintrag {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; text-decoration: none; position: relative;
  border-top: 1px solid var(--linie); min-height: 58px;
}
.eintrag:first-child { border-top: 0; }
.eintrag:active { background: var(--flaeche2); }
.eintrag .zeit { flex: none; width: 52px; font-weight: 750; font-size: .98rem; }
.eintrag .zeit small { display: block; font-weight: 500; color: var(--leise); font-size: .76rem; }
.eintrag .was { flex: 1; min-width: 0; }
.eintrag .was strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 650; overflow: hidden; overflow-wrap: anywhere; }
.eintrag .was > span { display: block; font-size: .84rem; color: var(--leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .punkt { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--leise); }
.eintrag.krit::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--rot); }
.eintrag.krit .zeit { color: var(--rot); }
.eintrag.vorbei { opacity: .5; }
.eintrag.weg strong { text-decoration: line-through; }
.marke { display: inline-block; font-size: .7rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 2px 6px; vertical-align: 1px; }
.marke.rot { background: var(--rot-hell); color: var(--rot); }
.marke.gelb { background: var(--messing-hell); color: var(--messing-text); }
.marke.gruen { background: var(--gruen-hell); color: var(--gruen); }
.marke.grau { background: var(--flaeche2); color: var(--leise); border: 1px solid var(--linie); }
.leer { text-align: center; padding: 38px 18px; color: var(--leise); }
.leer .gross { font-size: 2.2rem; margin-bottom: 6px; }

/* Monat (Tablet/PC) */
.monat { padding: 14px; }
.monat .mkopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 750; }
.monat .mkopf button { border: 0; background: none; font-size: 1.1rem; cursor: pointer; padding: 4px 10px; color: var(--leise); }
.monat table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.monat th { font-size: .7rem; color: var(--leise); font-weight: 650; padding-bottom: 4px; }
.monat td { text-align: center; padding: 2px; }
.monat td button { width: 100%; aspect-ratio: 1; border: 0; background: none; border-radius: 10px; cursor: pointer; font-size: .9rem; position: relative; }
.monat td button:hover { background: var(--flaeche2); }
.monat td.fremd button { color: var(--leise); opacity: .5; }
.monat td.heute button { background: var(--nacht); color: var(--auf-nacht); font-weight: 750; }
.monat td button .dots { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 2px; }
.monat td button .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--messing); }
.monat td button .dots i.k { background: var(--rot); }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--linie); background: var(--flaeche);
  border-radius: 999px; padding: 10px 16px; font-weight: 650; cursor: pointer; text-decoration: none; min-height: 42px; white-space: nowrap;
}
.knopf.haupt { background: var(--nacht); border-color: var(--nacht); color: var(--auf-nacht); }
.knopf.messing { background: var(--messing); border-color: var(--messing); color: #1e1608; }
.knopf.rot { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.zart { background: transparent; }
.knopf.klein { padding: 6px 12px; min-height: 34px; font-size: .88rem; }
.knopf.gross { width: 100%; padding: 15px; font-size: 1.05rem; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopfreihe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.knopfreihe.rechts { justify-content: flex-end; }
@media (prefers-color-scheme: dark) { .knopf.haupt { background: var(--messing); border-color: var(--messing); color: #1e1608; } }

/* Leiste unten */
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--flaeche) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--linie); padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
}
.leiste nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; align-items: center; }
.leiste a { text-decoration: none; text-align: center; font-size: .72rem; font-weight: 650; color: var(--leise); padding: 4px 0; position: relative; }
.leiste a .sym { display: block; font-size: 1.3rem; line-height: 1.4; }
.leiste a.an { color: var(--text); }
.leiste a.an .sym { transform: translateY(-1px); }
.leiste a.plus .sym { width: 50px; height: 50px; margin: -18px auto 0; border-radius: 50%; background: var(--messing); color: #1e1608; display: grid; place-items: center; font-size: 1.7rem; box-shadow: 0 4px 14px rgba(196, 145, 42, .45); }
.leiste .badge { position: absolute; top: 0; left: 50%; margin-left: 6px; background: var(--rot); color: #fff; border-radius: 999px; font-size: .68rem; padding: 0 6px; min-width: 18px; line-height: 18px; }

/* Formulare */
.feld { margin-bottom: 14px; }
.feld > label, .feld > .label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 5px; }
.feld .hilfe { font-size: .82rem; color: var(--leise); margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--linie); background: var(--flaeche); border-radius: var(--r-klein); padding: 11px 12px; min-height: 44px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--messing); box-shadow: 0 0 0 3px color-mix(in srgb, var(--messing) 25%, transparent); }
textarea { min-height: 90px; resize: vertical; }
.zwei-felder { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.schalter { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.schalter input { position: absolute; opacity: 0; pointer-events: none; }
.schalter .bahn { flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--linie); position: relative; transition: background .15s; }
.schalter .bahn::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.schalter input:checked + .bahn { background: var(--gruen); }
.schalter input:checked + .bahn::after { transform: translateX(18px); }
.schalter input:focus-visible + .bahn { outline: 2px solid var(--messing); outline-offset: 2px; }
.schalter .text { flex: 1; }
.schalter .text small { display: block; color: var(--leise); font-size: .82rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--linie); background: var(--flaeche); border-radius: 999px; padding: 7px 12px; font-size: .88rem; font-weight: 600; cursor: pointer; }
.chip.an { background: var(--nacht); border-color: var(--nacht); color: var(--auf-nacht); }
@media (prefers-color-scheme: dark) { .chip.an, .reiter button.an { background: var(--messing); border-color: var(--messing); color: #1e1608; } }
.chip.plus { border-style: dashed; color: var(--leise); }

.segment { display: inline-flex; border: 1px solid var(--linie); border-radius: 999px; padding: 3px; background: var(--flaeche2); }
.segment button { border: 0; background: none; border-radius: 999px; padding: 6px 12px; font-weight: 650; font-size: .86rem; cursor: pointer; color: var(--leise); }
.segment button.an { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }

/* Menü (Mehr) */
.menue a, .menue button.zeile {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; border: 0; border-top: 1px solid var(--linie); width: 100%;
  background: none; text-align: left; cursor: pointer;
}
.menue > :first-child { border-top: 0; }
.menue .sym { width: 34px; height: 34px; border-radius: 10px; background: var(--flaeche2); display: grid; place-items: center; flex: none; font-size: 1.05rem; }
.menue .t { flex: 1; }
.menue .t small { display: block; color: var(--leise); font-size: .82rem; }
.menue .pf { color: var(--leise); }

/* Detail */
.detail-kopf { padding: 18px; }
.detail-kopf h2 { font-size: 1.35rem; margin: 4px 0 6px; }
.info { display: grid; grid-template-columns: 28px 1fr; gap: 8px 10px; padding: 0 18px 16px; }
.info .s { text-align: center; }
.erinnerung { display: flex; gap: 10px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--linie); }
.erinnerung .t { flex: 1; }
.erinnerung .t small { display: block; color: var(--leise); font-size: .82rem; }

/* Kalender-Einstellungen */
.kal { padding: 14px 16px; border-top: 1px solid var(--linie); }
.kal:first-child { border-top: 0; }
.kal .kz { display: flex; align-items: center; gap: 10px; }
.kal .farbe { width: 12px; height: 12px; border-radius: 4px; flex: none; background: var(--leise); }
.kal .opt { margin-top: 10px; padding-left: 22px; display: grid; gap: 10px; }

/* Anleitung */
.anl h2 { font-size: 1.15rem; margin: 0 0 6px; }
.anl ol { padding-left: 1.3em; margin: 10px 0; }
.anl ol li { margin-bottom: 8px; }
.anl .tipp { background: var(--messing-hell); border-radius: var(--r-klein); padding: 9px 12px; margin-top: 8px; font-size: .92rem; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; background: var(--flaeche2); border: 1px solid var(--linie); border-radius: 6px; padding: 1px 5px; word-break: break-all; }
.code-feld { display: flex; gap: 8px; align-items: stretch; }
.code-feld input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; }

.protokoll { font-size: .84rem; }
.protokoll div { padding: 7px 0; border-top: 1px solid var(--linie); }
.protokoll b { font-weight: 650; }

/* Anmelden */
.anmelden { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--nacht); }
.anmelden .karte { width: 100%; max-width: 380px; padding: 26px 22px; }
.anmelden .logo { width: 68px; height: 68px; border-radius: 18px; display: block; margin: 0 auto 12px; }
.anmelden h1 { text-align: center; font-size: 1.5rem; }
.anmelden p { text-align: center; }

/* Meldung */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--nacht); color: var(--auf-nacht); padding: 11px 18px; border-radius: 999px; font-weight: 600; z-index: 50;
  transition: all .2s; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); pointer-events: none;
}
.toast.zeigen { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.fehler { background: var(--rot); color: #fff; }

.zieh { height: 0; overflow: hidden; text-align: center; color: var(--leise); font-size: .85rem; transition: height .15s; }

/* Bestätigen-Seite (ok.php) */
body.einzel { background: var(--nacht); padding: 0; min-height: 100vh; display: grid; place-items: center; }
.einzelkarte { background: var(--flaeche); border-radius: 22px; padding: 26px 22px; margin: 20px 16px; max-width: 420px; width: calc(100% - 32px); text-align: center; }
.einzel-kopf { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 750; margin-bottom: 16px; }
.einzel-kopf img { border-radius: 11px; }
.einzelkarte h1 { font-size: 1.4rem; margin: 4px 0 6px; }
.einzelkarte .wann { font-weight: 650; margin: 0 0 14px; }
.einzelkarte form { margin: 18px 0 8px; }
.einzelkarte .link { color: var(--leise); font-size: .9rem; }
.erledigt-zeichen { width: 70px; height: 70px; border-radius: 50%; background: var(--gruen); color: #fff; font-size: 2.2rem; display: grid; place-items: center; margin: 10px auto; }

@media print { .leiste, .kopf .rund { display: none; } body { padding: 0; } }
