/* ===== Dashboard / Settings Layout ===== */
.is-hidden { display: none !important; }
:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-hover: #F0F2F5;
  --border: #E2E5EA;
  --border-light: #EEF0F3;
  --text-primary: #1A1D23;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --accent: #2563EB;
  --accent-light: #EFF6FF;
  --accent-dark: #1D4ED8;
  --green: #059669;
  --green-bg: #ECFDF5;
  --green-border: #A7F3D0;
  --yellow: #D97706;
  --yellow-bg: #FFFBEB;
  --yellow-border: #FDE68A;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;
  --sidebar-bg: #111318;
  --sidebar-text: #9CA3AF;
  --sidebar-active: #FFFFFF;
  --sidebar-active-bg: rgba(255,255,255,0.08);
  --radius: 12px;
  --radius-sm: 6px;
  --text-muted: #9CA3AF;
  --bg-secondary: #F9FAFB;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 24px 12px;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  margin-bottom: 32px;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  font-weight: 700;
}

.sidebar-logo-text {
  color: white;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.sidebar-section { margin-bottom: 24px; }

.sidebar-section-title {
  color: var(--sidebar-text);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 12px;
  margin-bottom: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.sidebar-item:hover { background: var(--sidebar-active-bg); color: #D1D5DB; }
.sidebar-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); font-weight: 500; }
.sidebar-item .icon { width: 18px; text-align: center; font-size: 15px; opacity: 0.7; }
.sidebar-item.active .icon { opacity: 1; }

.sidebar-spacer { flex: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 8px;
  padding-top: 18px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user-name { color: #E5E7EB; font-size: 13px; font-weight: 500; }
.sidebar-user-plan { color: var(--sidebar-text); font-size: 11px; }
.sidebar-user-logout {
  margin-left: auto;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 15px;
  opacity: 0.6;
  transition: opacity 0.15s;
  background: none;
  border: none;
}
.sidebar-user-logout:hover { opacity: 1; }

/* ===== MAIN ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.header {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px; /* Titel stößt sonst an das Suchfeld */
  border-bottom: 1px solid var(--border-light);
  background: white;
}

.header-left h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.header-left p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.content { flex: 1; padding: 24px 32px; overflow-y: auto; }

/* ===== SETTINGS SECTIONS ===== */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  max-width: 1100px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.settings-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row.single {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: white;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-group input:disabled,
.form-group input[readonly] {
  background: var(--bg);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.form-group .input-hint {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* Häkchen mit Text daneben (statt Häkchen in voller Feldbreite über dem Text) */
.form-group .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
}

.form-group .checkbox-label input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.form-group select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: white;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: white;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

.billvox-address-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  border: 1px solid #BFDBFE;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent-dark);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.billvox-address-display .lock-icon {
  font-size: 12px;
  opacity: 0.6;
}

/* Buttons: einheitliche Höhe, kräftigere Typo, fühlbare Hover-/Fokus-/Active-Zustände */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .28); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .35);
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: 0 3px 8px rgba(37, 99, 235, .30); }
.btn-primary:disabled { background: var(--text-tertiary); box-shadow: none; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: #C7CDD6; }
.btn-secondary:disabled { color: var(--text-tertiary); box-shadow: none; cursor: not-allowed; transform: none; }

.btn-danger { background: #EF4444; color: white; box-shadow: 0 1px 2px rgba(239, 68, 68, .35); }
.btn-danger:hover { background: #DC2626; }

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

/* ===== SETTINGS DATA TABLE ===== */
.settings-section .data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
}

.settings-section .data-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.settings-section .data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
  vertical-align: middle;
}

.settings-section .data-table input[type="number"],
.settings-section .data-table input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: white;
  outline: none;
  box-sizing: border-box;
}

.settings-section .data-table input[type="number"]:focus,
.settings-section .data-table input[type="text"]:focus {
  border-color: var(--accent);
}

.settings-section .data-table select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: white;
  outline: none;
}

.settings-section .data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ===== ALERTS ===== */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
}

.alert-success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.alert-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* ===== SIDEBAR BADGE ===== */
.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
}

