:root {
    --primary: #000072;
    --secondary: #6bd5fd;
    --text-dark: #1f2937;
    --bg-light: #f9fafb;
    --border: #e5e7eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    background-color: white;
}

header.main-header {
    background-color: var(--primary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header.main-header h1 {
    font-size: 1.25rem;
    font-weight: bold;
}

.header-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.header-title:hover {
    opacity: 0.85;
}

main {
    max-width: 1200px;
    margin: 0 auto;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    animation: fadeIn 0.2s ease-in-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #000060;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 114, 0.2);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #5ac5ed;
    transform: translateY(-1px);
}

.btn-outline {
    background-color: white;
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

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

.btn-header-outline {
    background-color: transparent;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid white;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-header-outline:hover {
    background-color: white;
    color: var(--primary);
    transform: translateY(-1px);
}

.tab-button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-button:hover {
    color: var(--primary);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transition: all 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--bg-light);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
}

.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.th-sortable:hover {
    background-color: #eef2ff;
}

.sort-arrow {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-left: 0.25rem;
}

.th-sortable:hover .sort-arrow {
    opacity: 1;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background-color: var(--bg-light);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-primary {
    background-color: var(--primary);
    color: white;
}

.badge-secondary {
    background-color: var(--secondary);
    color: var(--primary);
}

@media (max-width: 640px) {
    .table-responsive table {
        display: none;
    }

    .mobile-cards {
        display: block;
    }
}

@media (min-width: 641px) {
    .mobile-cards {
        display: none;
    }
}

/* ---- Toast notifications ---- */

#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
    width: calc(100% - 2rem);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--border);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    font-size: 0.875rem;
}

.toast-visible {
    animation: toastIn 0.3s ease-out forwards;
}

.toast-exiting {
    animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-success {
    border-left-color: #16a34a;
    color: #15803d;
}

.toast-error {
    border-left-color: #dc2626;
    color: #b91c1c;
}

.toast-info {
    border-left-color: var(--primary);
    color: var(--primary);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
}

.toast-message {
    flex: 1;
    color: var(--text-dark);
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 0.25rem;
}

.toast-close:hover {
    color: var(--text-dark);
}

/* ---- Confirm modal ---- */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    padding: 1rem;
}

.confirm-visible {
    animation: fadeIn 0.2s ease-out forwards;
}

.confirm-exiting {
    animation: fadeOut 0.15s ease-in forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.confirm-box {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.25s ease-out;
}

.confirm-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.confirm-message {
    font-size: 0.9375rem;
    color: #4b5563;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.confirm-actions button {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
}

/* ---- Status badges ---- */

.badge-status-scheduled {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.badge-status-sending {
    background-color: #fef3c7;
    color: #b45309;
}

.badge-status-sent {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-status-failed {
    background-color: #fee2e2;
    color: #b91c1c;
}

.badge-status-cancel {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* ---- Stats modal ---- */

.stats-section {
    background-color: var(--bg-light);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.stats-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.875rem;
}

.stats-row + .stats-row {
    border-top: 1px solid var(--border);
}

/* ---- Inline form errors ---- */

.form-error {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: none;
}