/* Krötenzaun-App – ruhige Naturtöne, groß, kontrastreich. Dunkelmodus automatisch. */
:root {
  --bg: #f5f2ea; --card: #fff; --text: #1d2618; --muted: #4f5a49; --line: #cfc8b8;
  --primary: #3d6b2f; --on-primary: #fff; --primary-soft: #e4eedc;
  --on-danger: #fff; --accent: #6e4a2a; --focus: #1f5fbf; --danger: #a3241b;
  --free-bg: #fbe4e1; --free: #8f1d15;
  --signed-bg: #fdf1c7; --signed: #6b5200;
  --done-bg: #dfeed8; --done: #24561a;
  --off-bg: #ebebe8; --off: #555;
  --input-line: #857c6a;
  --nav-h: 68px; --sheet-pad: 18px;
  --c-m: #3d6b2f; --c-f: #a8672a; --c-o: #66779a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121611; --card: #1d231b; --text: #e8ede3; --muted: #b3bdab; --line: #3a4436;
    --primary: #8cc472; --on-primary: #0e1a09; --primary-soft: #26341f;
    --on-danger: #2b0a07; --accent: #d6ad80; --focus: #8ab8ff; --danger: #ff9a8f;
    --free-bg: #3a1c19; --free: #ffb1a7;
    --signed-bg: #352d10; --signed: #f1d36a;
    --done-bg: #1b3218; --done: #a5dc95;
    --off-bg: #2a2a2a; --off: #c8c8c8;
    --input-line: #7d8b75;
    --c-m: #8cc472; --c-f: #e0a56a; --c-o: #9bb0d6;
  }
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { min-height: 100vh; padding-bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
body.ohne-tabs #app { padding-bottom: 16px; }
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }
h1 { font-size: 1.5rem; margin: 12px 0 8px; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 22px 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 4px; }
p { margin: 6px 0; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.klein { font-size: .9rem; }
[hidden] { display: none !important; }

/* Kopf */
.kopf { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 1.1rem; min-height: 56px; }
.kopf img { background: #fff; border-radius: 50%; padding: 2px; }
body.embed .kopf { display: none; }

/* Tabs unten */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; min-width: 0; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: min(.85rem, 15px); font-weight: 600; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.tabs svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 4px 0 var(--primary); }
body.embed .tabs { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); }
body.embed #app { padding-bottom: 16px; display: flex; flex-direction: column; min-height: 0; }
body.embed main { width: 100%; min-width: 0; } /* sonst schrumpft main wegen margin:auto auf Inhaltsbreite (Diagramm 640 px) */
body.embed .tabs { order: -1; }

