:root {
  --nacht: #14325c;
  --nacht-2: #1f4a82;
  --schnee: #f3f6fa;
  --weiss: #fff;
  --linie: #dde4ee;
  --text: #17222f;
  --leise: #5f6f82;
  --rot: #d9472f;
  --gruen: #1f8a5b;
  --gelb: #f4b740;
  --eis: #e6f0fb;
  --radius: 14px;
  --schatten: 0 1px 2px rgba(20, 50, 92, .06), 0 4px 14px rgba(20, 50, 92, .07);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--schnee);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
.laden { padding: 40vh 0; text-align: center; color: var(--leise); }

/* Kopf */
.kopf {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(160deg, var(--nacht), var(--nacht-2));
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  display: flex; align-items: center; gap: 12px;
}
.kopf h1 { font-size: 18px; margin: 0; flex: 1; line-height: 1.2; }
.kopf h1 small { display: block; font-weight: 400; opacity: .75; font-size: 13px; }
.ich {
  background: rgba(255,255,255,.14); border: 0; border-radius: 999px;
  padding: 6px 12px; color: #fff; font-size: 14px; max-width: 46vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zahnrad { background: none; border: 0; color: #fff; font-size: 20px; padding: 4px; }

main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 24px 4px 10px; }
h2:first-child { margin-top: 4px; }

