/* Tagesplan -- Gestaltung.
   Hell und dunkel folgen der Systemeinstellung; ein Umschalter im Kopf setzt
   sich darueber hinweg und merkt sich das im localStorage. */

:root {
  color-scheme: light dark;

  --grund:        #f6f7f9;
  --flaeche:      #ffffff;
  --flaeche-2:    #f1f3f6;
  --rand:         #e3e6ec;
  --rand-stark:   #cdd2dc;
  --text:         #16181d;
  --text-leise:   #61667a;
  --text-still:   #8b90a3;
  --akzent:       #4f46e5;
  --akzent-hell:  #eef0fe;
  --akzent-text:  #ffffff;
  --warnung:      #d97706;
  --warnung-hell: #fff5e6;
  --gefahr:       #dc2626;
  --gefahr-hell:  #fdeceb;
  --gut:          #059669;

  --r-klein:  8px;
  --r:        12px;
  --r-gross:  18px;
  --schatten: 0 1px 2px rgba(16, 18, 25, .04), 0 4px 16px rgba(16, 18, 25, .05);
  --schatten-hoch: 0 2px 6px rgba(16, 18, 25, .07), 0 12px 32px rgba(16, 18, 25, .1);
  --schrift: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
             "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --grund:        #0d0f14;
    --flaeche:      #161920;
    --flaeche-2:    #1e222b;
    --rand:         #262b36;
    --rand-stark:   #363d4b;
    --text:         #e8eaf0;
    --text-leise:   #a0a6b8;
    --text-still:   #6f7688;
    --akzent:       #7c78ff;
    --akzent-hell:  #1e1f3d;
    --akzent-text:  #ffffff;
    --warnung:      #fbbf24;
    --warnung-hell: #2b2213;
    --gefahr:       #f87171;
    --gefahr-hell:  #2d1717;
    --gut:          #34d399;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .3);
    --schatten-hoch: 0 2px 6px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
  }
}

:root[data-thema="dunkel"] {
  --grund:        #0d0f14;
  --flaeche:      #161920;
  --flaeche-2:    #1e222b;
  --rand:         #262b36;
  --rand-stark:   #363d4b;
  --text:         #e8eaf0;
  --text-leise:   #a0a6b8;
  --text-still:   #6f7688;
  --akzent:       #7c78ff;
  --akzent-hell:  #1e1f3d;
  --warnung:      #fbbf24;
  --warnung-hell: #2b2213;
  --gefahr:       #f87171;
  --gefahr-hell:  #2d1717;
  --gut:          #34d399;
  --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .3);
  --schatten-hoch: 0 2px 6px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--schrift);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--grund);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Rahmen ------------------------------------------------------------- */

.huelle { display: flex; min-height: 100vh; }

.seitenleiste {
  width: 236px;
  flex: 0 0 236px;
  background: var(--flaeche);
  border-right: 1px solid var(--rand);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.marke {
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px 18px;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em;
}
.marke .punkt {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--akzent), #a78bfa);
  display: grid; place-items: center;
  color: #fff; font-size: .78rem; font-weight: 700;
}

.nav-glied {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-klein);
  color: var(--text-leise);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-glied:hover { background: var(--flaeche-2); color: var(--text); text-decoration: none; }