/* ===== HEADER SEARCH ===== */
.header-right { display: flex; align-items: center; gap: 10px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  min-width: 260px;
  transition: border-color 0.15s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.search-box .search-icon { font-size: 14px; color: var(--text-tertiary); flex-shrink: 0; }

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.search-box input::placeholder { color: var(--text-tertiary); }

/* ===== STATS GRID ===== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-card-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }

.stat-card-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}

.stat-card-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1; margin-bottom: 4px; }
.stat-card-change { font-size: 12px; color: var(--text-tertiary); }

/* ===== EXPORT BAR ===== */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.export-bar-left { display: flex; align-items: center; gap: 0.75rem; }
.export-bar-right { display: flex; align-items: center; gap: 0.5rem; }
.export-bar-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.export-date-label { font-size: 12.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 0.25rem; }
.export-date-input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-primary);
  background: var(--bg);
  font-family: inherit;
}
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }

/* ===== CONTENT LAYOUT (Table + Detail Panel) ===== */
.content-layout {
  display: flex;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.content-main {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  min-width: 0;
}

/* ===== TAB BAR ===== */
.table-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.table-header h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }

.table-tabs { display: flex; gap: 2px; background: var(--bg); border-radius: 7px; padding: 2px; }

.table-tab {
  padding: 5px 14px; font-size: 12.5px; font-weight: 500; border-radius: 5px;
  color: var(--text-secondary); cursor: pointer; border: none; background: none; font-family: 'DM Sans', sans-serif;
  transition: all 0.12s;
}
.table-tab:hover { color: var(--text-primary); }
.table-tab.active { background: white; color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ===== INVOICE TABLE ===== */
table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 10px 20px; text-align: left; font-size: 11.5px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-light); background: var(--bg);
}

tbody tr { border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child { border-bottom: none; }
tbody tr.selected { background: var(--accent-light); }
tbody td { padding: 14px 20px; font-size: 13.5px; }

.invoice-sender { font-weight: 500; }
.invoice-sender-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; }

.invoice-amount { white-space: nowrap; font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 13px; letter-spacing: -0.3px; }

.invoice-format {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; padding: 3px 8px;
  border-radius: 5px; background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary); font-weight: 500;
}

.invoice-date { white-space: nowrap; color: var(--text-secondary); font-size: 13px; }

/* ===== STATUS BADGES ===== */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; }

