/* public/css/reminder.css – Mahnungsverwaltung
 * Vollständige, korrigierte Version
 * Alle Probleme behoben: Template-Styles, Dropdown, Close-Button, Modal-Breite, Abstände, Tabs, Export-Icons
 */

:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --secondary: #3a0ca3;
    --success: #4cc9f0;
    --warning: #f8961e;
    --danger: #f72585;
    --info: #7209b7;
    --purple: #560bad;
    --teal: #06d6a0;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #4e555e;
    --white: #ffffff;
    --sidebar-width: 220px;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        sans-serif;
}

body {
    background-color: #f5f7fa;
    color: var(--dark);
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    font-weight: 700;
    font-size: 18px;
    color: var(--secondary);
    padding: 20px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo svg {
    background: white;
    border-radius: 6px;
    border: 1px solid var(--primary);
    box-shadow: 0 1px 4px rgba(67, 97, 238, 0.15);
    width: 24px;
    height: 24px;
}

.nav-menu {
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(67, 97, 238, 0.05);
    color: var(--primary);
}

.nav-item.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.nav-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.nav-item.reports-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
    background: transparent;
    color: var(--gray);
}

.nav-item.reports-disabled:hover {
    background: transparent;
    color: var(--gray);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    position: relative;
}

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

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.logout-btn:hover {
    color: var(--danger);
    background-color: rgba(247, 37, 133, 0.05);
}

.tariff-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.tariff-free {
    background: #f8f9fa;
    color: #4e555e;
    border-color: #dee2e6;
}

.tariff-basic {
    background: #e3f2fd;
    color: #1565c0;
    border-color: #bbdefb;
}

.tariff-pro {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #e1bee7;
}

.tariff-premium {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.tariff-warning {
    background: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    display: inline-block;
    margin-left: 5px;
}

/* ============================================================
   ACTION CARDS – mehr Abstand zur Tabelle
   ============================================================ */
.dashboard-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-bottom: 28px; /* mehr Abstand zur Tabelle */
}

.action-card {
    grid-column: span 4;
    background: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--card-shadow);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border-top: 4px solid;
}

.action-card:nth-child(1) {
    border-top-color: var(--warning);
}
.action-card:nth-child(2) {
    border-top-color: var(--info);
}
.action-card:nth-child(3) {
    border-top-color: #7c3aed;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.action-card.feature-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.action-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.action-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.action-description {
    font-size: 12px;
    color: var(--gray);
}

/* ============================================================
   REMINDERS CONTAINER – mit ausreichend Abstand nach oben
   ============================================================ */
.reminders-container {
    grid-column: span 12;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    padding: 20px;
    border-top: 4px solid var(--purple);
    overflow: visible;
    position: relative;
    margin-top: 28px; /* mehr Abstand zu den Action-Cards */
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* ============================================================
   TOOLBAR – Tabs zentriert, alles auf gleicher Höhe
   ============================================================ */
.reminder-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: space-between;
}

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

.search-box {
    position: relative;
    flex-shrink: 0;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #565656;
    font-size: 12px;
    pointer-events: none;
}

.search-box input {
    height: 32px;
    padding: 0 10px 0 30px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 12.5px;
    color: #212529;
    outline: none;
    width: 220px;
    background: #fff;
}

.search-box input:focus {
    border-color: var(--primary);
}

/* ─── Mahnstufen-Dropdown ─── */
.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    height: 32px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    font-size: 12.5px;
    cursor: pointer;
    color: #4e555e;
    transition: all 0.2s;
}

.filter-dropdown-toggle:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
}

.filter-dropdown-toggle.active {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

.filter-dropdown-toggle i {
    font-size: 10px;
    transition: transform 0.2s;
}

.filter-dropdown-toggle.active i {
    transform: rotate(180deg);
}

.filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    border-radius: 8px;
    overflow: hidden;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.filter-dropdown-menu.show {
    display: block;
}

.filter-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 12.5px;
    color: #212529;
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background: rgba(67, 97, 238, 0.08);
}

