/* Patchworkplan: fürs Handy zuerst, keine fremden Quellen.
   Gestaltung nach Corporate Design Patchworkplan, Richtung „Steppnaht“ (Werte aus CI - patchworkplan/Web/tokens.css):
   Kopfleiste in Tinte, Aktionen in Türkis mit Text in Tinte, Ecken freundlich gerundet, Pills nur für Kennzeichnungen.
   Kinderfarben (k1–k4) und Ampel sind getrennte Farbsysteme; Ampelfarben bedeuten nur Zustände. */

@font-face {
  font-family: "Baloo 2";
  src: url("fonts/baloo2-latin-wght.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-wght.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --surface: #f3f4fa;
  --surface-raised: #ffffff;
  --ink: #1f2347;
  --muted: #5e6385;
  --brand: #1f2347;
  --brand-strong: #141733;
  --on-brand: #ffffff;
  --on-brand-muted: #b7bbd6;
  --accent: #19a99b;
  --accent-strong: #46c2b5;
  --link: #0f7d73;
  --highlight: #ff8a3d;
  --tint: #e3f6f3;
  --tint-warm: #ffe3cf;
  --line: #e1e3ef;
  --border-strong: #7e83a3;

  --kind-1: #3d7bf0;
  --kind-2: #f062a0;
  --kind-3: #8b5cf6;
  --kind-4: #19c2b0;

  --font-display: "Baloo 2", "Figtree", system-ui, sans-serif;
  --font-text: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --naht: 2px dashed var(--line);

  /* Ampel */
  --gruen: #23854c;
  --gelb: #f5b82e;
  --grau: #a9adc4;
  --rot: #c93b2c;
  /* Ampel hell, für Flächen im Tagesraster */
  --gruen-hell: #e1f1e7;
  --gelb-hell: #fdf0d0;
  --grau-hell: #ecedf3;
  --rot-hell: #f9e0dc;
  --einrichtung: #e7ebfa;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 15px/23px var(--font-text);
}
a { color: var(--link); }
h2, h3 { font-family: var(--font-display); color: var(--ink); }
h2 { font-size: 22px; line-height: 28px; font-weight: 700; margin: 0 0 var(--space-3); }
main { max-width: 1200px; margin: 0 auto; padding: var(--space-3) var(--space-3) var(--space-5); }

/* Kopf: Leiste in Tinte mit Bildmarke, darunter die Naht in den Logofarben */
.kopf-leiste { background: var(--brand); color: var(--on-brand); position: relative; }
.kopf-leiste::after {
  content: ""; display: block; height: 3px;
  background:
    repeating-linear-gradient(90deg, var(--kind-1) 0 14px, transparent 14px 22px) left / 33.4% 100% no-repeat,
    repeating-linear-gradient(90deg, var(--highlight) 0 14px, transparent 14px 22px) center / 33.4% 100% no-repeat,
    repeating-linear-gradient(90deg, var(--kind-2) 0 14px, transparent 14px 22px) right / 33.4% 100% no-repeat;
}
.kopf {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  max-width: 1200px; margin: 0 auto; padding: 10px var(--space-3);
}
.marke { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--on-brand); }
.marke img { width: 34px; height: auto; }
.marke b { font: 800 24px/1 var(--font-display); letter-spacing: -.005em; padding-top: 3px; }
.kopf nav { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; color: var(--on-brand-muted); }
.kopf nav a { color: var(--on-brand); text-decoration: none; }
.kopf nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.kopf nav a:focus-visible { outline: 2px solid var(--on-brand); outline-offset: 3px; border-radius: 2px; }

/* Raster: Handy untereinander (Offenes zuerst), breit nebeneinander mit dem Monat links */
.raster { display: grid; gap: var(--space-4); grid-template-areas: "offen" "monat" "saldo"; }
.raster > .bereich-offen { grid-area: offen; }
.raster > .bereich-monat { grid-area: monat; }
.raster > .bereich-saldo { grid-area: saldo; }
@media (min-width: 900px) {
  .raster {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    grid-template-areas: "monat offen" "monat saldo";
    align-items: start;
  }
  .raster > .bereich-saldo { align-self: start; }
}
.schmal { max-width: 760px; margin: 0 auto; }