.status-valid { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.status-valid .status-dot { background: var(--green); }
.status-warning { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.status-warning .status-dot { background: var(--yellow); }
.status-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.status-error .status-dot { background: var(--red); }
.status-new { background: var(--accent-light); color: var(--accent); border: 1px solid #BFDBFE; }
.status-new .status-dot { background: var(--accent); }
.status-archived { background: var(--bg); color: var(--text-tertiary); border: 1px solid var(--border); }
.status-archived .status-dot { background: var(--text-tertiary); }
.status-quota { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }
.status-quota .status-dot { background: #C2410C; }

/* ===== SKONTO BADGE ===== */
.skonto-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.skonto-green {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}
.skonto-orange {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.skonto-red {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

/* ===== PAGINATION ===== */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.pagination { display: flex; gap: 4px; }

.pagination-btn {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: white;
  font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.12s;
}
.pagination-btn:hover { background: var(--surface-hover); }
.pagination-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== DETAIL PANEL ===== */
.detail-panel {
  width: 400px;
  background: white;
  border-left: 1px solid var(--border-light);
  overflow: hidden;
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.detail-panel.open { display: flex; }

.detail-panel-inner {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.detail-panel-header h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }

.detail-close {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: white; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; color: var(--text-secondary);
  transition: all 0.12s;
}
.detail-close:hover { background: var(--surface-hover); }

.detail-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }

.detail-meta-item { padding: 10px 12px; background: var(--bg); border-radius: var(--radius-sm); }
.detail-meta-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500; margin-bottom: 3px; }
.detail-meta-value { font-size: 13.5px; font-weight: 600; }
.detail-meta-value.mono { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }

.detail-section-title {
  font-size: 11.5px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; margin-top: 20px;
}

/* ===== VALIDATION CARDS ===== */
.validation-card { border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; }
.validation-card.error { background: var(--red-bg); border: 1px solid var(--red-border); }
.validation-card.warning { background: var(--yellow-bg); border: 1px solid var(--yellow-border); }
.validation-card.success { background: var(--green-bg); border: 1px solid var(--green-border); }

.validation-card-header { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.validation-card.error .validation-card-header { color: var(--red); }
.validation-card.warning .validation-card-header { color: var(--yellow); }
.validation-card.success .validation-card-header { color: var(--green); }

.validation-card-body { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }

/* ===== PAYMENT INFO ===== */
.payment-section {
  margin-top: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

.payment-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payment-field {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}

.payment-field-label {
  color: var(--text-tertiary);
  font-weight: 500;
  min-width: 42px;
  flex-shrink: 0;
}

.payment-field-value {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  word-break: break-all;
}

/* ===== GIROCODE ===== */
.girocode-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-light);
}

.girocode-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.girocode-qr {
  width: 140px;
  height: 140px;
}

.girocode-qr svg {
  width: 100%;
  height: 100%;
}

.girocode-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* ===== DETAIL ACTIONS ===== */
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.detail-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.12s;
}

.detail-action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.detail-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-action-btn .icon { width: 18px; text-align: center; font-size: 14px; }

.detail-action-btn.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: var(--radius);
  width: 520px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-tertiary);
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-field {
  margin-bottom: 16px;
}

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: white;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.modal-input:disabled {
  background: var(--bg);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.modal-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: white;
  box-sizing: border-box;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.15s;
}

.modal-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.modal-hint {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.modal-errors-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 8px;
  margin-top: 8px;
}

.modal-errors-list {
  margin: 0;
  padding-left: 20px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  padding: 12px 12px 12px 32px;
  list-style: disc;
}

.modal-errors-list li {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-errors-list li strong {
  color: var(--text-primary);
}

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

/* ===== EMAIL PREVIEW MODAL ===== */
.email-preview-modal {
  width: 900px;
  max-width: 90vw;
  max-height: 90vh;
}

.email-preview-body {
  padding: 0;
  min-height: 400px;
}

.email-preview-iframe {
  width: 100%;
  min-height: 400px;
  max-height: 65vh;
  border: none;
  display: block;
}

.email-preview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.email-preview-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--red);
  font-size: 13px;
  padding: 24px;
  text-align: center;
}

/* ===== ADMIN: USER STATUS BADGES ===== */
.user-status-active {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border);
}

.user-status-unconfirmed {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border);
}

.user-status-inactive {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border);
}

.badge-admin {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: var(--accent-light); color: var(--accent); border: 1px solid #BFDBFE;
  margin-left: 4px;
}

/* ===== ADMIN: PLAN BADGES ===== */
.badge-plan-free,
.badge-plan-starter,
.badge-plan-business {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}

