:root {
  --green: #1d4a37;
  --green-2: #2f6b50;
  --green-soft: #e6efe9;
  --red: #a8322a;
  --red-soft: #f8e5e2;
  --gold: #c08a2d;
  --bg: #f7f4ee;
  --card: #ffffff;
  --text: #1f2421;
  --muted: #5f6a64;
  --line: #dfe3dd;
  --focus: #d49a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.04);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-block: 24px 48px; }
.wrap { width: 100%; max-width: 720px; margin-inline: auto; padding-inline: 16px; }
.wrap.wide { max-width: 1180px; }

a { color: var(--green-2); }
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.break { word-break: break-all; }
.label { display: block; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Header / Footer */
.site-header { background: var(--green); color: #fff; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand .logo { width: 34px; height: 34px; color: #cfe3d5; flex: none; }
.brand strong { display: block; font-size: 1.05rem; }
.brand small { display: block; opacity: .8; font-size: .8rem; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.admin-nav a, .admin-nav .linklike { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .92rem; }
.admin-nav a:hover, .admin-nav .linklike:hover { background: rgb(255 255 255 / .12); }
.admin-nav a[aria-current="page"] { background: rgb(255 255 255 / .2); }
.admin-nav form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.site-footer { border-top: 1px solid var(--line); font-size: .85rem; }
.site-footer .wrap { display: flex; gap: 18px; padding-block: 18px; }
.site-footer a { color: var(--muted); }

/* ---------- Hero */
.hero { padding: 8px 0 20px; }
.hero.center { text-align: center; padding-block: 32px; }
.eyebrow { color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; margin-bottom: .4em; }
.lead { font-size: 1.1rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 20px 0 0; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.facts dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--green-2); }
.facts dd { margin: 2px 0 0; font-weight: 600; line-height: 1.35; }
.success .big-check { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--green); color: #fff; font-size: 34px; line-height: 64px; }

/* ---------- Karten / Formulare */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 0 0 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 400px; margin: 40px auto; }
fieldset.card { margin-inline: 0; }
legend { font-weight: 700; font-size: 1.1rem; padding: 0 6px; margin-left: -6px; display: flex; align-items: center; gap: 8px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; font-size: .85rem; }
.price-rule { background: var(--green-soft); border-radius: 10px; padding: 10px 12px; font-size: .95rem; }

.field { margin: 0 0 14px; }
.field label, .field > .label { display: block; font-weight: 600; margin-bottom: 4px; }
.req { color: var(--red); }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
.hint { font-size: .87rem; color: var(--muted); margin: -2px 0 6px; }
.err { color: var(--red); font-size: .9rem; font-weight: 600; margin: 6px 0 0; }

input[type="text"], input[type="tel"], input[type="email"], input[type="url"], input[type="number"], input[type="date"],
input[type="password"], input[type="search"], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* verhindert Zoom auf iOS */
  color: inherit;
  background: #fff;
  border: 1.5px solid #c9cfc8;
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 46px;
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23555' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); outline: 3px solid rgb(47 107 80 / .2); outline-offset: 0; }
.has-error input, .has-error select, .has-error textarea, [aria-invalid="true"] { border-color: var(--red); }

.grid-zip { display: grid; grid-template-columns: 7.5em 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 16px; }

.trees { display: grid; gap: 10px; margin-bottom: 10px; }
.tree-row { display: flex; align-items: flex-end; gap: 8px; }
.tree-label { flex: 1; }
.tree-label > span { display: block; font-weight: 600; margin-bottom: 4px; }
.remove-tree { flex: none; width: 46px; height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--muted); font-size: 1rem; cursor: pointer; }
.remove-tree:hover { color: var(--red); border-color: var(--red); }

.delivery-date { background: var(--green-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 2px; }
.delivery-date strong { font-size: 1.1rem; }
.delivery-date .area { font-weight: 600; color: var(--red); margin-top: 4px; }

.radios { display: grid; gap: 10px; }
.radio { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid #c9cfc8; border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--green-2); background: var(--green-soft); }
.radio input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); flex: none; }
.radio small { display: block; color: var(--muted); }
.radios.has-error .radio { border-color: var(--red); }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); flex: none; }
.check.inline { margin: 0; align-items: center; }
.check.has-error { color: var(--red); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Zusammenfassung */
.summary { margin-bottom: 8px; }
.summary h2 { margin-bottom: 10px; }
.summary .lines { list-style: none; margin: 0; padding: 0; }
.summary .lines li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.summary .what { font-weight: 600; }
.summary .calc { grid-row: 2; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.summary .price { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary .empty { color: var(--muted); padding: 6px 0; margin: 0; }
.summary .row { display: flex; justify-content: space-between; padding: 8px 0; margin: 0; }
.summary .total { border-top: 2px solid var(--text); font-size: 1.25rem; padding-top: 10px; }
.summary .total strong { font-variant-numeric: tabular-nums; }

/* ---------- Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1.5px solid var(--green); background: var(--green); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s ease, transform .1s ease; }
.btn:hover { background: var(--green-2); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.primary { background: var(--red); border-color: var(--red); }
.btn.primary:hover { background: #8f2821; }
.btn.big { width: 100%; min-height: 54px; font-size: 1.1rem; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn.ok { background: var(--green-soft); color: var(--green); border-color: var(--green-soft); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn:disabled { opacity: .6; cursor: wait; }
.add-tree { width: 100%; border-style: dashed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.phone-alt { text-align: center; color: var(--muted); }

/* ---------- Alerts / Badges */
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert.error { background: var(--red-soft); border-color: #e7b9b3; color: #6f1f19; }
.alert.ok { background: var(--green-soft); border-color: #b9d4c3; color: var(--green); }
.alert.info { background: #fdf6e7; border-color: #ecd9ab; color: #6b4d12; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.st-neu { background: #eef0f3; color: #3b4450; }
.st-geliefert { background: var(--green-soft); color: var(--green); }
.st-storniert { background: var(--red-soft); color: var(--red); }
.badge.paid { background: var(--green-soft); color: var(--green); }
.badge.unpaid { background: #fdf0d8; color: #7a5310; }
.flag { color: #8a5a0b; }

/* ---------- Tabellen */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.num { text-align: right; }
table.items td, table.items th { padding-inline: 0 8px; }
table.items tfoot th { font-size: 1.1rem; color: var(--text); text-transform: none; letter-spacing: 0; border-bottom: 0; border-top: 2px solid var(--text); }
table.compact td, table.compact th { padding: 6px 8px; }
.orders td small { display: block; color: var(--muted); font-size: .82rem; }
.orders tbody tr:hover { background: #fafbf9; }
.orders .rowlink { font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.orders tr.cancelled { opacity: .55; }
.empty-row { text-align: center; color: var(--muted); padding: 32px; }

dl.bank { display: grid; gap: 8px; margin: 0; }
dl.bank div { display: grid; grid-template-columns: 10em 1fr; gap: 8px; }
dl.bank dt { color: var(--muted); }
dl.bank dd { margin: 0; }

/* ---------- Admin */
.page-head { margin-bottom: 16px; }
.page-head .actions { margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat span { display: block; font-size: .8rem; color: var(--muted); }
.stat strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat.warn strong { color: #8a5a0b; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
.filters input[type="search"] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.danger-zone form { margin: 0; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

.tour { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: tour; }
.tour-item { counter-increment: tour; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tour-item.done { border-color: #b9d4c3; background: #f6faf7; }
.tour-item.done .tour-addr b { text-decoration: line-through; text-decoration-color: var(--green-2); }
.tour-item p { margin: 0 0 4px; }
.tour-addr { font-size: 1.08rem; }
.tour-addr::before { content: counter(tour) ". "; color: var(--muted); }
.maplink { font-size: .85rem; margin-left: 6px; }
.tree-chip { display: inline-block; background: var(--green-soft); color: var(--green); font-weight: 700; border-radius: 8px; padding: 2px 8px; margin: 2px 4px 2px 0; font-size: .9rem; }
.tour-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tour-sum { font-size: 1.2rem; font-weight: 700; }
.tour-sum small { display: block; font-size: .8rem; font-weight: 400; color: var(--muted); }
.tour-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tour-actions form { margin: 0; }
.print-only { display: none; }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.qr-card h2 { font-size: 1rem; }
.qr svg { width: 100%; height: auto; max-width: 200px; display: block; margin: 0 auto 8px; }

/* ---------- Mobil */
@media (max-width: 760px) {
  .orders thead { display: none; }
  .orders, .orders tbody, .orders tr, .orders td { display: block; width: 100%; }
  .orders tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
  .orders td { border: 0; padding: 0; }
  .orders td[data-label="Kunde"] { grid-column: 1 / -1; order: -1; }
  .orders td[data-label="Zahlung"], .orders td[data-label="Kanal"] { display: none; }
  .tour-item { grid-template-columns: 1fr; }
  .tour-side { text-align: left; align-items: flex-start; }
  .tour-actions { justify-content: flex-start; }
  dl.bank div { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 420px) {
  .grid-zip { grid-template-columns: 1fr; gap: 0; }
  .card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Druck (Auslieferliste) */
@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .site-footer, .no-print, .admin-nav { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .tour-item { break-inside: avoid; border: 1px solid #999; box-shadow: none; background: #fff !important; }
  .print-only { display: block; }
  a { color: inherit; text-decoration: none; }
}