/* Tagesansicht: breit zweispaltig (Raster links, Handeln rechts), schmal untereinander */
.tag-spalten { display: grid; gap: var(--space-4); }
.tag-rechts > * { margin: 0 0 var(--space-3); }
.tag-links .raster-tag { margin: 0; }
.tag-links > * + * { margin-top: var(--space-3); }
@media (min-width: 900px) {
  .tag-spalten { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  /* Am Rechner flacher, damit 06–24 Uhr ohne Scrollen auf den Bildschirm passt */
  .tag-spalten .zeitraster td, .tag-spalten .zeitraster th, .tag-spalten .zeitraster tbody tr { height: 10px; }
  .tag-spalten .feld-z a { padding-top: 0; }
  .tag-spalten .zeitraster tr.nacht td, .tag-spalten .zeitraster tr.nacht th { height: 24px; }
}

/* Kinderfarben: fest je Kind (Reihenfolge der Stammdaten), immer mit Name oder Buchstabe */
.k1 { --kind: var(--kind-1); } .k2 { --kind: var(--kind-2); }
.k3 { --kind: var(--kind-3); } .k4 { --kind: var(--kind-4); }
.kname { white-space: nowrap; }
.kname::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px;
  border-radius: 3px; background: var(--kind, var(--grau)); vertical-align: -1px;
}

/* Kalender: je Tag ein Farbstreifen je Kind, darunter 3 Spalten (Kinder) × 3 Zeilen (morgens, mittags, abends) */
.kalender { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; margin: 0 -3px; width: calc(100% + 6px); }
.kalender thead th {
  font: 600 12px/16px var(--font-text); color: var(--muted); padding: 2px 0;
}
.kal-tag { vertical-align: top; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 4px; }
.kal-tag.leer { border-color: transparent; background: transparent; }
.kal-tag.schulfrei { background: var(--tint-warm); border-color: #f6d3b8; }
.kal-tag.heute { box-shadow: inset 0 0 0 2px var(--ink); border-color: var(--ink); }
.kal-kopf { display: flex; align-items: baseline; gap: 4px; color: var(--ink); text-decoration: none; min-width: 0; }
.kal-kopf b { font: 700 15px/18px var(--font-display); flex-shrink: 0; }
.kal-kopf small { min-width: 0; font-size: 9px; line-height: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 4px 0 3px; }
.ks { display: block; height: 4px; border-radius: 2px; background: var(--kind); }
.mz {
  display: block; height: 18px; border-radius: 3px; font: 700 10px/18px var(--font-text); text-align: center;
  color: var(--on-brand); text-decoration: none; overflow: hidden;
}
.mz.st-einrichtung { background: var(--einrichtung); }
.mz.st-gruen { background: var(--gruen); }
.mz.st-gelb { background: var(--gelb); color: var(--ink); }
.mz.st-grau { background: var(--grau); color: var(--ink); }
.mz.st-rot { background: var(--rot); }
.mz.fest { box-shadow: inset 0 0 0 2px var(--ink); }
.kal-schicht { display: block; font-size: 9px; line-height: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .kalender { border-spacing: 2px; margin: 0 -2px; width: calc(100% + 4px); }
  .kal-tag { padding: 2px; border-radius: var(--radius-sm); }
  .kal-kopf small, .kal-schicht { display: none; }
  .mz { height: 9px; font-size: 0; border-radius: 2px; }
  .ks { height: 3px; }
  .mini { gap: 1px; }
}

.karte {
  background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--space-3); margin: 0;
}
.schmal .karte, .schmal .kind { margin-bottom: var(--space-3); }
.hinweis, .legende, .fuss, .wer, .tagart { color: var(--muted); font-size: 12px; line-height: 17px; }
.legende { margin: 8px 0 0; }
.fuss { text-align: center; margin-top: var(--space-4); }

.punkt { display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-pill); margin: 0 4px 0 8px; vertical-align: -1px; }
.punkt.gruen { background: var(--gruen); } .punkt.gelb { background: var(--gelb); }
.punkt.grau { background: var(--grau); } .punkt.rot { background: var(--rot); }