/* Knöpfe */
button, .btn { font: inherit; font-weight: 600; min-height: 56px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--primary); background: var(--card); color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none; touch-action: manipulation; }
.btn-haupt { background: var(--primary); color: var(--on-primary); font-size: 1.1rem; }
.btn-gefahr { border-color: var(--danger); color: var(--danger); }
.btn-gefahr-voll { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.warnung { font-weight: 800; color: var(--danger); }
.btn-link { border: 0; background: none; text-decoration: underline; padding: 8px 4px; color: var(--primary); }
button:disabled { opacity: .55; cursor: default; }
.voll { width: 100%; }
.knoepfe { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* Formulare */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea { font: inherit; width: 100%; min-height: 56px; padding: 10px 12px; border: 2px solid var(--input-line); border-radius: 10px; background: var(--card); color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 88px; resize: vertical; }
input[type=checkbox] { width: 32px; min-height: 32px; height: 32px; accent-color: var(--primary); margin: 0; flex: none; }
.check { display: flex; align-items: center; gap: 12px; min-height: 56px; font-weight: 600; margin: 0; }
.fehler { color: var(--danger); font-weight: 600; }
.hilfetext { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }

/* Karten */
h2:first-child, .karte > h2:first-child { margin-top: 0; }
.karte { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 10px 0; }
.ruhe { background: var(--primary-soft); border-color: var(--primary); }
.gross { font-size: 3.2rem; font-weight: 800; line-height: 1.1; color: var(--primary); }
.summe { text-align: center; }

/* Schicht-Karten (Ampel immer mit Symbol + Wort) */
.schicht { border-left-width: 8px; }
.st-free { border-left-color: var(--free); }
.st-signed { border-left-color: var(--signed); }
.st-counted { border-left-color: var(--done); }
.st-cancelled { border-left-color: var(--off); }
.ampel { display: inline-block; font-weight: 700; padding: 2px 10px; border-radius: 8px; margin: 2px 0; }
.st-free .ampel, .kachel.st-free { background: var(--free-bg); color: var(--free); }
.st-signed .ampel, .kachel.st-signed { background: var(--signed-bg); color: var(--signed); }
.st-counted .ampel, .kachel.st-counted { background: var(--done-bg); color: var(--done); }
.st-cancelled .ampel, .kachel.st-cancelled { background: var(--off-bg); color: var(--off); }
.tiere { font-size: 1.15rem; font-weight: 700; }

/* Kalender */
.filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.filter button { flex: 1; padding: 8px 6px; font-size: .95rem; }
.filter.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); align-items: stretch; }
.filter.raster button { min-height: 56px; min-width: 0; overflow-wrap: anywhere; }
.filter button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.tag { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tag-name { font-weight: 700; margin-bottom: 6px; }
.tag-heute .tag-name { color: var(--primary); }
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kachel { min-height: 76px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; border: 2px solid transparent; padding: 8px 10px; text-align: left; font-weight: 600; line-height: 1.25; }
.kachel small { font-weight: 500; font-size: .85rem; color: inherit; }
.kachel.meine { border-color: currentColor; }
.kachel[aria-expanded="true"] { outline: 3px solid var(--primary); }
.woche { margin-top: 18px; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* Zählmaske */
.zeile { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.zeile > .name { flex: 1 1 5em; min-width: 0; }
.zeile > .hilfetext { flex-basis: 100%; margin: 0; }
.zeile .name { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.stepper button { width: 60px; min-height: 60px; padding: 0; font-size: min(2rem, 40px); line-height: 1; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.stepper input { width: 84px; min-height: 60px; text-align: center; font-size: min(2.3rem, 56px); font-weight: 800; padding: 2px; }
.stepper input.sprung { background: var(--primary-soft); }
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
details > summary { min-height: 56px; display: flex; align-items: center; padding: 8px 16px; font-weight: 700; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; margin-right: 10px; }
details[open] > summary::before { content: "▾"; }
details > .inhalt { padding: 0 16px 12px; }
.speicherleiste { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0; display: flex; flex-direction: column; gap: 10px; }
body.embed .speicherleiste, body.schrift-gross .speicherleiste { position: static; }
@media (max-height: 600px) { .speicherleiste { position: static; } }
.nullmeldung { margin: 12px 0; }
.achtung { background: var(--signed-bg); border-color: var(--signed); font-weight: 700; }

/* Hinweise, Warteschlange */
.banner { margin: 8px auto 0; max-width: 640px; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--signed-bg); color: var(--text); border-bottom: 1px solid var(--line); }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.zahlen { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.zahlen dt { margin: 0; } .zahlen dd { margin: 0; font-weight: 700; text-align: right; }
.hilfe-inhalt img { max-width: 100%; height: auto; }

/* Bottom-Sheet & Bestätigung */
.huelle { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); color: var(--text); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: var(--sheet-pad) var(--sheet-pad) calc(var(--sheet-pad) + env(safe-area-inset-bottom)); }
.sheet h2 { margin-top: 0; }
.namen { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.namen button { justify-content: flex-start; }
/* Lange Namensliste: Knöpfe darunter bleiben unten im Sheet sichtbar */
body:not(.schrift-gross) .sheet form > .knoepfe, body:not(.schrift-gross) .sheet > .knoepfe, body:not(.schrift-gross) .namen + .knoepfe { position: sticky; bottom: calc(var(--sheet-pad) * -1); background: var(--card); margin: 12px calc(var(--sheet-pad) * -1) 0; padding: 10px var(--sheet-pad) var(--sheet-pad); border-top: 1px solid var(--line); }

.toast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 30; max-width: 616px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 14px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.login { text-align: center; padding-top: 24px; }
.login img { width: 120px; height: 120px; }
.login form { text-align: left; max-width: 420px; margin: 0 auto; }
.zeile label { margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 12px; }
legend { font-weight: 700; padding: 0 6px; }
body.embed .huelle { align-items: flex-start; }
body.embed .sheet { max-height: min(92vh, 600px); border-radius: 18px; }
body.embed .toast { top: 12px; bottom: auto; }
main:focus, main:focus-visible { outline: none; }
.kachel span { white-space: nowrap; }
body.schrift-gross .kacheln { grid-template-columns: 1fr; }
body.schrift-gross .kachel span { white-space: normal; }
.login .btn { margin-top: 8px; }

/* Unsichtbar, aber im Dokument (Download-Link, Schriftprobe); Dialog im iFrame erst nach dem Messen zeigen */
.versteckt { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.huelle.misst .sheet { visibility: hidden; }

/* Wetter (Stufe 2): Temperatur dezent, Wanderwetter als Hinweiskarte mit Symbol + Wort */
.wetter.reserviert { min-height: 3.5rem; margin: 6px 0; } /* Platz vorab: kein Layout-Sprung */
.chip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; width: 100%; min-height: 56px; margin: 0; padding: 6px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; font-size: .95rem; line-height: 1.25; text-align: left; }
.chip.wander { background: var(--primary-soft); border: 2px solid var(--primary); color: var(--text); justify-content: flex-start; }
.chip-text { flex: 1 1 auto; min-width: 0; }
.chip-temp { flex: none; white-space: nowrap; }
.chip-frage { flex: none; color: var(--primary); text-decoration: underline; }
.whatsapp { margin-top: 8px; }

/* Übersicht: Diagramm, Legende, Tabelle */
.legende { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 6px 0; }
.legende li { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.swatch { width: 18px; height: 18px; border-radius: 4px; display: inline-block; }
.dg-rahmen { display: flex; align-items: flex-start; margin: 6px 0; }
.dg-achse { flex: none; }
.dg-scroll { overflow-x: auto; flex: 1; min-width: 0; -webkit-overflow-scrolling: touch; }
.dg-scroll:focus-visible { outline: 3px solid var(--focus); }
.dg { display: block; }
.b-m { fill: var(--c-m); background: var(--c-m); }
.b-f { fill: var(--c-f); background: var(--c-f); }
.b-o { fill: var(--c-o); background: var(--c-o); }
.b-null { fill: var(--muted); }
.b-streifen { fill: url(#dg-streifen); }
.streifen-linie { fill: var(--card); opacity: .55; }
.swatch.b-m { background: repeating-linear-gradient(45deg, var(--c-m) 0 3px, var(--card) 3px 5px); }
.dg-hinweis { margin: 0 0 6px; }
.gitter { stroke: var(--line); stroke-width: 1; }
.x-text { fill: var(--muted); font-size: 12px; }
.rang { padding-left: 0; }
details > .tabelle-rahmen { padding: 0 4px 10px; }
.tabelle-rahmen { overflow-x: auto; max-width: 100%; }
.tabelle-rahmen:focus-visible { outline: 3px solid var(--focus); }
.zahlen-tabelle { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tabelle-rahmen .zahlen-tabelle { font-size: .75rem; }
.zahlen-tabelle th[scope=row] { white-space: nowrap; }
.zahlen-tabelle th, .zahlen-tabelle td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.zahlen-tabelle th[scope=row], .zahlen-tabelle thead th:first-child { text-align: left; }
.zahlen-tabelle thead th { font-size: .85rem; color: var(--muted); }
.zahlen-tabelle .summe th, .zahlen-tabelle .summe td { font-weight: 800; border-top: 2px solid var(--text); }
.zahlen-tabelle .unter th { font-weight: 400; padding-left: 24px; }

/* Bericht (Verwaltung): auf dem Bildschirm schlicht, gedruckt A4 ohne Navigation */
.bericht h1 { margin-top: 4px; }
.bericht .zahlen-tabelle { margin: 6px 0 12px; }
/* Zwei-Spalten-Tabellen: Text bricht um, Zahl bekommt feste Breite (kein Überlauf bei 390/360 px und großer Schrift) */
.bericht > .zahlen-tabelle { table-layout: fixed; }
.bericht > .zahlen-tabelle th[scope=row] { white-space: normal; overflow-wrap: anywhere; }
.bericht > .zahlen-tabelle td { width: 3.5em; }
.bericht h1, .bericht h2, .bericht p, .bericht .kopfzeile, .bericht .fussnoten, .bericht-fuss { overflow-wrap: anywhere; hyphens: auto; }
.bericht .kopfzeile, .fussnoten p { margin: 2px 0; }
@media print {
  @page { size: A4; margin: 14mm; }
  html { font-size: 10.5pt; }
  body { background: #fff; color: #000; }
  #kopf, #tabs, #hinweise, #toast, .noprint, #sheet-root { display: none !important; }
  #app { padding: 0; min-height: 0; }
  main { max-width: none; padding: 0; }
  .karte { border: 0; padding: 0; }
  .bericht { color: #000; }
  .bericht .muted, .zahlen-tabelle thead th { color: #333; }
  .zahlen-tabelle th, .zahlen-tabelle td { border-bottom: 1px solid #999; padding: 3px 6px; }
  .bericht h2 { break-after: avoid; margin-top: 14pt; }
  .bericht tr { break-inside: avoid; }
  .tabelle-rahmen { overflow: visible; }
  .bericht thead { display: table-header-group; }
  .bericht table { width: 100%; }
  .bericht thead th { font-size: 0.8em; padding: 3px 3px; overflow-wrap: normal; }
  .bericht td { padding: 3px 4px; }
  a { color: #000; text-decoration: none; }
}

/* Große Schrift (200 %): lange Wörter in Knöpfen, Listen und Eingaben dürfen umbrechen, nie die Seite verbreitern */
h1, h2, h3, p, label, button, .btn, .liste li, .hilfetext, details > summary, .inhalt { min-width: 0; overflow-wrap: anywhere; }
input, select, textarea { max-width: 100%; box-sizing: border-box; min-width: 0; }
