/* ============================================================
   STPS.OutputSolution — Design System
   Emerald admin look, light + dark, Inter + JetBrains Mono
   ============================================================ */

:root {
  /* Emerald primary (Tailwind emerald-600/500) */
  --color-primary:        #2e3862;
  --color-primary-hover:  #232b4d;
  --color-primary-soft:   #eef0f7;
  --color-primary-ring:   rgba(46, 56, 98, 0.22);
  --color-accent:         #ff6136;
  --color-accent-hover:   #f04a1f;
  --color-accent-soft:    #fff1ec;

  /* Surfaces — LIGHT */
  --color-bg-app:         #f8fafc;   /* slate-50 */
  --color-bg-subtle:      #f1f5f9;   /* slate-100 */
  --color-surface:        #ffffff;
  --color-surface-hover:  #f8fafc;
  --color-border:         #e2e8f0;   /* slate-200 */
  --color-border-strong:  #cbd5e1;   /* slate-300 */

  --color-text-primary:   #0f172a;   /* slate-900 */
  --color-text-secondary: #334155;   /* slate-700 */
  --color-text-muted:     #64748b;   /* slate-500 */
  --color-text-faint:     #94a3b8;   /* slate-400 */

  /* Semantic colors */
  --color-success:        #1e7d50;
  --color-success-bg:     #d8efe1;
  --color-success-text:   #0f5436;

  --color-warning:        #d97706;
  --color-warning-bg:     #fef3c7;
  --color-warning-text:   #92400e;

  --color-danger:         #dc2626;
  --color-danger-bg:      #fee2e2;
  --color-danger-text:    #991b1b;

  --color-info:           #2563eb;
  --color-info-bg:        #dbeafe;
  --color-info-text:      #1e40af;

  --color-neutral-bg:     #f1f5f9;
  --color-neutral-text:   #475569;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

  /* Radii */
  --radius-card:   12px;
  --radius-input:  8px;
  --radius-btn:    8px;
  --radius-pill:   9999px;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  64px;

  --font-ui:   'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --color-primary:        #6e7aae;
  --color-primary-hover:  #8a96c4;
  --color-primary-soft:   rgba(110, 122, 174, 0.16);
  --color-primary-ring:   rgba(110, 122, 174, 0.32);
  --color-accent:         #ff8b69;
  --color-accent-hover:   #ffa787;
  --color-accent-soft:    rgba(255, 97, 54, 0.16);

  --color-bg-app:         #0a0f14;
  --color-bg-subtle:      #0f172a;
  --color-surface:        #111827;
  --color-surface-hover:  #1f2937;
  --color-border:         #1f2937;
  --color-border-strong:  #334155;

  --color-text-primary:   #f1f5f9;
  --color-text-secondary: #cbd5e1;
  --color-text-muted:     #94a3b8;
  --color-text-faint:     #64748b;

  --color-success:        #10b981;
  --color-success-bg:     rgba(16, 185, 129, 0.14);
  --color-success-text:   #6ee7b7;

  --color-warning:        #f59e0b;
  --color-warning-bg:     rgba(245, 158, 11, 0.14);
  --color-warning-text:   #fcd34d;

  --color-danger:         #ef4444;
  --color-danger-bg:      rgba(239, 68, 68, 0.14);
  --color-danger-text:    #fca5a5;

  --color-info:           #3b82f6;
  --color-info-bg:        rgba(59, 130, 246, 0.14);
  --color-info-text:      #93c5fd;

  --color-neutral-bg:     rgba(148, 163, 184, 0.12);
  --color-neutral-text:   #cbd5e1;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

.mono { font-family: var(--font-mono); font-feature-settings: normal; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 10px; border: 2px solid var(--color-bg-app); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); }

/* ------------------------------------------------------------
   ds-card
   ------------------------------------------------------------ */
.ds-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-xs);
}
.ds-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ds-card-header h2, .ds-card-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text-primary); letter-spacing: -0.005em; }
.ds-card-body { padding: 20px; }

/* ------------------------------------------------------------
   ds-btn
   ------------------------------------------------------------ */