/* Offene Tage */
.zusammen { margin: 0 0 var(--space-2); }
.offen-liste { display: grid; gap: 6px; }
.offen-tag {
  display: grid; grid-template-columns: 5.2em 1fr; gap: var(--space-2); padding: var(--space-2) 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  text-decoration: none; color: var(--ink);
}
.offen-tag:hover { border-color: var(--border-strong); }
.offen-tag .datum { font-weight: 700; }
.offen-tag ul { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 20px; min-width: 0; overflow-wrap: anywhere; }
.offen-tag li { padding-left: 14px; position: relative; }
.offen-tag li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: var(--radius-pill); }
.offen-tag li.gelb::before { background: var(--gelb); }
.offen-tag li.grau::before { background: var(--grau); }
.offen-tag li.rot::before { background: var(--rot); }

/* Monat */
.monatsnav, .tagnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.monatsnav h2, .tagnav h2 { margin: 0; }
.monatsnav a, .tagnav a {
  font-size: 24px; line-height: 1; text-decoration: none; padding: 6px 12px; color: var(--ink);
  border-radius: var(--radius-md);
}
.monatsnav a:hover, .tagnav a:hover { background: var(--surface); }
.plan { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.plan th, .plan td { padding: 5px 2px; border-bottom: 1px solid var(--line); text-align: center; }
.plan th:first-child { width: 42%; }
.plan thead th {
  font: 600 12px/16px var(--font-text); color: var(--muted); background: var(--surface); overflow: hidden; text-overflow: ellipsis;
}
.plan tbody th { text-align: left; font-weight: 500; }
.plan tbody th a { color: var(--ink); text-decoration: none; }
.plan tbody th small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 15px; }
.plan tr.schulfrei { background: var(--tint-warm); }
.plan tr.heute th { box-shadow: inset 3px 0 0 var(--ink); }
.feld {
  display: inline-block; min-width: 2em; padding: 1px 6px; border-radius: var(--radius-pill);
  color: var(--on-brand); text-decoration: none; font-weight: 600;
}
.feld.gruen { background: var(--gruen); } .feld.gelb { background: var(--gelb); color: var(--ink); }
.feld.grau { background: var(--grau); color: var(--ink); } .feld.rot { background: var(--rot); }
.feld.fest { box-shadow: 0 0 0 2px var(--surface-raised), 0 0 0 4px var(--ink); }

/* Tag */
.kind {
  background: var(--surface-raised); border: 1px solid var(--line); border-left: 6px solid var(--grau);
  border-radius: var(--radius-md); padding: 10px var(--space-3);
}
.kind.gruen { border-left-color: var(--gruen); } .kind.gelb { border-left-color: var(--gelb); }
.kind.rot { border-left-color: var(--rot); }
.kind h3 { margin: 0 0 4px; font-size: 19px; font-weight: 700; }
.kind h3 span { font-family: var(--font-text); font-size: 15px; font-weight: 400; color: var(--muted); }
.kind ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 21px; }
.kind p { margin: 6px 0 0; }
.meldung { background: var(--tint); color: var(--ink); border-left: 4px solid var(--gruen); border-radius: var(--radius-md); padding: var(--space-2) 12px; }

