@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: oklch(97.3% 0.004 250);
  --panel: oklch(99% 0.002 250);
  --panel-2: oklch(95.3% 0.006 250);
  --border: oklch(89% 0.007 250);
  --border-strong: oklch(80% 0.012 250);
  --text: oklch(20% 0.018 255);
  --muted: oklch(46% 0.018 255);
  --faint: oklch(64% 0.014 255);

  --sidebar-bg: oklch(21% 0.025 260);
  --sidebar-bg-2: oklch(26.5% 0.03 260);
  --sidebar-border: oklch(31% 0.03 260);
  --sidebar-text: oklch(89% 0.01 260);
  --sidebar-text-muted: oklch(62% 0.02 260);

  --accent: oklch(45% 0.15 265);
  --accent-hover: oklch(39% 0.15 265);
  --accent-soft: oklch(94% 0.028 265);
  --accent-ink: oklch(30% 0.13 265);

  /* Statuswerte: gleiche Helligkeit/Sättigung, nur Farbton wechselt */
  --st-submitted-tx: oklch(45% 0.02 255); --st-submitted-bg: oklch(94% 0.008 255);
  --st-review-tx: oklch(50% 0.13 80); --st-review-bg: oklch(95% 0.045 85);
  --st-approved-tx: oklch(48% 0.13 155); --st-approved-bg: oklch(94% 0.05 150);
  --st-rejected-tx: oklch(50% 0.17 25); --st-rejected-bg: oklch(94% 0.05 25);
  --st-clarify-tx: oklch(46% 0.15 340); --st-clarify-bg: oklch(94% 0.035 340);
  --st-payment-tx: oklch(48% 0.14 230); --st-payment-bg: oklch(94% 0.04 230);
  --st-archived-tx: oklch(42% 0.06 220); --st-archived-bg: oklch(93% 0.015 220);

  --shadow-sm: 0 1px 2px oklch(20% 0.02 255 / 0.06);
  --shadow-md: 0 1px 2px oklch(20% 0.02 255 / 0.04), 0 10px 24px oklch(20% 0.02 255 / 0.07);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.55 'Public Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 20px; }
