:root {
  --marke: #b92557;        /* Pink aus dem Logo Weinsepphof Agrar, Variante C */
  --marke-dunkel: #9a1d48;
  --marke-hell: #f8e6ec;
  --gruen: #2d5a39;        /* Blattgrün aus dem Logo */
  --gruen-hell: #e8f0e6;
  --gruen-mittel: #5b8a4f;
  --text: #1d241c;
  --grau: #6b7368;
  --linie: #dfe4dc;
  --hinter: #f3efe7;       /* Creme wie der Logo-Hintergrund, etwas heller */
  --karte: #ffffff;
  --rot: #b3261e;
  --rot-hell: #fbe9e7;
  --gelb: #8a5a00;
  --gelb-hell: #fff4d6;
  --blau: #1f5f8b;
  --blau-hell: #e3eef6;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--hinter); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; font-size: 16px; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--karte); border-bottom: 1px solid var(--linie); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 15px; }
.brand img { width: 28px; height: 28px; }
.brand .pink { color: var(--marke); }
a.brand { color: var(--text); text-decoration: none; }
.pinktext { color: var(--marke); }
/* Home */
.home-gruss { margin: 4px 2px 14px; }
.home-hallo { font-size: 24px; font-weight: 750; line-height: 1.2; }
.home-name { font-size: 15px; color: var(--grau); margin-top: 2px; }
.home-wochentag { text-transform: capitalize; color: var(--grau); font-size: 14px; }
.home-datumgross { font-size: 22px; font-weight: 700; margin: 2px 0 4px; }
.home-countdown { text-align: center; padding: 18px 14px; }
.home-zahl { font-size: 54px; font-weight: 800; line-height: 1; color: var(--gruen); }
.home-zahl-label { font-size: 16px; font-weight: 600; }
.home-zahl-text { font-size: 22px; font-weight: 750; color: var(--gruen); }
.home-countdown.pink { border-color: #e9b9c9; background: var(--marke-hell); }
.home-countdown.pink .home-zahl, .home-countdown.pink .home-zahl-text, .home-countdown.pink .home-zahl-label { color: var(--marke); }
.home-meilensteine { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.home-wetter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.home-wettertag { background: var(--hinter); border-radius: 10px; padding: 8px 4px; }
.home-wettericon { font-size: 30px; line-height: 1.3; }
.home-frost { background: #e6f0fa; color: #1f4f7a; border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; font-weight: 600; font-size: 14px; }
.home-link { display: block; color: var(--text); text-decoration: none; font-weight: 600; }
.home-bild { margin: 18px 0 8px; }
.home-bild svg { width: 100%; height: auto; display: block; }
.home-marke { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; }
.home-marke img { width: 30px; height: 30px; }
.kennzahl .wert { overflow-wrap: anywhere; }
.who { color: var(--grau); font-size: 14px; text-align: right; }

main { max-width: 720px; margin: 0 auto; padding: 14px 14px 24px; }
h2 { font-size: 20px; margin: 6px 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.muted { color: var(--grau); font-size: 14px; }
.laden { padding: 40px; text-align: center; color: var(--grau); }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.karte.hinweis { background: var(--gelb-hell); border-color: #f0dca4; }
.karte.info { background: var(--blau-hell); border-color: #c6dbea; }
.karte.ok { background: var(--gruen-hell); border-color: #c8dbc3; }
.karte.fehler { background: var(--rot-hell); border-color: #f0c4bf; }

.zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.zeile.oben { align-items: flex-start; }
.stack > * + * { margin-top: 10px; }
.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.raster3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.raster > *, .raster3 > * { min-width: 0; }
input[type=time], input[type=date] { min-width: 0; }
@media (max-width: 420px) { .raster3 input[type=time] { padding: 11px 6px; font-size: 15px; } }

label { display: block; font-size: 13px; color: var(--grau); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=time], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #cdd3c9; border-radius: 10px; background: #fff; color: var(--text); min-height: 46px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marke); outline-offset: 0; border-color: var(--marke); }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--text); margin: 0; min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--marke); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--linie); background: #fff; color: var(--text);
  padding: 11px 16px; border-radius: 10px; min-height: 46px; cursor: pointer; font-weight: 550; text-decoration: none; }
.btn.primaer { background: var(--marke); border-color: var(--marke); color: #fff; }
.btn.gefahr { color: var(--rot); border-color: #e6b7b2; }
.btn.klein { padding: 6px 10px; min-height: 36px; font-size: 14px; }
.btn.voll { width: 100%; }
.btn:disabled { opacity: .5; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.offen { background: var(--gelb-hell); color: var(--gelb); }
.chip.geprueft { background: var(--blau-hell); color: var(--blau); }
.chip.freigegeben { background: var(--gruen-hell); color: var(--gruen); }
.chip.abgelehnt { background: var(--rot-hell); color: var(--rot); }
.chip.invest { background: #efe7f7; color: #5b3a85; }

.datumleiste { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.datumleiste input { flex: 1; text-align: center; font-weight: 600; }
.datumleiste .btn { min-width: 46px; padding: 0; }

.block { border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px; background: #fbfcfa; margin-bottom: 10px; }
.block .kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.summe { font-size: 18px; font-weight: 700; }

.eintrag { padding: 10px 0; border-top: 1px solid var(--linie); }
.eintrag:first-child { border-top: 0; padding-top: 0; }
.eintrag .zeit { font-weight: 650; }
.eintrag .details { font-size: 14px; color: var(--grau); margin-top: 2px; }
.eintrag .grund { font-size: 14px; color: var(--rot); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { color: var(--grau); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle-wrap { overflow-x: auto; }

.kennzahlen { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.kennzahl { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px; }
.kennzahl .wert { font-size: 22px; font-weight: 700; }
.kennzahl .name { font-size: 13px; color: var(--grau); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { border: 1px solid var(--linie); background: #fff; padding: 8px 12px; border-radius: 999px; white-space: nowrap; cursor: pointer; }
.tabs button.aktiv { background: var(--marke); color: #fff; border-color: var(--marke); }

.liste-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--linie); cursor: pointer; }
.liste-item:first-child { border-top: 0; }
.liste-item.inaktiv { opacity: .5; }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: var(--karte); border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; color: var(--grau); text-decoration: none; font-size: 12px; position: relative; }
.nav a svg { width: 24px; height: 24px; }
.nav a.aktiv { color: var(--marke); font-weight: 650; }
.nav .badge { position: absolute; top: 4px; left: 50%; margin-left: 6px; background: var(--rot); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; font-weight: 700; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 18, .45); display: flex; align-items: flex-end; justify-content: center; }
.modal .fenster { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal { align-items: center; } .modal .fenster { border-radius: 16px; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60; background: #1d241c; color: #fff;
  padding: 11px 16px; border-radius: 10px; font-size: 15px; max-width: 92vw; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.fehler { background: var(--rot); }

.qr { display: block; width: 100%; max-width: 320px; margin: 8px auto; image-rendering: pixelated; }
.qr-teil { border: 2px solid var(--linie); border-radius: var(--radius); padding: 12px; position: relative; }
.qr-nr { position: absolute; top: 10px; left: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--marke); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qr-zettel .qr { max-width: 260px; }
.qr-teil h2 { padding: 0 36px; }
@media print { .qr-zettel .qr { max-width: 230px; } .qr-teil { break-inside: avoid; border-color: #999; } }
.gantt-achse { position: relative; height: 18px; margin: 0 0 4px; font-size: 11px; color: var(--grau); }
.gantt-achse span { position: absolute; transform: translateX(-2px); white-space: nowrap; }
.gantt-zeile { padding: 6px 0; border-top: 1px solid var(--linie); }
.gantt-label { font-size: 14px; margin-bottom: 4px; }
.gantt-spur { position: relative; height: 26px; background: var(--hinter); border-radius: 6px; overflow: hidden; }
.gantt-spur i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--linie); }
.gantt-balken { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 600; padding: 3px 6px; white-space: nowrap; overflow: hidden; min-width: 6px; }
.link-box { word-break: break-all; font-size: 13px; background: var(--hinter); padding: 8px; border-radius: 8px; }

@media print {
  .topbar, .nav, .no-print { display: none !important; }
  body { padding: 0; background: #fff; }
  .karte { border: 0; }
  body.modal-offen main { display: none !important; }
  .modal { position: static; background: none; display: block; }
  .modal .fenster { max-height: none; box-shadow: none; }
}

/* Anlagen */
.anlagen-gruppe { margin: 18px 2px 8px; }
.anlage-fakten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 10px 0; background: var(--hinter); border-radius: 10px; padding: 10px 4px; }
.anlage-zahl { font-size: 20px; font-weight: 750; color: var(--gruen); }
.anlage-fakten .muted { font-size: 12px; }
.anlage-zeile { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--linie, #e6e1d6); font-size: 14px; }
.anlage-zeile span:last-child { text-align: right; }
.anlage-notiz { font-size: 13px; margin-top: 8px; line-height: 1.4; }
.sorte-chip { background: var(--marke-hell); color: var(--marke); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; text-align: right; }
.anlage-aktionen { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 10px; }
.home-anlagen-zahlen { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 4px; font-size: 18px; }