.nav-glied.aktiv { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
.nav-glied .zeichen { width: 18px; text-align: center; opacity: .85; }
.nav-glied .zahl {
  margin-left: auto; font-size: .75rem; font-weight: 600;
  background: var(--flaeche-2); color: var(--text-leise);
  padding: 1px 7px; border-radius: 999px;
}
.nav-glied.aktiv .zahl { background: var(--akzent); color: #fff; }

.leiste-fuss { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rand); }

.inhalt { flex: 1; min-width: 0; padding: 26px 30px 70px; max-width: 1080px; }

.kopf {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.kopf .datum { color: var(--text-leise); font-size: .92rem; margin-top: 2px; }

/* --- Karten ------------------------------------------------------------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--r);
  box-shadow: var(--schatten);
  margin-bottom: 18px;
  overflow: hidden;
}
.karte-kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--rand);
}
.karte-kopf h2 { flex: 1; }
.karte-leib { padding: 6px 16px 14px; }
.karte-leib.eng { padding: 0; }

.gitter { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .gitter { grid-template-columns: 1fr; } }

/* --- Aufgaben ----------------------------------------------------------- */

.aufgabe {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rand);
  transition: background .12s;
}
.aufgabe:last-child { border-bottom: none; }
.aufgabe:hover { background: var(--flaeche-2); }
.aufgabe.fertig .titel { text-decoration: line-through; color: var(--text-still); }

.haken {
  appearance: none;
  width: 19px; height: 19px; flex: 0 0 19px;
  margin-top: 2px;
  border: 1.5px solid var(--rand-stark);
  border-radius: 6px;
  background: var(--flaeche);
  cursor: pointer;
  position: relative;
  transition: all .14s;
}
.haken:hover { border-color: var(--akzent); }
.haken:checked { background: var(--akzent); border-color: var(--akzent); }
.haken:checked::after {
  content: "";
  position: absolute; left: 5.5px; top: 2px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}

.aufgabe .mitte { flex: 1; min-width: 0; }
.aufgabe .titel { font-weight: 500; }
.titel-link { color: inherit; }
.titel-link:hover { color: var(--akzent); text-decoration: none; }

/* Fortschritt einer Aufgabe mit Unteraufgaben */
.marker.fortschritt { gap: 6px; }
.balkenspur {
  width: 34px; height: 4px; border-radius: 2px;
  background: var(--rand-stark); overflow: hidden; flex: none;
}
.balkenfuellung { display: block; height: 100%; background: var(--gut); border-radius: 2px; }
.aufgabe .zeile2 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .8rem; color: var(--text-still); margin-top: 2px;
}
.aufgabe .notiz { font-size: .85rem; color: var(--text-leise); margin-top: 2px; }

.marker {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .75rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--flaeche-2); color: var(--text-leise);
  white-space: nowrap;
}
.marker .kringel { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.marker.spaet { background: var(--gefahr-hell); color: var(--gefahr); }
.marker.bald  { background: var(--warnung-hell); color: var(--warnung); }
.marker.vorbereitung { background: var(--akzent-hell); color: var(--akzent); }

.prio-hoch { color: var(--gefahr); font-weight: 700; }

/* --- Termine ------------------------------------------------------------ */

.termin {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 11px 16px;
  border-bottom: 1px solid var(--rand);
}
.termin:last-child { border-bottom: none; }
.termin:hover { background: var(--flaeche-2); }
.termin .zeit {
  flex: 0 0 98px;
  font-variant-numeric: tabular-nums;
  font-weight: 650; font-size: .87rem;
  color: var(--text);
  padding-top: 1px;
  line-height: 1.3;
}
.termin .zeit.ganztags { font-size: .74rem; color: var(--text-still); font-weight: 600; }
/* Aus dem Kalender verschwunden, aber wegen anhaengender Vorbereitung
   stehengeblieben. Sichtbar bleiben, aber nicht mehr mitreden. */
.termin.abgesagt .rumpf > div:first-child { text-decoration: line-through; }
.termin.abgesagt { opacity: .7; }
.termin .zeit .bis { display: block; font-weight: 500; color: var(--text-leise); font-size: .82rem; }
/* Ein Dienst, der erst am naechsten Morgen endet -- die Kennzeichnung muss
   auffallen, weil sonst der Folgetag frei aussieht. */
.termin .zeit .folgetag {
  font-size: .62rem; font-weight: 700; vertical-align: super;
  color: var(--akzent); margin-left: 1px;
}
.termin .balken { width: 3px; align-self: stretch; border-radius: 2px; background: var(--rand-stark); flex: none; }
.termin .rumpf { flex: 1; min-width: 0; }
.termin .ort { font-size: .8rem; color: var(--text-still); }
.termin .vorbereitung-zahl {
  font-size: .75rem; color: var(--akzent); font-weight: 600;
}

/* --- Terminkollisionen -------------------------------------------------- */

.konflikt-karte { border-color: color-mix(in srgb, var(--warnung) 40%, var(--rand)); }
.konflikt-karte .karte-kopf {
  background: var(--warnung-hell);
  border-bottom-color: color-mix(in srgb, var(--warnung) 30%, var(--rand));
}
.konflikt-karte .karte-kopf h2 { color: var(--warnung); }

.konflikt {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 16px; border-bottom: 1px solid var(--rand);
}
.konflikt:last-child { border-bottom: none; }
.konflikt .wann { flex: 0 0 100px; }
.konflikt .wann .tag { font-weight: 650; font-size: .85rem; }
.konflikt .wann .uhr {
  font-size: .78rem; color: var(--text-still); font-variant-numeric: tabular-nums;
}
.konflikt .paar { flex: 1; min-width: 0; }
.konflikt .paar .gegen {
  color: var(--text-still); font-size: .82rem; margin: 0 4px;
}
.konflikt .paar .dauer { font-size: .78rem; color: var(--warnung); font-weight: 600; }

/* --- Tagesbelegung ------------------------------------------------------ */

.belegung { padding: 2px 0 4px; }
.belegung .balken {
  position: relative;
  /* Hoehe kommt aus der Vorlage: sie haengt an der Zahl der Spuren. */
  background: var(--flaeche-2);
  border: 1px solid var(--rand);
  border-radius: 6px;
  overflow: hidden;
}
/* Nacht: 0 bis 7 und ab 21 Uhr abgedunkelt. Reine Sehhilfe -- man erkennt
   sofort, ob ein Balken in die Nacht ragt, ohne die Skala zu lesen. */
.belegung .nacht {
  position: absolute; top: 0; bottom: 0;
  background: rgba(30, 41, 59, .09);
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) .belegung .nacht { background: rgba(0, 0, 0, .32); }
}
:root[data-thema="dunkel"] .belegung .nacht { background: rgba(0, 0, 0, .32); }