.ds-btn {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-text-primary);
  --btn-border: var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.05s;
  white-space: nowrap;
  user-select: none;
}
.ds-btn:hover:not(:disabled) { background: var(--color-surface-hover); }
.ds-btn:active:not(:disabled) { transform: translateY(0.5px); }
.ds-btn:focus-visible { outline: 2px solid var(--color-primary-ring); outline-offset: 2px; }
.ds-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ds-btn-primary {
  --btn-bg: var(--color-primary);
  --btn-fg: #ffffff;
  --btn-border: var(--color-primary);
}
.ds-btn-primary:hover:not(:disabled) { --btn-bg: var(--color-primary-hover); --btn-border: var(--color-primary-hover); }

.ds-btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--color-text-secondary);
}
.ds-btn-ghost:hover:not(:disabled) { background: var(--color-surface-hover); }

.ds-btn-danger {
  --btn-bg: var(--color-surface);
  --btn-fg: var(--color-danger);
  --btn-border: var(--color-border);
}
.ds-btn-danger:hover:not(:disabled) { --btn-bg: var(--color-danger-bg); --btn-border: var(--color-danger); }

/* Gefüllte Ja/Nein-Varianten für eindeutige Entscheidungs-Aktionen (z. B. Freigeben/Ablehnen). */
.ds-btn-success {
  --btn-bg: var(--color-success);
  --btn-fg: #ffffff;
  --btn-border: var(--color-success);
}
.ds-btn-success:hover:not(:disabled) {
  --btn-bg: color-mix(in oklab, var(--color-success) 86%, #000);
  --btn-border: color-mix(in oklab, var(--color-success) 86%, #000);
}

.ds-btn-danger-solid {
  --btn-bg: var(--color-danger);
  --btn-fg: #ffffff;
  --btn-border: var(--color-danger);
}
.ds-btn-danger-solid:hover:not(:disabled) {
  --btn-bg: color-mix(in oklab, var(--color-danger) 86%, #000);
  --btn-border: color-mix(in oklab, var(--color-danger) 86%, #000);
}

.ds-btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }
.ds-btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.ds-btn-block { width: 100%; }

/* ------------------------------------------------------------
   ds-input, ds-label, ds-select
   ------------------------------------------------------------ */
.ds-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0;
}
.ds-label-hint { color: var(--color-text-muted); font-weight: 400; }

.ds-input, .ds-select, .ds-textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}
.ds-textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; line-height: 1.5; }
.ds-input:focus, .ds-select:focus, .ds-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--color-text-faint); }
.ds-select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
/* Kompakte Variante für dichte Filter-/Toolbar-Zeilen (z. B. Schreiben-Liste, Worker-Log). */
.ds-select-sm,
.ds-input-sm {
    font-size: 11.5px;
    padding: 2px 6px;
    height: 26px;
}

/* ------------------------------------------------------------
   ds-badge
   ------------------------------------------------------------ */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  height: 22px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-bg);
  color: var(--color-neutral-text);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.ds-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.ds-badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.ds-badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.ds-badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger-text); }
.ds-badge-info    { background: var(--color-info-bg);    color: var(--color-info-text); }

/* ------------------------------------------------------------
   ds-alert
   ------------------------------------------------------------ */
.ds-alert {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  background: var(--color-neutral-bg);
  color: var(--color-text-secondary);
  font-size: 13px;
  border: 1px solid transparent;
}
.ds-alert-info    { background: var(--color-info-bg);    color: var(--color-info-text); }
.ds-alert-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.ds-alert-danger  { background: var(--color-danger-bg);  color: var(--color-danger-text); }
.ds-alert-success { background: var(--color-success-bg); color: var(--color-success-text); }