/* Navigation */
nav.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--linie);
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.leiste button {
  background: none; border: 0; padding: 8px 0 10px; font-size: 12px; color: var(--leise);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav.leiste button span { font-size: 21px; line-height: 1.1; }
nav.leiste button.aktiv { color: var(--nacht); font-weight: 600; }
nav.leiste .punkt { background: var(--rot); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 5px; margin-left: 2px; }

/* Karten */
.karte {
  background: var(--weiss); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px 16px; margin-bottom: 10px;
}
.karte.klick { cursor: pointer; }
.zeile { display: flex; align-items: center; gap: 10px; }
.zeile .wachs { flex: 1; min-width: 0; }
.leise { color: var(--leise); font-size: 14px; }
.klein { font-size: 13px; }
.betrag { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.plus { color: var(--gruen); }
.minus { color: var(--rot); }
.chip {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--eis); color: var(--nacht); font-weight: 600; white-space: nowrap;
}
.chip.gelb { background: #fff1d1; color: #7a5300; }
.chip.gruen { background: #dcf3e8; color: #135c3b; }
.chip.rot { background: #fde3de; color: #8e2615; }
.spitz { font-style: italic; color: var(--nacht-2); }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600;
  background: var(--nacht); color: #fff; cursor: pointer; text-decoration: none;
}
.knopf.zweit { background: var(--eis); color: var(--nacht); }
.knopf.rot { background: #fde3de; color: #8e2615; }
.knopf.gruen { background: var(--gruen); }
.knopf.klein { padding: 6px 10px; font-size: 14px; border-radius: 10px; }
.knopf:disabled { opacity: .5; }
.knopf.breit { width: 100%; }
.reihe { display: flex; gap: 10px; flex-wrap: wrap; }
.reihe > .knopf { flex: 1; }
.gross {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px;
}
.gross .knopf { flex-direction: column; padding: 18px 10px; font-size: 15px; border-radius: var(--radius); }
.gross .knopf span { font-size: 28px; }

/* Formulare */
label.feld { display: block; margin-bottom: 12px; }
label.feld > span { display: block; font-size: 13px; color: var(--leise); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--nacht-2); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.check input { width: 22px; height: 22px; }
.faktoren { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.faktoren button { border: 1px solid var(--linie); background: #fff; border-radius: 8px; padding: 6px 10px; }
.faktoren button.an { background: var(--nacht); color: #fff; border-color: var(--nacht); }
.mitknopf { display: flex; gap: 8px; }
.mitknopf input { flex: 1; }

/* Positionen */
.positionen { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.positionen td { padding: 3px 0; vertical-align: middle; }
.positionen td:nth-child(2) { width: 96px; padding-left: 6px; }
.positionen td:nth-child(3) { width: 36px; text-align: right; }
.positionen input { padding: 8px 10px; }
.positionen input[data-f=betrag] { text-align: right; }
.weg { background: none; border: 0; color: var(--leise); font-size: 20px; padding: 4px 6px; cursor: pointer; }
.summenbox { background: var(--eis); border-radius: 12px; padding: 10px 12px; margin: 10px 0 14px; }
.warnung { background: #fff1d1; color: #6b4800; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.bon { width: 100%; max-height: 220px; object-fit: cover; object-position: top; border-radius: 12px; margin-bottom: 12px; cursor: zoom-in; }

/* Unterseite (Sheet) */
#schicht {
  position: fixed; inset: 0; z-index: 20; background: rgba(10, 25, 45, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.blatt {
  background: var(--schnee); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: hoch .18s ease-out;
}
#schicht[hidden] { display: none; }
@media (min-width: 700px) { #schicht { align-items: center; } .blatt { border-radius: 20px; } }
@keyframes hoch { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.blatt h3 { margin: 0 0 14px; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.blatt h3 .zu { margin-left: auto; background: none; border: 0; font-size: 24px; color: var(--leise); cursor: pointer; }
.vollbild { max-width: 100%; max-height: 85vh; display: block; margin: 0 auto; border-radius: 10px; }

/* Familien */
.familie { border-left: 5px solid var(--farbe, var(--nacht)); }
.familie .kopfzeile { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.familie .kopfzeile strong { flex: 1; font-size: 17px; }
.person { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--linie); cursor: pointer; }
.person:first-of-type { border-top: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--farbe, var(--nacht)); color: #fff; font-weight: 700; font-size: 15px; flex: none;
}

/* Rezepte */
.rezept .titel { font-weight: 650; font-size: 16.5px; }
.rezept details { margin-top: 8px; }
.rezept summary { cursor: pointer; color: var(--nacht-2); font-size: 14px; }
.rezept ul, .rezept ol { padding-left: 20px; margin: 6px 0; }
.stimme { border: 1px solid var(--linie); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 14px; cursor: pointer; }
.stimme.an { background: var(--eis); border-color: var(--nacht-2); }
.kochbanner { background: linear-gradient(140deg, #fff7e6, #fff); border: 1px solid #f6dfa8; }

/* Abrechnung */
.kennzahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.kennzahlen .karte { margin: 0; text-align: center; padding: 12px 6px; }
.kennzahlen b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tabelle th { text-align: right; font-weight: 500; color: var(--leise); font-size: 12.5px; padding: 4px 4px 8px; }
.tabelle th:first-child, .tabelle td:first-child { text-align: left; }
.tabelle td { text-align: right; padding: 8px 4px; border-top: 1px solid var(--linie); font-variant-numeric: tabular-nums; }
@media (max-width: 440px) {
  .tabelle { font-size: 13px; }
  .tabelle th, .tabelle td { padding-left: 2px; padding-right: 2px; }
  .karte:has(> .tabelle) { padding-left: 10px; padding-right: 10px; }
}
.ueberweisung { display: flex; align-items: center; gap: 10px; }
.ueberweisung .pfeil { font-size: 20px; color: var(--leise); }
.leer { text-align: center; color: var(--leise); padding: 26px 10px; }

/* Anmeldung */
.anmeldung { max-width: 420px; margin: 0 auto; padding: 12vh 20px 40px; }
.anmeldung .logo { width: 72px; height: 72px; display: block; margin: 0 auto 14px; }
.anmeldung h1 { text-align: center; margin: 0 0 6px; }
.anmeldung p { text-align: center; color: var(--leise); margin: 0 0 22px; }

#meldung {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #17222f; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 30; max-width: 90vw;
}
#meldung.an { opacity: 1; transform: translateX(-50%); }

.arbeitet { position: fixed; inset: 0; background: rgba(243,246,250,.85); z-index: 40; display: grid; place-items: center; text-align: center; color: var(--nacht); font-weight: 600; }
.arbeitet .flocke { font-size: 44px; display: block; animation: drehen 2.4s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

/* Drucken: nur der Bericht */
.nurdruck { display: none; }
@media print {
  body { background: #fff; }
  .kopf, nav.leiste, .keindruck, #meldung { display: none !important; }
  .nurdruck { display: block; }
  main { padding: 0; max-width: none; }
  .karte { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* Urlaub */
.ziel { background: linear-gradient(160deg, #e6f0fb, #fff 70%); }
.zielname { font-size: 24px; font-weight: 700; color: var(--nacht); line-height: 1.2; margin: 2px 0 4px; }
.countdown { display: inline-block; margin-top: 8px; background: var(--nacht); color: #fff; border-radius: 999px; padding: 3px 12px; font-size: 14px; font-weight: 600; }
.notizen { white-space: pre-wrap; background: var(--schnee); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 14.5px; }
.galerie { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 600px) { .galerie { grid-template-columns: repeat(4, 1fr); } }
.kachel { aspect-ratio: 1; border: 0; border-radius: 12px; background: #dde4ee center / cover no-repeat; position: relative; cursor: pointer; overflow: hidden; padding: 0; }
.kachel span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11.5px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); text-align: left; }
.kachel.neu { background: var(--eis); color: var(--nacht); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed #b9cbe2; }
.kachel.neu b { font-size: 28px; line-height: 1; }
a { color: var(--nacht-2); }
a.wachs { text-decoration: none; color: inherit; }
code { background: var(--eis); padding: 1px 6px; border-radius: 6px; }
nav.leiste button { font-size: 11px; }

/* Wetter */
.wetter .jetzt { font-size: 30px; font-weight: 700; line-height: 1.1; }
.tage { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 4px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; }
.tag { text-align: center; background: var(--schnee); border-radius: 12px; padding: 8px 4px; font-size: 14px; }
.tag.reise { background: var(--eis); outline: 2px solid #b9cbe2; }
.tag .schnee { color: var(--nacht-2); font-weight: 600; min-height: 1.4em; }
/* Lifte */
.lift { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--linie); }
.lift:first-child { border-top: 0; }
.lift a { text-decoration: none; }
.ampel { width: 12px; height: 12px; border-radius: 50%; flex: none; background: #c9d2dd; }
.ampel.offen { background: var(--gruen); box-shadow: 0 0 0 3px #dcf3e8; }
.ampel.zu { background: var(--rot); }
.ampel.vorb { background: var(--gelb); animation: blinken 1.5s ease-in-out infinite; }
@keyframes blinken { 50% { opacity: .35; } }
details summary { cursor: pointer; color: var(--nacht-2); font-size: 14px; padding-top: 10px; }
nav.leiste button { font-size: 10.5px; }
nav.leiste button span { font-size: 19px; }
.lift .wachs { flex: 1; min-width: 0; }
.legende { display: flex; gap: 14px; font-size: 12px; color: var(--leise); margin: 4px 4px 0; align-items: center; }
.legende .ampel { display: inline-block; margin-right: 5px; vertical-align: -1px; width: 10px; height: 10px; box-shadow: none; }

.schneezeile { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--linie); }
.schneezeile:first-child { border-top: 0; }
.schneezeile .wachs { flex: 1; min-width: 0; }
.balken { width: 34%; height: 10px; background: var(--schnee); border-radius: 999px; overflow: hidden; }
.balken span { display: block; height: 100%; background: linear-gradient(90deg, #9cc3ee, var(--nacht-2)); border-radius: 999px; }

/* Einkaufsliste */
.umschalter { display: grid; grid-template-columns: 1fr 1fr; background: #e3e9f1; border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.umschalter button { border: 0; background: none; padding: 9px 6px; border-radius: 10px; font-weight: 600; color: var(--leise); cursor: pointer; }
.umschalter button.an { background: #fff; color: var(--nacht); box-shadow: var(--schatten); }
.umschalter b { background: var(--nacht); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-left: 3px; }
.umschalter b.rot { background: var(--rot); }
.listeneingabe { display: flex; gap: 8px; padding: 10px; }
.listeneingabe input { flex: 1; min-width: 0; }
.listeneingabe .menge { flex: 0 0 84px; }
.listeneingabe .knopf { padding: 0 16px; font-size: 22px; }
.posten { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--linie); }
.posten:first-child { border-top: 0; }
.posten .wachs { flex: 1; min-width: 0; cursor: pointer; }
.haken { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid #b9cbe2; background: #fff; color: #fff; font-weight: 800; cursor: pointer; padding: 0; }
.posten.erledigt .haken { background: var(--gruen); border-color: var(--gruen); }
.posten.erledigt .ptext { text-decoration: line-through; color: var(--leise); }

.umschalter.drei { grid-template-columns: repeat(3, 1fr); }
.umschalter.drei button { font-size: 13px; padding: 9px 2px; }
.liste-punkte { margin: 0; padding-left: 18px; font-size: 14.5px; }
.liste-punkte li { margin: 4px 0; }
.skischule .titel { font-weight: 650; font-size: 16.5px; }
.angebote { margin-top: 8px; }
.angebot { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--linie); font-size: 14.5px; }
.angebot .wachs { flex: 1; min-width: 0; }
.angebot .preis { font-weight: 600; text-align: right; max-width: 48%; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

details.ausgeblendet summary { padding-top: 0; color: var(--leise); }
details.ausgeblendet[open] summary { margin-bottom: 6px; }

/* PDF-Ansicht */
.pdfansicht { position: fixed; inset: 0; z-index: 50; background: #0f1b2b; display: flex; flex-direction: column; }
.pdfkopf { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; background: var(--nacht); color: #fff; }
.pdftitel { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.pdfknopf { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px; min-width: 40px; height: 40px; font-size: 20px; display: grid; place-items: center; text-decoration: none; cursor: pointer; }
.pdfflaeche { flex: 1; overflow: auto; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
.pdfseiten { width: 100%; }
.pdfseiten canvas { display: block; width: 100%; height: auto; background: #fff; margin-bottom: 6px; }
.pdflaedt { color: #fff; text-align: center; padding: 30vh 20px; }
.pdflaedt .flocke { font-size: 40px; display: block; animation: drehen 2.4s linear infinite; }

.schloss { background: var(--eis); color: var(--nacht); border-radius: 12px; padding: 9px 12px; font-size: 13.5px; margin: 0 0 12px; }
form.nurspitz input:disabled, form.nurspitz select:disabled { background: var(--schnee); color: var(--leise); }