.filter-option.selected {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.filter-option i {
    width: 16px;
    text-align: center;
}

.filter-option .dtab-count {
    margin-left: auto;
    background: #f8f9fa;
    color: #4e555e;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
}

.badge-count {
    background: var(--primary);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ─── Tabs (zentriert) ─── */
.dunning-tabs {
    display: flex;
    gap: 4px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 9px;
    padding: 4px;
    margin: 0 auto; /* zentriert */
    flex-shrink: 0;
}

.dtab {
    padding: 4px 14px;
    height: 28px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #4e555e;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    transition: all 0.18s;
    white-space: nowrap;
}

.dtab:hover {
    color: #212529;
}

.dtab.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.dtab-count {
    background: #f8f9fa;
    color: #4e555e;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.dtab.active .dtab-count {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

/* ─── Action Buttons (rechts) ─── */
.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.btn-refresh,
.export-btn {
    height: 32px;
    padding: 0 14px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    font-size: 12.5px;
    font-weight: 500;
    color: #4e555e;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.18s;
}

.btn-refresh:hover,
.export-btn:hover {
    background: #f8f9fa;
    color: #212529;
    border-color: #d1d5db;
}

/* ─── Erinnern/Mahnen/Nachfassen – Glocke und Outline in einer Zeile ─── */
.dtab {
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-btn i.fa-chevron-down {
    font-size: 10px;
    transition: transform 0.2s;
}

.export-btn.active i.fa-chevron-down {
    transform: rotate(180deg);
}

/* ─── Export Dropdown ─── */
.export-dropdown {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.export-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 100;
    border-radius: 8px;
    overflow: hidden;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.export-menu.show {
    display: block;
}

.export-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #212529;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.export-option:last-child {
    border-bottom: none;
}

.export-option:hover {
    background: rgba(67, 97, 238, 0.08);
    padding-left: 20px;
}

/* ─── Export-Icons: Schwarz/Weiß wie bei Customers ─── */
.export-option i {
    color: var(--gray-600);
    width: 16px;
    text-align: center;
}
.export-option:hover i {
    color: var(--dark);
}

.export-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 0, 0, 0.08),
        transparent
    );
    margin: 4px 16px;
}

/* ============================================================
   BULK BAR
   ============================================================ */
.dunning-bulk {
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    align-items: center;
    gap: 12px;
    display: none;
    flex-wrap: wrap;
}

.dunning-bulk.show {
    display: flex;
}

.bulk-action-btn {
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.bulk-send {
    background: #fff;
    color: var(--primary);
}

.bulk-send:hover {
    background: #f0f0f0;
}

.bulk-stop {
    background: rgba(247, 37, 133, 0.25);
    color: #fff;
}

.bulk-stop:hover {
    background: rgba(247, 37, 133, 0.35);
}

.bulk-clear {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.bulk-clear:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   TABLE
   ============================================================ */
.reminders-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.reminders-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
    table-layout: fixed;
}

.reminders-table th {
    text-align: left;
    padding: 10px 12px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #495057;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
    user-select: none;
}

.reminders-table th:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.reminders-table th.sortable {
    padding-right: 30px;
}

.reminders-table th .sort-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 11px;
}

.reminders-table th.active-sort .sort-arrow {
    opacity: 1;
}

.reminders-table th.sort-asc .sort-arrow::before {
    content: "↑";
}
.reminders-table th.sort-desc .sort-arrow::before {
    content: "↓";
}

.reminders-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
    font-size: 12.5px;
    color: #212529;
}

.reminders-table tr:hover {
    background-color: rgba(67, 97, 238, 0.02);
}

.reminders-table tr.row-blocked {
    opacity: 0.6;
    border-left: 3px solid var(--warning);
}