/* Formulare */
fieldset { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
legend { font: 600 12px/16px var(--font-text); color: var(--muted); margin-bottom: 6px; padding: 0; }
fieldset label { display: flex; align-items: center; gap: 6px; min-height: 36px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--link); }
.notiz, .login label { display: block; margin-bottom: 12px; }
.notiz input, .login input {
  display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink);
}
.notiz input:focus, .login input:focus { outline: 2px solid var(--link); outline-offset: 0; border-color: var(--link); }
button {
  font: 600 15px/1 var(--font-text); padding: 12px 20px; border: 0; border-radius: var(--radius-md);
  background: var(--accent); color: var(--ink); cursor: pointer; min-height: 44px;
}
button:hover { background: var(--accent-strong); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button.leise { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
button.leise:hover { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.zusage { background: var(--tint); border-left: 6px solid var(--gelb); }
.zusage p { margin: 0 0 12px; }
.fuer-mich { margin-bottom: var(--space-4); }
.login { max-width: 360px; margin: var(--space-5) auto; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); }
.fehler { color: var(--rot); }
.saldo { width: 100%; border-collapse: collapse; font-size: 14px; }
.saldo th, .saldo td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.saldo th { font: 600 12px/16px var(--font-text); color: var(--muted); background: var(--surface); }

.kind, .karte { overflow-wrap: anywhere; }

/* Tagesraster: Zeilen = Viertelstunden, Spalten = Kinder, Abschnitte als Zellen über mehrere Zeilen */
.punkt.einrichtung { background: var(--einrichtung); box-shadow: inset 0 0 0 1px var(--border-strong); }
.raster-tag { padding: var(--space-2); margin-bottom: var(--space-3); }
.zeitraster { width: 100%; border-collapse: separate; border-spacing: 4px 0; table-layout: fixed; }
.zeitraster thead th {
  font: 700 13px/16px var(--font-text); color: var(--ink);
  padding: 4px 2px 6px; border-bottom: 3px solid var(--line); overflow: hidden; text-overflow: ellipsis;
}
.zeitraster thead th.st-gruen { border-bottom-color: var(--gruen); }
.zeitraster thead th.st-gelb { border-bottom-color: var(--gelb); }
.zeitraster thead th.st-grau { border-bottom-color: var(--grau); }
.zeitraster thead th.st-rot { border-bottom-color: var(--rot); }
.zeitraster th.uhrzeit {
  width: 30px; padding: 0 2px 0 0; font: 400 11px/12px var(--font-text); color: var(--muted);
  text-align: right; vertical-align: top; font-variant-numeric: tabular-nums;
}
.zeitraster tr.voll th.uhrzeit { border-top: 1px solid var(--line); }
/* Feste Zeilenhöhe: Beschriftungen bleiben einzeilig (voller Text im Tooltip), damit die Zeitachse nicht verrutscht */
.zeitraster td, .zeitraster th, .zeitraster tbody tr { height: 13px; }
.feld-z { padding: 0; vertical-align: top; border-left: 3px solid transparent; }
.feld-z a {
  display: block; height: 100%; padding: 1px 4px; overflow: hidden;
  color: var(--ink); text-decoration: none; font-size: 11px; line-height: 13px;
}
.feld-z b, .feld-z small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feld-z b { font-weight: 600; }
.feld-z small { color: var(--muted); font-size: 10px; line-height: 12px; }
.feld-z.st-einrichtung { background: var(--einrichtung); border-left-color: var(--border-strong); }
.feld-z.st-gruen { background: var(--gruen-hell); border-left-color: var(--gruen); }
.feld-z.st-gelb { background: var(--gelb-hell); border-left-color: var(--gelb); }
.feld-z.st-grau { background: var(--grau-hell); border-left-color: var(--grau); }
.feld-z.st-rot { background: var(--rot-hell); border-left-color: var(--rot); }
.feld-z.st-rot b { color: var(--rot); }
.feld-z.art-termin { outline: 2px solid var(--ink); outline-offset: -2px; }
.feld-z.art-termin b::before { content: "● "; color: var(--ink); }
/* Abschnitte untereinander sichtbar trennen */
.feld-z { box-shadow: inset 0 1px 0 var(--surface-raised); }
.zeitraster tr.nacht td, .zeitraster tr.nacht th { height: 30px; vertical-align: middle; }
.zeitraster tr.nacht td { border-bottom: var(--naht); }

.festlegungen { list-style: none; margin: 0; padding: 0; }
.festlegungen li {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.festlegungen small { display: block; color: var(--muted); font-size: 12px; }
.festlegungen form { margin: 0; }
.festlegungen .knoepfe { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.einladung p { margin: 0 0 8px; }
.einladung input { width: 100%; padding: 8px; font: 13px var(--font-text); border: var(--naht); border-radius: var(--radius-md); }
.kopf nav { flex-wrap: wrap; justify-content: flex-end; }
.festlegungen button { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.zeiten { align-items: center; }
.zeiten input {
  margin-left: 4px; padding: 8px; font: inherit; border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); background: var(--surface-raised); color: var(--ink);
}
.zeiten small { color: var(--muted); font-size: 12px; }

@media (max-width: 420px) {
  main { padding: var(--space-3) 12px var(--space-5); }
  .plan { font-size: 14px; }
  .feld { min-width: 1.8em; padding: 1px 4px; }
  .offen-tag { grid-template-columns: 4.6em 1fr; }
  .marke b { font-size: 21px; }
}

.anbieter { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-3) var(--space-4); border-top: var(--naht); padding-top: var(--space-3); color: var(--muted); font-size: 12px; text-align: center; }
