/* OnlyVends Control – Design-Tokens (Spec §2) und Komponenten */
:root {
  --ov-font: "Segoe UI", Tahoma, sans-serif;
  --ov-text: rgb(44, 38, 31);
  --ov-muted: #7a6d60;
  --ov-faint: #a89a8b;
  --ov-bg: #f7f1ea;
  --ov-bg-2: #efe5d8;
  --ov-bg-glow: rgba(233, 183, 120, .35);
  --ov-sidebar-top: #2d2117;
  --ov-sidebar-bottom: #4a3526;
  --ov-sidebar-text: #f8ecde;
  --ov-sidebar-muted: rgba(248, 236, 222, .62);
  --ov-primary-a: #b45309;
  --ov-primary-b: #7c2d12;
  --ov-primary-text: #fff8ee;
  --ov-primary-gradient: linear-gradient(135deg, var(--ov-primary-a), var(--ov-primary-b));
  --ov-accent: #c2410c;
  --ov-badge: #ea7a1c;
  --ov-card: #ffffff;
  --ov-border: #eadfce;
  --ov-shadow: 0 10px 30px rgba(74, 53, 38, .08), 0 2px 6px rgba(74, 53, 38, .05);
  --ov-radius-sm: 12px;
  --ov-radius: 18px;
  --ov-radius-lg: 20px;
  --ov-danger: #b42318;
  --ov-danger-bg: #fdecea;
  --ov-success: #1f7a3d;
  --ov-success-bg: #e8f6ec;
  --ov-warn-bg: #fff4e0;
  --ov-input-bg: #fffdfa;
  --ov-h1: 32px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ov-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ov-text);
  background-color: var(--ov-bg);
  background-image: radial-gradient(circle at 100% 0%, var(--ov-bg-glow), transparent 24%),
                    linear-gradient(180deg, #faf6f0 0%, var(--ov-bg) 45%, var(--ov-bg-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--ov-primary-a); }
h1 { font-size: var(--ov-h1); font-weight: 700; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 20px; margin: 0 0 6px; }
h3 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--ov-muted); }
.small { font-size: 13px; }
code { background: var(--ov-bg); padding: 1px 5px; border-radius: 6px; font-size: 13px; }

/* ── Layout ─────────────────────────────────────────────── */
#onlyvendsLayout { display: flex; min-height: 100vh; }
#onlyvendsSidebar {
  width: 270px; flex: 0 0 270px;
  background: linear-gradient(var(--ov-sidebar-top) 0%, var(--ov-sidebar-bottom) 100%);
  color: var(--ov-sidebar-text);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; align-self: flex-start; min-height: 100vh; max-height: 100vh; overflow-y: auto;
}
.sidebar-head .brand { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.sidebar-head .user { font-size: 13px; color: var(--ov-sidebar-muted); word-break: break-all; }
.nav-group-title { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ov-sidebar-muted);
  margin: 8px 8px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--ov-sidebar-text); text-decoration: none; padding: 9px 12px; border-radius: var(--ov-radius-sm);
  font-size: 15px; margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); }
.nav-link.active { background: var(--ov-primary-gradient); color: var(--ov-primary-text); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.nav-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.1);
  color: var(--ov-sidebar-muted); white-space: nowrap; }
.nav-link.active .nav-tag { background: rgba(255,255,255,.2); color: var(--ov-primary-text); }
.nav-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--ov-badge);
  color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--ov-sidebar-muted); background: rgba(255,255,255,.05);
  border-radius: var(--ov-radius-sm); padding: 10px 12px; }
.sidebar-foot strong { color: var(--ov-sidebar-text); font-weight: 600; }
.sidebar-logout { margin: 0; }
.sidebar-logout button { background: transparent; border: 1px solid rgba(248,236,222,.25); color: var(--ov-sidebar-text);
  border-radius: var(--ov-radius-sm); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; width: 100%; }
.sidebar-logout button:hover { background: rgba(255,255,255,.07); }