/* Sidebar-nav-Stile (.ds-nav-item, .ds-nav-icon) leben in NavItem.razor.css;
   .ds-nav-section in Sidebar.razor.css. */

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ds-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  white-space: nowrap;
}
.ds-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  vertical-align: middle;
}
.ds-table tbody tr { transition: background 0.1s; }
.ds-table tbody tr:hover { background: var(--color-surface-hover); cursor: pointer; }
.ds-table tbody tr:last-child td { border-bottom: 0; }
.ds-table .num { font-family: var(--font-mono); font-size: 12px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.ds-table-filter-row th { padding: 6px 16px; background: var(--color-bg-subtle); border-bottom: 1px solid var(--color-border); }
.ds-table-filter-input {
  width: 100%; box-sizing: border-box;
  height: 28px; padding: 0 8px;
  font-size: 12px; font-family: inherit;
  border: 1px solid var(--color-border); border-radius: 6px;
  background: var(--color-surface); color: var(--color-text-primary);
  outline: none; transition: border-color 0.15s;
}
.ds-table-filter-input::placeholder { color: var(--color-text-muted); }
.ds-table-filter-input:focus { border-color: var(--color-primary); }
.ds-table-filter-select {
  width: 100%; box-sizing: border-box;
  height: 28px; padding: 0 24px 0 8px;
  font-size: 12px; font-family: inherit;
  border: 1px solid var(--color-border); border-radius: 6px;
  background: var(--color-surface); color: var(--color-text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  outline: none; cursor: pointer; transition: border-color 0.15s;
}
.ds-table-filter-select:focus { border-color: var(--color-primary); }

/* Layout-Stile (.app-shell, .app-sidebar, .app-topbar, .app-content,
   .sidebar-brand) leben in MainLayout/Sidebar/Topbar.razor.css. */

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 32px 80px;
}
/* Volle Breite für Seiten, die den Platz brauchen (z. B. Aussendungs-Detail mit
   Liste + PDF-Vorschau). Padding der .page bleibt erhalten. */
.page-wide {
  max-width: none;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin: 0;
}
/* FocusOnNavigate (Routes.razor) setzt nach jeder Navigation den Fokus programmatisch
   auf die h1, damit Tastatur-/Screenreader-Nutzer am Hauptinhalt landen. Der Browser-
   Fokusrahmen stört dabei optisch; bei echter Tastaturnavigation (:focus-visible) bleibt
   er erhalten. */
.page-title:focus:not(:focus-visible) { outline: none; }
.page-subtitle {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

/* Dashboard KPI cards (farbig, mit Icon-Chip) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}
.kpi-card--info    { border-left-color: var(--color-info); }
.kpi-card--primary { border-left-color: var(--color-primary); }
.kpi-card--success { border-left-color: var(--color-success); }
.kpi-card--danger  { border-left-color: var(--color-danger); }

.kpi-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--color-neutral-bg);
  color: var(--color-neutral-text);
}
.kpi-card--info    .kpi-icon { background: var(--color-info-bg);      color: var(--color-info-text); }
.kpi-card--primary .kpi-icon { background: var(--color-primary-soft); color: var(--color-primary); }
.kpi-card--success .kpi-icon { background: var(--color-success-bg);   color: var(--color-success-text); }
.kpi-card--danger  .kpi-icon { background: var(--color-danger-bg);    color: var(--color-danger-text); }

.kpi-body { min-width: 0; }
.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.kpi-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
}
.kpi-hint {
  font-size: 11.5px;
  color: var(--color-text-faint);
}

/* Inline-Balken in Tabellen (Schreiben-Anzahl) */
.kpi-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.kpi-bar-track {
  flex: 1 1 auto;
  height: 6px;
  min-width: 32px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.kpi-bar-fill {
  display: block;
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Topbar (.topbar-tenant, .tenant-*, .avatar, .dropdown*, .breadcrumb)
   leben in Topbar.razor.css. */

/* Progress bar */
.progress {
  position: relative;
  height: 8px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease-out;
}
.progress-fill.indeterminate {
  width: 35% !important;
  animation: progress-indet 1.4s ease-in-out infinite;
}
@keyframes progress-indet {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Search box */
.search-box {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.search-box input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-ring); }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }

/* Focus styling */
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible {
  outline-offset: 2px;
}

/* ============================================================
   Konzept-update — additional shell components
   ============================================================ */

/* Tenant-Pill und Breadcrumb leben in Topbar.razor.css. */

/* ============================================================
   Prozess-Stepper (Aussendungs-Detail): Konfigurieren → … → Versendet
   ============================================================ */
.mailing-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 16px 4px;
  margin-bottom: 18px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card, 12px);
}
.mailing-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  text-align: center;
}
/* Verbindungslinie zwischen den Schritten (hinter den Kreisen). */
.mailing-step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 15px;            /* vertikale Mitte des Kreises (32px / 2 - 1px) */
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}
.mailing-step.is-done::before,
.mailing-step.is-active::before {
  background: color-mix(in srgb, var(--color-success) 55%, var(--color-border));
}
.mailing-step-circle {
  position: relative;
  z-index: 1;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-bg-subtle);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.mailing-step-label {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.25;
  padding: 0 4px;
}
/* Erledigt (success). */
.mailing-step.is-done .mailing-step-circle {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}
.mailing-step.is-done .mailing-step-label {
  color: var(--color-text-secondary);
}
/* Aktiv (info, fett). */
.mailing-step.is-active .mailing-step-circle {
  background: var(--color-info);
  border-color: var(--color-info);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-info) 18%, transparent);
}
.mailing-step.is-active .mailing-step-label {
  color: var(--color-text-primary);
  font-weight: 600;
}
/* Laufender, transienter Schritt — Lade-Spinner statt Nummer/Häkchen. */
.mailing-step-spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, #fff 45%, transparent);
  border-top-color: #fff;
  animation: mailing-step-spin 0.8s linear infinite;
}
@keyframes mailing-step-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .mailing-step-label { font-size: 10.5px; }
}