.badge-plan-free { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-plan-starter { background: var(--accent-light); color: var(--accent); border: 1px solid #BFDBFE; }
.badge-plan-business { background: #F5F3FF; color: #7C3AED; border: 1px solid #DDD6FE; }

/* ===== ADMIN: MODAL CHECKBOX ROW ===== */
.modal-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.modal-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.modal-checkbox-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

/* ===== ADMIN: MODAL META INFO ===== */
.modal-meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.modal-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-meta-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal-meta-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ===== ADMIN: MODAL WIDER VARIANT ===== */
.modal-wide {
  width: 620px;
}

/* ===== ADMIN: MODAL TWO-COL LAYOUT ===== */
.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== QUOTA BANNER ===== */
.quota-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  color: #9A3412;
}

.quota-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.quota-banner-text {
  flex: 1;
  line-height: 1.5;
}

.quota-banner-text strong {
  font-weight: 600;
  color: #7C2D12;
}

.quota-banner-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: white;
  transition: all 0.15s;
}

.quota-banner-link:hover {
  background: var(--accent);
  color: white;
}

/* ===== QUOTA LOCK NOTICE (Detail Panel) ===== */
.quota-lock-notice {
  text-align: center;
  padding: 28px 20px;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: var(--radius);
  margin-top: 20px;
}

.quota-lock-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.quota-lock-title {
  font-size: 15px;
  font-weight: 700;
  color: #9A3412;
  margin-bottom: 8px;
}

.quota-lock-desc {
  font-size: 13px;
  color: #78350F;
  line-height: 1.6;
  margin-bottom: 20px;
}

.quota-lock-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.quota-lock-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.quota-lock-btn-primary:hover {
  background: var(--accent-dark);
}

.quota-lock-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.quota-lock-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== PLAN SECTION (Settings) ===== */
.plan-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.plan-current-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.plan-badge-free { background: #F3F4F6; color: #6B7280; }
.plan-badge-starter { background: #EFF6FF; color: #2563EB; }
.plan-badge-business { background: #F0FDF4; color: #059669; }

.plan-current-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-current-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-current-price {
  font-size: 12px;
  color: var(--text-secondary);
}

.plan-quota {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-quota-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-quota-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.plan-quota-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.plan-quota-fill.green { background: var(--green); }
.plan-quota-fill.yellow { background: var(--yellow); }
.plan-quota-fill.red { background: var(--red); }

.plan-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.plan-btn-upgrade {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}

.plan-btn-upgrade:hover { background: var(--accent-dark); }

.plan-btn-manage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.plan-btn-manage:hover { border-color: var(--accent); color: var(--accent); }

.plan-subscription-info {
  padding: 12px 16px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-subscription-info.warning {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
  color: var(--yellow);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state-desc { font-size: 13px; }

/* ===== LOADING STATE ===== */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ===== FEEDBACK ===== */
.modal-overlay.modal-hidden {
  display: none !important;
}

/* Feedback Button */
.sidebar-feedback-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-feedback-btn:hover {
  background: rgba(255,255,255,0.12);
  color: var(--sidebar-active);
  border-color: rgba(255,255,255,0.3);
}

/* ===== TEMPLATE VARIABLES INFO ===== */
.template-vars-info {
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.template-vars-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.template-vars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  font-size: 12px;
  color: var(--text-secondary);
}

.template-vars-grid code {
  display: inline-block;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 11px;
  color: var(--accent);
  margin-right: 4px;
}

.template-vars-note {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== CHART SECTION ===== */
.chart-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

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

.chart-header h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.chart-period-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: white;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.chart-period-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.chart-container {
  padding: 20px;
  position: relative;
  height: 300px;
}
.timeline-chart svg:first-child { display: block; width: 100%; height: 230px; }
.timeline-legend { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ===== ZUGFERD COMPARISON VIEW ===== */
.compare-modal {
  width: 95vw;
  max-width: 1400px;
  height: 85vh;
  max-height: 85vh;
}

.compare-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.compare-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.compare-pane + .compare-pane {
  border-left: 1px solid var(--border);
}

.compare-pane-header {
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.compare-pane-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.compare-pane-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.compare-pane-content object {
  width: 100%;
  height: 100%;
  display: block;
}

.compare-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  font-size: 13px;
}

.compare-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--red);
  font-size: 13px;
  padding: 20px;
  text-align: center;
}

.compare-pdf-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 20px;
  text-align: center;
}

.compare-pdf-fallback .btn {
  margin-top: 4px;
}

@media (max-width: 768px) {
  .compare-body { flex-direction: column; }
  .compare-pane + .compare-pane { border-left: none; border-top: 1px solid var(--border); }
  .compare-modal { width: 98vw; height: 90vh; }
}

/* ===== CREATE BUTTON (shared) ===== */
.btn-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3);
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-create:hover {
  background: var(--accent-dark);
  box-shadow: 0 2px 6px rgba(37,99,235,0.4);
  transform: translateY(-1px);
}

/* ===== MD-MODAL (shared overlay modal for outgoing/masterdata) ===== */
.md-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.md-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.md-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 540px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform 0.2s;
}
.md-modal-overlay.visible .md-modal {
  transform: translateY(0);
}

.md-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.md-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.md-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.12s;
}
.md-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.md-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.md-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.md-form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}
.md-form-group input,
.md-form-group select,
.md-form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  background: white;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}
.md-form-group input:focus,
.md-form-group select:focus,
.md-form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.md-form-group textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}
.md-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.md-form-row .md-form-group {
  margin-bottom: 0;
}
.md-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.md-form-checkbox input[type="checkbox"] {
  width: auto;
}

.md-modal-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.md-modal-alert.error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
  display: block;
}
.md-modal-alert.success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  display: block;
}