.reminders-table th:nth-child(1),
.reminders-table td:nth-child(1) {
    width: 40px;
}
.reminders-table th:nth-child(2),
.reminders-table td:nth-child(2) {
    width: 110px;
}
.reminders-table th:nth-child(3),
.reminders-table td:nth-child(3) {
    width: 140px;
}
.reminders-table th:nth-child(4),
.reminders-table td:nth-child(4) {
    width: 90px;
}
.reminders-table th:nth-child(5),
.reminders-table td:nth-child(5) {
    width: 180px;
}
.reminders-table th:nth-child(6),
.reminders-table td:nth-child(6) {
    width: 110px;
}
.reminders-table th:nth-child(7),
.reminders-table td:nth-child(7) {
    width: 100px;
}
.reminders-table th:nth-child(8),
.reminders-table td:nth-child(8) {
    width: 100px;
}
.reminders-table th:nth-child(9),
.reminders-table td:nth-child(9) {
    width: 130px;
}
.reminders-table th:nth-child(10),
.reminders-table td:nth-child(10) {
    width: 150px;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}

.status-draft {
    background: rgba(248, 150, 30, 0.12);
    color: #b45309;
}
.status-sent {
    background: rgba(76, 201, 240, 0.12);
    color: #0b7e8a;
}
.status-scheduled {
    background: rgba(114, 9, 183, 0.12);
    color: #5b1e7a;
}
.status-failed {
    background: rgba(247, 37, 133, 0.12);
    color: #b91c6b;
}
.status-overdue {
    background: rgba(220, 53, 69, 0.12);
    color: #b91c1c;
}

/* ============================================================
   REMINDER TYPE
   ============================================================ */
.reminder-type {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

.type-friendly {
    background: rgba(76, 201, 240, 0.12);
    color: #0b7e8a;
}
.type-first {
    background: rgba(248, 150, 30, 0.12);
    color: #b45309;
}
.type-second {
    background: rgba(247, 37, 133, 0.12);
    color: #b91c6b;
}
.type-final {
    background: rgba(58, 12, 163, 0.12);
    color: #3a0ca3;
}

.reminder-type-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reminder-type-range {
    font-size: 11px;
    color: var(--gray);
    padding-left: 8px;
    border-left: 2px solid #e9ecef;
    margin-top: 2px;
}

.reminder-type-range.friendly {
    border-left-color: var(--success);
}
.reminder-type-range.first {
    border-left-color: var(--warning);
}
.reminder-type-range.second {
    border-left-color: var(--danger);
}
.reminder-type-range.final {
    border-left-color: var(--secondary);
}

/* ============================================================
   ACTION BUTTONS IN TABLE
   ============================================================ */
.reminder-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.send-reminder-btn {
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}

.send-reminder-btn:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.send-reminder-btn:not(:disabled):hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.send-reminder-btn:disabled {
    background: #f1f3f5;
    /* WCAG-Ausnahme: inaktive Bedienelemente brauchen keinen Kontrast (1.4.3) –
       hellgrau signalisiert bewusst „deaktiviert“ */
    color: #adb5bd;
    border-color: #e9ecef;
    cursor: not-allowed;
}

.dunning-stop-btn {
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    white-space: nowrap;
}

.dunning-stop-btn:hover {
    opacity: 0.8;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    gap: 4px;
}

.page-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white;
    border: 1px solid #e9ecef;
    color: #212529;
    font-size: 13px;
    transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #d1d5db;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
    padding: 20px;
}

.modal-bg.open {
    opacity: 1;
    visibility: visible;
}

.modal-bg .modal {
    background: white;
    border-radius: var(--border-radius-xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    padding: 24px 28px;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
    width: 100%;
}

.modal-bg.open .modal {
    transform: scale(1) translateY(0);
}

.modal-bg .modal.wide {
    max-width: 860px;
}

.modal-bg .modal.narrow {
    max-width: 480px;
}

/* ─── Send Reminder Modal – breit wie Vorlagen ─── */
#sendReminderModal .modal {
    max-width: 860px;
    width: 100%;
}

/* ─── Modal Header & Close-Button (normal groß) ─── */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #212529;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem; /* normal groß, nicht riesig */
    cursor: pointer;
    color: #565656;
    padding: 4px 6px;
    line-height: 1;
    transition: color 0.2s;
    border-radius: var(--border-radius-sm);
}

.modal-close:hover {
    color: #212529;
    background: var(--gray-100);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
}

/* ============================================================
   FILTER CONTROLS (in Templates Modal)
   ============================================================ */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #4e555e;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
    color: #212529;
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.filter-btn i {
    font-size: 12px;
}

