* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
}

/* Login */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #07111f, #10253f);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: #ffffff;
    padding: 38px;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #1976d2;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

.brand h1 {
    margin: 0;
    font-size: 22px;
}

.brand p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.login-heading {
    margin-top: 38px;
    margin-bottom: 28px;
}

.login-heading h2 {
    margin: 0;
    font-size: 24px;
}

.login-heading p {
    color: #6b7280;
    margin-top: 8px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
}

.form-group input {
    width: 100%;
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}

.form-group input:focus {
    border-color: #1976d2;
}

.primary-button {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 7px;
    background: #1976d2;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.primary-button:hover {
    background: #1565c0;
}

.primary-button:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.error-message {
    min-height: 20px;
    margin-bottom: 12px;
    color: #c62828;
    font-size: 13px;
}

.login-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
}

/* Dashboard */
.dashboard-page {
    background: #f5f7fa;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: #081626;
    padding: 24px 16px;
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 30px;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    color: #91a1b4;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    color: #aebccc;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 7px;
    font-size: 14px;
}

.nav-item:hover,
.nav-item.active {
    background: #132d49;
    color: #ffffff;
}

.logout-button {
    margin-top: auto;
    border: 1px solid #30465e;
    background: transparent;
    color: #ccd6e0;
    border-radius: 7px;
    padding: 10px;
    cursor: pointer;
}

.logout-button:hover {
    background: #132d49;
}

.main-content {
    margin-left: 240px;
    padding: 32px;
}

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

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 6px 0 0;
    color: #6b7280;
}

.admin-badge {
    padding: 8px 13px;
    border-radius: 20px;
    background: #e8f1fb;
    color: #1565c0;
    font-size: 12px;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.stat-card,
.metric-card,
.dashboard-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.stat-card {
    padding: 22px;
}

.stat-card span,
.metric-card span {
    display: block;
    color: #6b7280;
    font-size: 13px;
}

.stat-card strong {
    display: block;
    margin: 9px 0;
    font-size: 30px;
}

.stat-card small {
    color: #9ca3af;
}

.section-title {
    margin-top: 34px;
    margin-bottom: 15px;
}

.section-title h2 {
    margin: 0;
}

.section-title p {
    color: #6b7280;
    margin-top: 5px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.metric-card {
    padding: 20px;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 26px;
}

.dashboard-panel {
    margin-top: 32px;
}

.panel-heading {
    padding: 22px;
    border-bottom: 1px solid #e5e7eb;
}

.panel-heading h2 {
    margin: 0;
    font-size: 18px;
}

.panel-heading p {
    margin: 5px 0 0;
    color: #6b7280;
    font-size: 13px;
}

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

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

th,
td {
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid #edf0f3;
    font-size: 13px;
}

th {
    color: #6b7280;
    font-weight: 600;
    background: #fafbfc;
}

.status-badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 12px;
    background: #edf4fb;
    color: #1565c0;
    font-size: 11px;
}

@media (max-width: 1000px) {
    .stats-grid,
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .stats-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        gap: 20px;
    }
}

/* Campaigns */
.campaigns-panel {
    margin-top: 0;
}

.primary-action-button {
    border: none;
    background: #1976d2;
    color: #ffffff;
    padding: 11px 18px;
    border-radius: 7px;
    font-weight: 600;
    cursor: pointer;
}

.primary-action-button:hover {
    background: #1565c0;
}

.primary-action-button:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.secondary-button {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    padding: 10px 18px;
    border-radius: 7px;
    cursor: pointer;
}

.table-action-button {
    border: none;
    background: #e7f1fb;
    color: #1565c0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.table-action-button:hover {
    background: #d7e9fa;
}

.muted-text {
    color: #9ca3af;
    font-size: 12px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 10, 20, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    z-index: 999;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 26px;
}

.modal-header h2 {
    margin: 0;
}

.modal-header p {
    margin: 5px 0 0;
    color: #6b7280;
    font-size: 13px;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
}

.form-group select {
    width: 100%;
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 0 12px;
    background: #ffffff;
}

.selection-group {
    margin: 0 0 20px;
    padding: 0;
    border: 0;
}

.selection-group legend {
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
}

.selection-box {
    border: 1px solid #d1d5db;
    border-radius: 7px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

.checkbox-item:hover {
    background: #f5f7fa;
}

.checkbox-item input {
    width: auto;
    height: auto;
}

.checkbox-item strong {
    display: block;
    font-size: 13px;
}

.checkbox-item small {
    display: block;
    color: #6b7280;
    margin-top: 2px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
}

/* Template management */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.template-modal {
    max-width: 760px;
}

.template-body-editor {
    width: 100%;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 12px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    line-height: 1.6;
    outline: none;
}

.template-body-editor:focus {
    border-color: #1976d2;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
}

.template-preview-section {
    margin-top: 26px;
}

.preview-heading {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 9px;
}

.email-preview {
    border: 1px solid #dfe3e8;
    background: #fafafa;
    border-radius: 8px;
    padding: 20px;
}

.preview-field {
    font-size: 12px;
    padding-bottom: 8px;
    color: #4b5563;
}

.preview-body {
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
    padding-top: 16px;
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 13px;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 7px;
}

.danger-button {
    border: none;
    background: #fdecec;
    color: #c62828;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.danger-button:hover {
    background: #f9d7d7;
}

@media (max-width: 700px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Campaign analytics */
.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: #1976d2;
    text-decoration: none;
    font-size: 13px;
}

.back-link:hover {
    text-decoration: underline;
}

.campaign-link {
    color: #1f2937;
    text-decoration: none;
    font-weight: 600;
}

.campaign-link:hover {
    color: #1976d2;
}

.table-action-link {
    display: inline-block;
    background: #f0f4f8;
    color: #374151;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.table-action-link:hover {
    background: #e1e7ee;
}

.metric-card small {
    display: block;
    margin-top: 5px;
    color: #6b7280;
}

.event-yes {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e7f6ec;
    color: #188038;
    font-weight: bold;
}

.event-no {
    color: #c5cad1;
}

.timeline-empty {
    padding: 24px;
    color: #6b7280;
    font-size: 13px;
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 14px;
    padding: 16px 24px;
    border-bottom: 1px solid #edf0f3;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: #1976d2;
}

.timeline-title {
    font-size: 13px;
    font-weight: 600;
}

.timeline-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
}

/* Reports */
.risk-badge {
    display: inline-block;
    min-width: 60px;
    text-align: center;
    padding: 5px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.risk-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.risk-medium {
    background: #fff4e5;
    color: #b26a00;
}

.risk-high {
    background: #fdecec;
    color: #c62828;
}

/* Campaign delivery */
.form-group.hidden {
    display: none;
}

.delivery-options {
    display: grid;
    gap: 10px;
}

.radio-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #e1e5ea;
    border-radius: 7px;
    cursor: pointer;
}

.radio-item:hover {
    background: #f8fafc;
    border-color: #b8c5d2;
}

.radio-item input {
    width: auto;
    height: auto;
    margin-top: 3px;
}

.radio-item strong {
    display: block;
    font-size: 13px;
}

.radio-item small {
    display: block;
    color: #6b7280;
    margin-top: 3px;
    font-size: 11px;
}
