:root {
  --blau: #1a3a5c; --blau-h: #e6edf5; --text: #15202b; --grau: #5b6670; --linie: #d5dbe1; --hg: #f4f6f8; --weiss: #fff;
  --rot: #c0392b; --rot-h: #fde2e2; --gruen: #2e7d32; --gruen-h: #e3f2e4; --lila: #7b3fa0; --lila-h: #f1e6f7;
  --blau2: #1f6fb2; --blau2-h: #e1eefa; --grau2: #6c757d; --grau2-h: #eceeef; --gelb-h: #fff1cc; --orange: #d08a00;
  --schrift: 18px;
}
html[data-schrift="gross"] { --schrift: 21px; }
html[data-schrift="sehrgross"] { --schrift: 24px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: var(--schrift); line-height: 1.45; color: var(--text); background: var(--hg); }
a { color: var(--blau2); }
h2 { font-size: 1.3em; margin: 1em 0 .5em; color: var(--blau); }
h3 { font-size: 1.1em; margin: 1.2em 0 .5em; color: var(--blau); }

.kopf { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; background: var(--blau); color: #fff; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.kopf h1 { flex: 1; margin: 0; font-size: 1.05em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-k { color: #fff; text-decoration: none; font-weight: 600; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.14); white-space: nowrap; font-size: .9em; }
main { max-width: 900px; margin: 0 auto; padding: 12px 16px 120px; }

/* Knöpfe */
.knopf { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; min-height: 48px; padding: 10px 16px; border: 2px solid var(--blau); border-radius: 10px; background: var(--blau); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; margin: 4px 6px 4px 0; }
.knopf small { font-weight: 400; font-size: .78em; opacity: .9; }
.knopf.hell { background: var(--weiss); color: var(--blau); }
.knopf.gruen { background: var(--gruen); border-color: var(--gruen); }
.knopf.rot { border-color: var(--rot); color: var(--rot); background: var(--weiss); }
.knopf.gross { width: 100%; min-height: 58px; font-size: 1.05em; margin: 8px 0; }
.knopf.breit { width: 100%; align-items: flex-start; text-align: left; }
.knopf.gruen-r { background: var(--weiss); color: var(--text); border-color: var(--gruen); border-left-width: 8px; width: 100%; align-items: flex-start; text-align: left; }
.knopf.mini { min-height: 38px; padding: 4px 10px; font-size: .85em; margin: 2px; }
.knopf.mini.rot { background: var(--weiss); }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.knopfreihe .knopf { flex: 1 1 auto; }
.knopfreihe.zwei .knopf { flex: 1 1 40%; min-height: 60px; }
.liste-knoepfe { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }

/* Startkacheln */
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.kachel { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; min-height: 112px; border-radius: 14px; background: var(--weiss); border: 2px solid var(--linie); color: var(--text); text-decoration: none; font-weight: 700; padding: 12px; font-size: 1em; }
.kachel span { font-size: 1.8em; line-height: 1.2; }
.kachel small { font-weight: 400; color: var(--grau); font-size: .8em; }
.kachel.k1 { border-color: var(--gruen); } .kachel.k2 { border-color: var(--blau2); } .kachel.k3 { border-color: var(--grau2); } .kachel.k4 { border-color: var(--orange); }

.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: 4px 16px 12px; margin: 12px 0; }
.hinweis-karte { border: 2px solid var(--gruen); }
.warnung { background: var(--gelb-h); border-left: 6px solid var(--orange); padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.warnung.rot { background: var(--rot-h); border-color: var(--rot); }
.warnung.gruen { background: var(--gruen-h); border-color: var(--gruen); }
.hilfe { color: var(--grau); font-size: .9em; }
.fuss { text-align: center; margin-top: 24px; }
.schritt { color: var(--grau); font-weight: 600; margin: 12px 0 4px; }

/* Veranstaltungskarten */
.vkarte { display: flex; gap: 12px; background: var(--weiss); border: 1px solid var(--linie); border-left: 10px solid var(--grau2); border-radius: 12px; padding: 10px 12px; margin: 8px 0; color: var(--text); text-decoration: none; }
.vk-datum { display: flex; flex-direction: column; align-items: center; min-width: 54px; color: var(--grau); font-size: .85em; text-align: center; }
.vk-datum b { font-size: 1.6em; color: var(--text); line-height: 1.1; }
.vk-text { display: flex; flex-direction: column; min-width: 0; }
.vk-text span { color: var(--grau); font-size: .88em; }
.vk-status { font-weight: 600; }
.ist-wichtig { box-shadow: 0 0 0 3px var(--orange) inset; }
.ist-abgesagt { opacity: .55; text-decoration: line-through; }
.f-rot { border-left-color: var(--rot) !important; } .f-gruen { border-left-color: var(--gruen) !important; } .f-lila { border-left-color: var(--lila) !important; } .f-blau { border-left-color: var(--blau2) !important; } .f-grau { border-left-color: var(--grau2) !important; }
.abzeichen { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.abz { font-size: .78em; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--grau2-h); color: var(--text); }
.abz.wichtig { background: var(--orange); color: #fff; } .abz.abw { background: var(--gelb-h); color: #7a4d00; border: 1px solid var(--orange); }
.abz.konflikt { background: var(--rot); color: #fff; } .abz.geaendert { background: var(--rot-h); color: var(--rot); } .abz.abgesagt { background: #333; color: #fff; }

/* Veranstaltung */
.v-kopf { background: var(--weiss); border: 1px solid var(--linie); border-left: 12px solid var(--grau2); border-radius: 12px; padding: 8px 16px; margin: 8px 0; }
.v-kopf h2 { margin: .2em 0; }
.v-kopf p { margin: .2em 0; }
.v-anlass { color: var(--grau); font-weight: 600; font-size: .9em; }
.stand { color: var(--grau); font-size: .85em; }
.abschnitte { list-style: none; padding: 0; margin: 0; counter-reset: ab; }
.abschnitte li a { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; margin: 6px 0; color: var(--text); text-decoration: none; font-weight: 600; }
.abschnitte .haken { display: inline-flex; justify-content: center; align-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--linie); color: #fff; flex: none; }
.abschnitte a.ok .haken { background: var(--gruen); border-color: var(--gruen); }
.aend { padding-left: 1.2em; font-size: .9em; } .aend em { color: var(--grau); }

/* Checkliste */
.fortschritt { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.fortschritt a { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--weiss); border: 2px solid var(--linie); color: var(--text); text-decoration: none; font-weight: 700; font-size: .85em; }
.fortschritt a.ok { background: var(--gruen-h); border-color: var(--gruen); }
.fortschritt a.jetzt { background: var(--blau); border-color: var(--blau); color: #fff; }
.formular { background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: 8px 16px 16px; }
.feld { display: block; margin: 14px 0; }
.feld-l { display: block; font-weight: 700; margin-bottom: 6px; }
.feld-l em { font-weight: 400; color: var(--grau); font-style: normal; }
.feld small { display: block; color: var(--grau); margin-top: 4px; font-size: .82em; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=email], input[type=tel], input[type=search], textarea, select {
  width: 100%; font: inherit; padding: 12px; border: 2px solid #b8c2cc; border-radius: 10px; background: #fff; color: var(--text); min-height: 52px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blau2); }
.reihe { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.reihe > .feld { flex: 1 1 150px; }
.reihe.zusatz > .knopf { margin-bottom: 18px; }
.summe { font-size: 1.05em; background: var(--blau-h); padding: 10px 12px; border-radius: 8px; }
.unten { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .92em; min-height: 46px; padding: 8px 14px; border-radius: 24px; border: 2px solid #b8c2cc; background: #fff; color: var(--text); cursor: pointer; text-align: left; margin: 0; display: inline-flex; align-items: center; justify-content: flex-start; font-weight: 400; flex-direction: row; }
.chip.an { background: var(--blau); color: #fff; border-color: var(--blau); font-weight: 700; }
.chips.klein .chip { min-height: 38px; font-size: .82em; padding: 4px 12px; }
.chip.kat.an { background: var(--blau2); border-color: var(--blau2); }
.chip.speise { border-style: dashed; }
.schalter { display: flex; align-items: center; gap: 12px; margin: 14px 0; cursor: pointer; font-weight: 600; }
.schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.schalter-k { flex: none; width: 60px; height: 34px; border-radius: 34px; background: #b8c2cc; position: relative; transition: background .15s; }
.schalter-k::after { content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; }
.schalter input:checked + .schalter-k { background: var(--gruen); }
.schalter input:checked + .schalter-k::after { left: 30px; }
.schalter input:focus-visible + .schalter-k { outline: 3px solid #f0a500; outline-offset: 2px; }
.aufklapp { margin: 10px 0; }
.aufklapp summary { cursor: pointer; font-weight: 600; color: var(--blau2); padding: 8px 0; }
.frei { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.frei input { flex: 1; }
.frei .knopf { margin: 0; }

/* Menü */
.gang { border: 2px solid var(--linie); border-radius: 12px; padding: 4px 12px 8px; margin: 14px 0; background: #fbfcfd; }
.gang-kopf { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.gang-titel { font-weight: 700 !important; font-size: 1.05em !important; }
.gang-pfeile { display: flex; }
.speisen { margin: 0; padding-left: 1.6em; }
.speisen li { padding: 6px 0; border-bottom: 1px solid var(--linie); }
.speisen li span { display: block; font-weight: 600; }
.speisen li.leer { color: var(--grau); list-style: none; margin-left: -1.6em; }
.speisen li.tauscht { background: var(--gelb-h); }
.auswahl { background: var(--blau-h); border-radius: 10px; padding: 8px 10px; margin: 10px 0; }
.auswahl .chips { margin: 6px 0; }
.auswahl.tausch-aktiv { background: var(--gelb-h); border: 2px solid var(--orange); }

/* Aufgaben */
.zeile-box { border: 1px solid var(--linie); border-radius: 10px; padding: 0 12px 8px; margin: 10px 0; background: #fbfcfd; }
.zeile-box.erledigt { opacity: .7; background: var(--gruen-h); }
.aufg-zeile { display: block; padding: 10px 0; border-bottom: 1px solid var(--linie); color: var(--text); text-decoration: none; }
.aufg-zeile span { display: block; color: var(--grau); font-size: .85em; }
.aufg-zeile.ueberfaellig b { color: var(--rot); }

/* Ablauf */
.ablauf-zeile { display: grid; grid-template-columns: 120px 1fr; gap: 6px; background: var(--weiss); border: 1px solid var(--linie); border-radius: 10px; padding: 8px; margin: 8px 0; }
.ablauf-zeile textarea { grid-column: 1 / -1; min-height: 52px; }
.ablauf-zeile select { grid-column: 1; }
.ablauf-zeile .knopf { grid-column: 2; justify-self: end; }

/* Preise */
.rechnung { width: 100%; border-collapse: collapse; font-size: .92em; margin: 10px 0; }
.rechnung th, .rechnung td { border-bottom: 1px solid var(--linie); padding: 6px 4px; text-align: right; }
.rechnung th:first-child, .rechnung td:first-child { text-align: left; }
.rechnung tfoot td { font-weight: 700; border-top: 2px solid var(--text); }
.regeln { padding-left: 1.2em; font-size: .9em; color: var(--grau); }

/* Kalender */
.kal-kopf { display: flex; align-items: center; gap: 6px; }
.kal-kopf h2 { flex: 1; text-align: center; margin: .4em 0; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .8em; margin: 6px 0 10px; }
.legende span { border-left: 12px solid; padding-left: 6px; }
.legende .lg-wichtig { border: none; padding: 0; color: #7a4d00; font-weight: 700; }
.kal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.kal-wt { text-align: center; font-weight: 700; color: var(--grau); font-size: .8em; }
.kal-tag { display: flex; flex-direction: column; gap: 2px; min-height: 82px; background: var(--weiss); border: 1px solid var(--linie); border-radius: 8px; padding: 3px; color: var(--text); text-decoration: none; overflow: hidden; }
.kal-tag.fremd { opacity: .4; }
.kal-tag.heute { border: 3px solid var(--blau2); }
.kal-tag.gewaehlt { background: var(--blau-h); border-color: var(--blau); }
.kal-nr { font-weight: 700; font-size: .85em; }
.kal-warn { color: var(--rot); }
.kal-v { display: block; font-size: .68em; line-height: 1.25; padding: 2px 4px; border-radius: 4px; color: #fff; background: var(--grau2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 0 !important; }
.kal-v i { font-style: normal; }
.kal-v.f-rot { background: var(--rot); } .kal-v.f-gruen { background: var(--gruen); } .kal-v.f-lila { background: var(--lila); } .kal-v.f-blau { background: var(--blau2); }
.kal-v.auffaellig { outline: 3px solid var(--orange); outline-offset: -1px; font-weight: 700; }
@media (max-width: 560px) {
  .kal-tag { min-height: 60px; }
  .kal-v { font-size: 0; height: 12px; padding: 0; }
  .kal-v.auffaellig { height: 14px; font-size: 10px; text-align: center; line-height: 14px; }
  .kal-v.auffaellig i { display: none; }
}

/* Plan-Reiter */
.reiter { display: flex; gap: 4px; margin: 6px 0; overflow-x: auto; }
.reiter a { flex: 1; text-align: center; padding: 12px 8px; border-radius: 10px 10px 0 0; background: var(--grau2-h); color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; border-bottom: 4px solid transparent; }
.reiter a.an { background: var(--weiss); border-bottom-color: var(--blau); color: var(--blau); }

/* Papieransicht (Plan) */
.papier { background: #fff; border: 1px solid var(--linie); border-radius: 6px; padding: 12px 18px 20px; margin: 10px 0; font-size: .92em; }
.p-titel h2 { margin: .3em 0; font-size: 1.35em; }
.p-sub { margin: 0 0 6px; color: #444; }
.p-badge { display: inline-block; font-weight: 700; color: #b03000; border: 2px solid #b03000; padding: 2px 8px; border-radius: 6px; margin: 2px 4px 6px 0; font-size: .85em; }
.p-titel { border-bottom: 3px solid var(--blau); padding-bottom: 6px; margin-bottom: 8px; }
.p-h { background: var(--blau-h); padding: 6px 10px; margin: 18px 0 8px; font-size: 1.05em; }
.p-kv { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 4px 12px; margin: 0; }
.p-kv dt { font-weight: 700; color: #333; }
.p-kv dd { margin: 0; }
.p-kv dd.stark { font-weight: 700; color: #b03000; }
.p-liste { padding-left: 1.2em; margin: 4px 0; }
.p-text { margin: 6px 0; }
.p-hinweis { padding: 8px 12px; border-left: 6px solid var(--gruen); background: var(--gruen-h); margin: 8px 0; border-radius: 4px; font-weight: 600; }
.p-hinweis.warn { border-color: var(--orange); background: var(--gelb-h); }
.p-hinweis.rot { border-color: var(--rot); background: var(--rot-h); }
.p-tab { width: 100%; border-collapse: collapse; margin: 4px 0; }
.p-tab th { background: #eee; text-align: left; padding: 6px; font-size: .9em; }
.p-tab td { border-bottom: 1px solid #ccc; padding: 6px; vertical-align: top; }
.p-tab td:first-child { font-weight: 700; white-space: nowrap; }
.p-gang { margin: 8px 0 12px; }
.p-gang-k strong { color: var(--blau); font-size: 1.05em; }
.p-gang-k span { color: #555; }
.p-gang ul { margin: 4px 0; padding-left: 1.4em; }
.p-gang-h { color: #8a4b00; margin: 2px 0 0 1.4em; font-style: italic; }

.status { padding-left: 1.2em; }
.verwalten { list-style: none; padding: 0; }
.verwalten li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--linie); }
.verwalten small { display: block; color: var(--grau); }
.suche { margin: 8px 0; }
.hilfe-liste li { margin: 8px 0; }
.anlass-wahl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.anlass-k { font: inherit; font-weight: 700; min-height: 64px; border-radius: 12px; border: 2px solid var(--linie); border-left: 12px solid; background: #fff; color: var(--text); cursor: pointer; text-align: left; padding: 8px 12px; }
.anlass-k.an { background: var(--blau); color: #fff; }

.meldung { position: fixed; left: 12px; right: 12px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; background: #1d2b36; color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.3); transform: translateY(160%); transition: transform .25s; z-index: 50; }
.meldung.sichtbar { transform: none; }
.meldung.fehler { background: var(--rot); }

#druckbereich { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; font-size: 11pt; }
  .druckt #app, .druckt .meldung { display: none !important; }
  .druckt #druckbereich { display: block; border: none; padding: 0; margin: 0; font-size: 11pt; }
  body:not(.druckt) .kopf, body:not(.druckt) .knopf, body:not(.druckt) .knopfreihe, body:not(.druckt) .reiter, body:not(.druckt) .meldung, body:not(.druckt) .hilfe { display: none !important; }
  .papier { border: none; padding: 0; }
  .p-h { -webkit-print-color-adjust: exact; print-color-adjust: exact; break-after: avoid; }
  .p-hinweis, .p-badge, .p-tab th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-gang, .p-tab tr, .p-hinweis { break-inside: avoid; }
}
