/* ===================================================
   trechnung – Hauptstylesheet v1.0
   Professionelles, minimalistisches ERP-UI
   =================================================== */

/* --- Reset & Base ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --blue-light: #eff6ff;
  --green:      #16a34a;
  --green-dark: #15803d;
  --green-light:#f0fdf4;
  --red:        #dc2626;
  --red-light:  #fef2f2;
  --orange:     #ea580c;
  --yellow:     #ca8a04;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-300:   #cbd5e1;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-800:   #1e293b;
  --gray-900:   #0f172a;
  --white:      #ffffff;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow:     0 2px 8px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --sidebar-w:  240px;
  --topbar-h:   60px;
  --font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); color: var(--gray-800); background: var(--gray-100); line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { font-family: var(--font); }

/* --- Auth Pages ------------------------------------ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 60%, #f0fdf4 100%);
  padding: 24px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  padding: 44px 44px 36px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  justify-content: center;
}

.auth-logo-mark {
  width: 42px; height: 42px;
  background: var(--blue);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-weight: 800;
  font-size: 20px;
}

.auth-logo-text { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.auth-logo-text span { color: var(--blue); }

.auth-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
  text-align: center;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 28px;
}

.auth-page--split {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  width: 100%;
}

.auth-marketing {
  background: linear-gradient(160deg, #1e40af 0%, #1d4ed8 45%, #0f172a 100%);
  color: #e2e8f0;
  padding: 48px 56px;
  display: flex;
  align-items: center;
}

.auth-marketing-inner {
  max-width: 520px;
}

.auth-logo--left {
  justify-content: flex-start;
  margin-bottom: 36px;
}

.auth-logo--left .auth-logo-text {
  color: #fff;
}

.auth-logo--left .auth-logo-mark {
  background: rgba(255,255,255,.15);
}

.auth-marketing-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.25;
}

.auth-marketing-lead {
  font-size: 15px;
  color: #bfdbfe;
  margin-bottom: 28px;
  line-height: 1.55;
}

.auth-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
}

.auth-feature-list li {
  position: relative;
  padding: 10px 0 10px 28px;
  font-size: 14px;
  line-height: 1.45;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.auth-feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #4ade80;
  font-weight: 700;
}

.auth-feature-list strong {
  color: #fff;
}

.auth-marketing-foot {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

.auth-split-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 60%, #f0fdf4 100%);
}

.auth-card--flat {
  box-shadow: var(--shadow-md);
  max-width: 460px;
}

.plan-price { font-size: 12px; color: var(--gray-500); }
.plan-option { align-items: flex-start; }
.plan-option input { margin-top: 4px; }

@media (max-width: 900px) {
  .auth-split {
    grid-template-columns: 1fr;
  }
  .auth-marketing {
    padding: 32px 24px;
  }
  .auth-feature-list li {
    font-size: 13px;
  }
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.form-label-row .form-label {
  margin-bottom: 0;
}

.form-label-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}

.form-label-link:hover {
  text-decoration: underline;
}

.password-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.password-input-wrap .form-control {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--gray-400);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

.password-toggle:hover {
  color: var(--gray-600);
  background: var(--gray-100);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.password-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.password-toggle-icon svg {
  display: block;
}

.password-toggle-icon--hide {
  display: none;
}

.password-toggle.is-visible .password-toggle-icon--show {
  display: none;
}

.password-toggle.is-visible .password-toggle-icon--hide {
  display: inline-flex;
}

.auth-back-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
}

/* --- Form Elements --------------------------------- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 5px;
}

.form-label .required { color: var(--red); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(37,99,235,.10);
}

.form-control::placeholder { color: var(--gray-400); }
.form-control:disabled { background: var(--gray-100); color: var(--gray-500); cursor: not-allowed; }

/* iOS zoomt beim Fokussieren automatisch in Felder mit Schriftgröße < 16px hinein.
   Das betrifft ausnahmslos alle Formulare (nicht nur die Belegpositionen-Tabelle),
   daher hier global für mobile Breiten korrigiert. */
@media (max-width: 900px) {
  .form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px;
    min-height: 42px;
  }
  textarea.form-control { min-height: 80px; }
  .btn:not(.btn-icon):not(.btn-sm) { min-height: 42px; }
  /* Icon-Buttons (Listenaktionen, Löschen, WhatsApp …) auf ein komfortables
     Mindest-Tippziel anheben, ohne das Desktop-Layout zu beeinflussen. */
  .btn-icon { width: 38px; height: 38px; flex-basis: 38px; }
}

select.form-control { cursor: pointer; }

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-hint--warning { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; padding: 6px 10px; border-radius: 6px; margin-top: 6px; }

.form-row {
  display: grid;
  gap: 12px;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-row.cols-5 { grid-template-columns: repeat(5, 1fr); }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
}

.form-check input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* --- Pflichtfeld-Ein/Aus-Schalter (Einstellungen) --- */
.tr-switch-group {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 4px 16px;
}
.tr-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.tr-switch-row:last-child { border-bottom: none; }
.tr-switch-label { display: flex; flex-direction: column; font-size: 13px; color: var(--gray-700); }
.tr-switch-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tr-switch-input { position: absolute; top: 0; left: 0; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; z-index: 2; }
.tr-switch-track {
  position: relative;
  width: 44px; height: 24px;
  background: var(--gray-300);
  border-radius: 999px;
  transition: background .15s;
  flex-shrink: 0;
}
.tr-switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.tr-switch-input:checked + .tr-switch-track { background: var(--blue); }
.tr-switch-input:checked + .tr-switch-track .tr-switch-thumb { transform: translateX(20px); }
.tr-switch-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--gray-300);
  min-width: 44px;
}
.tr-switch-input:not(:checked) ~ .tr-switch-text-off { color: var(--gray-600); }
.tr-switch-input:checked ~ .tr-switch-text-on { color: var(--blue); }