/* Dezenter dashed-Hinweis im Entwurf: noch keine Schreiben. */
.mailing-no-letters-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-card, 12px);
  background: transparent;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

/* Ablehnungs-Hinweis des Freigebers — gelbe Karte über der Konfiguration im Entwurf. */
.mailing-rejection-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid var(--color-warning-text);
  border-left-width: 4px;
  border-radius: var(--radius-card, 12px);
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}
.mailing-rejection-note strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.mailing-rejection-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.mailing-rejection-note-label {
  font-weight: 600;
  white-space: nowrap;
}

/* Kompakte Konfig-Zusammenfassung (Status „Produced"): Versandziel · Trennung · … */
.mailing-config-summary {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
}
.mailing-config-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
}
.mailing-config-summary-item .label {
  color: var(--color-text-muted);
}
.mailing-config-summary-item .value {
  color: var(--color-text-primary);
  font-weight: 500;
}

/* Aufklappbare Konfiguration (Status „Produced"+): native Disclosure-Marker ausblenden,
   eigener Chevron im Summary-Markup. */
.mailing-config-collapse > summary { list-style: none; }
.mailing-config-collapse > summary::-webkit-details-marker { display: none; }

/* ============================================================
   Native <dialog>-Modals — Backdrop, Surface, Header, Footer
   ============================================================ */
dialog.ds-dialog {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
    color: var(--color-text-primary);
    padding: 0;
    box-shadow: var(--shadow-lg);
    max-width: min(92vw, 1100px);
    max-height: 88vh;
    overflow: hidden;
}
/* WICHTIG: Browser-Default ist `display: none` für geschlossene <dialog>.
   Flex-Layout nur im offenen Zustand, sonst zeigen sie sich inline. */
dialog.ds-dialog[open] {
    display: flex;
    flex-direction: column;
}
dialog.ds-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
html[data-theme="dark"] dialog.ds-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}
.ds-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
}
.ds-dialog-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.005em;
}
.ds-dialog-body {
    padding: 20px;
    overflow: auto;
    flex: 1 1 auto;
}
.ds-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}
.ds-dialog-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    border-radius: var(--radius-input);
    line-height: 0;
}
.ds-dialog-close:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }

/* ============================================================
   Sidebar — Collapsed-Variante
   Selectoren liegen hier (statt im isolierten Sidebar.razor.css),
   weil die [data-sidebar-collapsed]-Marke am .app-shell hängt.
   ============================================================ */