/* ─── Modal interner Filter-Dropdown ─── */
#modalReminderTypeFilter {
    margin-left: auto;
}

#modalReminderTypeFilter .filter-dropdown-toggle {
    height: 32px;
    padding: 0 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #4e555e;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}

#modalReminderTypeFilter .filter-dropdown-toggle:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
    color: #212529;
}

#modalReminderTypeFilter .filter-dropdown-toggle.active {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

#modalReminderTypeFilter .filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    border-radius: 8px;
    overflow: hidden;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#modalReminderTypeFilter .filter-dropdown-menu.show {
    display: block;
}

#modalReminderTypeFilter .filter-option {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 12px;
    color: #212529;
}

#modalReminderTypeFilter .filter-option:last-child {
    border-bottom: none;
}

#modalReminderTypeFilter .filter-option:hover {
    background: rgba(67, 97, 238, 0.08);
}

#modalReminderTypeFilter .filter-option.selected {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    font-weight: 500;
}

#modalReminderTypeFilter .filter-option i {
    width: 16px;
    text-align: center;
}

/* ============================================================
   TEMPLATE EDITOR
   ============================================================ */
.template-editor {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    margin-bottom: 20px;
}

.editor-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.editor-sidebar {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    font-size: 13px;
}

.editor-sidebar h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #212529;
}

.template-preview {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 14px;
    background: white;
    min-height: 220px;
    max-height: 450px;
    overflow-y: auto;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #212529;
}

.template-preview h5 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.editor-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid #e9ecef;
}

.editor-tab {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--gray);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.editor-tab:hover {
    color: var(--dark);
}

.editor-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.editor-panes {
    position: relative;
}

.editor-pane {
    display: none;
}

.editor-pane.active {
    display: block;
}

.editor-textarea {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

.editor-html {
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    tab-size: 2;
    color: #212529;
    background-color: #fafbfc;
}

.editor-html:focus {
    background-color: #fff;
}

.variable-palette {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.variable-tag {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: monospace;
}

.variable-tag:hover {
    background: var(--primary-light);
}

/* ============================================================
   TEMPLATE LIST (Styles für Systemvorlagen)
   ============================================================ */
.template-list {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    background: #fafbfc;
}

.template-item {
    padding: 12px 14px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.template-item:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.04);
}

.template-item.inactive {
    opacity: 0.65;
    background: #f8f9fa;
    border-style: dashed;
}

.template-item .template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.template-item .template-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
}