/* --- Buttons --------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  line-height: 1;
}

.btn:active { transform: translateY(1px); }

.btn-primary   { background: var(--blue);  color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-dark); color: #fff; }

.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-outline:hover { background: var(--blue); color: #fff; }

.btn-outline-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
}
.btn-outline-danger:hover { background: var(--red); color: #fff; }

.btn-sm  { padding: 6px 14px; font-size: 12px; }

/* Einheitliche Icon-Buttons für Tabellen-Aktionen (quadratisch, gleiche Größe) */
.btn-icon {
  width: 32px; height: 32px; padding: 0; flex: 0 0 32px;
  border-radius: var(--radius-sm);
}
.btn-icon svg { width: 16px; height: 16px; display: block; }
.btn-icon.btn-whatsapp { background: #e9fbf0; color: #1fa855; }
.btn-icon.btn-whatsapp:hover { background: #1fa855; color: #fff; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-xl  {
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  min-width: 200px;
  height: 44px;
}

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-full { width: 100%; }

/* --- Alerts ---------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { background: var(--red-light); color: var(--red); border: 1px solid #fecaca; }
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #bbf7d0; }
.alert-info    { background: var(--blue-light); color: var(--blue); border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: var(--yellow); border: 1px solid #fde68a; }

/* --- App Layout ------------------------------------ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: var(--gray-300);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}

.sidebar-logo-mark {
  width: 34px; height: 34px;
  background: var(--blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo-text { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-logo-text span { color: #60a5fa; }

.sidebar-firma {
  padding: 10px 20px 16px;
  font-size: 11px;
  color: var(--gray-500);
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 8px;
}

.sidebar-firma strong {
  display: block;
  font-size: 13px;
  color: var(--gray-300);
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav { flex: 1; padding: 4px 10px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  text-decoration: none;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: var(--white);
  text-decoration: none;
}

.nav-item.active {
  background: var(--blue);
  color: var(--white);
}

.nav-item svg, .nav-item .nav-icon { flex-shrink: 0; opacity: .8; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--gray-600);
  padding: 14px 12px 6px;
}

.sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Einstellungs-Menü (Desktop): helles Panel über der dunklen Seitenleiste.
   Links bleiben --sn-gap (~8 mm) der dunklen Leiste sichtbar; das Panel wirft einen weichen Schatten. */
:root { --sn-gap: 30px; --sn-w: 250px; }
.settings-nav {
  position: fixed; top: 0; left: var(--sn-gap); width: var(--sn-w); height: 100vh;
  z-index: 110; display: flex; flex-direction: column;
  background: #e9edf3; color: var(--gray-700);
  box-shadow: -6px 0 14px rgba(0,0,0,.28), 6px 0 22px rgba(15,23,42,.14);
  padding: 12px 10px;
}
.settings-nav-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gray-500); padding: 14px 12px 8px;
}
.settings-nav-list { flex: 1; overflow-y: auto; min-height: 0; padding: 0 0 6px; }
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--gray-700); text-decoration: none;
  transition: background .15s, color .15s;
}
.settings-nav-item:hover { background: rgba(255,255,255,.75); color: var(--gray-900); text-decoration: none; }
.settings-nav-item.active { background: var(--blue); color: #fff; }
.settings-nav-ico { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px; line-height: 1; }
.settings-nav-back {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: #fff; background: var(--red); text-decoration: none;
  transition: background .15s;
}
.settings-nav-back:hover { background: #b91c1c; color: #fff; text-decoration: none; }
.has-settings-nav .main-content { margin-left: calc(var(--sn-gap) + var(--sn-w)); }
@media (max-width: 900px) {
  .settings-nav { display: none; }
  .has-settings-nav .main-content { margin-left: 0; }
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.topbar-user:hover { background: var(--gray-100); }

.user-avatar {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.user-name { font-size: 13px; font-weight: 600; color: var(--gray-700); }

/* Page Content */
.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-header-left h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.page-header-left p {
  font-size: 13px;
  color: var(--gray-500);
}

/* --- Primäre "Neu"-Aktionsbuttons (Icon + Text) ----- */
.btn-new-action { display: inline-flex; align-items: center; gap: 6px; }
.btn-new-short { display: none; }

/* --- Demo-Modus-Banner ------------------------------ */
.demo-mode-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(90deg, #7c3aed, #2563eb);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.demo-mode-banner .btn { flex-shrink: 0; }

/* --- Cards ----------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}

.card-body { padding: 20px; }
.tr-auto { color: #b91c1c; font-weight: 700; }

.card-collapsible .card-header {
  cursor: pointer;
  user-select: none;
}

.card-collapsible .card-header:hover { background: var(--gray-50); }

.card-body.collapsed { display: none; }

/* --- Entry Card (New Record) ----------------------- */
.entry-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.entry-card .card-header {
  background: var(--gray-50);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* --- Filter Card ----------------------------------- */
.filter-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

/* Aktiv/Archiv-Umschalter (z. B. Belegliste) */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
}
.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
}
.tab-item:hover { color: var(--blue); }
.tab-item.active { color: var(--blue); border-bottom-color: var(--blue); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-row + .filter-row { margin-top: 10px; }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--blue-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
}

.bulk-bar #bulkCount {
  font-weight: 700;
  color: var(--blue-dark);
}

.filter-select {
  padding: 7px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--gray-50);
  color: var(--gray-700);
  cursor: pointer;
  min-width: 140px;
}

.filter-input {
  padding: 7px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--gray-50);
  flex: 1;
  min-width: 160px;
}

/* Suche + Filter (Belege / Bestellungen): zwei beschriftete Blöcke in einem Formular */
.filter-card-2 .lf-block + .lf-block { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--gray-200); }
.lf-title { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 8px; }
.lf-grid { display: grid; gap: 10px 12px; }
.lf-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lf-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lf-grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.lf-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lf-field > span:first-child { font-size: 11px; font-weight: 600; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lf-field .filter-input, .lf-field .filter-select { width: 100%; min-width: 0; box-sizing: border-box; flex: none; }
.lf-pair { display: flex; gap: 6px; min-width: 0; }
.lf-pair .filter-input { flex: 1 1 0; }
.lf-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.lf-active { font-size: 12px; color: var(--blue); font-weight: 600; }
@media (max-width: 1280px) { .lf-grid-6, .lf-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .lf-grid-4, .lf-grid-5, .lf-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .lf-grid-4, .lf-grid-5, .lf-grid-6 { grid-template-columns: minmax(0, 1fr); } }

.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--blue);
}

/* --- Table ----------------------------------------- */
.table-wrap {
  overflow-x: auto;
}

table.tr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tr-table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  text-align: left;
}

.tr-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.tr-table tr:last-child td { border-bottom: none; }
.tr-table tr:hover td { background: var(--gray-50); }
.tr-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tr-table .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; position: relative; }