.app-shell[data-sidebar-collapsed="true"] .sidebar-brand {
    flex-direction: column;
    padding: 14px 0;
    gap: 8px;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-brand > div:last-child {
    display: none;
}
/* Toggle bleibt im eingeklappten Zustand erreichbar (kein margin-left:auto,
   das ihn aus den 64px herausschieben würde). */
.app-shell[data-sidebar-collapsed="true"] .sidebar-toggle {
    margin-left: 0;
}
.app-shell[data-sidebar-collapsed="true"] .ds-nav-section {
    display: none;
}
.app-shell[data-sidebar-collapsed="true"] .ds-nav-item .ds-nav-label {
    display: none;
}
.app-shell[data-sidebar-collapsed="true"] .ds-nav-item {
    justify-content: center;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-footer {
    display: none;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-toggle-icon {
    transform: rotate(180deg);
}
/* Eingeklappt: breites Logo aus, quadratische Bildmarke an (verhindert das abgeschnittene
   Logo in der schmalen Spalte). Die Klassen kommen aus dem scoped Sidebar.razor.css; die
   Collapse-Marke hängt am .app-shell, deshalb leben diese Regeln hier global. */
.app-shell[data-sidebar-collapsed="true"] .sidebar-brand-full {
    display: none;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-brand-mark {
    display: flex;
}

.sidebar-toggle {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: var(--color-text-muted);
    padding: 4px;
    border-radius: var(--radius-input);
    cursor: pointer;
    line-height: 0;
    display: grid;
    place-items: center;
}
.sidebar-toggle:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}
.sidebar-toggle-icon {
    transition: transform 0.16s ease-out;
}

/* ============================================================
   Toaster (bottom-right)
   ============================================================ */
.ds-toaster {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1100;
    pointer-events: none;
}
.ds-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--color-text-primary);
    pointer-events: auto;
    animation: toast-in 0.16s ease-out;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ds-toast-msg { flex: 1; line-height: 1.4; }
.ds-toast-close {
    background: transparent;
    border: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px;
    line-height: 0;
    border-radius: 4px;
}
.ds-toast-close:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }

.ds-toast-success { border-left: 3px solid var(--color-success); }
.ds-toast-success > svg:first-of-type { color: var(--color-success); }
.ds-toast-warning { border-left: 3px solid var(--color-warning); }
.ds-toast-warning > svg:first-of-type { color: var(--color-warning); }
.ds-toast-danger  { border-left: 3px solid var(--color-danger); }
.ds-toast-danger  > svg:first-of-type { color: var(--color-danger); }
.ds-toast-info    { border-left: 3px solid var(--color-info); }
.ds-toast-info    > svg:first-of-type { color: var(--color-info); }

/* ============================================================
   Drawer (right side panel — inspection surface)
   ============================================================ */
.ds-drawer-shell {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 900;
}
.ds-drawer-scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0;
    transition: opacity 0.16s ease-out;
}
.ds-drawer {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(420px, 90vw);
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.18s ease-out;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}
.ds-drawer-shell.ds-drawer-open { pointer-events: auto; }
.ds-drawer-shell.ds-drawer-open .ds-drawer-scrim { opacity: 1; }
.ds-drawer-shell.ds-drawer-open .ds-drawer { transform: translateX(0); }
.ds-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}
.ds-drawer-header h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text-primary); }
.ds-drawer-close {
    background: transparent;
    border: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    border-radius: var(--radius-input);
}
.ds-drawer-close:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.ds-drawer-body { padding: 16px 20px; overflow: auto; flex: 1 1 auto; }

/* ============================================================
   Hinweis-Leiste (Banners above content)
   ============================================================ */
.ds-banner-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 24px 0;
}
.ds-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    font-size: 12.5px;
    color: var(--color-text-primary);
    background: var(--color-surface);
}
.ds-banner-msg { flex: 1; line-height: 1.4; }
.ds-banner-action {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-btn);
    background: var(--color-surface);
}
.ds-banner-action:hover { background: var(--color-surface-hover); }
.ds-banner-close {
    background: transparent;
    border: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px;
    line-height: 0;
    border-radius: 4px;
}
.ds-banner-close:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }

.ds-banner-info    { border-left: 3px solid var(--color-info); }
.ds-banner-info    > svg:first-of-type { color: var(--color-info); }
.ds-banner-success { border-left: 3px solid var(--color-success); }
.ds-banner-success > svg:first-of-type { color: var(--color-success); }
.ds-banner-warning { border-left: 3px solid var(--color-warning); }
.ds-banner-warning > svg:first-of-type { color: var(--color-warning); }
.ds-banner-danger  { border-left: 3px solid var(--color-danger); }
.ds-banner-danger  > svg:first-of-type { color: var(--color-danger); }

/* ============================================================
   Meta-Label (kleine Caps-Label über Wert-Feldern in Cards)
   ============================================================ */
.ds-meta-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================
   RichTextEditor (Mail-Body WYSIWYG, contenteditable)
   Eigenes, themenfähiges Styling (nur CSS-Variablen) — die
   Dropdown-Klassen aus dem Topbar sind component-scoped und
   greifen hier nicht, daher unter .rte nachgebildet.
   ============================================================ */