.md-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ===== BUTTON SPINNER (shared) ===== */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
.btn-secondary .btn-spinner {
  border-color: rgba(0,0,0,0.15);
  border-top-color: currentColor;
}
.btn-danger .btn-spinner {
  border-color: rgba(239,68,68,0.2);
  border-top-color: currentColor;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .detail-panel { width: 340px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 16px; }
  .content-main { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .settings-section { padding: 18px 20px; }
  .stats-row { grid-template-columns: 1fr; }
  /* Detail als Vollbild-Overlay (vorher ganz ausgeblendet – auf dem Handy nicht zu öffnen) */
  /* unter den Dialogen (z-index 1000), sonst öffnen sich Versand/Storno/Rückfragen unsichtbar dahinter */
  .detail-panel { position: fixed; inset: 0; width: 100% !important; z-index: 900; border-left: none; }
  .detail-panel:not(.open) { display: none !important; }
  .search-box { min-width: 180px; }
  .chart-container { height: 220px; }
  .chart-header { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* --- Manueller Beleg-Upload: Drag&Drop-Zustand --- */
.table-section.drop-active {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-light, #eef2ff);
}

/* --- Responsive: schmale Viewports (Smartphone) --- */
@media (max-width: 760px) {
  /* Tabellen horizontal scrollen statt das Layout zu sprengen */
  .table-section { overflow-x: auto; }
  .table-section table { min-width: 640px; }
  /* Export-Leiste und Tabellen-Header umbrechen lassen */
  .export-bar, .table-header { flex-wrap: wrap; gap: 8px; }
  /* Statistik-Karten einspaltig */
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* ===== EMPFANGSADRESSE (Posteingang-Karte) ===== */
.receiving-card {
  /* dashboard.js setzt display:flex beim Einblenden */
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.receiving-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.receiving-card-label {
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}
.receiving-card-address {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #BFDBFE;
  user-select: all;
}
.receiving-card-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
  flex-wrap: wrap;
}
.receiving-card-dismiss {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.receiving-card-dismiss:hover { color: var(--text-primary); background: var(--surface-hover); }
.receiving-card-qr { width: 128px; height: 128px; }
.receiving-card-hint {
  color: var(--text-tertiary);
  font-size: 12px;
  border-top: 1px dashed var(--border-light);
  padding-top: 8px;
}

/* ===== ZWEI-FAKTOR-AUTHENTIFIZIERUNG (Einstellungen) ===== */
.twofa-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.twofa-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.twofa-badge-on  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.twofa-badge-off { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); }
.twofa-status-text { color: var(--text-secondary); flex: 1; min-width: 220px; }
.twofa-status-actions { display: flex; gap: 8px; }

.twofa-setup {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex-wrap: wrap;
}
.twofa-qr {
  width: 176px;
  height: 176px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.twofa-qr svg { width: 100%; height: 100%; display: block; }
.twofa-qr-fallback { font-size: 12px; color: var(--text-secondary); text-align: center; padding: 8px; }
.twofa-setup-steps { flex: 1; min-width: 260px; }
.twofa-setup-steps ol {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}
.twofa-secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.twofa-secret-row code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  letter-spacing: .08em;
  user-select: all;
}
.twofa-confirm-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.twofa-code-input {
  width: 140px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  letter-spacing: .25em;
  text-align: center;
}
.twofa-code-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* Upload-Button im Tabellen-Header rechtsbuendig */
.table-header { gap: 12px; }
.table-header #uploadInvoiceBtn { margin-left: auto; }

/* ===== TOASTS (Ersatz fuer alert) ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 48px));
}
.toast {
  background: #1F2430;
  color: #F3F4F6;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  border-left: 3px solid #6B7280;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  white-space: pre-line;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: #34D399; }
.toast-error   { border-left-color: #F87171; }

/* ===== DIALOGE (Ersatz fuer confirm/prompt) ===== */
.app-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 24, .45);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.app-dialog {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  padding: 22px 24px;
  width: 100%;
  max-width: 420px;
}
.app-dialog-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.app-dialog-message {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-line;
}
.app-dialog-input {
  width: 100%;
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
}
.app-dialog-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
/* Häkchen im Dialog (appAuswahl) */
.app-dialog-haken { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 0; font-size: 14px; cursor: pointer; }
.app-dialog-haken input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; }
.app-dialog-haken small { color: var(--text-secondary); font-size: 12.5px; }
.app-dialog-haken + .app-dialog-actions { margin-top: 18px; }
.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Handwerk-Funktionen ausgeschaltet (Einstellungen → Arbeitsweise) */
.ohne-handwerk .nur-handwerk { display: none !important; }
/* Gegenstück: Text nur ohne Handwerk-Modus (z. B. "Lieferanschrift" statt "Baustelle") */
html:not(.ohne-handwerk) .nur-ohne-handwerk { display: none !important; }

/* ===== SVG-ICONS (Feather Icons (MIT, © Cole Bemis), erben currentColor) ===== */
.sidebar-item .icon svg { width: 16px; height: 16px; display: block; }
.settings-subnav-item .ico svg { width: 15px; height: 15px; display: block; }
.stat-card-icon svg { width: 16px; height: 16px; display: block; }
.receiving-card-label svg { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; margin-right: 7px; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-feedback-btn svg { width: 15px; height: 15px; flex-shrink: 0; margin-right: 8px; vertical-align: -2px; display: inline-block; }
.sidebar-user-logout svg { width: 16px; height: 16px; display: block; }

/* Stat-Icon-Farbvarianten (vorher Inline-Styles, von der frueheren CSP geblockt) */
.stat-icon-accent { background: var(--accent-light); color: var(--accent); }
.stat-icon-green  { background: var(--green-bg);  color: var(--green); }
.stat-icon-red    { background: var(--red-bg);    color: var(--red); }
.stat-icon-yellow { background: var(--yellow-bg); color: var(--yellow); }

/* ===== TABELLEN-FEINSCHLIFF ===== */
/* Lange Absendernamen/Betreffs einzeilig mit Ellipsis (Tooltip via title-Attribut) */
.invoice-sender,
.invoice-sender-sub {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== SKELETON-LOADER (Posteingang) ===== */
.skeleton-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border-light) 25%, #F5F6F8 40%, var(--border-light) 60%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-row td { padding-top: 16px; padding-bottom: 16px; }
.skeleton-row td:nth-child(1) .skeleton-bar { width: 75%; }
.skeleton-row td:nth-child(2) .skeleton-bar { width: 60%; }
.skeleton-row td:nth-child(3) .skeleton-bar { width: 40%; }
.skeleton-row td:nth-child(4) .skeleton-bar { width: 65%; }
.skeleton-row td:nth-child(5) .skeleton-bar { width: 55%; }
.skeleton-row td:nth-child(6) .skeleton-bar { width: 70%; }
.skeleton-row td:nth-child(7) .skeleton-bar { width: 60%; }

/* ===== EDITIERBARE STAMMDATEN-TABELLEN (settings-masterdata.js / settings-apikeys.js) ===== */
/* Ersetzt frühere Inline-Styles in den JS-Templates (CSP-Regel: keine style-Attribute) */
.data-table-edit { margin-top: 8px; }
.data-table-edit .pt-label { width: 140px; }
.data-table-edit .pt-text { width: 200px; }
.data-table-edit .pt-days,
.data-table-edit .pt-skontotage { width: 60px; }
.data-table-edit .pt-skonto,
.data-table-edit .vr-rate { width: 70px; }
.data-table-edit .vr-label { width: 160px; }
.data-table .cell-center { text-align: center; }
.data-table .cell-right { text-align: right; }
.data-table .cell-actions { white-space: nowrap; }
.data-table .cell-actions .btn + .btn { margin-left: 4px; }
.data-table .cell-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Leere-Tabelle-Hinweis (statt Inline-Style) */
.table-empty-hint {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 12px 0;
}

/* Plan-Sektion: Hinweis neben dem Kontingent-Label */
.plan-quota-note {
  color: var(--text-tertiary);
  font-weight: 400;
}

/* API-Key-Anzeige nach dem Erstellen (einmalige Einblendung) */
.apikey-reveal-intro { margin-bottom: 8px; }
.apikey-reveal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.apikey-reveal-code {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-secondary, #F7F8FA);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  word-break: break-all;
}
.apikey-copy-btn { white-space: nowrap; }
.apikey-reveal-warning {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ===== KATEGORIEN (Eingangsbelege) ===== */
.category-filter {
  margin-left: auto;
  margin-right: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  max-width: 190px;
}

.detail-category-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.detail-category-input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.detail-category-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== EMPTY-STATE: TESTRECHNUNG ===== */
.empty-state-demo-btn {
  margin-top: 14px;
}

/* ===== PFLICHTFELDER + INLINE-FELDFEHLER ===== */
.required-label::after,
label.required::after {
  content: " *";
  color: var(--red);
  font-weight: 600;
}

.field-error-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--red);
}

input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px var(--red-bg);
}

/* ===== AUTOSAVE-STATUS (Rechnungseditor) ===== */
.autosave-status {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: 10px;
  white-space: nowrap;
  transition: color .3s;
}
.autosave-status.saving { color: var(--yellow); }
.autosave-status.saved { color: var(--green); }
.autosave-status.error { color: var(--red); }

/* ===== DARK MODE =====
   Automatisch via prefers-color-scheme: Variablen-Overrides reichen,
   da die App durchgängig mit CSS-Variablen arbeitet. */
@media (prefers-color-scheme: dark) {
  body:not(.force-light) {
    --bg: #0F1115;
    --surface: #171A21;
    --surface-hover: #1E222B;
    --border: #2A2F3A;
    --border-light: #232833;
    --text-primary: #E5E7EB;
    --text-secondary: #9CA3AF;
    --text-tertiary: #6B7280;
    --accent: #3B82F6;
    --accent-light: #172554;
    --accent-dark: #60A5FA;
    --green: #34D399;
    --green-bg: #052E24;
    --green-border: #065F46;
    --yellow: #FBBF24;
    --yellow-bg: #2E2205;
    --yellow-border: #92660A;
    --red: #F87171;
    --red-bg: #2E0A0A;
    --red-border: #7F1D1D;
    --sidebar-bg: #0B0D11;
    --text-muted: #6B7280;
    --bg-secondary: #14171D;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  }
}

/* ===== WEBHOOKS + STEUERBERATER-ZUGANG (Einstellungen) ===== */
.webhook-create-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.webhook-create-row input[type="url"] {
  flex: 1;
  min-width: 240px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.webhook-create-row select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.webhook-actions { white-space: nowrap; }
.webhook-delete { color: var(--red); }

.advisor-link-box {
  margin-top: 14px;
  padding: 14px;
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius-sm);
}

/* Pflichtfelder automatisch markieren: jedes Label, dessen Feldgruppe ein
   [required]-Feld enthaelt, bekommt ein rotes Sternchen (progressive
   enhancement via :has(); aeltere Browser zeigen einfach kein Sternchen). */
.form-group:has([required]) > label::after,
.fw-form-group:has([required]) > label::after,
.modal-field:has([required]) > .modal-label::after {
  content: " *";
  color: var(--red);
  font-weight: 600;
}

/* ===== SKIP-LINK (Barrierefreiheit): unsichtbar bis Tastatur-Fokus ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 8px 0;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

/* ============================================================
   Zahlungsstand der Eingangsrechnungen
   ============================================================ */
.table-tab-sep { display: inline-block; width: 1px; height: 18px; background: var(--border); margin: 0 6px; vertical-align: middle; }
.tab-count {
  display: inline-block;
  margin-left: 6px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  background: var(--border);
  color: var(--text-secondary);
}
.tab-count[hidden] { display: none; }
.tab-count-red { background: var(--red-bg, #fee2e2); color: var(--red, #dc2626); }
.pay-sub { font-size: 11.5px; margin-top: 2px; white-space: nowrap; }
.pay-open { color: var(--text-tertiary); }
.pay-soon { color: var(--yellow, #b45309); font-weight: 500; }
.pay-overdue { color: var(--red, #dc2626); font-weight: 600; }
.pay-paid { color: var(--green, #16a34a); font-weight: 500; }
.pay-banner {
  margin: 12px 0 4px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}
.pay-banner.pay-overdue { border-color: var(--red-border, #fecaca); background: var(--red-bg, #fef2f2); }
.pay-banner.pay-paid { border-color: var(--green-border, #bbf7d0); background: var(--green-bg, #f0fdf4); }
.pay-banner.pay-soon { border-color: var(--yellow-border, #fde68a); background: var(--yellow-bg, #fffbeb); }
.detail-action-btn.primary { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Abschnitte, die es für dieses Konto nicht gibt (z.B. Peppol ohne Betreiber-Zugang) */
.settings-section[hidden] { display: none !important; }

.table-tabs .table-tab { white-space: nowrap; }

/* ===== DARK MODE: manuelle Wahl =====
   Dieselben Variablen wie oben im Media-Query – hier für den Fall, dass der Nutzer
   "Dunkel" ausdrücklich wählt, obwohl das Betriebssystem hell eingestellt ist.
   "Hell" erzwingt die Klasse force-light (schaltet den Media-Query ab). */
body.force-dark {
  --bg: #0F1115;
  --surface: #171A21;
  --surface-hover: #1E222B;
  --border: #2A2F3A;
  --border-light: #232833;
  --text-primary: #E5E7EB;
  --text-secondary: #9CA3AF;
  --text-tertiary: #6B7280;
  --accent: #3B82F6;
  --accent-light: #172554;
  --accent-dark: #60A5FA;
  --green: #34D399;
  --green-bg: #052E24;
  --green-border: #065F46;
  --yellow: #FBBF24;
  --yellow-bg: #2E2205;
  --yellow-border: #92660A;
  --red: #F87171;
  --red-bg: #2E0A0A;
  --red-border: #7F1D1D;
  --sidebar-bg: #0B0D11;
  --text-muted: #6B7280;
  --bg-secondary: #14171D;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
}
.theme-toggle { font-size: 15px; line-height: 1; }

/* Handy: Menüknopf in der Kopfleiste öffnet die Seitenleiste als Overlay (js/app.js) */
.menu-knopf { display: none; }
@media (max-width: 768px) {
  .menu-knopf { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0;
    margin-right: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-primary);
    font-size: 20px; line-height: 1; cursor: pointer; }
  .header { gap: 8px; }
  .header-left { min-width: 0; }
  body.sidebar-offen .sidebar { display: flex; position: fixed; top: 0; left: 0; bottom: 0; z-index: 1200; overflow-y: auto; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.sidebar-offen::after { content: ""; position: fixed; inset: 0; z-index: 1150; background: rgba(15, 23, 42, .45); }
}

/* Kassenbon per Foto (js/kassenbon.js) */
.kassenbon-modal { width: 480px; max-width: calc(100vw - 24px); }
.kassenbon-hinweis { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }
.kassenbon-foto { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; cursor: pointer; }
.kassenbon-dateiname { font-size: 12.5px; color: var(--text-secondary); margin: 6px 0 12px; }
.kassenbon-zeile { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kassenbon-modal .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text-primary); }
/* Handy: Kopfzeile und Export-Leiste umbrechen statt quetschen bzw. seitlich überlaufen */
@media (max-width: 768px) {
  .header { flex-wrap: wrap; padding: 14px 16px; row-gap: 10px; }
  .header-left { flex: 1 1 0; }
  .header-right { flex: 1 1 100%; flex-wrap: wrap; gap: 8px; }
  .header-right .search-box { flex: 1 1 100%; min-width: 0; }
  .export-bar { flex-wrap: wrap; }
  .export-bar-left, .export-bar-right { flex-wrap: wrap; }
}

/* Rechtslinks unten in der Seitenleiste */
.sidebar-recht { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 6px 12px 2px; font-size: 11px; }
.sidebar-recht a { color: var(--sidebar-text); opacity: 0.7; text-decoration: none; }
.sidebar-recht a:hover { opacity: 1; text-decoration: underline; }

/* Plan-Sektion: Support-Postfach und Ziel-Antwortzeit */
.plan-support { margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.plan-support a { color: var(--accent); }

/* Mittlere Breiten (Tablet quer, halbes Fenster): Kopfzeile darf umbrechen – vorher lag
   z. B. "+ Neue Rechnung" rechts außerhalb des Bildes. Unter 768 px gilt das Handy-Layout. */
@media (min-width: 769px) and (max-width: 1240px) {
  .header { flex-wrap: wrap; row-gap: 10px; padding: 16px 24px; }
  .header-right { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  .header-right .search-box { min-width: 0; width: 220px; }
}

/* Mittlere Breiten (Laptop, Tablet quer): Neben Seitenleiste und Detail blieben der Liste nur
   300–700 px – Beträge brachen um, Spalten und Kacheln liefen seitlich hinaus. Das Detail legt
   sich hier als Schublade über die rechte Seite; die Liste behält ihre volle Breite. */
@media (min-width: 769px) and (max-width: 1400px) {
  .content-layout { position: relative; }
  .detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 100%);
    z-index: 900; /* unter den Dialogen (1000) */
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.14);
  }
}
