:root {
  /* Farben nach Design-Standard (Entwurf Paul, 2026-10-21, Abschnitt 2.2; Entwurf Ackerhelfer 26.10.2026).
     Namen bleiben, weil Module (z. B. Beleg-Scan) sie mitbenutzen. Ziel laut Standard: core/ui/tokens.css mit deutschen Namen.
     --green = Akzent (Linienfarbe Agrar, später Firmenfarbe des Betriebs), Signalfarben sind fest. Keine Dunkelansicht in V1. */
  --bg: #ffffff;            /* Seite */
  --flaeche: #f3f4f6;       /* abgesetzte Bereiche, Seitenleiste */
  --card: #ffffff;
  --ink: #1f2937;           /* Fließtext, 14,7 : 1 */
  --muted: #4b5563;         /* Zusatzinfo, 7,6 : 1 */
  --rand: #6b7280;          /* Rahmen von Eingabefeldern, 4,8 : 1 */
  --line: #d1d5db;
  --line-soft: #e5e7eb;
  --green: #4d6b2f;         /* Akzent: Erdgrün */
  --green-2: #3a5223;
  --green-soft: #e9eee4;
  --ok: #15803d; --ok-soft: #dcfce7; --ok-ink: #14532d;
  --warn: #b45309; --warn-soft: #fef3c7; --warn-ink: #78350f;
  --red: #b91c1c;
  --red-soft: #fee2e2; --red-ink: #991b1b;
  --blue-soft: #f3f4f6; --blue-ink: #1f2937;   /* Info: Text auf Fläche (kein eigenes Blau) */
  --grey-soft: #f3f4f6;
  --fokus: #1d4ed8;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { overflow-x: clip; max-width: 100%; overscroll-behavior-x: none; touch-action: pan-y; margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--card); color: var(--ink); border-bottom: 4px solid var(--green); }
.brand { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net { font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--ok-soft); color: var(--ok-ink); white-space: nowrap; }
.net.off { background: var(--warn-soft); color: var(--warn-ink); }

.timerbar { position: sticky; top: 52px; z-index: 4; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--warn-soft); border-bottom: 2px solid var(--warn); color: var(--warn-ink); font-weight: 600; }
.timerbar button { background: var(--ink); color: #fff; border: 0; border-radius: 6px; min-height: 48px; padding: 0 18px; font: inherit; font-size: 16px; font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px; }
h2 { font-size: 20px; line-height: 1.25; color: var(--ink); margin: 24px 0 10px; }
h2:first-child { margin-top: 4px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; min-height: 60px; justify-content: center; }
.tabs a span { font-size: 22px; line-height: 1; height: 24px; display: flex; align-items: center; justify-content: center; }
.tabs a span svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--green); }
.navhead { font-size: 14px; font-weight: 600; color: var(--muted); padding: 18px 12px 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pick { min-height: 64px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); font: inherit; font-size: 18px; font-weight: 600; text-align: left; cursor: pointer; }
.pick small { display: block; font-weight: 400; font-size: 15px; color: var(--muted); }
.pick.on { border-color: var(--green); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.muted { color: var(--muted); font-size: 15px; }
.big { font-size: 24px; font-weight: 700; }

label.f { display: block; margin: 16px 0 0; font-size: 16px; font-weight: 600; color: var(--ink); }
input, select, textarea { width: 100%; margin-top: 6px; padding: 10px 12px; min-height: 48px; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--rand); border-radius: 6px; }
input, select, textarea { min-width: 0; max-width: 100%; display: block; }
input[type=date], input[type=month] { -webkit-appearance: none; appearance: none; min-height: 50px; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
.card, .modal .sheet { overflow-wrap: anywhere; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
input.huge { font-size: 32px; font-weight: 700; padding: 8px 14px; min-height: 64px; border: 2px solid var(--green); }
input[type=checkbox] { display: inline-block; width: 26px; height: 26px; margin: 0; accent-color: var(--green); flex: none; }
.check { display: flex; gap: 12px; align-items: center; padding: 12px; margin-top: 12px; border-radius: var(--radius); background: var(--flaeche); font-weight: 600; min-height: 48px; }

.btn { white-space: nowrap; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border: 2px solid var(--green); border-radius: 6px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--card); color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.block { width: 100%; min-height: 56px; font-size: 18px; margin-top: 16px; }
.btn.sm { min-height: 48px; padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: .45; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick { display: flex; gap: 6px; margin-top: 6px; }
.quick .btn { flex: 1; padding: 10px 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line-soft); min-height: 64px; }
.list li:first-child { border-top: 0; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 14px; font-weight: 600; background: var(--ok-soft); color: var(--ok-ink); white-space: nowrap; }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.red { background: var(--red-soft); color: var(--red-ink); }
.chip.grey { background: var(--grey-soft); color: var(--ink); }
.amount { font-weight: 700; white-space: nowrap; }
.preview { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--green-soft); font-weight: 600; }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 12px 12px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal { align-items: center; } .modal .sheet { border-radius: 12px; } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 30; max-width: 520px; margin: 0 auto; padding: 14px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.err { background: var(--red); }
.login { max-width: 360px; margin: 12vh auto 0; }
details.card > summary { font-weight: 700; cursor: pointer; list-style: none; }
details.card > summary::after { content: '▸'; float: right; color: var(--muted); }
details.card[open] > summary::after { content: '▾'; }
.inactive { opacity: .5; }

/* Schmale Handys: Felder untereinander statt nebeneinander */
@media (max-width: 420px) { .row { flex-direction: column; align-items: stretch; gap: 0; } }

/* ---------- Desktop (Büro) ---------- */
.desk-only { display: none !important; }
.tbl { width: 100%; border-collapse: collapse; font-size: 16px; }
.tbl th { text-align: left; font-size: 14px; color: var(--muted); font-weight: 600; padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { white-space: nowrap; padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f9fafb; }
.tbl .r { text-align: right; white-space: nowrap; }
.tablewrap { padding: 4px 8px; overflow-x: auto; }

@media (min-width: 960px) {
  .desk-only { display: block !important; }
  .mobile-only { display: none !important; }
  /* Büro am PC: Seitenleiste links über die volle Höhe, Kopfzeile hell statt grünem Balken */
  body { padding-bottom: 0; }
  body.nav-on { padding-left: 232px; }
    body.nav-on .top { margin-left: -232px; padding-left: 264px; }
  .tabs { top: 72px; bottom: 0; right: auto; width: 232px; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 16px; border-top: 0; background: var(--flaeche); }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 6px; font-size: 16px; font-weight: 600; color: var(--ink); }
  .tabs a span { width: 20px; height: 20px; font-size: 18px; flex: none; color: var(--muted); }
  .tabs a span svg { width: 18px; height: 18px; }
  .tabs a.on { background: var(--card); color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
  .tabs a.on span { color: var(--green); }
  .tabs a:hover { background: var(--line-soft); }
  .tabs a.on:hover { background: var(--card); }
  main { max-width: 1320px; padding: 28px 32px 48px; }
  html, body { font-size: 16px; }
  .timerbar { top: 72px; }
  .toast { left: auto; right: 24px; bottom: 24px; margin: 0; }

  /* Erfassen: links Auswahl, rechts Formular */
  .erf { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
  .erf-form { position: sticky; top: 92px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .row { flex-direction: row !important; gap: 10px !important; }

  /* Offen: Kennzahlen oben, Kunden in Spalten */
  .topgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 4px; }
  .topgrid .card { margin: 0; }
  .groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 12px; align-items: start; margin-top: 12px; }
  .groups .card { margin: 0; }

  /* Admin: Bereiche nebeneinander */
  .admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; align-items: start; }

  .modal .sheet { max-width: 680px; }
  .btn:hover { background: var(--green-soft); }
  .btn.primary:hover { background: var(--green-2); }
  .pick:hover { border-color: var(--green-2); }
}
@media (min-width: 1400px) {
  .admin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.tbl td.wrap { white-space: normal; min-width: 160px; }

/* ---------- Rechnungsentwurf ---------- */
.chip.blue { background: var(--blue-soft); color: var(--blue-ink); }
input.r { text-align: right; }
.ed-head .card { margin-bottom: 10px; }
.ln { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 8px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.ln:first-child { border-top: 0; }
.ln label { display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
.ln input, .ln textarea { margin-top: 2px; padding: 8px 10px; font-size: 16px; }
.ln textarea { resize: vertical; min-height: 44px; }
.ln .ln-text { grid-column: 1 / -1; }
.ln .ln-sum { font-size: 15px; padding-top: 4px; }
.ln .ln-sum .lbl { display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
.ln .ln-del { display: flex; align-items: end; justify-content: flex-end; }
.ln-head { display: none; }
.ed-sums { max-width: 420px; margin-left: auto; }
.ed-actions { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; margin: 10px -4px 0; background: var(--bg); border-top: 1px solid var(--line); z-index: 3; }
.ed-actions .btn { flex: 1 1 auto; }

@media (min-width: 960px) {
  .ed-head { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
  .ed-head .card { margin: 0; }
  .ln, .ln-head { display: grid; grid-template-columns: 110px minmax(220px, 1fr) 76px 76px 100px 60px 96px 40px; gap: 8px; align-items: start; }
  .ln-head { font-size: 14px; font-weight: 600; color: var(--muted); padding: 4px 0 8px; border-top: 0; }
  .ln-head .r, .ln .r { text-align: right; }
  .ln .ln-text { grid-column: auto; }
  .ln .lbl { display: none !important; }
  .ln .ln-sum { padding-top: 10px; }
  .ln .ln-del { padding-top: 4px; }
  .ed-actions { bottom: 0; margin: 10px 0 0; }
  .ed-actions .btn { flex: 0 0 auto; }
}
@media (max-width: 959px) { .ln > label:first-child { grid-column: span 2; } }
@media (max-width: 959px) {
  .ed-actions { flex-wrap: nowrap; gap: 6px; padding: 8px 6px; }
  .ed-actions .btn { flex: 1 1 0; padding: 0 4px; font-size: 15px; }
}

/* ---------- Symbole ---------- */
.pick.svc { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.pick .ico { font-size: 26px; line-height: 1; }
.ico-s { display: inline-block; width: 1.5em; text-align: center; margin-right: 4px; }
.icons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.icons label { cursor: pointer; }
.icons input { display: none !important; }
.icons span { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 48px; padding: 0 8px; font-size: 24px; border: 2px solid var(--line); border-radius: 6px; background: var(--card); }
.icons span.auto { font-size: 14px; font-weight: 700; color: var(--muted); }
.icons input:checked + span { border-color: var(--green); background: var(--green-soft); }

/* ---------- Zugang: Benutzer, Geräte, 2-Faktor, Protokoll (2026-10-18) ---------- */
.hdr-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who { font: inherit; font-size: 15px; font-weight: 600; min-height: 48px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login .card + .card { margin-top: 14px; }
.hint { padding: 12px 14px; border-radius: var(--radius); margin: 12px 0; background: var(--flaeche); color: var(--ink); }
.hint.warn { background: var(--warn-soft); border: 2px solid var(--warn); color: var(--warn-ink); }
.qr { display: block; margin: 10px auto; width: 240px; max-width: 100%; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: 8px; }
.code-big { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; letter-spacing: 2px; text-align: center; margin: 8px 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; margin: 10px 0; }
.codes span { background: #f3f3f3; color: #222; padding: 6px 8px; border-radius: 6px; text-align: center; }
.alarm { background: var(--red-soft); color: var(--red-ink); border: 2px solid var(--red); }
.audit { font-size: 14px; }
.audit td { vertical-align: top; }
.audit .diff { color: #555; max-width: 520px; white-space: normal; word-break: break-word; }
.chip.ok { background: var(--ok-soft); color: var(--ok-ink); }
.top .brand { flex: 1 1 auto; min-width: 0; }
.hdr-right { flex: 0 0 auto; margin-left: 8px; }
@media (max-width: 480px) { .who { max-width: 28vw; } }
.preview:empty { display: none; }

/* ---------- Büro: Seitenkopf, Kennzahlen, Tabellen mit Detailbereich (Entwurf 26.10.2026) ---------- */
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin: 4px 0 16px; }
.pagehead h1 { margin: 0; font-size: 24px; }
.pagehead p { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.pagehead .btns { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpis .card { margin: 0; padding: 14px 16px; }
.kpis .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpis .v.red { color: var(--red); }
.seg { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.seg button { flex: none; white-space: nowrap; border: 0; background: none; min-height: 48px; padding: 0 2px; font: inherit; font-size: 16px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.seg button.on { color: var(--ink); border-bottom-color: var(--green); }
.seg button small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .mainpane { flex: 999 1 560px; min-width: 0; }
.split > .aside { flex: 1 1 320px; max-width: 100%; position: sticky; top: 72px; }
.aside:empty { display: none; }
.aside .card { margin: 0; padding: 18px; }
.aside .over { font-size: 14px; font-weight: 600; color: var(--muted); }
.aside h3 { margin: 4px 0 2px; font-size: 19px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0; font-size: 16px; }
.kv > :nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.kv .sum { font-weight: 700; }
.num, .tbl .r { font-variant-numeric: tabular-nums; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.sel { background: var(--green-soft); }
.tbl tr.grp td { background: var(--flaeche); border-top: 1px solid var(--line); padding-top: 12px; padding-bottom: 12px; }
.tbl tr.grp:first-child td { border-top: 0; }
.tbl tr.grp .btn { margin-left: 8px; }
.tablewrap.flush { padding: 0; overflow: hidden; }
.tablewrap.flush .tbl th:first-child, .tablewrap.flush .tbl td:first-child { padding-left: 16px; }
.tablewrap.flush .tbl th:last-child, .tablewrap.flush .tbl td:last-child { padding-right: 16px; }
.tablewrap.flush .tbl th { background: var(--card); }
@media (max-width: 959px) { .kpis .card { padding: 12px 14px; } .kpis .v { font-size: 20px; } }
@media (min-width: 960px) { .pagehead h1 { font-size: 26px; } }
@media (min-width: 960px) { .split.desk-only { display: flex !important; } } /* .desk-only setzt sonst display:block */

/* ---------- Erfassen am Handy: drei Schritte, Speichern immer erreichbar (Entwurf 26.10.2026) ---------- */
.steps { display: flex; gap: 6px; margin: 0 0 12px; }
.steps button { flex: 1; min-width: 0; min-height: 56px; display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border: 0; border-radius: 6px; background: var(--grey-soft); color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.steps button span { font-size: 14px; font-weight: 600; }
.steps button b { font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.steps button.on { background: var(--green); color: var(--card); }
.steps button.on b { color: var(--card); }
.steps button:disabled { opacity: .5; }
@media (max-width: 959px) {
  .erf-kunde .stp-arbeit, .erf-kunde .stp-menge, .erf-arbeit .stp-kunde, .erf-arbeit .stp-menge, .erf-menge .stp-kunde, .erf-menge .stp-arbeit { display: none; }
  .erf .stp-arbeit .grid { grid-template-columns: 1fr; }
  .erf h2:first-child { margin-top: 4px; }
  .erf #save { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
  body.nav-on .erf #save { bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* Meldung über der Kopfzeile: verdeckt weder „Speichern“ noch die Schrittleiste */
  .toast { top: calc(8px + env(safe-area-inset-top)); bottom: auto; left: 8px; right: 8px; padding: 12px 14px; }
  .tabs a.desk-nav { display: none; }
}