.rte {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    background: var(--color-surface);
    overflow: visible;
}
.rte-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
    border-top-left-radius: var(--radius-input);
    border-top-right-radius: var(--radius-input);
}
.rte-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    list-style: none;
}
.rte-tool:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}
.rte-tool::-webkit-details-marker { display: none; }
.rte-tool-text { white-space: nowrap; }
.rte-sep {
    width: 1px;
    align-self: stretch;
    margin: 4px 2px;
    background: var(--color-border);
}
.rte-placeholder { position: relative; }
.rte-placeholder > .dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 50;
}
.rte-placeholder:not([open]) > .dropdown-menu { display: none; }
.rte-placeholder > .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--color-text-primary);
    cursor: pointer;
}
.rte-placeholder > .dropdown-menu .dropdown-item:hover {
    background: var(--color-surface-hover);
}
.rte-token {
    font-size: 11px;
    color: var(--color-text-muted);
}
.rte-free {
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
    padding: 8px 10px 4px;
}
.rte-hint {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 6px;
}
.rte-linkbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}
.rte-surface {
    min-height: 220px;
    max-height: 480px;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text-primary);
    outline: none;
}
.rte-surface.is-readonly {
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
    cursor: default;
}
.rte-surface:empty::before {
    content: "Mailtext hier eingeben …";
    color: var(--color-text-faint);
}
.rte-surface a { color: var(--color-primary); }
.rte-surface ul { padding-left: 22px; margin: 8px 0; }
.rte-surface p { margin: 0 0 10px; }

/* Absender im Mailinhalt — read-only (zentral pro Mail-Domain gepflegt) */
.mail-from-readonly {
    padding: 10px 14px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    font-size: 13px;
    color: var(--color-text-secondary);
}
.ds-field-hint {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--color-text-muted);
}
/* Betreff-Zeile mit „Platzhalter einfügen"-Dropdown rechts neben dem Label */
.mailinhalt-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.mailinhalt-label-row .ds-label { margin-bottom: 0; }

/* ------------------------------------------------------------
   Log-Viewer-Zeilen (.live-log-*) — geteilt zwischen dem Live-Worker-Log-Panel
   (MailingWorkerLogPanel) und dem Fortschritts-Dialog (MailingProgressDialog). Beide
   Komponenten rendern dieselbe terminal-artige Zeilenoptik; weil zwei Komponenten betroffen
   sind, liegen die Zeilen-Klassen global statt scoped. Die jeweilige Hülle (Card/Dialog-Body)
   bleibt komponenten-lokal.
   ------------------------------------------------------------ */