/* Feine Trennung zwischen Vormittag, Nachmittag und Abend. */
.belegung .abschnitt {
  position: absolute; top: 0; bottom: 0;
  border-right: 1px dashed var(--rand-stark);
  pointer-events: none;
}
.belegung .abschnitt:last-of-type { border-right: none; }
/* Lage und Hoehe stehen inline: bei Ueberschneidungen teilen sich die Termine
   den Balken in Spuren, und wer frei steht, zieht sich ueber alle. */
.belegung .block {
  position: absolute;
  border-radius: 3px;
  min-width: 3px;
  opacity: .88;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
/* Ein ganztaegiger Eintrag fuellt den Balken, hat aber keine Uhrzeit. Blasser
   und schraffiert, damit er nicht mit einem Termin verwechselt wird, der
   tatsaechlich von 0 bis 24 Uhr laeuft. */
.belegung .block.ganztags { opacity: .42; }
/* Die Schraffur liegt in einem eigenen Kaestchen darueber, nicht im
   background des Blocks: dort steht die Bereichsfarbe als Inline-Stil, und
   die Kurzform `background` setzt jedes background-image aus dieser Datei
   wieder zurueck. */
.belegung .block.ganztags::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, .3) 0 5px,
    rgba(255, 255, 255, 0) 5px 10px
  );
}

/* Laeuft der Termin ueber die Tagesgrenze, bleibt die betroffene Kante eckig
   und bekommt einen hellen Strich: der Balken ist dort abgeschnitten, nicht
   zu Ende. Das ist der Nachtdienst, der auf dem Nachbartag weitergeht. */
.belegung .block.von-vortag {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  border-left: 2px solid var(--flaeche);
}
.belegung .block.in-folgetag {
  border-top-right-radius: 0; border-bottom-right-radius: 0;
  border-right: 2px solid var(--flaeche);
}
.belegung .skala {
  display: flex; justify-content: space-between;
  font-size: .68rem; color: var(--text-still);
  font-variant-numeric: tabular-nums;
  margin-top: 1px; padding: 0 1px;
}
.belegung .urteil {
  font-size: .78rem; color: var(--text-leise); font-weight: 600; margin-top: 2px;
}

.tageszeile {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px; border-bottom: 1px solid var(--rand);
}
.tageszeile:last-child { border-bottom: none; }
.tageszeile .wann {
  flex: 0 0 96px; font-size: .82rem; font-weight: 600;
}
.tageszeile .wann .datum { color: var(--text-still); font-weight: 500; font-size: .75rem; }
.tageszeile .belegung { flex: 1; min-width: 0; }

/* --- Bereichsblock ------------------------------------------------------ */

.bereich-kopf {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 5px;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-still);
}
.bereich-kopf .kringel { width: 9px; height: 9px; border-radius: 50%; }

/* --- Formulare und Knoepfe ---------------------------------------------- */