/* ⋮-Menü (z. B. Bearbeitungsrechte je Firma im Admin-Panel) */
.dots-menu { position: relative; display: inline-block; }
.dots-menu-toggle { font-size: 18px; font-weight: 700; line-height: 1; }
.dots-menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  width: 260px; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); box-shadow: 0 12px 28px rgba(16,24,40,.16);
  padding: 12px;
}
/* Wird per JS bei Öffnung an <body> gehängt (Portal), um das Beschneiden
   durch überlaufende Eltern-Container (z.B. .table-wrap) zu vermeiden. */
.dots-menu-panel--open { z-index: 9999; }
.dots-menu-title { font-size: 11px; font-weight: 700; color: var(--gray-500); margin-bottom: 8px; }
.dots-menu-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 5px 2px; cursor: pointer;
}
.dots-menu-item input[type="checkbox"] { width: 15px; height: 15px; flex: 0 0 15px; }

.tr-dd { position: relative; display: inline-block; }
.tr-dd > summary {
  list-style: none;
  cursor: pointer;
}
.tr-dd > summary::-webkit-details-marker,
.tr-dd > summary::marker { display: none; content: none; }
.tr-dd-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 230px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  padding: 4px;
}
.tr-dd-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray-700);
}
.tr-dd-menu button:hover { background: var(--gray-50); color: var(--gray-900); }

/* --- Badges ---------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-orange  { background: #ffedd5; color: #c2410c; }
.badge-yellow  { background: #fef9c3; color: #a16207; }
.badge-gray    { background: var(--gray-200); color: var(--gray-600); }
.badge-purple  { background: #ede9fe; color: #6d28d9; }

/* --- KPI Cards ------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.kpi-value.blue  { color: var(--blue); }
.kpi-value.green { color: var(--green); }
.kpi-value.red   { color: var(--red); }
.kpi-value.orange{ color: var(--orange); }

.kpi-trend {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 6px;
}

/* --- Positions Table (Document) -------------------- */
.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}

.positions-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 8px 8px 8px 0;
  border-bottom: 2px solid var(--gray-200);
  text-align: left;
}

.positions-table td {
  padding: 6px 8px 6px 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
}

.positions-table .pos-input {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--gray-50);
  color: var(--gray-800);
  box-sizing: border-box;
}
.positions-table .pos-input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--white);
}

/* Artikel/Beschreibung: mehrzeilig, wächst nach unten statt zu scrollen */
textarea.pos-input {
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 32px;
  line-height: 1.35;
  font-family: inherit;
}

.pos-col-nr    { width: 32px; }
.pos-col-sku   { width: 112px; }
.pos-col-sku .pos-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pos-col-art   { width: 26%; }
.pos-add-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pos-pick-btn { padding-left: 11px; padding-right: 11px; }
.pos-col-desc  { width: auto; }
.pos-col-qty   { width: 64px; }
.pos-col-unit  { width: 60px; }
.pos-col-price { min-width: 96px; width: 1%; white-space: nowrap; }
.pos-col-mwst  { width: 68px; }
.pos-col-total { min-width: 108px; width: 1%; white-space: nowrap; text-align: right; }
.pos-col-del   { width: 32px; }

.pos-col-price .pos-input,
.pos-col-total .pos-total-field {
  white-space: nowrap;
}

.pos-total-field {
  text-align: right;
  font-weight: 600;
  color: var(--gray-800);
  padding: 6px 8px;
  white-space: nowrap;
}

.pos-delete-btn {
  width: 28px; height: 28px;
  border: none;
  background: none;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
.pos-delete-btn:hover { color: var(--red); background: var(--red-light); }

/* Totals Block */
.totals-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  min-width: 280px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--gray-600);
}

.totals-row.brutto {
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-900);
  border-top: 2px solid var(--gray-200);
  padding-top: 8px;
  margin-top: 4px;
}

/* --- Autocomplete Dropdown ------------------------- */
.autocomplete-wrap { position: relative; }

.autocomplete-results {
  position: fixed;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.autocomplete-results.open { display: block; }

.autocomplete-item {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--blue-light); color: var(--blue); }
.autocomplete-item .ac-price { font-size: 12px; color: var(--gray-400); }

/* --- Modal ----------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform .2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
}
.modal-close:hover { background: var(--gray-200); }

.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Confirm Modal variants */
.modal.modal-danger .modal-header { border-bottom-color: #fee2e2; }
.modal.modal-danger .modal-title  { color: var(--red); }

/* --- Pagination ------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 16px;
  justify-content: center;
}

.page-btn {
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--white);
  text-decoration: none;
  transition: all .15s;
  padding: 0 10px;
}

.page-btn:hover    { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.page-btn.active   { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* --- Admin Layout ---------------------------------- */
.admin-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-100);
}