.live-log-empty {
    padding: 18px;
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
    font-family: inherit;
}
.live-log-row {
    display: grid;
    grid-template-columns: 80px 36px auto 1fr;
    column-gap: 8px;
    padding: 4px 12px;
    border-bottom: 1px solid var(--color-border);
    align-items: baseline;
}
.live-log-row:last-child { border-bottom: 0; }
.live-log-time {
    color: var(--color-text-faint);
    font-size: 10.5px;
}
.live-log-level {
    font-weight: 600;
    font-size: 10px;
    letter-spacing: 0.05em;
    padding: 1px 4px;
    border-radius: 3px;
    text-align: center;
}
.live-log-step {
    color: var(--color-text-muted);
    font-size: 10.5px;
}
.live-log-msg {
    color: var(--color-text-primary);
    word-break: break-word;
    white-space: pre-wrap;
}
.live-log-ex {
    grid-column: 1 / -1;
    margin: 4px 0 0;
    color: var(--color-danger, #dc2626);
    font-size: 10.5px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 180px;
    overflow: auto;
    padding: 6px 8px;
    background: rgba(220, 38, 38, 0.05);
    border-radius: var(--radius-input);
}
.live-log-row.is-error  .live-log-level { background: rgba(220, 38, 38, 0.15); color: var(--color-danger, #dc2626); }
.live-log-row.is-warning .live-log-level { background: rgba(234, 179, 8, 0.18); color: #b45309; }
.live-log-row.is-debug   .live-log-level { background: rgba(120, 120, 120, 0.15); color: var(--color-text-muted); }
.live-log-row.is-info    .live-log-level { background: var(--color-primary-soft); color: var(--color-primary); }

/* Klickbare Step-/Letter-Chips als Filter-Trigger im Log-Row */
.live-log-step-btn,
.live-log-lid-btn {
    border: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
    color: var(--color-text-muted);
    font-size: 10.5px;
    padding: 1px 6px;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1.3;
}
.live-log-step-btn:hover,
.live-log-lid-btn:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.live-log-lid-btn {
    justify-self: end;
}

/* ------------------------------------------------------------
   Versandkosten-Auflistung (.preview-cost-*) — geteilt zwischen dem Freigabe-Dialog
   (ApproveDialog) und den Abschluss-Karten (MailingCompletionCards). Zwei Komponenten
   nutzen dieselbe Zeilenoptik, daher global statt scoped.
   ------------------------------------------------------------ */
.preview-cost {
    flex: 0 0 auto;
    border-top: 1px solid var(--color-border);
    padding: 10px 14px;
    background: var(--color-bg-subtle);
    font-size: 11.5px;
    max-height: 40%;
    overflow-y: auto;
}
.preview-cost-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.preview-cost-title {
    font-weight: 600;
    color: var(--color-text-primary);
}
.preview-cost-stand {
    color: var(--color-text-muted);
    font-size: 10.5px;
}
.preview-cost-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    color: var(--color-text-secondary);
}
.preview-cost-label {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.preview-cost-label .ds-badge {
    font-size: 9.5px;
}
.preview-cost-muted { color: var(--color-text-muted); }
.preview-cost-count {
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 48px;
}
.preview-cost-sum {
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 72px;
}
.preview-cost-total {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--color-border);
    font-weight: 600;
    color: var(--color-text-primary);
}
.preview-cost-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    color: var(--color-warning, var(--color-text-secondary));
    font-size: 10.5px;
}
.preview-cost-gross {
    font-weight: 600;
    color: var(--color-text-primary);
}

/* ─── PdfViewer (pdf.js-Wrapper, Components/Shared/PdfViewer.razor) ─── */
/* Bewusst ohne Rahmen/Radius: der Viewer ist neutral und füllt seinen Container —
   Card-Chrome macht, wer ihn einbettet (z. B. .elc-pdf-wrap). */
.os-pdfviewer {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--color-bg-subtle);
    overflow: hidden;
}
.os-pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-elevated, var(--color-bg-subtle));
    flex: 0 0 auto;
}
.os-pdf-search-input {
    flex: 1;
    min-width: 0;
    height: 28px;
    font-size: 12.5px;
}
.os-pdf-match-count {
    font-size: 11.5px;
    color: var(--color-text-muted);
    white-space: nowrap;
    padding: 0 4px;
}
.os-pdf-body {
    display: flex;
    flex: 1;
    min-height: 0;
}
.os-pdf-thumbs {
    flex: 0 0 84px;
    overflow-y: auto;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg-elevated, var(--color-bg-subtle));
}
.os-pdf-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    cursor: pointer;
}
.os-pdf-thumb:hover { border-color: var(--color-border); }
.os-pdf-thumb canvas {
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    background: #fff;
}
.os-pdf-thumb-label {
    font-size: 10px;
    color: var(--color-text-muted);
}
.os-pdf-pages {
    flex: 1;
    min-width: 0;
    overflow: auto;
    padding: 12px;
}
.os-pdf-status {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 12px;
    text-align: center;
}
.os-pdf-status-error { color: var(--color-danger-text, var(--color-danger)); }
.os-pdf-page {
    position: relative;
    margin: 0 auto 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    background: #fff;
}
.os-pdf-page canvas { display: block; }
/* Unsichtbarer Text-Layer über dem Canvas — macht den Inhalt per Maus selektier-/kopierbar.
   Positionierung/Skalierung jedes einzelnen Spans setzt pdf.js' TextLayer.render() inline;
   hier nur Sichtbarkeit, Cursor und die Auswahl-/Treffer-Optik. */
.os-pdf-textlayer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    line-height: 1;
    text-align: initial;
    opacity: 1;
}
.os-pdf-textlayer span, .os-pdf-textlayer br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
.os-pdf-textlayer ::selection { background: rgba(37, 99, 235, 0.35); }
.os-pdf-hit { background: rgba(250, 204, 21, 0.55); border-radius: 2px; color: transparent; }
.os-pdf-hit-current { background: rgba(249, 115, 22, 0.75); }