input[type="text"], input[type="password"], input[type="date"],
input[type="datetime-local"], input[type="number"], input[type="email"],
input[type="time"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  font: inherit; font-size: .9rem;
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--rand-stark);
  border-radius: var(--r-klein);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px var(--akzent-hell);
}
textarea { resize: vertical; min-height: 62px; }
label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-leise); margin-bottom: 4px; }

.feldreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.feldreihe > * { flex: 1; min-width: 130px; }
.feld { margin-bottom: 12px; }

.knopf {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px;
  font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--akzent-text); background: var(--akzent);
  border: 1px solid transparent; border-radius: var(--r-klein);
  cursor: pointer; white-space: nowrap;
  transition: filter .12s, transform .06s;
}
.knopf:hover { filter: brightness(1.08); text-decoration: none; }
.knopf:active { transform: translateY(1px); }
.knopf.stumm {
  background: var(--flaeche); color: var(--text-leise);
  border-color: var(--rand-stark);
}
.knopf.stumm:hover { background: var(--flaeche-2); color: var(--text); }
.knopf.gefahr { background: transparent; color: var(--gefahr); border-color: transparent; }
.knopf.gefahr:hover { background: var(--gefahr-hell); }
.knopf.klein { padding: 5px 10px; font-size: .8rem; }

.schnell {
  display: flex; gap: 9px; align-items: flex-end; flex-wrap: wrap;
  padding: 13px 16px;
  background: var(--flaeche-2);
  border-bottom: 1px solid var(--rand);
}
.schnell .weit { flex: 1 1 240px; }
.schnell label { margin-bottom: 3px; }

/* --- Kleinteile --------------------------------------------------------- */

.leer {
  padding: 30px 16px; text-align: center;
  color: var(--text-still); font-size: .9rem;
}
.leer .gross { font-size: 1.7rem; display: block; margin-bottom: 6px; opacity: .5; }

.hinweis {
  padding: 10px 14px; border-radius: var(--r-klein);
  font-size: .87rem; margin-bottom: 14px;
  border: 1px solid transparent;
}
.hinweis.gut   { background: color-mix(in srgb, var(--gut) 12%, transparent); color: var(--gut); }
.hinweis.boese { background: var(--gefahr-hell); color: var(--gefahr); }
.hinweis.info  { background: var(--akzent-hell); color: var(--akzent); }

.reiter { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.reiter a {
  padding: 6px 12px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; color: var(--text-leise);
  background: var(--flaeche);
  border: 1px solid var(--rand);
}
.reiter a:hover { text-decoration: none; border-color: var(--rand-stark); }
.reiter a.aktiv { background: var(--akzent); color: #fff; border-color: var(--akzent); }

.kachelreihe { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.kachel {
  flex: 1 1 130px;
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--r); padding: 13px 15px;
  box-shadow: var(--schatten);
}
.kachel .zahl { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kachel .wort { font-size: .78rem; color: var(--text-still); font-weight: 600;
                text-transform: uppercase; letter-spacing: .05em; margin-top: 1px; }
.kachel.mahnend .zahl { color: var(--gefahr); }

/* --- Anmeldeseite ------------------------------------------------------- */

.mitte-schirm {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
}
.anmeldekarte {
  width: 100%; max-width: 370px;
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--r-gross); padding: 30px 28px;
  box-shadow: var(--schatten-hoch);
}
.anmeldekarte .marke { justify-content: center; font-size: 1.2rem; padding-bottom: 6px; }
.anmeldekarte .unterzeile {
  text-align: center; color: var(--text-leise); font-size: .88rem; margin-bottom: 22px;
}

/* --- Mobil -------------------------------------------------------------- */

@media (max-width: 760px) {
  .huelle { flex-direction: column; }
  .seitenleiste {
    width: 100%; flex: none; height: auto; position: sticky; top: 0; z-index: 20;
    flex-direction: row; align-items: center; gap: 2px;
    padding: 8px 10px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--rand);
  }
  .seitenleiste .marke { display: none; }
  .leiste-fuss { margin-top: 0; padding-top: 0; border-top: none; display: flex; gap: 4px; }
  .nav-glied { padding: 7px 11px; white-space: nowrap; }
  .nav-glied .zeichen { display: none; }
  .inhalt { padding: 18px 15px 60px; }
  h1 { font-size: 1.35rem; }
  .gitter { grid-template-columns: 1fr; }
}

@media print { .seitenleiste, .schnell, .knopf { display: none !important; } }