.brand svg { flex: 0 0 auto; }
.brand b { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; color: #fff; }

.sidebar-context {
  margin: 0 8px 20px; padding: 11px 12px;
  background: var(--sidebar-bg-2); border: 1px solid var(--sidebar-border); border-radius: var(--radius-sm);
}
.sidebar-context .label { font-size: 10.5px; color: var(--sidebar-text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.sidebar-context .mandant { font-size: 13px; font-weight: 600; color: #fff; margin-bottom: 7px; }
.role-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--sidebar-text); background: var(--sidebar-bg); padding: 3px 9px 3px 7px; border-radius: 999px;
}
.role-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: oklch(72% 0.16 155); }

.nav-group { padding: 10px 0 0; }
.nav-group p { margin: 0; padding: 10px 12px 6px; font-size: 10.5px; font-weight: 700; color: var(--sidebar-text-muted); text-transform: uppercase; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 8px 2px; border-radius: 8px;
  color: var(--sidebar-text-muted); font-size: 13.5px; font-weight: 500;
}
.nav-item svg { flex: 0 0 auto; }
.nav-item:hover { background: var(--sidebar-bg-2); color: var(--sidebar-text); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--accent); color: #fff; }

.sidebar-foot {
  margin: 0 0 8px; padding: 0 0 16px 8px; border-bottom: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.sidebar-foot .who-name { font-size: 12.5px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot a { font-size: 11px; color: var(--sidebar-text-muted); }
.sidebar-foot a:hover { color: var(--sidebar-text); }

/* ---------- Main / topbar ---------- */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 26px 40px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-actions { flex: 0 0 auto; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .lede { font-size: 13px; color: var(--muted); margin-top: 3px; }

.view { padding: 28px 40px; max-width: 1400px; }

/* Mobiles Menue-Knopf + Abdunklung - nur unter 960 px sichtbar (siehe unten). */
.nav-toggle {
  display: none; flex: 0 0 auto; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); cursor: pointer;
}
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-backdrop { display: none; }
.nur-mobil-zeile { display: none; } /* Tabellenzeile nur unter 960 px, siehe unten */


.layout-2col { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
.pdf-preview {
  position: sticky; top: 24px;
  height: calc(100vh - 130px);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pdf-preview iframe { display: block; width: 100%; height: 100%; border: 0; }
.pdf-preview-empty {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--faint); font-size: 13px; text-align: center; padding: 24px;
}
@media (max-width: 900px) {
  .layout-2col { grid-template-columns: minmax(0, 1fr); }
  .pdf-preview { position: static; height: 60vh; }
}

.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 820px) {
  .layout-side { grid-template-columns: minmax(0, 1fr); }
}

.layout-2col-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 820px) {
  .layout-2col-even { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Stat tiles ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; }
.stat-tile .stat-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.stat-tile .stat-value { font-family: 'IBM Plex Mono', monospace; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- Panels / cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
.panel-h { display: flex; align-items: baseline; gap: 8px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.panel-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-h .hint { color: var(--muted); font-size: 12px; }
.panel-b { padding: 20px 22px; }

/* Schieberegler (z.B. Kassen-Feature aktivieren, admin/kassen.php) */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track {
  width: 42px; height: 24px; flex: 0 0 auto; background: var(--border-strong); border-radius: 999px;
  position: relative; transition: background .15s;
}
.toggle .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff;
  border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform .15s;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle .toggle-label { font-size: 13.5px; font-weight: 600; }

/* CTA-Karte (z.B. Freigabe-Bericht-Einstieg im Dashboard) */
.cta-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; }
.cta-card .cta-icon {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: var(--radius-sm); background: var(--accent-soft);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
}
.cta-card .cta-title { font-size: 14.5px; font-weight: 600; }
.cta-card .cta-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.tbl th { color: var(--faint); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.tbl.kv th { width: 200px; color: var(--muted); font-weight: 600; text-transform: none; font-size: 13px; letter-spacing: normal; }
.tbl.kv td { overflow-wrap: anywhere; } /* lange Dateinamen/E-Mails ohne Trennstellen */
.tbl tr:last-child th, .tbl tr:last-child td { border-bottom: none; }
.tbl td.num, .tbl th.num { text-align: right; }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--muted); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-submitted { background: var(--st-submitted-bg); color: var(--st-submitted-tx); }
.chip-review     { background: var(--st-review-bg);    color: var(--st-review-tx); }
.chip-approved   { background: var(--st-approved-bg);  color: var(--st-approved-tx); }
.chip-rejected   { background: var(--st-rejected-bg);  color: var(--st-rejected-tx); }
.chip-clarify    { background: var(--st-clarify-bg);   color: var(--st-clarify-tx); }
.chip-payment    { background: var(--st-payment-bg);   color: var(--st-payment-tx); }
.chip-archived   { background: var(--st-archived-bg);  color: var(--st-archived-tx); }

.note { padding: 13px 18px; border-radius: var(--radius-sm); background: var(--st-review-bg); color: oklch(38% 0.1 80); margin-bottom: 18px; border: 1px solid oklch(88% 0.06 85); font-size: 13px; line-height: 1.55; }
.note-crit { background: var(--st-clarify-bg); border-color: oklch(88% 0.06 340); color: oklch(38% 0.13 340); }

/* ---------- Forms ---------- */
.field, textarea.field, select.field {
  display: block; width: 100%; max-width: 420px; padding: 10px 12px; margin: 4px 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 14px;
  background: var(--panel); color: var(--text);
}
.field:focus, textarea.field:focus, select.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
label { font-weight: 600; font-size: 12.5px; }
.fld { margin-bottom: 4px; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 16px;
  display: flex; align-items: center; gap: 12px; background: var(--panel-2); max-width: 420px;
}
.dropzone .dz-icon {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; background: var(--accent-soft);
  color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
}
.dropzone .dz-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone .dz-meta { font-size: 11.5px; color: var(--muted); }
.dropzone input[type="file"] { font-size: 12.5px; max-width: 100%; }
.file-input-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.dz-aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.dz-aktionen .btn[hidden] { display: none; }

/* Reiterleiste (admin/_einstellungen_tabs.php) - scrollt auf schmalen Bildschirmen seitlich */
.reiter {
  display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.reiter a {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.reiter a:hover { color: var(--text); text-decoration: none; }
.reiter a[aria-current="page"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
.reiter a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }

/* Auswahl der Belegerfassung (admin/einstellungen.php) */
.erfassung-wahl { display: grid; gap: 10px; }
.erfassung-option {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; font-weight: 400;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
}
.erfassung-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.erfassung-option input { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; accent-color: var(--accent); }
.erfassung-option > span { display: grid; gap: 3px; font-size: 13px; }
.erfassung-option > span > span { color: var(--muted); font-size: 12.5px; }

/* Beleg-Scan per Kamera (rechnung_neu.php): Seiten als Vorschaubilder, daraus wird im Browser ein PDF. */
.scan-panel {
  max-width: 420px; margin: 0 0 12px; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--panel);
}
.scan-panel[hidden] { display: none; }
.scan-tipp { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.scan-seiten { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 10px; }
.scan-seite { display: flex; flex-direction: column; gap: 4px; }
.scan-seite img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 6px;
}
.scan-seite .scan-seite-kopf { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.scan-seite .scan-seite-kopf span { display: flex; gap: 2px; }
.scan-seite button {
  border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 4px; cursor: pointer; display: inline-flex;
}
.scan-seite button:hover, .scan-seite button:focus-visible { background: var(--panel-2); color: var(--text); }
.scan-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-status { margin-top: 8px; font-size: 12px; color: var(--muted); }
.scan-status:empty { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.approve { background: var(--st-approved-tx); border-color: var(--st-approved-tx); color: #fff; }
.btn.approve:hover { filter: brightness(0.92); }
.btn.danger { background: var(--st-rejected-bg); border-color: oklch(88% 0.06 25); color: var(--st-rejected-tx); }
.btn.danger:hover { background: oklch(91% 0.06 25); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }

/* ---- Cookie-Hinweis (views/_cookie_notice.php) ---- */
.cookie-notice {
  position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 1000; margin: 0 auto;
  max-width: 640px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--sidebar-bg); border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 16px 20px;
}
.cookie-notice[hidden] { display: none; }
.cookie-notice p { margin: 0; flex: 1; min-width: 220px; font-size: 13px; line-height: 1.55; color: var(--sidebar-text-muted); }
.cookie-notice a { color: var(--sidebar-text); text-decoration: underline; }
.cookie-notice .btn { flex: 0 0 auto; }
.iconbtn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--panel);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); padding: 0;
}
.iconbtn:hover { background: var(--panel-2); }
.iconbtn:disabled { opacity: .35; cursor: default; }
.iconbtn:disabled:hover { background: var(--panel); }
.iconbtn.danger { color: var(--st-rejected-tx); }

.flash { padding: 11px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13px; }
.flash-error { background: var(--st-rejected-bg); color: var(--st-rejected-tx); }
.flash-info { background: var(--st-approved-bg); color: var(--st-approved-tx); }

/* ---------- Stepper (Freigabekette-Fortschritt) ---------- */
.stepper { display: flex; align-items: flex-start; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.step-badge {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex: 0 0 38px;
  background: var(--panel-2); border: 1.5px solid var(--border-strong); color: var(--faint);
}
.step-badge.done { background: var(--st-approved-tx); border-color: var(--st-approved-tx); color: #fff; }
.step-badge.current { background: var(--accent-soft); border: 2.5px solid var(--accent); color: var(--accent); }
.step-badge.rejected { background: var(--st-rejected-tx); border-color: var(--st-rejected-tx); color: #fff; }
.step-name { margin-top: 9px; font-size: 13px; font-weight: 600; text-align: center; }
.step-sub { font-size: 11px; font-weight: 600; text-align: center; margin-top: 1px; color: var(--faint); }
.step-sub.done { color: var(--st-approved-tx); }
.step-sub.current { color: var(--accent-ink); }
.step-sub.rejected { color: var(--st-rejected-tx); }
.step-line { flex: 1; height: 2px; margin-top: 19px; background: var(--border); }
.step-line.done { background: var(--st-approved-tx); }

/* ---------- Verlauf-Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 2px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--dotcolor, var(--st-submitted-tx)); border: 2px solid var(--panel);
}
.tl-title { font-size: 13px; font-weight: 600; }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- Stufen-Karten (Freigabekette-Konfiguration) ---------- */
.stage-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.stage-info { flex: 1; min-width: 0; }
.stage-num {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13.5px;
}
.stage-avatar {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px;
}
.stage-name { font-size: 14px; font-weight: 600; }
.stage-email { font-size: 12px; color: var(--muted); }
.stage-limit { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 700; padding: 5px 12px; background: var(--panel-2); border-radius: 999px; white-space: nowrap; }
.stage-limit.unlimited { background: var(--accent-soft); color: var(--accent-ink); }

body.bare { display: flex; align-items: stretch; min-height: 100vh; }
.auth-split { display: flex; width: 100%; min-height: 100vh; }
.auth-brand {
  position: relative; width: 46%; min-width: 380px; max-width: 600px; background:
    radial-gradient(120% 100% at 100% 0%, oklch(30% 0.05 260) 0%, var(--sidebar-bg) 45%), var(--sidebar-bg);
  color: var(--sidebar-text); padding: 56px; display: flex; flex-direction: column; overflow: hidden;
}
.auth-brand .brand { padding-bottom: 0; }
.auth-brand-body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 420px; }
.auth-brand-body h1 { margin: 0 0 14px; font-size: 32px; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; color: #fff; }
.auth-brand-body > p { margin: 0 0 30px; font-size: 14.5px; line-height: 1.6; color: var(--sidebar-text-muted); }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.auth-feature .fi {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; background: var(--sidebar-bg-2); border: 1px solid var(--sidebar-border);
  display: flex; align-items: center; justify-content: center;
}
.auth-feature .ft { font-size: 13.5px; font-weight: 600; color: #fff; }
.auth-feature .fd { font-size: 12.5px; color: var(--sidebar-text-muted); margin-top: 1px; }
.auth-foot { font-size: 12px; color: var(--sidebar-text-muted); }
.auth-foot a { color: var(--sidebar-text-muted); }
.auth-foot a:hover { color: var(--sidebar-text); }
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.auth-box { width: 380px; max-width: 100%; }
.auth-box h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.auth-box > p { margin: 0 0 28px; color: var(--muted); font-size: 13.5px; }
.auth-hint { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; align-items: flex-start; gap: 10px; font-size: 12px; line-height: 1.6; color: var(--faint); }
@media (max-width: 860px) {
  .auth-split { flex-direction: column; }
  .auth-brand { width: 100%; max-width: none; min-width: 0; }
}
@media (max-width: 480px) {
  .auth-brand { padding: 28px 20px; }
  .auth-form-side { padding: 28px 16px; }
}

/* Testzugang-Passwortseite (siehe views/preview_gate.php): bewusst ohne den
   dunklen Marken-Balken der regulaeren Login-/Passwort-Seiten - nur eine
   vorlaeufige Huerde fuer die Testversion, keine Produktseite. */
.auth-minimal { width: 100%; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
@media (max-width: 480px) {
  .auth-minimal { padding: 28px 16px; }
}

/* Druckbare Berichte (siehe views/admin/bericht.php) */
.print-head { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .flash { display: none !important; }
  body, .app, .main { margin: 0; background: #fff; }
  .view { max-width: none; padding: 0; }
  .print-head { display: block; margin-bottom: 16px; }
  .print-head h1 { margin: 0 0 4px; font-size: 18px; }
  .print-head p { margin: 0; color: #444; font-size: 12px; }
  .panel { border: none; border-radius: 0; box-shadow: none; margin-bottom: 12px; }
  .panel-h { padding: 0 0 6px; border-bottom: 1px solid #999; }
  .panel-b { padding: 8px 0; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Markenseite / Produktvorstellung (views/marketing.php) ---------- */
.mkt-body { background: var(--bg); }

.mkt-nav {
  position: sticky; top: 0; z-index: 10; background: oklch(99% 0.002 250 / 0.85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.mkt-nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.mkt-brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.mkt-brand:hover { text-decoration: none; }
.mkt-brand b { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.mkt-nav-links { display: flex; align-items: center; gap: 26px; }
.mkt-nav-links a:not(.btn) { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.mkt-nav-links a:not(.btn):hover { color: var(--text); text-decoration: none; }

.mkt-eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent-ink); background: var(--accent-soft);
  padding: 4px 11px; border-radius: 999px; margin-bottom: 16px;
}
.mkt-lede { font-size: 16px; line-height: 1.6; color: var(--muted); max-width: 46ch; }

.mkt-hero { padding: 72px 24px 90px; }
.mkt-hero-inner {
  max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.05fr 1fr;
  gap: 56px; align-items: center;
}
.mkt-hero-copy h1 {
  margin: 0 0 18px; font-size: 42px; line-height: 1.14; font-weight: 800;
  letter-spacing: -0.02em; text-wrap: balance; max-width: 14ch;
}
.mkt-hero-cta { display: flex; gap: 12px; margin-top: 30px; }
.mkt-hero-cta .btn { padding: 11px 20px; font-size: 14px; }
.mkt-hero-trust {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 34px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.mkt-hero-trust span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.mkt-hero-trust svg { color: var(--accent); flex: 0 0 auto; }

.mkt-hero-visual { position: relative; }
.mkt-browser {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-md); overflow: hidden; transform: rotate(0.4deg);
}
.mkt-browser-bar { display: flex; gap: 6px; padding: 12px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.mkt-browser-bar span { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.mkt-browser-body { padding: 22px 24px 26px; }
.mkt-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mkt-preview-title { font-size: 15px; font-weight: 700; }
.mkt-preview-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.mkt-section { padding: 84px 24px; }
.mkt-section-alt { background: var(--panel-2); }
.mkt-section-inner { max-width: 1120px; margin: 0 auto; }
.mkt-section-inner > h2 { margin: 0 0 14px; font-size: 30px; font-weight: 800; letter-spacing: -0.015em; text-wrap: balance; }

.mkt-features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 40px;
}
.mkt-feature {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 22px 24px;
}
.mkt-feature-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.mkt-feature h3 { margin: 0 0 7px; font-size: 15.5px; font-weight: 700; }
.mkt-feature p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }

.mkt-status-strip {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--border); color: var(--faint);
}

.mkt-trial-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 24px; padding: 12px 18px;
  background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; max-width: fit-content;
}
.mkt-trial-banner svg { flex: 0 0 auto; }
.mkt-pricing { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-top: 28px; max-width: 760px; }
.mkt-price-card {
  position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 28px 28px;
}
.mkt-price-card.featured { border: 2px solid var(--accent); box-shadow: var(--shadow-md); }
.mkt-price-badge {
  position: absolute; top: -13px; left: 28px; background: var(--accent); color: #fff; font-size: 11px;
  font-weight: 700; padding: 4px 12px; border-radius: 999px; letter-spacing: .02em;
}
.mkt-price-name { font-size: 13.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mkt-price-value { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin-top: 10px; }
.mkt-price-value span { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.mkt-price-vat { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.mkt-price-hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 20px; }
.mkt-price-list { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mkt-price-list li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.mkt-price-list svg { color: var(--st-approved-tx); flex: 0 0 auto; }
.mkt-price-note { margin-top: 26px; font-size: 12.5px; color: var(--faint); max-width: 60ch; }

/* ---- Rechtliches (views/impressum.php, views/datenschutz.php) ---- */
.mkt-legal { max-width: 760px; }
.mkt-legal h1 { margin: 0 0 28px; font-size: 32px; font-weight: 800; letter-spacing: -0.015em; text-wrap: balance; hyphens: auto; overflow-wrap: break-word; }
@media (max-width: 480px) {
  .mkt-legal h1 { font-size: 26px; }
}
.mkt-legal h2 { margin: 32px 0 10px; font-size: 17px; font-weight: 700; }
.mkt-legal h2:first-of-type { margin-top: 0; }
.mkt-legal p, .mkt-legal ul { margin: 0 0 14px; font-size: 14.5px; line-height: 1.7; color: var(--muted); }
.mkt-legal ul { padding-left: 20px; }
.mkt-legal li { margin-bottom: 4px; }
.mkt-legal a { color: var(--accent); }
.mkt-legal strong { color: var(--text); }
.mkt-legal-stand { margin-top: 36px; font-size: 12.5px; color: var(--faint); }

/* ---- Registrierung (views/registrieren.php, views/registrieren_uebersicht.php) ---- */
.mkt-paket-badge {
  display: flex; align-items: center; gap: 10px; margin: 22px 0 32px; padding: 12px 18px;
  background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; flex-wrap: wrap;
}
.mkt-paket-badge svg { flex: 0 0 auto; }
.mkt-paket-badge a { margin-left: auto; font-weight: 700; font-size: 12.5px; }
.mkt-note-transparent { display: block; margin: 4px 0 0; opacity: .5; font-size: 12px; font-weight: 500; }

.mkt-form { margin-top: 8px; }
.mkt-form .field, .mkt-form textarea.field, .mkt-form select.field { max-width: none; }
.mkt-form-section-title {
  margin: 30px 0 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.mkt-form-section-title:first-child { margin-top: 0; }
.mkt-form-hint { margin: -8px 0 14px; font-size: 12.5px; color: var(--faint); }
.mkt-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.mkt-field-optional { font-weight: 400; color: var(--faint); }
.field-error { border-color: var(--st-rejected-tx); }
.mkt-field-error { margin: -10px 0 14px; font-size: 12px; color: var(--st-rejected-tx); font-weight: 600; }

.mkt-aktionscode-form {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 28px;
}
.mkt-aktionscode-form label { font-size: 12.5px; }
.mkt-aktionscode-form .field { width: 200px; margin: 0; }
.mkt-aktionscode-ok { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--st-approved-tx); }
.mkt-aktionscode-err { font-size: 12.5px; font-weight: 600; color: var(--st-rejected-tx); }

.mkt-review-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }
.mkt-review-side { position: sticky; top: 90px; }
.mkt-consent-list { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.mkt-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--text); cursor: pointer; }
.mkt-consent input[type="checkbox"] { margin-top: 2px; width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--accent); }

.mkt-footer { border-top: 1px solid var(--border); background: var(--sidebar-bg); }
.mkt-footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 30px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.mkt-footer-copy { font-size: 12.5px; color: var(--sidebar-text-muted); }
.mkt-footer-links { display: flex; gap: 16px; }
.mkt-footer-links a { font-size: 12.5px; color: var(--sidebar-text-muted); }
.mkt-footer-links a:hover { color: var(--sidebar-text); }

@media (max-width: 900px) {
  .mkt-hero-inner { grid-template-columns: 1fr; }
  .mkt-hero { padding: 48px 20px 64px; }
  .mkt-hero-copy h1 { font-size: 32px; max-width: none; }
  .mkt-section { padding: 56px 20px; }
  .mkt-form-grid-2 { grid-template-columns: 1fr; }
  .mkt-review-inner { grid-template-columns: 1fr; }
  .mkt-review-side { position: static; }
  .mkt-paket-badge a { margin-left: 0; }
  .mkt-features { grid-template-columns: 1fr; }
  .mkt-pricing { grid-template-columns: 1fr; max-width: 420px; }
  .mkt-nav-links { gap: 14px; }
  .mkt-nav-links a:not(.btn) { display: none; }
}

/* ---------- Handy und Tablet (hochkant) ----------
   Unter 960 px faehrt die Seitenleiste als Menue von links ein (Knopf in der
   Kopfleiste, Script in views/_layout.php); breite Tabellen scrollen innerhalb
   ihres Panels statt die Seite zu verbreitern. */
@media (max-width: 959px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1100;
    width: 280px; max-width: 85vw; flex: none; overflow-y: auto;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-offen { overflow: hidden; }
  body.nav-offen .sidebar { transform: none; box-shadow: var(--shadow-md); }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 1090; background: oklch(20% 0.02 255 / 0.45); }
  .nav-backdrop[hidden] { display: none; }
  .nav-toggle { display: inline-flex; }

  .topbar { position: sticky; top: 0; z-index: 50; padding: 12px 16px; gap: 12px; }
  .topbar h1 { font-size: 18px; }
  .topbar .lede { font-size: 12.5px; }
  .view { padding: 18px 16px; }

  .panel-h { padding: 14px 16px; flex-wrap: wrap; }
  .panel-b { padding: 16px; overflow-x: auto; }
  .tbl:not(.kv) th, .tbl:not(.kv) td { white-space: nowrap; }
  .tbl.kv th { width: 40%; }

  .stat-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .stat-tile { padding: 14px 16px; }
  .stat-tile .stat-value { font-size: 22px; }
  .cta-card { flex-wrap: wrap; padding: 16px; }

  /* 16 px verhindert das automatische Hineinzoomen von iOS beim Antippen eines Feldes. */
  .field, textarea.field, select.field { max-width: none; font-size: 16px; }
  .dropzone, .scan-panel { max-width: none; }

  .nur-mobil-zeile { display: table-row; }

  /* Freigabekette: Wertgrenze und Knoepfe rutschen unter Nummer/Avatar/Name. */
  .stage-card { flex-wrap: wrap; gap: 10px 12px; padding: 14px 16px; }
  .stage-info { flex: 1 1 calc(100% - 110px); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