.ov-main { flex: 1; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.mobile-bar, .nav-backdrop { display: none; }

/* ── Karten / Hero ─────────────────────────────────────── */
.card { background: var(--ov-card); border-radius: var(--ov-radius); box-shadow: var(--ov-shadow);
  border: 1px solid var(--ov-border); padding: 22px 24px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head p { margin: 0; }
.subcard { border: 1px solid var(--ov-border); border-radius: 14px; padding: 16px; background: #fffcf8; }
.hero { border-radius: var(--ov-radius-lg); padding: 26px 28px; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero .hero-text { max-width: 760px; }
.hero p { color: var(--ov-muted); margin: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero-side { display: flex; align-items: flex-start; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }

/* KPI */
.kpi { padding: 18px 20px; }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--ov-faint); font-weight: 600; }
.kpi-value { font-size: 30px; font-weight: 700; margin: 4px 0 2px; line-height: 1.15; }
.kpi-help { font-size: 13px; color: var(--ov-muted); }
.kpi-mini .kpi-value { font-size: 24px; }

/* ── Buttons ──────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px;
  border-radius: var(--ov-radius-sm); border: 1px solid var(--ov-primary-a); background: transparent;
  color: var(--ov-primary-b); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  line-height: 1.2; }
.btn:hover { background: #fff3e4; }
.btn-primary { background: var(--ov-primary-gradient); color: var(--ov-primary-text); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.07); background: var(--ov-primary-gradient); }
.btn-small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn-danger { border-color: var(--ov-danger); color: var(--ov-danger); }
.btn-danger:hover { background: var(--ov-danger-bg); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: wait; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-block { width: 100%; }

/* ── Formulare ─────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
.field label { font-size: 13px; font-weight: 600; color: var(--ov-muted); }
.field .hint { font-size: 12px; color: var(--ov-faint); }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  font: inherit; font-size: 16px; color: var(--ov-text); background: var(--ov-input-bg);
  border: 1px solid var(--ov-border); border-radius: 10px; padding: 9px 12px; width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(180, 83, 9, .35); border-color: var(--ov-primary-a); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-row .field { min-width: 170px; }
.section-title { font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ov-faint); margin: 18px 0 8px; font-weight: 700; }

/* ── Tabellen ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.ov-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ov-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ov-faint);
  font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--ov-border); white-space: nowrap; }
.ov-table td { padding: 10px; border-bottom: 1px solid #f3ebe0; vertical-align: top; }
.ov-table tr:last-child td { border-bottom: 0; }
.ov-table td.num, .ov-table th.num { text-align: right; white-space: nowrap; }
.ov-table td.empty { text-align: center; color: var(--ov-muted); padding: 22px 10px; }
.ov-table tr.low-stock td { background: #fff4e5; }
.ov-table tr.edit-row td { background: #fffaf3; }
.ov-table .actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Pills / Status ────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: #f4ece2; color: var(--ov-text); white-space: nowrap; }
a.pill { text-decoration: none; }
.pill-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-danger { background: var(--ov-danger-bg); color: var(--ov-danger); }
.pill-success { background: var(--ov-success-bg); color: var(--ov-success); }
.pill-warn { background: var(--ov-warn-bg); color: #9a5b00; }
.status-offen, .status-neu { background: #fff1de; color: #9a4d00; }
.status-fehlende_daten { background: #fde7e4; color: #a12b1c; }
.status-versand_gewuenscht, .status-versendet { background: #e9eefc; color: #2c46a0; }
.status-produkt_versendet { background: #e6f3fb; color: #1d5d82; }
.status-gutschrift_erstellt, .status-bezahlt { background: #f1e8fb; color: #64329a; }
.status-ausgezahlt, .status-abgeschlossen, .status-übernommen { background: var(--ov-success-bg); color: var(--ov-success); }
.status-abgelehnt, .status-retoure, .status-ignoriert { background: #eee9e4; color: #6a5d51; }
.status-geprüft { background: #e9eefc; color: #2c46a0; }

/* Flash */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 12px; font-size: 14px; border: 1px solid transparent; }
.flash-error, .flash-danger { background: var(--ov-danger-bg); color: var(--ov-danger); border-color: #f5c6c0; }
.flash-success { background: var(--ov-success-bg); color: var(--ov-success); border-color: #bfe3cb; }
.flash-info, .flash-message { background: #fff7ea; color: #7a4a10; border-color: #f2dcb8; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert-danger { background: var(--ov-danger-bg); color: var(--ov-danger); }

/* Listen (Analyse) */
.stat-list { display: flex; flex-direction: column; gap: 12px; }
.stat-item strong { display: block; }
.stat-item .stat-sub { color: var(--ov-muted); font-size: 13px; }
.bar { height: 6px; border-radius: 99px; background: #f1e7da; margin-top: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ov-primary-gradient); border-radius: 99px; }

/* Verlauf */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { border-left: 3px solid var(--ov-primary-a); padding: 4px 0 4px 12px; }
.timeline-item .meta { font-size: 12px; color: var(--ov-faint); }
.timeline-item .text { white-space: pre-wrap; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(45, 33, 23, .55); z-index: 50; padding: 16px;
  align-items: center; justify-content: center; }
.modal-content { background: var(--ov-card); border-radius: var(--ov-radius); max-width: 620px; width: 100%;
  padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-height: 92vh; overflow-y: auto; margin: 6vh auto; }

.placeholder-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.qr-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; }
.qr-box img { width: 200px; height: 200px; border: 1px solid var(--ov-border); border-radius: 12px; background: #fff; }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--ov-border); border-radius: 12px; background: #fff; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 420px; }
.login-brand { background: linear-gradient(var(--ov-sidebar-top), var(--ov-sidebar-bottom)); color: var(--ov-sidebar-text);
  border-radius: var(--ov-radius) var(--ov-radius) 0 0; margin: -22px -24px 18px; padding: 20px 24px; }
.login-brand .brand { font-size: 20px; font-weight: 700; }
.divider { text-align: center; color: var(--ov-faint); font-size: 13px; margin: 14px 0; }

/* ── Zusatzkomponenten (Ein-Klick-Gutschrift, Postfach) ─────────────── */
.btn-payout { white-space: nowrap; }
.btn-lg { padding: 14px 22px; font-size: 17px; }
.qr-hero { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 24px; align-items: start; }
.qr-big { width: 100%; max-width: 360px; aspect-ratio: 1; display: block; background: #fff; border: 1px solid var(--ov-border);
  border-radius: 16px; padding: 6px; image-rendering: pixelated; }
.qr-caption { font-size: 13px; color: var(--ov-muted); margin-top: 6px; text-align: center; max-width: 360px; }
.copy-list { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--ov-border); border-radius: 12px; background: #fffcf8; }
.copy-row dt { font-size: 12px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--ov-faint); font-weight: 700; }
.copy-row dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; word-break: break-word; font-variant-numeric: tabular-nums; }
.copy-btn { flex: 0 0 auto; }
.copy-btn.copied { background: var(--ov-success-bg); border-color: var(--ov-success); color: var(--ov-success); }
.serie-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.serie-nav a { min-width: 40px; text-align: center; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--ov-border);
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ov-primary-b); background: #fff; }
.serie-nav a.current { background: var(--ov-primary-gradient); color: var(--ov-primary-text); border-color: transparent; }
.serie-nav a.paid { background: var(--ov-success-bg); color: var(--ov-success); border-color: #bfe3cb; }
.attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attach-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--ov-border); border-radius: 12px; background: #fffcf8; }
.attach-list .att-name { font-weight: 600; word-break: break-all; }
.mail-body { white-space: pre-wrap; word-break: break-word; background: #fffcf8; border: 1px solid var(--ov-border);
  border-radius: 12px; padding: 14px; font-size: 15px; max-height: 70vh; overflow: auto; }
.folder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; margin: 6px 0 4px; }
.test-result { margin-top: 10px; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 14px; }
.wizard-hint { background: var(--ov-warn-bg); border: 1px solid #f2dcb8; color: #7a4a10; border-radius: 12px; padding: 10px 14px;
  font-size: 14px; }
.wizard-hint:empty { display: none; }
.missing-field input, .missing-field select { border-color: var(--ov-danger) !important; background: #fffafa; }
.missing-field label { color: var(--ov-danger); }
.only-mobile { display: none; }
.sticky-actions { display: none; }
.pdf-frame-wrap { margin-top: 12px; }

/* ── Responsiv ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  body { background-attachment: scroll; }
  #onlyvendsLayout { flex-direction: column; }
  /* Kopfleiste mit Burger (Safe-Area oben) */
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 40;
    padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
    background: linear-gradient(var(--ov-sidebar-top), var(--ov-sidebar-bottom)); color: var(--ov-sidebar-text);
    box-shadow: 0 2px 10px rgba(0,0,0,.18); }
  .mobile-menu-btn { display: inline-flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 10px; border: 0;
    background: transparent; color: inherit; font: inherit; font-weight: 700; font-size: 17px; cursor: pointer; }
  .burger { display: inline-flex; flex-direction: column; gap: 4px; width: 22px; }
  .burger i { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s; }
  .nav-open .burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-open .burger i:nth-child(2) { opacity: 0; }
  .nav-open .burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .mobile-bar-tickets { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 12px;
    color: var(--ov-sidebar-text); text-decoration: none; font-weight: 600; font-size: 15px; }
  /* Navigation als Schublade von links, Hintergrund abgedunkelt, Seite gesperrt */
  #onlyvendsSidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(86vw, 320px); min-height: 0;
    max-height: none; height: 100dvh; display: flex; transform: translateX(-105%); transition: transform .22s ease;
    padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overflow-y: auto; overscroll-behavior: contain; visibility: hidden; }
  #onlyvendsLayout.nav-open #onlyvendsSidebar { transform: none; visibility: visible; box-shadow: 8px 0 30px rgba(0,0,0,.35); }
  .nav-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(25, 18, 12, .5); }
  #onlyvendsLayout.nav-open .nav-backdrop { display: block; }
  html.nav-lock, html.nav-lock body { overflow: hidden; }
  .nav-link { min-height: 46px; font-size: 16px; }
  .sidebar-logout button { min-height: 44px; font-size: 15px; }

  .ov-main { padding: 14px max(14px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    gap: 14px; }
  .grid { gap: 14px; }
  .grid-2, .grid-main, .grid-3, .form-grid, .qr-hero { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px 16px; border-radius: 16px; }
  .hero { padding: 18px 16px; }
  h1 { font-size: 24px; }
  h2 { font-size: 19px; }
  .btn-grid { grid-template-columns: 1fr; }
  .hero-quick { display: none; }
  .hero-side { width: 100%; }

  /* Touch-Ziele ≥ 44 px, Eingaben 16 px (kein iOS-Zoom) */
  .btn, .btn-small { min-height: 44px; padding: 10px 16px; font-size: 15px; }
  input[type=text], input[type=email], input[type=number], input[type=password], input[type=date], input[type=tel],
  input[type=datetime-local], input[type=search], input[type=file], select, textarea { min-height: 44px; font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: 0 0 auto; }
  input[type=color] { min-width: 44px; min-height: 44px; font-size: 16px; }
  .check { min-height: 44px; font-size: 15px; }
  .filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .filter-row .field { min-width: 0; }
  .filter-row > .btn, .filter-row > .btn-row { grid-column: 1 / -1; }
  .filter-row > .btn-row .btn { flex: 1 1 auto; }
  .card-head > .btn, .card-head > .btn-row { width: 100%; }
  .card-head > .btn-row .btn { flex: 1 1 auto; }
  .fin-subnav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin-left: -4px; margin-right: -4px; padding: 2px 4px 6px; }
  .fin-subnav a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; }
  .pill { white-space: normal; }
  .modal-content { margin: 0 auto; padding: 18px 16px; max-height: calc(100dvh - 32px); }
  .pdf-frame { height: 60vh; }
  .only-mobile { display: initial; }
  .only-desktop { display: none !important; }

  /* Sticky-Aktionsleiste (Ticket-Detail, Gutschrift-Ergebnis) */
  .sticky-actions { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: rgba(255, 252, 248, .97); border-top: 1px solid var(--ov-border); box-shadow: 0 -6px 20px rgba(74, 53, 38, .12);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .sticky-actions > *, .sticky-actions form > .btn { flex: 1 1 0; min-width: 0; }
  .sticky-actions form { display: flex; flex: 1.6 1 0; margin: 0; }
  .sticky-actions .btn { padding: 10px 8px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.has-sticky .ov-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .bulk-bar { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .bulk-bar .field { width: 100%; }
}
@media (max-width: 640px) {
  /* Kennzahlen 2-spaltig */
  .grid-4, .grid:has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-label { font-size: 11px; letter-spacing: .8px; }
  .kpi-value { font-size: 22px; word-break: break-word; }
  .kpi-help { font-size: 12px; }
  .form-grid-3, .form-grid-4, .map-grid, .split-row { grid-template-columns: minmax(0, 1fr); }

  /* Tabellen als Karten: erste (wichtigste) Spalte als Titel, übrige Spalten beschriftet, Aktionen unten */
  .table-wrap:has(> table.stackable) { overflow: visible; }
  table.stackable, table.stackable > tbody { display: block; width: 100%; }
  table.stackable > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stackable > tbody > tr { display: flex; flex-direction: column; position: relative; border: 1px solid var(--ov-border); border-radius: 14px;
    padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  table.stackable > tbody > tr:last-child { margin-bottom: 0; }
  table.stackable > tbody > tr > td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 5px 0; border: 0; text-align: right; min-width: 0; background: transparent !important; }
  table.stackable > tbody > tr > td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; font-size: 11px;
    font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--ov-faint); padding-top: 3px; }
  table.stackable > tbody > tr > td:not([data-label])::before { content: none; }
  table.stackable td .cell-val { flex: 1 1 auto; min-width: 0; word-break: break-word; }
  table.stackable td.cell-title { order: -1; display: block; text-align: left; font-size: 16px; padding: 2px 44px 6px 0; }
  table.stackable td.cell-title::before { content: none; }
  table.stackable td.cell-check { position: absolute; top: 8px; right: 8px; padding: 0; display: block; }
  table.stackable td.cell-check::before { content: none; }
  table.stackable td.cell-check input { width: 26px; height: 26px; margin: 4px; }
  table.stackable td.cell-actions { order: 99; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding-top: 8px;
    margin-top: 4px; border-top: 1px solid #f3ebe0; text-align: left; white-space: normal; }
  table.stackable td.cell-actions::before { content: none; }
  table.stackable td.cell-empty { display: none; }
  table.stackable td.cell-actions .actions, td.cell-actions form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
  table.stackable td.cell-actions .btn { flex: 1 1 auto; }
  table.stackable td.cell-wide { display: block; text-align: left; }
  table.stackable td.cell-wide::before { content: none; }
  table.stackable > tbody > tr.edit-row { background: #fffaf3; }
  table.stackable > tbody > tr.low-stock { border-color: #f2c48d; background: #fff8ee; }
  table.stackable > tbody > tr.total, table.stackable > tbody > tr.warn { background: #fffcf8; }
  table.stackable td select.inline { max-width: 100%; min-width: 0; width: 100%; }
  table.stackable td .purpose { max-width: none; }
  table.stackable > tbody > tr > td.empty { display: block; text-align: center; }
  table.stackable td.cell-title .small, table.stackable td.cell-title .muted { font-size: 13px; }
  .table-wrap { margin: 0 -2px; }
  .ov-table th, .ov-table td { padding: 8px; }
  .copy-row dd { font-size: 16px; }
}
@media (pointer: coarse) {
  .nav-link { min-height: 44px; }
}
@media print {
  .mobile-bar, #onlyvendsSidebar, .sticky-actions, .hero-actions, .nav-backdrop { display: none !important; }
  .ov-main { padding: 0; }
}
/* Postfach: Als Beleg zuweisen (Rechnungen & Belege) */
.bulk-bar-beleg { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--ov-border); border-radius: 14px; background: #fffcf8; }
.bulk-bar-beleg select { width: auto; min-width: 200px; }
details.beleg-pop { display: inline-block; }
details.beleg-pop > summary { list-style: none; cursor: pointer; }
details.beleg-pop > summary::-webkit-details-marker { display: none; }
details.beleg-pop[open] { display: block; width: 100%; }
.status-beleg { background: #e6f4f1; color: #0f766e; }
@media (max-width: 640px) { .bulk-bar-beleg select { min-width: 0; width: 100%; } }