.template-item .template-item-buttons {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.template-btn {
    padding: 2px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.template-btn-edit {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.template-btn-edit:hover {
    background: #e07c00;
}

.template-btn-copy {
    background: var(--info);
    color: white;
    border-color: var(--info);
}

.template-btn-copy:hover {
    background: #5a0a8a;
}

.template-btn-delete {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.template-btn-delete:hover {
    background: #d91a6b;
}

/* ─── System-Template Warnung ─── */
.system-template-warning {
    padding: 10px 14px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    margin-bottom: 14px;
    color: #856404;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-template-warning i {
    color: #f8961e;
    font-size: 16px;
}

/* ============================================================
   TEMPLATE SELECT (für Send Reminder)
   ============================================================ */
.template-select-container {
    margin-bottom: 16px;
}

.template-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.template-select-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px;
    background: #f8f9fa;
}

.template-select-item {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.template-select-item:hover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.05);
}

.template-select-item.selected {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
    border-left: 3px solid var(--primary);
}

.template-select-item.active {
    border-left: 3px solid var(--success);
}

.template-select-name {
    font-weight: 600;
    font-size: 13px;
}

.template-select-type {
    font-size: 11px;
    color: var(--gray);
    margin-top: 2px;
}

.template-select-status {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    display: inline-block;
    margin-right: 4px;
}

.template-select-status.active {
    background: var(--success);
    color: white;
}
.template-select-status.system {
    background: var(--info);
    color: white;
}
.template-select-status.favorite {
    background: var(--warning);
    color: white;
}

/* ============================================================
   CONFIRM MODAL
   ============================================================ */
.conf-ico {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.conf-ico.w {
    background: #fff7ed;
    color: #f8961e;
}
.conf-ico.i {
    background: #eff6ff;
    color: var(--primary);
}

.conf-reason {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 12.5px;
    margin-bottom: 14px;
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.conf-reason:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.1);
}

/* ============================================================
   SEQUENCE CONFIG PANEL
   ============================================================ */
.seq-panel {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.seq-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.seq-col {
    border-right: 1px solid #e9ecef;
}

.seq-col:last-child {
    border-right: none;
}

.seq-ch {
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 11px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.seq-steps {
    padding: 10px 12px;
}

.seq-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 5px;
    background: white;
    transition: all 0.15s;
}

.seq-step.on {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.03);
}

.seq-step.off {
    opacity: 0.5;
    background: #f8f9fa;
}

.seq-day {
    font-size: 12px;
    font-weight: 700;
    min-width: 36px;
    color: #212529;
}

.seq-day.neg {
    color: #0369a1;
}

.seq-sub {
    font-size: 11px;
    color: var(--gray);
    flex: 1;
}

.seq-days-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 12px;
    font-family: monospace;
    background: #f8f9fa;
    box-sizing: border-box;
}

.seq-days-input:focus {
    border-color: var(--primary);
    background: white;
    outline: none;
}

/* ============================================================
   LOGIN OVERLAY
   ============================================================ */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.login-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-icon {
    font-size: 64px;
    margin-bottom: 20px;
    color: var(--primary);
}
.login-title {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--dark);
    font-weight: 600;
}
.login-description {
    font-size: 16px;
    margin-bottom: 30px;
    color: var(--gray);
    line-height: 1.5;
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-login {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-login:hover {
    background: var(--primary-light);
}

.btn-register {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-register:hover {
    background: var(--primary);
    color: white;
}

.main-content.blurred {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    display: none;
    flex-direction: column;
    gap: 12px;
}

.loading-overlay .loading-text {
    font-size: 14px;
    color: var(--gray);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.no-data-container {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.no-data-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ddd;
}
.no-data-title {
    font-size: 18px;
    margin-bottom: 8px;
}
.no-data-description {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ============================================================
   TOAST
   ============================================================ */
#fd-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
}

.fd-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    font-family: "Inter", system-ui, sans-serif;
    line-height: 1.45;
    pointer-events: all;
    animation: fd-toast-in 0.2s ease;
    max-width: 380px;
    border-left: 4px solid transparent;
}

.fd-toast.fd-error {
    background: #fff5f5;
    color: #c0392b;
    border-left-color: #e03e3e;
}
.fd-toast.fd-warning {
    background: #fffbf0;
    color: #856404;
    border-left-color: #f59e0b;
}
.fd-toast.fd-info {
    background: #f0f7ff;
    color: #1e40af;
    border-left-color: #4361ee;
}

.fd-toast-icon {
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}
.fd-toast-body {
    flex: 1;
}
.fd-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: inherit;
    opacity: 0.5;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.fd-toast-close:hover {
    opacity: 1;
}

@keyframes fd-toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .reminders-table {
        min-width: 1000px;
    }
}

@media (max-width: 992px) {
    .dashboard-container .action-card {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        overflow: hidden;
    }
    .logo span,
    .nav-item span {
        display: none;
    }
    .nav-item {
        justify-content: center;
        padding: 12px 0;
    }
    .nav-item i {
        margin-right: 0;
        font-size: 16px;
    }
    .main-content {
        margin-left: 60px;
    }

    .dashboard-container .action-card {
        grid-column: span 12;
    }

    .reminder-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .search-filter {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .search-box {
        flex: 1;
        min-width: 150px;
    }

    .search-box input {
        width: 100%;
    }

    .dunning-tabs {
        width: 100%;
        justify-content: space-around;
        margin: 0;
    }

    .action-buttons {
        margin-left: 0;
        justify-content: flex-end;
        width: 100%;
    }

    .reminders-table {
        min-width: 700px;
        font-size: 11px;
    }

    .reminders-table th,
    .reminders-table td {
        padding: 6px 8px;
    }

    .reminders-table th:nth-child(5),
    .reminders-table td:nth-child(5) {
        width: 150px;
    }
    .reminders-table th:nth-child(10),
    .reminders-table td:nth-child(10) {
        width: 120px;
    }

    .template-editor {
        grid-template-columns: 1fr;
    }

    .modal-bg .modal {
        padding: 16px;
        max-width: 100%;
        max-height: 95vh;
    }

    .modal-bg .modal.wide {
        max-width: 100%;
    }

    #sendReminderModal .modal {
        max-width: 100%;
    }

    .filter-dropdown-menu {
        left: auto;
        right: 0;
        min-width: 180px;
    }

    .pagination {
        justify-content: center;
    }

    .login-container {
        padding: 30px 20px;
        margin: 20px;
    }
    .login-title {
        font-size: 20px;
    }
    .login-description {
        font-size: 14px;
    }
}

/* ─── ARCHIVED REMINDERS STYLES ──────────────────────────────── */

/* Archived row – gray/white/black styling, faded out */
.reminders-table tr.row-archived {
    opacity: 0.6;
    background: #f5f5f5 !important;
    border-left: 3px solid #999;
}

.reminders-table tr.row-archived td {
    color: #666 !important;
    text-decoration: line-through;
}

.reminders-table tr.row-archived .status-badge {
    background: #e0e0e0 !important;
    color: #888 !important;
}

.reminders-table tr.row-archived .reminder-type {
    background: #e8e8e8 !important;
    color: #777 !important;
}

/* Archived send button – disabled, gray */
.reminders-table tr.row-archived .send-reminder-btn {
    background: #e0e0e0 !important;
    color: #999 !important;
    border-color: #ccc !important;
    cursor: not-allowed !important;
}

/* ─── ARCHIVE DROPDOWN STYLES ──────────────────────────────── */

.reminder-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.reminder-actions-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.more-actions-btn-reminder {
    background: none;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s;
    min-height: 30px;
    min-width: 30px;
}

.more-actions-btn-reminder:hover {
    background: var(--gray-200);
    color: var(--gray-900);
    border-color: var(--gray-300);
}

.more-actions-btn-reminder:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── DROPDOWN OVERLAY STYLES (Shared with invoices) ──────────────────────────────── */
.dropdown-menu-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 2000;
    display: none;
}

.dropdown-menu-overlay.show {
    display: block;
}

.dropdown-menu {
    position: fixed;
    background: #fff;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2001;
    min-width: 220px;
    display: none;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    animation: slideIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-header {
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-800);
}

.dropdown-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 4px 0;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--gray-800);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.15s;
}