.admin-topbar {
  background: var(--gray-900);
  color: var(--gray-300);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar-logo {
  display: flex; align-items: center; gap: 8px;
}
.admin-topbar-logo .mark {
  width: 30px; height: 30px; background: var(--blue); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff;
}
.admin-topbar-logo .name { font-size: 15px; font-weight: 700; color: #fff; }
.admin-topbar-logo .badge-admin {
  background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; letter-spacing: .5px;
  text-transform: uppercase;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-nav a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.active { background: var(--blue); color: #fff; }

.admin-content {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 28px 24px;
}

/* Für Seiten mit breiten/dichten Tabellen (z.B. Firmenliste mit vielen
   Aktions-Icons) — verhindert, dass die Aktionen-Spalte aus der Karte
   herausläuft/umbricht. */
.admin-content--wide { max-width: 1560px; }

/* --- Utility --------------------------------------- */
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--gray-500); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.d-none { display: none; }
.w-100  { width: 100%; }

/* --- Responsive ------------------------------------ */
/* --- Mobile Bottom-Tab-Bar -------------------------- */
.bottom-tab-bar {
  display: none;
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .page-content { padding: 14px; padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .demo-mode-banner { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }

  .bottom-tab-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 500;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-tab-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 2px 6px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    min-height: 56px;
  }
  .bottom-tab-icon { display: flex; align-items: center; justify-content: center; }
  .bottom-tab-icon svg { width: 20px; height: 20px; }
  .bottom-tab-item.active { color: var(--accent); }
  .bottom-tab-label { white-space: nowrap; }

  /* Admin-Panel: Topbar-Navigation waagerecht scrollbar statt umbrechend/abgeschnitten. */
  .admin-topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .admin-nav {
    order: 3; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .admin-nav a { flex-shrink: 0; }
  .admin-content { padding: 14px; }

  /* Primärer "Neu"-Button: auf dem Handy nur Icon + Kurzlabel statt langem
     Text — spart Platz in der (oft engen) Kopfzeile neben Import/Export. */
  .btn-new-full { display: none; }
  .btn-new-short { display: inline; }
  .page-header { flex-wrap: wrap; gap: 10px; }
  .page-header .flex.gap-2 { flex-wrap: wrap; }

  /* Tabellen -> Karten: Kopfzeile ausblenden, jede Zeile wird eine Karte mit
     Label/Wert-Paaren (Label kommt aus data-label auf dem <td>). Kein
     horizontales Scrollen mehr nötig, jede Zeile passt kompakt auf 1 Blick. */
  .table-wrap { overflow-x: visible; }
  table.tr-table thead { display: none; }
  table.tr-table, table.tr-table tbody, table.tr-table tr, table.tr-table td {
    display: block; width: 100%; box-sizing: border-box;
  }
  table.tr-table tr {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    padding: 4px 12px;
    background: #fff;
  }
  table.tr-table td {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    text-align: right; padding: 8px 0; border-bottom: 1px dashed var(--gray-100);
    white-space: normal; word-break: break-word;
  }
  table.tr-table td:last-child { border-bottom: none; }
  table.tr-table td::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 700; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: .4px;
    text-align: left; flex-shrink: 0; margin-right: auto;
  }
  table.tr-table td:not([data-label])::before { content: none; }
  table.tr-table td:not([data-label]) { justify-content: flex-end; }
  table.tr-table td.tr-card-title {
    font-size: 15px; font-weight: 700; color: var(--gray-900);
    justify-content: flex-start;
  }
  table.tr-table td.tr-card-title::before { content: none; }
  table.tr-table td.actions { justify-content: flex-end; flex-wrap: wrap; }

  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4, .form-row.cols-5 { grid-template-columns: 1fr; }

  /* Zahleneingaben (Menge/Preis) auf dem Handy: größere Tippfläche und
     mindestens 16px Schrift — verhindert das automatische Hineinzoomen
     von iOS Safari beim Fokussieren eines Feldes mit kleinerer Schrift
     (ein bekanntes, oft als „Ruckeln/Sprung“ wahrgenommenes iOS-Verhalten). */
  .positions-table .pos-input,
  .positions-table .pos-total-field,
  .positions-table .pos-mwst {
    font-size: 16px;
    min-height: 40px;
    padding: 8px 10px;
  }
  /* Größere Tippflächen für Lösch- und Speicher-Buttons (min. 40x40px). */
  .pos-delete-btn { width: 40px; height: 40px; flex-shrink: 0; }
  .pos-save-label { min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }

  /* Mengen-Feld: +/- Stepper-Buttons für bequeme Eingabe ohne Tastatur. */
  .qty-stepper { display: flex; align-items: stretch; gap: 3px; }
  .qty-stepper .pos-qty { text-align: center; width: 40px; flex: 1 1 auto; min-width: 0; padding-left: 2px; padding-right: 2px; }
  .qty-step-btn {
    width: 36px; min-width: 36px; flex-shrink: 0; min-height: 40px;
    border: 1.5px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 18px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .qty-step-btn:active { background: var(--gray-200); }

  /* ============================================================
     Positionszeilen -> Karten (Handy)
     ============================================================
     Ein klassisches <table>-Layout mit 9 Spalten quetscht auf schmalen
     Bildschirmen jede Spalte unter ihre Mindestbreite oder erzwingt
     horizontales Scrollen — beides schlecht bedienbar. Stattdessen wird
     jede Positions-Zeile zu einer Flexbox-"Karte": Artikel und
     Beschreibung bekommen die volle Zeilenbreite (je eine eigene Zeile),
     Menge/Einheit/Preis/MwSt./Gesamt folgen darunter als gemeinsame,
     umbrechende Gruppe — sitzen bei ausreichend Platz nebeneinander,
     rutschen sonst OHNE horizontales Scrollen einfach in die nächste
     Zeile (flex-wrap statt Tabellenspalten). */
  .positions-table thead { display: none; }
  .positions-table,
  .positions-table tbody,
  .positions-table tr.pos-row { display: block; width: 100%; }
  .positions-table tr.pos-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2px 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-200);
  }
  .positions-table tbody tr.pos-row:first-child { padding-top: 6px; }
  .positions-table td { display: block; border-bottom: none; padding: 4px 0; }

  /* Kartenkopf: Positionsnummer links, Speichern-/Löschen-Button rechts. */
  .positions-table .pos-col-nr {
    order: 1; flex: 0 0 auto; width: auto;
    font-size: 12px; font-weight: 700; color: var(--gray-400);
    padding-top: 8px !important;
  }
  .positions-table .pos-col-save { order: 2; flex: 0 0 auto; width: auto; margin-left: auto; }
  .positions-table .pos-col-del  { order: 3; flex: 0 0 auto; width: auto; }

  /* Artikel + Beschreibung: volle Breite, jeweils eine eigene Zeile
     (Beschreibung war zuvor auf dem Handy komplett ausgeblendet). */
  .positions-table .pos-col-sku,
  .positions-table .pos-col-art,
  .positions-table .pos-col-desc {
    order: 4; flex: 1 1 100%; width: 100%;
  }

  /* Menge/Einheit/Preis/MwSt./Gesamt: umbrechende Gruppe mit kleinen
     Beschriftungen (da die Tabellen-Kopfzeile ausgeblendet ist). */
  .positions-table .pos-col-qty,
  .positions-table .pos-col-unit,
  .positions-table .pos-col-price,
  .positions-table .pos-col-mwst,
  .positions-table .pos-col-total {
    order: 5;
    width: auto;
    position: relative;
    padding-top: 20px !important;
  }
  .positions-table .pos-col-qty   { flex: 0 1 128px; min-width: 118px; }
  .positions-table .pos-col-unit  { flex: 0 1 90px;  min-width: 72px; }
  .positions-table .pos-col-price { flex: 1 1 110px; min-width: 92px; }
  .positions-table .pos-col-mwst  { flex: 0 1 78px;  min-width: 68px; }
  .positions-table .pos-col-total { flex: 0 1 130px; min-width: 108px; text-align: right; }

  .positions-table .pos-col-qty::before,
  .positions-table .pos-col-unit::before,
  .positions-table .pos-col-price::before,
  .positions-table .pos-col-mwst::before,
  .positions-table .pos-col-total::before {
    content: attr(data-label);
    position: absolute;
    top: 0; left: 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .3px;
  }
  .positions-table .pos-col-total::before { left: auto; right: 0; }
}

/* ============================================================
   Kopieren/Einfügen-Hilfsbuttons (nur Touch-Geräte)
   ============================================================
   Auf Maus/Tastatur-Geräten unnötig (Strg+C/V funktioniert nativ) und
   daher standardmäßig ausgeblendet — erscheinen nur bei grobem
   Zeigegerät (Finger statt Maus), unabhängig von der Fenstergröße. */
.tr-clip-toolbar,
.tr-clip-inline { display: none; }

@media (pointer: coarse) {
  .tr-clip-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 3px;
  }
  .tr-clip-inline {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 6px;
    align-items: center;
  }
  .tr-clip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    padding: 0;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--gray-500);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
  }
  .tr-clip-btn:active { background: var(--gray-200); }
  .tr-clip-btn.is-done {
    background: var(--green-light, #dcfce7);
    border-color: var(--green, #16a34a);
    color: var(--green, #16a34a);
  }
}

@media (min-width: 901px) {
  /* Auf dem Desktop sind die Stepper-Buttons unnötig (Tastatur/Maus reichen). */
  .qty-step-btn { display: none; }
}

@media print {
  .sidebar, .settings-nav, .topbar, .btn, .filter-card, .page-header .btn, .bottom-tab-bar, .demo-mode-banner { display: none !important; }
  .main-content { margin-left: 0; }
  .has-settings-nav .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}

/* ============================================================
   Preloader — winziger, sympathischer Lade-Indikator
   ============================================================
   Erscheint bei jeder normalen Seiten-Navigation (Link-Klick) und bei
   jedem Formular-Absenden. Da es sich um eine klassische Mehrseiten-
   Anwendung handelt (kein SPA), löst sich der Indikator automatisch
   auf, sobald die neue Seite fertig geladen ist — es braucht dafür
   keinerlei explizites "Verstecken". Für den seltenen Fall, dass eine
   Navigation abgebrochen wird (z. B. Browser-Zurück aus dem
   Zwischenspeicher/bfcache), wird er per JS beim "pageshow"-Event
   sicherheitshalber ausgeblendet. */
.tr-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, .72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none; /* blockiert nie Klicks — ein „hängender“ Indikator darf den Nutzer nicht aussperren */
  transition: opacity .2s ease;
}
.tr-preloader.is-active {
  opacity: 1;
  transition-delay: .12s; /* sehr schnelle Seitenwechsel zeigen den Indikator gar nicht erst */
}
/* Große „t“-Marke in Bildschirmmitte mit mehreren auslaufenden Wellen */
.tr-preloader-inner { position: relative; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; }
.tr-preloader .tr-t-logo {
  width: 84px; height: 84px; border-radius: 22px; font-size: 56px; padding-left: 2px;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .38);
  position: relative; z-index: 2;
}
.tr-preloader .tr-t-logo::after { display: none; }
.tr-preloader-inner > i {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px;
  border-radius: 50%; border: 2px solid rgba(37, 99, 235, .55); background: rgba(37, 99, 235, .06);
  opacity: 0; animation: tr-wave 2.4s ease-out infinite;
}
.tr-preloader-inner > i:nth-child(2) { animation-delay: .6s; }
.tr-preloader-inner > i:nth-child(3) { animation-delay: 1.2s; }
.tr-preloader-inner > i:nth-child(4) { animation-delay: 1.8s; }
@keyframes tr-wave {
  0%   { transform: scale(.9); opacity: .85; }
  100% { transform: scale(4.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-preloader-inner > i { animation: none; display: none; }
}

/* Kanal-Abruf / Prüfung: Preloader in der Mitte, blockiert die Seite, Statustext darunter */
.tr-preloader--sync { flex-direction: column; gap: 64px; opacity: 1; pointer-events: auto; background: rgba(248, 250, 252, .88); }
.tr-sync-msg { max-width: min(420px, 88vw); text-align: center; font-size: 15px; font-weight: 600; line-height: 1.45; color: #1e293b; position: relative; z-index: 3; }
.tr-preloader--sync.is-done .tr-sync-msg { color: #15803d; }

/* „t“-Logo (wie das Favicon) mit pulsierendem Ring — Ladeanzeige & Fehlerseiten */
.tr-t-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font: 800 25px/1 Arial, Helvetica, sans-serif;
  padding-left: 1px;
  animation: tr-t-pulse 1.1s ease-in-out infinite;
}
.tr-t-logo::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 14px;
  border: 2px solid rgba(37, 99, 235, .45);
  animation: tr-t-ring 1.1s ease-out infinite;
}
.tr-t-lg { width: 64px; height: 64px; border-radius: 15px; font-size: 42px; }
.tr-t-lg::after { border-radius: 20px; inset: -7px; }
.tr-t-still, .tr-t-still::after { animation: none; }
.tr-t-still::after { display: none; }
.tr-boot { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--gray-50, #f8fafc); z-index: 99999; }
@keyframes tr-t-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes tr-t-ring {
  0% { transform: scale(.92); opacity: .9; }
  100% { transform: scale(1.25); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tr-t-logo, .tr-t-logo::after { animation: none; }
}

@media print {
  .tr-preloader { display: none !important; }
}

.dhl-board { display: flex; flex-direction: column; gap: 6px; }
.dhl-row {
  display: grid;
  grid-template-columns: 24px minmax(130px, .7fr) minmax(300px, 1.7fr) minmax(210px, 1.15fr) minmax(210px, 1.1fr);
  gap: 10px;
  align-items: start;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 10px;
}
.dhl-row.is-ok { background: #f0fdf4; border-color: #bbf7d0; }
.dhl-row.is-err { background: #fef2f2; border-color: #fecaca; }
.dhl-row input.dhl-check { margin-top: 3px; }
.dhl-col { font-size: 12px; line-height: 1.3; min-width: 0; }
.dhl-col input.dhl-in {
  width: 100%;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  min-width: 0;
}
.dhl-addr { display: flex; flex-direction: column; gap: 3px; }
.dhl-ar { display: grid; gap: 3px; }
.dhl-ar.ar1 { grid-template-columns: 1fr 1fr; }
.dhl-ar.ar2 { grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr); }
.dhl-ar.ar3 { grid-template-columns: 1fr 1.2fr 1fr; }
.dhl-ar.ar4 { grid-template-columns: 1fr 1fr; }
.dhl-meta { color: var(--gray-600); }
.dhl-meta strong { color: var(--gray-800); font-size: 13px; }
.dhl-line { display: flex; align-items: center; gap: 6px; font-family: ui-monospace, monospace; font-size: 12px; margin-bottom: 2px; }
.dhl-line span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dhl-line input.dhl-in { width: 58px; flex: 0 0 58px; text-align: right; }
.dhl-note {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 700; cursor: pointer; border: 0; padding: 0; margin-left: 4px;
}
.dhl-note-pop {
  display: none; margin-top: 6px; padding: 8px 10px; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 6px; color: #991b1b; white-space: pre-wrap; font-size: 12px;
}
.dhl-note-pop.is-open { display: block; }
.dhl-labels { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.dhl-label-list { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; align-content: flex-start; }
.dhl-label {
  flex: 1 1 130px; min-width: 120px; border: 1px solid var(--gray-200);
  border-radius: 6px; padding: 4px 8px; background: #fff; font-size: 12px; line-height: 1.3;
}
.dhl-label.is-draft { border-style: dashed; border-color: #fcd34d; background: #fffbeb; }
.dhl-label.is-done { border-color: #86efac; background: #fff; }
.dhl-label a { color: var(--blue); font-weight: 600; }
.dhl-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 8px; background: #fde68a; color: #92400e; }
.dhl-add {
  flex: 0 0 74px; align-self: stretch; margin-left: auto; border: 1px dashed #cbd5e1; border-radius: 6px;
  background: #fafafa; color: var(--gray-600); cursor: pointer; font-size: 12px; line-height: 1.3; text-align: center; padding: 4px;
}
.dhl-add:hover:not(:disabled) { background: #eff6ff; border-color: #93c5fd; color: var(--blue); }
.dhl-add:disabled { opacity: .5; cursor: not-allowed; }
.dhl-warn { color: #b45309; font-size: 11px; margin-top: 3px; }
.dhl-err { color: #b91c1c; font-size: 11px; margin-top: 3px; }
.dhl-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.dhl-dlg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.dhl-dlg[hidden] { display: none; }
.dhl-dlg-box { background: #fff; border-radius: 12px; padding: 18px 20px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dhl-dlg-box h3 { margin: 0 0 8px; font-size: 16px; }
.dhl-dlg-box p { margin: 0 0 12px; font-size: 13px; color: var(--gray-600); }
.dhl-dlg-box label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.dhl-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@media (max-width: 1180px) {
  .dhl-row { grid-template-columns: 24px minmax(120px, .8fr) minmax(280px, 1.8fr) minmax(190px, 1.2fr); }
  .dhl-row > .dhl-labels { grid-column: 2 / -1; }
}
@media (max-width: 980px) {
  .dhl-row { grid-template-columns: 24px 1fr; }
  .dhl-row > :not(.dhl-check) { grid-column: 2; }
}


/* --- Bestellungen: Kanal-Buttons + quadratische Werkzeug-Buttons --------- */
.orders-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding: 14px 16px; }
.orders-toolbar-channels { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.orders-channel { display: inline-flex; gap: 4px; margin: 0; }
.orders-toolbar-gap { width: 36px; flex: 0 0 36px; }
.orders-toolbar-tools { display: flex; align-items: center; gap: 8px; }

.btn-channel {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 0 20px;
  font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .2px; line-height: 1;
  color: var(--blue); background: #fff;
  border: 2px solid var(--blue); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s;
}
.btn-channel:hover { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn-channel svg { flex: 0 0 auto; }
.btn-channel-ico { font-size: 18px; line-height: 1; }
.btn-channel-mini { padding: 0; width: 46px; color: var(--gray-500); border-color: var(--gray-300); }
.btn-channel-mini:hover { background: var(--gray-700); border-color: var(--gray-700); color: #fff; box-shadow: none; }

.btn-square {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; padding: 0; flex: 0 0 46px;
  background: #fff; border: 2px solid var(--gray-300); border-radius: var(--radius-sm);
  color: var(--gray-600); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.btn-square svg { display: block; }
.btn-square-blue   { color: var(--blue);   border-color: var(--blue); }
.btn-square-purple { color: #7c3aed;       border-color: #7c3aed; }
.btn-square-orange { color: var(--orange); border-color: var(--orange); }
.btn-square-gray   { color: var(--gray-600); border-color: var(--gray-400); }
.btn-square-green  { color: #15803d;       border-color: #15803d; }
.btn-square-red    { color: #b91c1c;       border-color: #b91c1c; }
.btn-square-red:not([disabled]):hover    { background: #b91c1c;       color: #fff; }
.btn-square-green:not([disabled]):hover  { background: #15803d; color: #fff; }
.btn-square-blue:not([disabled]):hover   { background: var(--blue);   color: #fff; }
.btn-square-purple:not([disabled]):hover { background: #7c3aed;       color: #fff; }
.btn-square-orange:not([disabled]):hover { background: var(--orange); color: #fff; }
.btn-square-gray:not([disabled]):hover   { background: var(--gray-600); color: #fff; }
.btn-square[disabled] { opacity: .35; cursor: not-allowed; }


/* Sortierbare Tabellenköpfe */
a.th-sort { color: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; }
a.th-sort:hover { color: var(--blue, #2563eb); }
a.th-sort.is-active { color: var(--blue, #2563eb); }

/* ── Dashboard-Schnellzugriff (Icon-Buttons, von rechts nach links) ── */
.dash-shortcuts { display: flex; flex-direction: row-reverse; justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dash-shortcut {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: #fff; border: 1px solid var(--gray-200, #e5e7eb); color: var(--gray-600, #4b5563);
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.dash-shortcut svg { width: 20px; height: 20px; }
.dash-shortcut:hover { background: var(--blue, #2563eb); border-color: var(--blue, #2563eb); color: #fff; transform: translateY(-1px); }

/* ── Bestellungen: Split-Button „Bestellungen importieren“ + Kanal-Menü ── */
.orders-importer { position: relative; display: inline-block; }
.orders-importer-split { display: inline-flex; align-items: stretch; }
.orders-importer-main { margin: 0; display: inline-flex; }
.btn-channel-split-main { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-channel-split-caret { padding: 0; width: 38px; margin-left: -2px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.orders-importer.open .btn-channel-split-caret { background: var(--blue); color: #fff; }
.orders-importer-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0;
  display: flex; flex-direction: column; gap: 8px; min-width: 100%; padding: 8px;
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .15);
}
.orders-importer-menu[hidden] { display: none; }
.orders-importer-menu .orders-channel { display: flex; }
.orders-importer-menu .btn-channel { width: 100%; justify-content: flex-start; white-space: nowrap; }
.orders-importer-menu .btn-channel svg:last-child { margin-left: auto; }

/* Belegliste: Gruppierung nach Belegtyp */
.doc-groups { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.doc-group {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--gray-200); background: #fff;
  font-size: 13px; font-weight: 600; color: var(--gray-600); text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.doc-group:hover { border-color: var(--blue); color: var(--blue); }
.doc-group.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.doc-group-n {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 11px; font-weight: 700; background: var(--gray-100); color: var(--gray-600);
}
.doc-group.active .doc-group-n { background: rgba(255,255,255,.22); color: #fff; }

/* Belegliste: Dropdowns in der Tabelle (Zahlungsart / Status) */
.inline-select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--gray-200); border-radius: 6px; background-color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
  padding: 5px 24px 5px 9px; font-size: 12.5px; font-weight: 600; color: var(--gray-700);
  cursor: pointer; max-width: 150px; min-width: 104px;
}
.inline-select:hover:not(:disabled) { border-color: var(--blue); }
.inline-select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.inline-select:disabled { opacity: .6; cursor: default; }
.inline-select.is-green  { background-color: #ecfdf3; border-color: #a7e3be; color: #166534; }
.inline-select.is-blue   { background-color: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.inline-select.is-orange { background-color: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.inline-select.is-red    { background-color: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.inline-select.is-purple { background-color: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }

/* Belegliste: Aktionsmenü ("⋯") */
.act-menu { position: relative; display: inline-block; }
.act-list {
  z-index: 1000; min-width: 210px; padding: 6px; border-radius: 10px;
  background: #fff; border: 1px solid var(--gray-200);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}
.act-list[hidden] { display: none; }
.act-list form { margin: 0; }
.act-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 7px; background: none;
  font: inherit; font-size: 13px; color: var(--gray-700); text-align: left; text-decoration: none; cursor: pointer;
}
.act-item:hover { background: var(--gray-100); color: var(--blue); }
.act-item svg { flex: 0 0 15px; color: var(--gray-500); }
.act-item:hover svg { color: var(--blue); }
.act-item.act-danger, .act-item.act-danger svg { color: var(--red, #dc2626); }
.act-item.act-danger:hover { background: #fef2f2; }
.act-sep { height: 1px; margin: 5px 4px; background: var(--gray-200); }

/* Belegansicht: Kopfzeile + zweispaltiges Layout */
.docv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.docv-head-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.docv-back {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 8px; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-600); text-decoration: none; font-size: 16px;
}
.docv-back:hover { border-color: var(--blue); color: var(--blue); }
.docv-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.docv-title-row h2 { margin: 0; font-size: 22px; }
.docv-sub { margin-top: 4px; font-size: 13px; color: var(--gray-500); }
.docv-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.docv-actions .btn svg { vertical-align: -3px; margin-right: 2px; }
.docv-actions .btn-icon svg { margin-right: 0; }

.docv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 20px; align-items: start; }
.docv-main, .docv-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.docv-main > .card, .docv-side > .card { margin-bottom: 0 !important; }
@media (max-width: 1020px) { .docv-grid { grid-template-columns: minmax(0, 1fr); } }

.docv-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.docv-field > label { font-size: 12.5px; font-weight: 600; color: var(--gray-500); }
.docv-field-col { flex-direction: column; align-items: stretch; gap: 6px; }
.docv-inline { display: flex; gap: 8px; }
.docv-inline .form-control { flex: 1; min-width: 0; }
.docv-hint { margin: 6px 0 0; font-size: 12px; color: var(--gray-500); }
.docv-pay { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--gray-100); }
.docv-pay-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.docv-pay-row span { color: var(--gray-500); }
.docv-bar { height: 6px; border-radius: 999px; background: var(--gray-100); overflow: hidden; margin-top: 8px; }
.docv-bar span { display: block; height: 100%; background: var(--green, #16a34a); border-radius: 999px; }
.docv-mini { width: 100%; border-collapse: collapse; margin: 12px 0 4px; font-size: 12.5px; }
.docv-mini th { text-align: left; font-size: 11px; font-weight: 600; color: var(--gray-500); padding: 3px 0; }
.docv-mini td { padding: 4px 0; border-top: 1px solid var(--gray-100); vertical-align: top; }
.docv-details { margin-top: 12px; }
.docv-details > summary { list-style: none; cursor: pointer; display: inline-flex; }
.docv-details > summary::-webkit-details-marker { display: none; }
.docv-payform { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--gray-50); }
.docv-payform .form-group { margin: 0; }
.docv-kv { display: grid; grid-template-columns: 38% 1fr; gap: 6px 10px; margin: 0; font-size: 13px; }
.docv-kv dt { color: var(--gray-500); }
.docv-kv dd { margin: 0; word-break: break-word; }
.docv-side .form-row.cols-2 { grid-template-columns: 1fr; }


/* --- Anmeldung / Registrierung: Markenbereich (am-*) und Formular (lg-*) ------------------------ */
.auth-page--split .auth-marketing { display: none; }
.am {
  position: relative; overflow: hidden; color: #cbd5e1;
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a 0%, rgba(30,58,138,0) 60%),
              linear-gradient(165deg, #0b1b3f 0%, #0f1f4d 45%, #070d1f 100%);
  display: flex; padding: 44px 56px;
}
.am::before { /* feines Raster */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 75%); mask-image: radial-gradient(ellipse at 30% 30%, #000 0%, transparent 75%);
}
.am-glow { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.am-glow--a { width: 380px; height: 380px; right: -120px; top: 80px; background: rgba(59,130,246,.35); }
.am-glow--b { width: 300px; height: 300px; left: -100px; bottom: -80px; background: rgba(16,185,129,.18); }
.am-inner { position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; max-width: 640px; margin: 0 auto; min-height: calc(100vh - 88px); }
.am-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none !important; align-self: flex-start; }
.am-logo-mark { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg,#3b82f6,#2563eb); color: #fff; font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(37,99,235,.45); }
.am-logo-text { font-size: 23px; font-weight: 700; color: #fff; letter-spacing: -.2px; }
.am-logo-text span { color: #93c5fd; }
.am-body { margin: auto 0; padding: 36px 0 28px; }
.am-eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: #93c5fd; background: rgba(147,197,253,.1); border: 1px solid rgba(147,197,253,.25); padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
.am-title { font-size: clamp(1.7rem, 2.6vw, 2.4rem); font-weight: 800; line-height: 1.15; color: #fff; letter-spacing: -.5px; margin: 0 0 14px; }
.am-lead { font-size: 15.5px; line-height: 1.6; color: #b6c4dc; margin: 0 0 28px; max-width: 540px; }
.am-flow { list-style: none; display: flex; align-items: stretch; gap: 0; margin: 0 0 24px; padding: 0; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; overflow: hidden; }
.am-flow li { flex: 1; display: flex; align-items: center; gap: 9px; padding: 12px 14px; font-size: 12.5px; font-weight: 600; color: #e2e8f0; position: relative; }
.am-flow li + li { border-left: 1px solid rgba(255,255,255,.08); }
.am-flow li + li::before { content: '›'; position: absolute; left: -5px; top: 50%; transform: translateY(-52%); color: #64748b; font-size: 18px; background: #0f1f4d; line-height: 1; padding: 0 1px; }
.am-flow-ico { display: inline-flex; width: 30px; height: 30px; border-radius: 9px; align-items: center; justify-content: center; background: rgba(59,130,246,.2); color: #93c5fd; flex: none; }
.am-flow-ico svg { width: 16px; height: 16px; }
.am-flow-ico--ok { background: rgba(16,185,129,.2); color: #6ee7b7; }
.am-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.am-card { background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; padding: 15px 16px; transition: background .2s, border-color .2s, transform .2s; }
.am-card:hover { background: rgba(255,255,255,.075); border-color: rgba(147,197,253,.3); transform: translateY(-1px); }
.am-card-ico { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; background: rgba(59,130,246,.18); color: #93c5fd; margin-bottom: 9px; }
.am-card strong { display: block; color: #fff; font-size: 14px; margin-bottom: 3px; }
.am-card p { margin: 0; font-size: 12.5px; line-height: 1.5; color: #9fb0cc; }
.am-channels { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.am-channels-label { font-size: 12px; color: #8294b3; margin-right: 4px; }
.am-chip { font-size: 12px; font-weight: 600; color: #dbe7fb; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); padding: 4px 11px; border-radius: 999px; }
.am-foot { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px; color: #8294b3; }
.am-foot li { display: inline-flex; align-items: center; gap: 7px; }
.am-foot svg { width: 15px; height: 15px; color: #6ee7b7; }

.auth-page--split .auth-split { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }
.auth-page--split .auth-split-form { background: #f6f8fc; padding: 32px 24px; }
.lg-card { max-width: 440px; padding: 40px 40px 30px; border-radius: 18px; border: 1px solid #e6ebf3; box-shadow: 0 20px 50px -20px rgba(15,23,42,.18), 0 2px 6px rgba(15,23,42,.04); }
.lg-title { font-size: 24px; font-weight: 800; letter-spacing: -.3px; color: var(--gray-900); margin: 0 0 6px; }
.lg-sub { font-size: 14px; color: var(--gray-500); margin: 0 0 24px; line-height: 1.5; }
.lg-card .form-control { padding: 11px 14px; border-radius: 10px; }
.lg-card .form-control:focus { box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.lg-remember { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--gray-600); margin: 4px 0 18px; cursor: pointer; user-select: none; }
.lg-remember input { width: 16px; height: 16px; accent-color: var(--blue); }
.lg-submit { border-radius: 10px; font-weight: 700; box-shadow: 0 8px 18px -8px rgba(37,99,235,.7); }
.lg-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--gray-400); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.lg-divider::before, .lg-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }
.lg-register { border-radius: 10px; text-align: center; }
.lg-legal { text-align: center; font-size: 12px; color: var(--gray-400); margin: 22px 0 0; }
.lg-legal a { color: var(--gray-500); }
.lg-badge-ico { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: #eff6ff; color: var(--blue); margin-bottom: 16px; }
.lg-code { font-size: 22px; letter-spacing: 4px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.lg-tfa-offer { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px; padding: 10px 12px; }
.lg-tfa-offer .form-check { align-items: flex-start; }

@media (max-width: 1100px) { .am { padding: 36px 32px; } .am-grid { grid-template-columns: 1fr; } .am-flow li { padding: 10px; font-size: 12px; } }
@media (max-width: 900px) {
  .auth-page--split .auth-split { grid-template-columns: 1fr; }
  .am { padding: 22px 20px 26px; }
  .am-inner { min-height: 0; }
  .am-body { padding: 18px 0 0; margin: 0; }
  .am-title { font-size: 1.35rem; margin-bottom: 8px; }
  .am-lead { font-size: 13.5px; margin-bottom: 0; }
  .am-hide-sm { display: none !important; }
  .lg-card { padding: 28px 22px 22px; }
}

/* DHL-Prüfung: während des Erstellens keine weiteren Klicks */
#dhlBoardForm.is-busy .dhl-bar .btn { opacity: .6; pointer-events: none; }
#dhlBoardForm.is-busy .dhl-add { pointer-events: none; opacity: .6; }

/* Bestellungen › Handlungsbedarf (Storno / Gutschrift-Entwurf / Betragsdifferenz) */
.vorgang-box { margin-top: 6px; padding: 6px 8px; border: 1px dashed #fca5a5; background: #fef2f2; border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }


/* Schalter (an/aus) */
.tr-switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.tr-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.tr-switch-slider {
  position: relative; width: 46px; height: 26px; border-radius: 26px; background: var(--gray-300);
  transition: background .2s; flex: 0 0 46px;
}
.tr-switch-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.tr-switch input:checked + .tr-switch-slider { background: var(--green); }
.tr-switch input:checked + .tr-switch-slider::after { transform: translateX(20px); }
.tr-switch input:focus-visible + .tr-switch-slider { outline: 2px solid var(--blue); outline-offset: 2px; }
.tr-switch-label { font-size: 14px; font-weight: 600; }


/* Kanal-Meldungen: Fortschritt unten rechts */
.kanalq-toast {
  position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 2500;
  max-width: min(360px, calc(100vw - 28px)); padding: 10px 14px; border-radius: 10px;
  background: #1e293b; color: #fff; font-size: 13px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.kanalq-toast.is-done { background: #15803d; }
.kanalq-toast.is-error { background: #b91c1c; }
.kanalq-spin {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: kanalq-rot .8s linear infinite;
}
.kanalq-p { margin-top: 6px; font-size: 12px; opacity: .9; }
@keyframes kanalq-rot { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .kanalq-toast { bottom: calc(var(--m-dock-h, 58px) + 14px + env(safe-area-inset-bottom, 0px)); } }
