/* Fallstein: Arbeits-App für Hof, Destille und Gästehaus.
   Palette aus Streuobstwiese (Grün), Brennblase (Kupfer) und Kalkstein (warmes Grau). */
:root {
  --bg: #F4F3EE; --flaeche: #FFFFFF; --flaeche-2: #ECEBE4; --text: #1F2620; --gedämpft: #5E665F; --linie: #D9D8CF;
  --gruen: #2F4A3A; --gruen-hell: #E2EBDF; --kupfer: #A65A2E; --kupfer-hell: #F5E3D6;
  --ok: #2E7D4F; --ok-hell: #DDF0E3; --warn: #9A6A00; --warn-hell: #FBEFCF; --rot: #B23A2B; --rot-hell: #F8DEDA;
  --zoll: #8C3B2C; --oeko: #4B7A1E;
  --f-titel: "Fraunces", Georgia, "Times New Roman", serif;
  --f-text: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141815; --flaeche: #1C211D; --flaeche-2: #252B26; --text: #E8ECE6; --gedämpft: #A3ACA4; --linie: #343C36;
  --gruen: #9CC3A8; --gruen-hell: #23352A; --kupfer: #E09A6C; --kupfer-hell: #3A2619;
  --ok: #7DCB98; --ok-hell: #1D3527; --warn: #E8C163; --warn-hell: #3A3016; --rot: #F08A7C; --rot-hell: #3D1F1B;
  --zoll: #F0A391; --oeko: #A8D07A; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #141815; --flaeche: #1C211D; --flaeche-2: #252B26; --text: #E8ECE6; --gedämpft: #A3ACA4; --linie: #343C36;
  --gruen: #9CC3A8; --gruen-hell: #23352A; --kupfer: #E09A6C; --kupfer-hell: #3A2619;
  --ok: #7DCB98; --ok-hell: #1D3527; --warn: #E8C163; --warn-hell: #3A3016; --rot: #F08A7C; --rot-hell: #3D1F1B;
  --zoll: #F0A391; --oeko: #A8D07A; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 17px/1.45 var(--f-text); -webkit-text-size-adjust: 100%;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
a { color: var(--gruen); }
h1, h2, h3 { font-family: var(--f-titel); font-weight: 600; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; font-family: var(--f-text); font-weight: 700; }

.kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--gruen); color: #F4F3EE; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kopf { background: #1F2D24; } }
:root[data-theme="dark"] .kopf { background: #1F2D24; }
.marke { color: inherit; text-decoration: none; font-family: var(--f-titel); font-size: 1.2rem; display: flex; align-items: center; gap: 8px; }
.marke-zeichen { width: 22px; height: 22px; border-radius: 50% 50% 50% 4px; background: #C9763F; display: inline-block; box-shadow: inset -5px -5px 0 rgba(0,0,0,.15); }
.kopf-titel { flex: 1; min-width: 0; opacity: .85; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nutzer { background: rgba(255,255,255,.14); color: inherit; border: 0; border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .9rem; }

main { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
main:focus { outline: none; }

.leiste { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--flaeche); border-top: 1px solid var(--linie); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
.leiste a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
  color: var(--gedämpft); text-decoration: none; font-size: .72rem; font-weight: 600; }
.leiste a.aktiv { color: var(--gruen); }
.badge { position: absolute; top: 0; right: calc(50% - 22px); background: var(--kupfer); color: #fff; border-radius: 99px;
  font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; }
.i { width: 24px; height: 24px; display: block; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.i-start { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linejoin="round"><path d="M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/></svg>'); }
.i-plus { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="9"/><path d="M12 8v8M8 12h8"/></svg>'); }
.i-box { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linejoin="round"><path d="M3 7l9-4 9 4v10l-9 4-9-4z"/><path d="M3 7l9 4 9-4M12 11v10"/></svg>'); }
.i-bett { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linejoin="round"><path d="M3 18V6M3 14h18v4M21 14v-2a3 3 0 0 0-3-3h-7v5"/><circle cx="7" cy="11" r="2"/></svg>'); }
.i-ok { --m: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="4"/><path d="M8 12l3 3 5-6"/></svg>'); }

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.karte.leise { background: transparent; border-style: dashed; }
.zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.zeile > .wachsen { flex: 1; min-width: 0; }
.gedämpft { color: var(--gedämpft); font-size: .92rem; }
.klein { font-size: .85rem; }
.zahl { font-variant-numeric: tabular-nums; }
.hinweis { border-radius: 10px; padding: 10px 12px; font-size: .95rem; }
.hinweis.warn { background: var(--warn-hell); color: var(--warn); }
.hinweis.rot { background: var(--rot-hell); color: var(--rot); }
.hinweis.ok { background: var(--ok-hell); color: var(--ok); }
.hinweis.info { background: var(--gruen-hell); color: var(--gruen); }

.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kachel { display: flex; flex-direction: column; gap: 4px; min-height: 84px; padding: 12px 14px; border-radius: var(--r);
  background: var(--flaeche); border: 1px solid var(--linie); color: var(--text); text-decoration: none; }
.kachel b { font-size: 1rem; } .kachel span { font-size: .82rem; color: var(--gedämpft); }
.kachel .ue { font-size: .72rem; font-weight: 700; color: var(--kupfer); letter-spacing: .04em; }
.kachel:active { transform: scale(.98); }
.gruppe-titel { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gedämpft); font-weight: 700; margin: 4px 2px -4px; }

form { display: flex; flex-direction: column; gap: 14px; }
label.feld { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
label.feld small { font-weight: 400; color: var(--gedämpft); }
input, select, textarea { font: inherit; font-size: 17px; color: var(--text); background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 10px; padding: 12px; width: 100%; min-width: 0; }
textarea { min-height: 90px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--kupfer); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 22px; height: 22px; }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 1rem;
  padding: 13px 18px; border-radius: 10px; border: 1px solid transparent; background: var(--gruen); color: #F4F3EE; cursor: pointer; text-decoration: none; min-height: 48px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .knopf { color: #141815; } }
:root[data-theme="dark"] .knopf { color: #141815; }
.knopf.zweit { background: var(--flaeche); color: var(--gruen); border-color: var(--linie); }
.knopf.kupfer { background: var(--kupfer); }
.knopf.rot { background: var(--flaeche); color: var(--rot); border-color: var(--rot); }
.knopf.klein { min-height: 38px; padding: 7px 12px; font-size: .9rem; }
.knopf[disabled] { opacity: .5; }
.knoepfe { display: flex; gap: 10px; flex-wrap: wrap; }
.knoepfe > .knopf { flex: 1 1 140px; }

.kg { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: stretch; }
.kg button { font-size: 1.4rem; font-weight: 700; border-radius: 10px; border: 1px solid var(--linie); background: var(--flaeche-2); color: var(--text); }
.kg input { text-align: center; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--linie); background: var(--flaeche); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .9rem; color: var(--text); }
.chip.an { background: var(--gruen); color: #F4F3EE; border-color: var(--gruen); }
.wahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.wahl button { text-align: left; border: 1px solid var(--linie); background: var(--flaeche); border-radius: 10px; padding: 12px; font: inherit; color: var(--text); min-height: 56px; }
.wahl button small { display: block; color: var(--gedämpft); font-size: .8rem; }
.wahl button.an { border: 2px solid var(--gruen); background: var(--gruen-hell); padding: 11px; }

.foto { display: flex; gap: 10px; align-items: center; }
.foto img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }

.liste { display: flex; flex-direction: column; }
.liste > * { padding: 12px 0; border-bottom: 1px solid var(--linie); display: flex; gap: 10px; align-items: flex-start; }
.liste > *:last-child { border-bottom: 0; }
.liste a.eintrag { color: var(--text); text-decoration: none; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: 2px 9px; background: var(--flaeche-2); color: var(--gedämpft); white-space: nowrap; }
.pill.ok { background: var(--ok-hell); color: var(--ok); } .pill.warn { background: var(--warn-hell); color: var(--warn); }
.pill.rot { background: var(--rot-hell); color: var(--rot); } .pill.zoll { background: var(--kupfer-hell); color: var(--zoll); }
.pill.oeko { background: var(--gruen-hell); color: var(--oeko); } .pill.bsp { background: var(--warn-hell); color: var(--warn); }
.ampel { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 7px; }
.ampel.rot { background: var(--rot); } .ampel.gelb { background: var(--warn); } .ampel.gruen { background: var(--ok); }

.tabelle-rahmen { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .78rem; color: var(--gedämpft); font-weight: 700; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.kalender { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche); }
.kalender table { min-width: 680px; font-size: .8rem; }
.kalender th, .kalender td { padding: 6px 4px; text-align: center; border-left: 1px solid var(--linie); }
.kalender td.raum, .kalender th.raum { text-align: left; position: sticky; left: 0; background: var(--flaeche); border-left: 0; font-weight: 700; min-width: 96px; }
.kalender td.belegt { background: var(--gruen-hell); color: var(--gruen); font-weight: 700; }
.kalender td.booking { background: var(--kupfer-hell); color: var(--kupfer); }
.kalender th.heute { color: var(--kupfer); }

.scanner { position: relative; border-radius: var(--r); overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner::after { content: ""; position: absolute; inset: 30% 12%; border: 2px solid rgba(255,255,255,.8); border-radius: 10px; }
.fortschritt { height: 10px; background: var(--flaeche-2); border-radius: 99px; overflow: hidden; }
.fortschritt i { display: block; height: 100%; background: var(--ok); transition: width .2s; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 10; max-width: 560px; margin: 0 auto;
  padding: 14px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast.fehler { background: var(--rot); color: #fff; }
.leer { text-align: center; color: var(--gedämpft); padding: 24px 8px; }
.login { max-width: 380px; margin: 8vh auto 0; }
.daten dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: .92rem; }
.daten dt { color: var(--gedämpft); } .daten dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
pre.text { white-space: pre-wrap; font: inherit; font-size: .92rem; margin: 0; background: var(--flaeche-2); padding: 10px; border-radius: 8px; max-height: 260px; overflow: auto; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
details.hinweis summary { cursor: pointer; }
details.hinweis .liste > * { padding: 6px 0; border-color: rgba(0,0,0,.08); }
.zahl { white-space: nowrap; }

/* Offline-Anzeige */
.offline-pill { margin-left: auto; margin-right: .5rem; padding: .2rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; text-decoration: none; background: #e8efe9; color: #2F4A3A; white-space: nowrap; }
.offline-pill.warn { background: #fff2cc; color: #7a5b00; }
.offline-pill.rot { background: #f8d7d3; color: #8a1c12; }
body.offline .kopf { box-shadow: inset 0 -3px 0 #e0a800; }

/* Rezeptur-Anzeige (vertraulich) */
.rz-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 22, .55); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow: auto; }
.rz-karte { background: var(--flaeche); color: inherit; border-radius: 14px; padding: 16px; width: 100%; max-width: 560px; }
.rz-inhalt { position: relative; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.rz-inhalt table { width: 100%; }
.rz-wz { position: absolute; inset: -40px; pointer-events: none; display: flex; flex-wrap: wrap; gap: 28px 40px; transform: rotate(-24deg); opacity: .13; font-weight: 700; font-size: .85rem; color: #8a1c12; }
.rz-wz span { white-space: nowrap; }
@media print { .rz-overlay, .rz-inhalt { display: none !important; } }
/* Unterschrift */
canvas.sig { width: 100%; height: 140px; border: 1.5px dashed #A8B0AB; border-radius: 10px; background: #fff; touch-action: none; display: block; margin-bottom: 6px; }
.tabelle tr.rot td { color: #8a1c12; font-weight: 600; }

/* Kontrolle nach der Erfassung („Stimmt alles?“) */
.kontrolle-hg { position: fixed; inset: 0; background: rgba(20, 28, 24, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 60; padding: 12px; }
.kontrolle { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.kontrolle table td { padding: 4px 6px; vertical-align: top; }
@media (min-width: 700px) { .kontrolle-hg { align-items: center; } }