.dropdown-item:hover:not(:disabled) {
    background: var(--gray-50);
}

.dropdown-item:disabled {
    color: var(--gray-400);
    cursor: not-allowed;
}

.dropdown-item .item-text {
    flex: 1;
}

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 16px;
}

@media (max-width: 520px) {
    .dashboard-container .action-card {
        grid-column: span 12;
    }

    .reminders-table {
        min-width: 600px;
        font-size: 10px;
    }

    .reminders-table th,
    .reminders-table td {
        padding: 4px 6px;
    }

    .reminders-table th:nth-child(1),
    .reminders-table td:nth-child(1) {
        width: 30px;
    }
    .reminders-table th:nth-child(2),
    .reminders-table td:nth-child(2) {
        width: 80px;
    }
    .reminders-table th:nth-child(3),
    .reminders-table td:nth-child(3) {
        width: 100px;
    }
    .reminders-table th:nth-child(5),
    .reminders-table td:nth-child(5) {
        width: 120px;
    }
    .reminders-table th:nth-child(10),
    .reminders-table td:nth-child(10) {
        width: 100px;
    }

    .reminders-container {
        padding: 12px;
    }

    .export-btn span {
        display: none;
    }

    .filter-dropdown-toggle {
        font-size: 11px;
        padding: 2px 8px;
        min-width: 100px;
    }

    .dtab {
        font-size: 10px;
        padding: 2px 8px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .conf-mbox {
        padding: 18px;
    }
}
