/* Postfix Log Viewer - Main Styles */

:root {
    /* ConPDS Brand Colors */
    --primary-color: #083B70;
    --primary-hover: #05294E;
    --accent-color: #8DC5D6;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #083B70;
    --bg-color: #F1F9FD;
    --text-color: #1E1E1E;
    --text-secondary: #353535;
    --border-color: #E7EFF4;
    --card-bg: #ffffff;
    --shadow: 0 1px 3px 0 rgba(8, 59, 112, 0.08), 0 1px 2px 0 rgba(8, 59, 112, 0.05);

    /* App-wide button heights */
    --btn-height: 40px;
    --btn-sm-height: 29px;
}

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

body {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--primary-hover);
    color: white;
    padding: 0.65rem 0;
    border-bottom: 3px solid var(--accent-color);
}

/* ── Page navigation tabs ────────────────────────────────────────────────── */
.page-nav {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.page-nav__inner {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.page-nav__tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1.4rem;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    font-size: 0.92rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
    text-decoration: none;  /* for <a> elements */
}

.page-nav__tab:hover {
    color: var(--primary-color);
    background: #f8fafc;
}

.page-nav__tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color);
    background: #f0f7ff;
}

.page-nav__tab i {
    font-size: 0.9rem;
}

.header__inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header__logo {
    height: 22px;
    width: auto;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.header__divider {
    width: 1px;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.header__sub {
    font-size: 0.9rem;
    opacity: 0.75;
    white-space: nowrap;
}

.header__user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .85rem;
    font-size: .85rem;
    white-space: nowrap;
}

.header__username {
    opacity: .85;
    color: #fff;
}

.header__profile-btn {
    background: none;
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    opacity: .85;
    padding: .25rem .65rem;
    border-radius: 4px;
    font-size: .85rem;
    cursor: pointer;
    transition: opacity .15s, background .15s;
}
.header__profile-btn:hover { opacity: 1; background: rgba(255,255,255,.12); }

.header__logout {
    color: #fff;
    opacity: .8;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.35);
    padding: .25rem .65rem;
    border-radius: 4px;
    transition: opacity .15s, background .15s;
}

.header__logout:hover { opacity: 1; background: rgba(255,255,255,.12); }

/* ── Users page ────────────────────────────────────────────────────────────── */

.users-create-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.users-create-title {
    font-size: .95rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 1rem 0;
}

.users-create-form {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
}

.users-field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.users-field label {
    font-size: .8rem;
    font-weight: 600;
    color: #4a5568;
}

.users-field--check {
    justify-content: flex-end;
    padding-bottom: .1rem;
}

.users-hint {
    font-weight: 400;
    color: #a0aec0;
}

.users-feedback {
    margin-top: .75rem;
    font-size: .875rem;
    padding: .5rem .75rem;
    border-radius: 5px;
}

.users-feedback.success { background: #f0fff4; color: #276749; border-left: 3px solid #48bb78; }
.users-feedback.error   { background: #fff5f5; color: #c53030; border-left: 3px solid #e53e3e; }

.users-table-wrap { overflow-x: auto; }

.users-table { width: 100%; }

.users-table .badge-admin   { background: #ebf8ff; color: #2b6cb0; }
.users-table .badge-user    { background: #f7fafc; color: #718096; }
.users-table .badge-active  { background: #f0fff4; color: #276749; }
.users-table .badge-inactive{ background: #fff5f5; color: #c53030; }

.users-loading { text-align: center; padding: 2rem; color: #718096; }

.users-table td { vertical-align: middle; }
.users-table .users-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.users-email { font-size: .82rem; color: #4a5568; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

.header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* Main Content */
.main-content {
    padding: 0 0 2rem;
}

.app-page {
    /* Each page section manages its own spacing */
}

.page-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trace-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: -0.75rem 0 1rem;
    max-width: 56rem;
}

/* Log toolbar: compact single-row control strip */
.log-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}

.log-toolbar__divider {
    width: 1px;
    height: 1.2em;
    background: var(--border-color);
    flex-shrink: 0;
}

.btn-sm {
    height: var(--btn-sm-height);
    min-height: var(--btn-sm-height);
    padding: 0 0.9rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-sizing: border-box;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.card h2,
.card h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
}

/* Log status bar elements (used inside .log-toolbar) */

.log-source-status {
    font-weight: 500;
}

.log-source-available {
    color: var(--success-color);
}

.log-source-unavailable {
    color: var(--error-color);
}

.log-data-status {
    font-weight: 500;
}

.log-data-pending {
    color: #64748b;
}

.log-data-loading {
    color: var(--primary-color);
}

.log-data-loaded {
    color: var(--success-color);
}

.log-data-error {
    color: var(--error-color);
}

.auto-ingest-status {
    margin-left: auto;
    font-size: 0.85rem;
    color: #64748b;
}

.auto-ingest-status .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    margin-right: 0.3rem;
    vertical-align: middle;
}

/* Buttons — app-wide standard heights */
.btn {
    height: var(--btn-height);
    min-height: var(--btn-height);
    padding: 0 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-sizing: border-box;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--warning-color);
    color: white;
    margin-top: 0.5rem;
}

.btn-secondary:hover {
    filter: brightness(1.1);
}

/* ── Postfix service status banner ──────────────────────────────────────── */
.pfx-status-banner {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem 1rem;
    margin-bottom: 1rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: .5rem;
    font-size: .84rem;
    color: #1a202c;
    flex-wrap: wrap;
}
.pfx-status-banner--down {
    background: #fff5f5;
    border-color: #fc8181;
}
.pfx-status-banner__indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #38a169;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, .2);
}
.pfx-status-banner--down .pfx-status-banner__indicator {
    background: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, .2);
}
.pfx-status-banner__label {
    font-weight: 700;
    color: #2f855a;
}
.pfx-status-banner--down .pfx-status-banner__label {
    color: #c53030;
}
.pfx-status-banner__state {
    font-weight: 600;
    text-transform: capitalize;
}
.pfx-status-banner__sep {
    width: 1px;
    height: 1rem;
    background: #c6f6d5;
    flex-shrink: 0;
}
.pfx-status-banner--down .pfx-status-banner__sep {
    background: #fed7d7;
}
.pfx-status-banner__item {
    color: #4a5568;
}
.pfx-status-banner__item i {
    color: #718096;
    margin-right: .2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 0;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
}

.stat-card {
    text-align: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
}

.stat-card i {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.stat-card.sent i { color: var(--primary-color); }
.stat-card.success i { color: var(--success-color); }
.stat-card.error i { color: var(--error-color); }
.stat-card.warning i { color: var(--warning-color); }
.stat-card.info i { color: var(--info-color); }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0 0.1rem;
    color: var(--text-color);
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.chart-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.chart-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
}

/* Uniform canvas height across all cards */
.chart-card canvas {
    width: 100% !important;
    max-height: 280px;
}

/* Extended analytics charts ────────────────────────────────────────────────── */

/* 2-column grid; wide cards span both columns */
.charts-container--extended {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.chart-card--wide {
    grid-column: 1 / -1;
}

/* Card header with badge */
.chart-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.chart-card__header h3 {
    margin-bottom: 0;
}

.chart-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.2rem 0.55rem;
    border-radius: 0.9rem;
    flex-shrink: 0;
}

.chart-badge--trend  { background: #d0e8f5; color: #083B70; }
.chart-badge--health { background: #dcfce7; color: #15803d; }
.chart-badge--load   { background: #fef3c7; color: #b45309; }
.chart-badge--perf   { background: #d6eef5; color: #05294E; }

.hourly-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .9rem;
    margin-bottom: .6rem;
}
.hourly-cb {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
}
.hourly-cb input[type="checkbox"] { cursor: pointer; accent-color: currentColor; }
.hcb-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .charts-container--extended {
        grid-template-columns: 1fr;
    }
    .chart-card--wide {
        grid-column: 1;
    }
}

/* Records Section ─────────────────────────────────────────────────────────── */

.records-section {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.records-section h3 {
    margin-bottom: 0.85rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Filter bar */
.records-filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.85rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 160px;
}

.filter-group--wide {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-input {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    background: white;
    color: var(--text-color);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(8, 59, 112, 0.15);
}

/* Live-search inputs get a subtle ⚡ tint while active */
#filterQuery:not(:placeholder-shown),
#filterFrom:not(:placeholder-shown),
#filterTo:not(:placeholder-shown) {
    border-color: #6366f1;
    background: #fafafe;
}

.filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.filter-input-wrap .filter-input {
    padding-right: 1.8rem;
}
.filter-clear-btn {
    position: absolute;
    right: 0.4rem;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.15rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: color .15s, opacity .15s;
}
.filter-clear-btn:hover { color: #374151; }
.filter-input-wrap.has-value .filter-clear-btn {
    opacity: 1;
    pointer-events: auto;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    padding-bottom: 0;
}

.btn-outline {
    background: transparent;
    color: #64748b;
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* Records info line */
.records-info {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    min-height: 1.2em;
}

/* Records table wrapper */
.records-table-wrap {
    overflow-x: auto;
}

.records-table {
    margin-top: 0;
    table-layout: fixed;
    width: 100%;
}

/* Column widths — col 1 (trace toggle) is sized by .trace-toggle-cell class */
.records-table th:nth-child(2),
.records-table td:nth-child(2) { width: 7rem;  }  /* Status      */
.records-table th:nth-child(3),
.records-table td:nth-child(3) { width: 9.5rem; } /* Time        */
.records-table th:nth-child(4),
.records-table td:nth-child(4) { width: 15%;   }  /* From        */
.records-table th:nth-child(5),
.records-table td:nth-child(5) { width: 15%;   }  /* To          */
.records-table th:nth-child(6),
.records-table td:nth-child(6) { width: 19%;   }  /* Subject     */
.records-table th:nth-child(7),
.records-table td:nth-child(7) { width: 17%;   }  /* Reason      */
.records-table th:nth-child(8),
.records-table td:nth-child(8) { width: 7rem;  }  /* Queue ID    */
.records-table th:nth-child(9),
.records-table td:nth-child(9) { width: 5.5rem; } /* Size (MB)   */

/* Reduce padding for a denser, viewport-fitting layout */
.records-table th,
.records-table td {
    padding: 0.5rem 0.6rem;
}

.records-table td.ts-cell {
    white-space: nowrap;
    font-size: 0.82rem;
    color: #475569;
}

/* All text columns: clip with ellipsis instead of expanding the table */
.records-table td.email-cell,
.records-table td.subject-cell,
.records-table td.reason-cell,
.records-table td.queue-id {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Export buttons ─────────────────────────────────────────────────────── */
.btn-export {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
    font-weight: 600;
    gap: 4px;
    transition: background 0.15s, border-color 0.15s;
}

.btn-export:hover {
    background: #dcfce7;
    border-color: #4ade80;
}

.btn-export:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Delivery reason cell ────────────────────────────────────────────────── */
.reason-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dsn-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 4px;
    white-space: nowrap;
    cursor: default;
}

.dsn-ok      { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.dsn-temp    { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.dsn-perm    { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.dsn-unknown { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }

.reason-text {
    font-size: 0.78rem;
    color: #6b7280;
    cursor: help;
    vertical-align: middle;
}

/* DSN breakdown — scrollable inner area, fixed canvas height */
.chart-card--dsn-scroll .chart-scroll-area {
    overflow-y: auto;
    max-height: 260px;
}

.chart-card--dsn-scroll canvas {
    max-height: none !important; /* override the global 280px cap so bars fit */
}

/* Infinite scroll sentinel + loader */
.scroll-sentinel {
    height: 1px;
}

.loading-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: #64748b;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.dashboard-block {
    display: none; /* empty placeholder, kept for JS compatibility */
}

/* Results Table */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-table th,
.result-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.result-table th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--primary-color);
}

.result-table tr:hover {
    background: var(--bg-color);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.sent {
    background: #dcfce7;
    color: var(--success-color);
}

.status-badge.deferred {
    background: #fef3c7;
    color: var(--warning-color);
}

.status-badge.bounced {
    background: #fee2e2;
    color: var(--error-color);
}

.status-badge.rejected {
    background: #fee2e2;
    color: var(--error-color);
}

.status-badge.draft {
    background: #e0e7ff;
    color: var(--primary-color);
}

/* Error Section */
.error-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.error-table th,
.error-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.error-table th {
    background: #fef2f2;
    color: var(--error-color);
    font-weight: 600;
}

/* Status Indicator */
.status-indicator {
    margin-left: 1rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    background: #fef3c7;
    color: var(--warning-color);
    font-weight: 500;
}

.status-indicator.done {
    background: #dcfce7;
    color: var(--success-color);
}

.status-indicator.analyzing {
    background: #d0e8f5;
    color: var(--primary-color);
}

/* Load progress (button + spinner when ingesting) */
.analysis-controls--load {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.load-progress {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #d0e8f5;
    color: var(--primary-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.load-progress__spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.load-progress__text {
    white-space: nowrap;
}

/* Footer */
.footer {
    background: var(--primary-hover);
    color: white;
    padding: 0.75rem 0;
    margin-top: 1rem;
    border-top: 3px solid var(--accent-color);
}

.footer p {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

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

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive — consolidated at end of file */

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* ── Remedy page (4.7.28 auto-remedy) ─────────────────────────────────────── */

.remedy-section {
    padding: 1.5rem 0;
}

/* Nav badge on the Remedy tab */
.remedy-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: var(--color-error, #e53e3e);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: .35rem;
    vertical-align: middle;
}

/* Explainer banner */
.remedy-explainer {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #fffbeb;
    border: 1px solid #f6ad55;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.remedy-explainer__icon {
    font-size: 1.4rem;
    color: #d97706;
    flex-shrink: 0;
    margin-top: .1rem;
}

.remedy-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: #2b6cb0;
    font-weight: 600;
    text-decoration: underline;
}

.remedy-link:hover { color: #1a4a8a; }

/* Stat cards row */
.remedy-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.remedy-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border-left: 4px solid transparent;
}

.remedy-stat--warning { border-color: #f6ad55; }
.remedy-stat--danger  { border-color: #e53e3e; }
.remedy-stat--info    { border-color: #4299e1; }
.remedy-stat--neutral { border-color: #a0aec0; }

.remedy-stat-card i {
    font-size: 1.2rem;
    color: #718096;
    margin-bottom: .15rem;
}

.remedy-stat__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.remedy-stat__label {
    font-size: .75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Toolbar */
.remedy-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    margin-bottom: 1rem;
}

.remedy-scheduler-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: #4a5568;
    cursor: pointer;
}

.remedy-reset-btn {
    font-size: .8rem;
    opacity: .8;
}

.remedy-help-btn {
    margin-left: auto;
    min-width: 2rem;
    padding-left: .55rem;
    padding-right: .55rem;
}

/* ── More dropdown ─────────────────────────────────────────────────────────── */

.remedy-more-dropdown {
    position: relative;
    display: inline-block;
}

.remedy-more-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 200;
    min-width: 190px;
    padding: .35rem 0;
}

.remedy-more-menu.open { display: block; }

.remedy-more-menu button {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    text-align: left;
    padding: .5rem .85rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    color: #374151;
    white-space: nowrap;
}

.remedy-more-menu button:hover { background: #f7fafc; }

.remedy-more-menu-danger { color: #c53030 !important; }
.remedy-more-menu-danger:hover { background: #fff5f5 !important; }

.remedy-more-menu-sep {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: .3rem 0;
}

/* ── Remedy help modal ─────────────────────────────────────────────────────── */

.remedy-help-modal {
    max-width: 660px;
    width: 100%;
}

.remedy-help-body {
    max-height: 72vh;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    font-size: .9rem;
    line-height: 1.6;
}

.rh-intro {
    background: #f0f4ff;
    border-left: 3px solid #667eea;
    padding: .75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 1.25rem;
    font-size: .875rem;
}

.rh-section {
    margin-bottom: 1.1rem;
}

.rh-section p {
    margin: .25rem 0;
}

.rh-section--danger {
    background: #fff5f5;
    border-left: 3px solid #e53e3e;
    padding: .6rem .85rem;
    border-radius: 0 6px 6px 0;
}

.rh-heading {
    font-size: .9rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 .35rem 0;
}

.rh-heading i {
    color: #667eea;
    margin-right: .3rem;
}

.rh-section--danger .rh-heading i { color: #e53e3e; }

.rh-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 1.1rem 0 .75rem;
}

.rh-group-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #718096;
    margin: 0 0 .75rem 0;
}

.rh-note {
    font-size: .8rem;
    padding: .4rem .7rem;
    border-radius: 4px;
    margin-top: .4rem;
}

.rh-note--info    { background: #ebf8ff; color: #2b6cb0; border-left: 3px solid #4299e1; }
.rh-note--warning { background: #fffaf0; color: #c05621; border-left: 3px solid #dd6b20; }
.rh-note--danger  { background: #fff5f5; color: #9b2c2c; border-left: 3px solid #e53e3e; }

.rh-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    background: #edf2f7;
    color: #4a5568;
    padding: .1rem .45rem;
    border-radius: 999px;
    margin-left: .35rem;
    vertical-align: middle;
}

.rh-badge--danger { background: #fff5f5; color: #c53030; }

/* Feedback bar */
.remedy-feedback {
    border-radius: 6px;
    padding: .6rem 1rem;
    margin-bottom: 1rem;
    font-size: .875rem;
    font-weight: 500;
}

.remedy-feedback--success { background: #f0fff4; border: 1px solid #68d391; color: #276749; }
.remedy-feedback--error   { background: #fff5f5; border: 1px solid #fc8181; color: #9b2c2c; }
.remedy-feedback--info    { background: #ebf8ff; border: 1px solid #90cdf4; color: #2c5282; }

/* Table */
.remedy-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.remedy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.remedy-table th,
.remedy-table td {
    padding: .5rem .75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.remedy-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.remedy-row--active {
    background: #fffbf0;
}

.remedy-qid code {
    font-size: .8rem;
    background: #edf2f7;
    padding: .1rem .35rem;
    border-radius: 4px;
}

.remedy-addr { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remedy-subj { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remedy-ts   { white-space: nowrap; color: #718096; font-size: .8rem; }

.remedy-queue-badge {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.remedy-queue-badge--yes  { background: #fef3c7; color: #92400e; }
.remedy-queue-badge--hold { background: #fed7d7; color: #9b2c2c; }
.remedy-queue-badge--no   { background: #e2e8f0; color: #718096; }

.remedy-toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 1.5rem;
    background: var(--border-color, #e2e8f0);
    margin: 0 .15rem;
    vertical-align: middle;
}

/* Provider badges */
.remedy-provider-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    background: #e2e8f0;
    color: #4a5568;
}

.remedy-provider--google {
    background: #e8f5e9;
    color: #2e7d32;
}

.remedy-provider--microsoft {
    background: #e3f2fd;
    color: #1565c0;
}

/* Button extras */
.btn-warning {
    background: #dd6b20;
    color: #fff;
    border: 1px solid #c05621;
}

.btn-warning:hover { background: #c05621; }

.btn-xs {
    padding: .2rem .55rem;
    font-size: .75rem;
}

/* Empty state */
.remedy-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #718096;
}

.remedy-empty__icon {
    font-size: 3rem;
    color: #68d391;
    display: block;
    margin-bottom: 1rem;
}

/* Loading */
.remedy-loading {
    text-align: center;
    padding: 2rem;
    color: #718096;
    font-size: .9rem;
}

@media (max-width: 768px) {
    .remedy-stats { grid-template-columns: repeat(2, 1fr); }
    .remedy-toolbar { flex-direction: column; align-items: flex-start; }
    .remedy-scheduler-toggle { margin-left: 0; }
}

/* ── Address autocomplete dropdown ────────────────────────────────────────── */

.addr-ac-list {
    position: absolute;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: .25rem 0;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(8, 59, 112, 0.12), 0 2px 6px rgba(8, 59, 112, 0.07);
    max-height: 240px;
    overflow-y: auto;
    /* smooth pop-in */
    animation: ac-appear 0.12s ease-out;
}

@keyframes ac-appear {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.addr-ac-item {
    padding: .45rem .85rem;
    font-size: .85rem;
    color: var(--text-color, #1e1e1e);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.08s;
}

.addr-ac-item:hover,
.addr-ac-item--active {
    background: var(--bg-color, #f1f9fd);
    color: var(--primary-color, #083b70);
}

.addr-ac-item--active {
    background: #e8f0fe;
}

.addr-ac-mark {
    background: transparent;
    color: var(--primary-color, #083b70);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--accent-color, #8dc5d6);
}

/* ══════════════════════════════════════════════════════ DANGER BUTTON ══════ */

.btn-danger {
    background: #e53e3e;
    color: #fff;
    border: 1px solid #c53030;
}
.btn-danger:hover { background: #c53030; border-color: #9b2c2c; }

.btn-info {
    background: #bee3f8;
    color: #2a4365;
    border: 1px solid #63b3ed;
}
.btn-info:hover { background: #90cdf4; border-color: #4299e1; }

.btn-amber {
    background: #feebc8;
    color: #7b341e;
    border: 1px solid #f6ad55;
}
.btn-amber:hover { background: #fbd38d; border-color: #ed8936; }

.btn-subtle {
    background: #e2e8f0;
    color: #334155;
    border: 1px solid #94a3b8;
}
.btn-subtle:hover { background: #cbd5e1; border-color: #64748b; }

.filter-actions-sep {
    display: inline-block;
    width: 1px;
    height: 1.5rem;
    background: var(--border-color, #e2e8f0);
    margin: 0 .15rem;
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════ MODAL ══════════ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal__header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem .75rem;
    border-bottom: 1px solid #e2e8f0;
    gap: .5rem;
}
.modal__title {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}
.modal__close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #718096;
    cursor: pointer;
    line-height: 1;
    padding: 0 .25rem;
}
.modal__close:hover { color: #2d3748; }

.modal__body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.modal__desc {
    font-size: .875rem;
    color: #4a5568;
    margin: 0 0 .75rem;
}

.modal-sep { border: none; border-top: 1px solid #e2e8f0; margin: .75rem 0; }

.modal__footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}
.modal__footer .btn-outline { margin-left: auto; }

/* Share journey modal */
.share-journey-info {
    font-size: .84rem;
    line-height: 1.55;
    padding: .6rem .8rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.share-journey-info div { padding: 1px 0; }
.share-journey-info strong { color: #475569; min-width: 60px; display: inline-block; }

.share-journey-ai-btn {
    background: #7c3aed;
    color: #fff;
    border: 1px solid #7c3aed;
}
.share-journey-ai-btn:hover { background: #6d28d9; border-color: #6d28d9; }
.share-journey-ai-btn:disabled {
    background: #c4b5fd;
    border-color: #c4b5fd;
    cursor: not-allowed;
    opacity: .7;
}

/* Purge breakdown table */
.purge-total { font-size: .85rem; color: #4a5568; margin: 0 0 .5rem; }
.purge-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    margin-bottom: .5rem;
}
.purge-table th, .purge-table td {
    padding: .35rem .6rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}
.purge-table th { background: #f7fafc; font-weight: 600; color: #4a5568; }
.purge-table tr:hover td { background: #f7fafc; }
.purge-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.purge-loading, .purge-error { font-size: .85rem; color: #718096; }
.purge-error { color: #e53e3e; }

/* Purge form */
.purge-form { display: flex; flex-direction: column; gap: .6rem; }
.purge-form__row {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: .5rem;
}
.purge-form__row label { font-size: .85rem; font-weight: 500; color: #4a5568; }

/* Preview result */
.purge-preview {
    margin-top: .75rem;
    padding: .65rem .9rem;
    border-radius: 6px;
    font-size: .875rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.purge-preview--loading { background: #ebf8ff; color: #2b6cb0; border: 1px solid #90cdf4; }
.purge-preview--warn    { background: #fff5f5; color: #9b2c2c; border: 1px solid #fc8181; }
.purge-preview--ok      { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.purge-preview--error   { background: #fff5f5; color: #e53e3e; border: 1px solid #fc8181; }

/* ══════════════════════════════════════════════════════ COPY BUTTON ══════ */

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: .1rem .3rem;
    margin-left: .25rem;
    color: #a0aec0;
    cursor: pointer;
    font-size: .72rem;
    vertical-align: middle;
    transition: color .12s, background .12s, border-color .12s;
    line-height: 1;
}
.copy-btn:hover {
    color: var(--primary-color, #083b70);
    background: #ebf8ff;
    border-color: #90cdf4;
}
.copy-btn--done {
    color: #38a169 !important;
    background: #f0fff4 !important;
    border-color: #9ae6b4 !important;
}
.copy-btn--inline {
    font-size: .68rem;
    padding: .08rem .25rem;
}

/* Inline code values in SMTP check cards */
.smtp-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: .78em;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    padding: .05em .35em;
    color: #2d3748;
    word-break: break-all;
}

/* Clickable links inside SMTP check cards */
.smtp-link {
    color: var(--primary-color, #083b70);
    text-decoration: underline;
    text-decoration-color: #90cdf4;
    word-break: break-all;
}
.smtp-link:hover { color: #3182ce; }

/* ═══════════════════════════════════════════ SMTP HEALTH CHECK PAGE ══════ */

/* Nav badge */
.smtp-check-badge {
    display: inline-block;
    min-width: 1.25rem;
    padding: .05rem .35rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1.4;
    margin-left: .35rem;
    vertical-align: middle;
}
.smtp-check-badge--warn  { background: #f59e0b; color: #fff; }
.smtp-check-badge--fail  { background: #e53e3e; color: #fff; }
.smtp-check-badge--error { background: #dd6b20; color: #fff; }

/* Section header row (title + toolbar) */
#smtpCheckPage .section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid #e2e8f0;
}
#smtpCheckPage .section__title {
    margin: 0;
    font-size: 1.1rem;
}

/* Toolbar */
.smtp-check-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.smtp-check-last-run {
    font-size: .8rem;
    color: #718096;
}

/* Overall status banner */
.smtp-check-banner {
    margin-top: .5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.smtp-check-banner--pass  { background: #f0fff4; border-color: #9ae6b4; color: #276749; }
.smtp-check-banner--warn  { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.smtp-check-banner--fail  { background: #fff5f5; border-color: #fc8181; color: #9b2c2c; }
.smtp-check-banner--error { background: #fff8f0; border-color: #f6ad55; color: #7b341e; }
.smtp-check-banner--info  { background: #ebf8ff; border-color: #90cdf4; color: #2b6cb0; }

/* Notice bar */
.smtp-check-notice {
    font-size: .82rem;
    color: #718096;
    margin: 0 0 1.25rem;
}

/* Domain tabs (multi-domain pills) */
.smtp-domain-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding: .2rem 0;
}
.smtp-domain-tab {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .9rem;
    border-radius: 9999px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: .9rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, background .15s;
}
.smtp-domain-tab:hover {
    border-color: #cbd5e0;
    background: #f7fafc;
}
.smtp-domain-tab--active {
    border-color: #4299e1;
    background: #ebf8ff;
    color: #2b6cb0;
}
.smtp-domain-tab__dot {
    font-size: .6rem;
}
.smtp-domain-tab--pass.smtp-domain-tab--active { border-color: #48bb78; background: #f0fff4; color: #276749; }
.smtp-domain-tab--warn.smtp-domain-tab--active { border-color: #ecc94b; background: #fffbeb; color: #92400e; }
.smtp-domain-tab--fail.smtp-domain-tab--active,
.smtp-domain-tab--error.smtp-domain-tab--active { border-color: #e53e3e; background: #fff5f5; color: #9b2c2c; }

/* Section labels for Domain / Server checks */
.smtp-section-label {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 1rem 0 .5rem;
}
.smtp-section-label:first-of-type { margin-top: 0; }

/* Cards grid */
.smtp-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
    margin-top: .5rem;
}

/* Individual check card */
.smtp-check-card {
    background: #fff;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 1rem 1.1rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: box-shadow .15s;
}
.smtp-check-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }

.smtp-check-card--pass  { border-left: 4px solid #48bb78; }
.smtp-check-card--warn  { border-left: 4px solid #f59e0b; }
.smtp-check-card--fail  { border-left: 4px solid #e53e3e; }
.smtp-check-card--error { border-left: 4px solid #dd6b20; }
.smtp-check-card--info  { border-left: 4px solid #63b3ed; }

/* Card header */
.smtp-check-card__header {
    display: flex;
    align-items: center;
    gap: .55rem;
}
.smtp-check-card__name {
    font-weight: 600;
    font-size: .95rem;
    flex: 1;
    color: #2d3748;
}

/* Status dot */
.smtp-check-status-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.smtp-check-status-dot--pass  { background: #48bb78; }
.smtp-check-status-dot--warn  { background: #f59e0b; }
.smtp-check-status-dot--fail  { background: #e53e3e; }
.smtp-check-status-dot--error { background: #dd6b20; }
.smtp-check-status-dot--info  { background: #63b3ed; }

/* Status pill badge */
.smtp-check-badge-pill {
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.smtp-check-badge-pill--pass  { background: #c6f6d5; color: #22543d; }
.smtp-check-badge-pill--warn  { background: #fef3c7; color: #92400e; }
.smtp-check-badge-pill--fail  { background: #fed7d7; color: #9b2c2c; }
.smtp-check-badge-pill--error { background: #feebc8; color: #7b341e; }
.smtp-check-badge-pill--info  { background: #bee3f8; color: #2b6cb0; }

/* Summary line */
.smtp-check-card__summary {
    font-size: .875rem;
    color: #4a5568;
    line-height: 1.4;
}

/* Detail list */
.smtp-check-detail-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: .8rem;
    color: #718096;
    line-height: 1.6;
}
.smtp-check-detail-list li { margin: .1rem 0; }

/* Recommendations box */
.smtp-check-recs {
    background: #fffbeb;
    border: 1px solid #f6e05e;
    border-radius: 6px;
    padding: .65rem .85rem;
    margin-top: .2rem;
}
.smtp-check-card--fail .smtp-check-recs {
    background: #fff5f5;
    border-color: #feb2b2;
}
.smtp-check-recs__title {
    font-size: .78rem;
    font-weight: 700;
    color: #744210;
    margin-bottom: .35rem;
    display: flex;
    align-items: center;
    gap: .3rem;
}
.smtp-check-card--fail .smtp-check-recs__title { color: #9b2c2c; }
.smtp-check-recs ul {
    margin: 0;
    padding-left: 1.15rem;
    font-size: .8rem;
    color: #744210;
    line-height: 1.6;
}
.smtp-check-card--fail .smtp-check-recs ul { color: #9b2c2c; }
.smtp-check-recs ul li { margin: .1rem 0; }

/* Empty & loading states */
.smtp-check-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #718096;
}
.smtp-check-empty i { display: block; margin-bottom: .75rem; color: #a0aec0; }
.smtp-check-empty p { margin-bottom: 1rem; }

.smtp-check-loading {
    text-align: center;
    padding: 2rem;
    color: #718096;
    font-size: .9rem;
}
.smtp-check-loading small { display: block; margin-top: .4rem; color: #a0aec0; font-size: .78rem; }

/* ── DKIM Rotation Wizard ──────────────────────────────────────────────────── */

/* Card header: push action button to the far right */
.smtp-check-card__header {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}
.smtp-check-card__header .dkim-rotate-btn {
    margin-left: auto;
    font-size: .72rem;
    padding: .2rem .55rem;
    line-height: 1.4;
}

/* Modal sizing */
.dkim-wizard { max-width: 620px; width: 94vw; }

/* Progress indicator */
.dkim-wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: .75rem 1.25rem .25rem;
    font-size: .75rem;
}
.dkim-wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .18rem;
    width: 60px;
    font-weight: 700;
    color: #a0aec0;
    background: #edf2f7;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    position: relative;
}
.dkim-wizard-step span {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: .67rem;
    font-weight: 500;
    color: #718096;
}
.dkim-wizard-step--active { background: #4299e1; color: #fff; }
.dkim-wizard-step--done   { background: #48bb78; color: #fff; }
.dkim-wizard-connector {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    max-width: 80px;
}

/* Wizard body */
.dkim-wizard-body { padding: 2.5rem 1.5rem 1.25rem; }
.dkim-wizard-body p { font-size: .88rem; color: #4a5568; margin-bottom: .9rem; }

/* DNS table */
.dkim-dns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    margin-bottom: .75rem;
}
.dkim-dns-table th {
    background: #f7fafc;
    color: #718096;
    font-weight: 600;
    padding: .35rem .6rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}
.dkim-dns-table td {
    padding: .4rem .6rem;
    border: 1px solid #e2e8f0;
    vertical-align: top;
    word-break: break-all;
}
.dkim-dns-value { max-width: 380px; }

/* Checkbox confirm row */
.dkim-wizard-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: #2d3748;
    font-weight: 600;
    margin: .75rem 0;
    cursor: pointer;
}

/* Hint text */
.dkim-wizard-hint { font-size: .78rem; color: #718096; margin: .25rem 0; }

/* Notice (already existed) */
.dkim-wizard-notice {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 6px;
    padding: .45rem .75rem;
    font-size: .8rem;
    color: #2c5282;
    margin-bottom: .75rem;
}

/* Log output */
.dkim-wizard-log {
    background: #1a202c;
    color: #a0aec0;
    border-radius: 6px;
    padding: .6rem .9rem;
    font-size: .78rem;
    font-family: monospace;
    margin-bottom: .75rem;
}
.dkim-log-ok  { color: #68d391; }
.dkim-log-err { color: #fc8181; }

/* Change list in step 3 */
.dkim-wizard-change-list {
    margin: .5rem 0;
    padding-left: 1.25rem;
    font-size: .82rem;
    line-height: 1.7;
}

/* Success banner */
.dkim-wizard-success {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #276749;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: .9rem;
}
.dkim-wizard-success i { font-size: 1.4rem; color: #38a169; }

/* Action row */
.dkim-wizard-actions {
    display: flex;
    gap: .65rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}

/* Inline spinner (reuse existing if present) */
.spinner-inline {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* btn-xs helper */
.btn-xs { font-size: .72rem; padding: .2rem .5rem; }
.btn-warning { background: #dd6b20; color: #fff; border: none; }
.btn-warning:hover { background: #c05621; }

/* DKIM info modal */
.dkim-info-modal { max-width: 640px; width: 94vw; }

.dkim-info-body {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1rem 1.25rem 1.25rem;
    max-height: 70vh;
    overflow-y: auto;
}

.dkim-info-step {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
}

.dkim-info-step__badge {
    flex-shrink: 0;
    background: #2563eb;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .25rem .6rem;
    border-radius: 1rem;
    margin-top: .15rem;
    white-space: nowrap;
}

.dkim-info-step__content { flex: 1; }

.dkim-info-step__content h4 {
    margin: 0 0 .35rem;
    font-size: .95rem;
    color: #1a202c;
}

.dkim-info-step__sub {
    font-size: .78rem;
    font-weight: 400;
    color: #718096;
}

.dkim-info-step__content p,
.dkim-info-step__content ul {
    margin: .3rem 0;
    font-size: .85rem;
    color: #4a5568;
    line-height: 1.55;
}

.dkim-info-step__content ul { padding-left: 1.2rem; }
.dkim-info-step__content li { margin-bottom: .25rem; }
.dkim-info-step__content code {
    background: #edf2f7;
    padding: .05rem .35rem;
    border-radius: 4px;
    font-size: .8rem;
    color: #2d3748;
    word-break: break-all;
}

.dkim-info-note {
    font-size: .8rem !important;
    color: #718096 !important;
    font-style: italic;
}

/* ── Mail journey timeline ────────────────────────────────────────────────── */

/* Toggle button column header + cell */
th.trace-toggle-cell,
td.trace-toggle-cell {
    width: 28px;
    min-width: 28px;
    padding: 0 6px !important;
    text-align: center;
}

.trace-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.65rem;
    padding: 3px 4px;
    border-radius: 4px;
    transition: color 0.15s, transform 0.2s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.trace-toggle-btn:hover {
    color: var(--primary-color);
    background: #e0f2fe;
}
.trace-toggle-btn.open {
    transform: rotate(90deg);
    color: var(--primary-color);
}
.trace-toggle-btn.no-events {
    color: #d1d5db;
    cursor: default;
    opacity: 0.5;
}
.trace-toggle-btn.no-events:hover {
    background: none;
    color: #d1d5db;
}

/* Timeline expansion row */
.trace-timeline-row > td {
    padding: 0 !important;
    border-top: none !important;
    background: #f8fafc;
}

/* Timeline container */
.trace-timeline {
    padding: 14px 24px 14px 48px;
    border-top: 1px dashed var(--border-color);
    /* Prevent the timeline from overflowing the table column width */
    overflow: hidden;
    word-break: break-word;
}

.trace-timeline__title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.trace-timeline__qid {
    font-family: monospace;
    font-weight: 400;
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0;
    overflow-wrap: break-word;
    word-break: break-all;
}

.trace-share-btn {
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    transition: background .15s;
}
.trace-share-btn:hover { background: var(--primary-hover); }

.trace-timeline__summary {
    font-size: 0.82rem;
    color: var(--text-color);
    line-height: 1.55;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.trace-timeline__summary div { padding: 1px 0; }
.trace-timeline__summary strong { color: #475569; }

/* Individual node */
.trace-node {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 0 10px;
}

.trace-node__track {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trace-node__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #94a3b8;
    background: #fff;
    flex-shrink: 0;
    margin-top: 3px;
    position: relative;
    z-index: 1;
}

.trace-node__line {
    flex: 1;
    width: 2px;
    background: #e2e8f0;
    min-height: 10px;
    margin-top: 2px;
}

/* Hide connector line on the last node */
.trace-node--last > .trace-node__track > .trace-node__line {
    display: none;
}

.trace-node__body {
    padding: 0 0 14px 0;
    /* min-width:0 lets the 1fr grid column shrink; overflow is intentionally visible so long SMTP responses wrap fully */
    min-width: 0;
}

.trace-node__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-bottom: 2px;
    min-height: 18px;
}

.trace-node__time {
    font-size: 0.76rem;
    color: #64748b;
    font-feature-settings: "tnum";
    min-width: 130px;
    flex-shrink: 0;
}

.trace-node__event {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
}

.trace-node__relay {
    font-size: 0.78rem;
    color: #475569;
    font-family: monospace;
    overflow-wrap: break-word;
    word-break: break-all;
}

.trace-node__detail {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 2px;
    padding-left: 2px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Status dot colours per node type */
.trace-node--received .trace-node__dot  { border-color: #94a3b8; background: #f1f5f9; }
.trace-node--sent     .trace-node__dot  { border-color: var(--success-color); background: #dcfce7; }
.trace-node--deferred .trace-node__dot  { border-color: #d97706; background: #fef3c7; }
.trace-node--bounced  .trace-node__dot  { border-color: var(--error-color); background: #fee2e2; }
.trace-node--rejected .trace-node__dot  { border-color: #7c3aed; background: #ede9fe; }

/* Connector line colour matches dot colour */
.trace-node--sent     .trace-node__line { background: #bbf7d0; }
.trace-node--deferred .trace-node__line { background: #fde68a; }
.trace-node--bounced  .trace-node__line { background: #fca5a5; }
.trace-node--rejected .trace-node__line { background: #c4b5fd; }

/* Inline status badge inside the timeline */
.trace-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.73rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}
.trace-status-badge--received { background: #f1f5f9; color: #475569; }
.trace-status-badge--sent     { background: #dcfce7; color: #166534; }
.trace-status-badge--deferred { background: #fef3c7; color: #92400e; }
.trace-status-badge--bounced  { background: #fee2e2; color: #991b1b; }
.trace-status-badge--rejected { background: #ede9fe; color: #5b21b6; }

/* ══════════════════════════════════════════════════════════════════════════════
   Postfix SMTP Users — sub-tabs, tag inputs, modals
   ══════════════════════════════════════════════════════════════════════════════ */

/* Sub-tab navigation */
.users-subnav {
    display: flex;
    gap: .25rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}
.users-subnav__tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: .55rem 1.1rem;
    font-size: .875rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.users-subnav__tab:hover {
    color: #374151;
    background: #f9fafb;
}
.users-subnav__tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Sub-panel visibility is controlled by JS */
.users-subpanel { }

/* SASL warning banner */
.sasl-warning-banner {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #fef9c3;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: .65rem 1rem;
    font-size: .85rem;
    color: #78350f;
    margin-bottom: 1rem;
}
.sasl-warning-banner i { color: #f59e0b; font-size: 1rem; flex-shrink: 0; }

/* Tag input for send-as addresses */
.pfx-senders-field { flex: 1; min-width: 280px; }

.tag-input-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    min-height: 36px;
    background: #fff;
    cursor: text;
}
.tag-input-wrap:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.tag-input-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.tag-input-text {
    flex: 1;
    min-width: 160px;
    border: none;
    outline: none;
    font-size: .83rem;
    padding: 2px 0;
    background: transparent;
}

/* Individual tags */
.pfx-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
}
.pfx-tag__remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #3b82f6;
    font-size: .9rem;
    line-height: 1;
    padding: 0 1px;
    opacity: .7;
}
.pfx-tag__remove:hover { opacity: 1; color: #1e40af; }

/* Senders cell in table */
.pfx-senders-cell { display: flex; flex-wrap: wrap; gap: 3px; max-width: 280px; }
.pfx-sender-tag {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: .75rem;
}

/* Known-sources cell in table */
.pfx-sources-cell { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.pfx-source-tag {
    display: inline-block;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: .75rem;
    cursor: default;
    white-space: nowrap;
}
.pfx-source-tag small { opacity: .65; }

/* Password reveal modal */
.pfx-pw-reveal-row {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: .5rem;
}
.pfx-pw-reveal-block {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.pfx-pw-code {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: .3rem .6rem;
    font-size: .85rem;
    word-break: break-all;
    flex: 1;
}
.pfx-pw-code--password {
    background: #fefce8;
    border-color: #fde047;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: #713f12;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — 768px breakpoint
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .container { padding: 0 12px; }

    /* ── Header: wrap and stack ── */
    .header__inner {
        flex-wrap: wrap;
        gap: .5rem;
    }
    .header__divider,
    .header__sub {
        display: none;
    }
    .header h1 {
        font-size: 1rem;
        white-space: normal;
    }
    .header__user {
        width: 100%;
        justify-content: flex-end;
        gap: .5rem;
        font-size: .8rem;
        white-space: normal;
    }

    /* ── Nav tabs: horizontal scroll ── */
    .page-nav__inner {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .page-nav__inner::-webkit-scrollbar { display: none; }
    .page-nav__tab {
        padding: 0.6rem 1rem;
        font-size: .84rem;
    }
    .page-nav { margin-bottom: 1rem; }

    /* ── Filter rows: stack vertically ── */
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-group,
    .filter-group--wide {
        min-width: 0;
        width: 100%;
    }
    .filter-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    .filter-actions .btn-sm,
    .filter-actions .btn-outline,
    .filter-actions .btn-export,
    .filter-actions .btn-danger {
        flex: 1 1 auto;
        text-align: center;
        justify-content: center;
    }
    .filter-actions-sep { display: none; }
    .records-filters { padding: 0.65rem 0.75rem; }

    /* ── Log toolbar ── */
    .log-toolbar { font-size: .82rem; padding: .4rem .65rem; gap: .35rem .5rem; }
    .log-toolbar__divider { display: none; }
    .auto-ingest-status { margin-left: 0; width: 100%; }

    /* ── Charts ── */
    .charts-container {
        grid-template-columns: 1fr;
    }
    .charts-container--extended {
        grid-template-columns: 1fr;
    }
    .chart-card--wide { grid-column: 1; }

    /* ── Trace table: hide From, Delivery Reason, Queue ID on mobile ── */
    .records-table { table-layout: auto; }
    .col-hide-mobile { display: none; }
    .records-table th,
    .records-table td { width: auto; }

    /* ── Tables: smaller text, tighter padding ── */
    .records-table th,
    .records-table td {
        padding: .35rem .4rem;
        font-size: .78rem;
    }
    .result-table th,
    .result-table td {
        padding: .4rem .5rem;
        font-size: .82rem;
    }
    .remedy-table th,
    .remedy-table td {
        padding: .35rem .5rem;
    }

    /* ── Modals: near full-width ── */
    .modal {
        width: 94vw;
        max-width: none;
    }
    .modal__body { padding: .85rem 1rem; }
    .modal__header { padding: .85rem 1rem .65rem; }
    .modal__footer { padding: .65rem 1rem; }
    .purge-form__row {
        grid-template-columns: 1fr;
    }
    .remedy-help-modal { max-width: none; width: 94vw; }

    /* ── Remedy page ── */
    .remedy-explainer { flex-direction: column; gap: .5rem; }
    .remedy-stat__value { font-size: 1.4rem; }

    /* ── Users page ── */
    .users-create-form {
        flex-direction: column;
        align-items: stretch;
    }
    .users-field { width: 100%; }
    .pfx-senders-field { min-width: 0; }
    .tag-input-text { min-width: 100px; }
    .pfx-senders-cell { max-width: none; }
    .pfx-sources-cell { max-width: none; }
    .users-email { max-width: 140px; }
    .users-subnav { gap: 0; }
    .users-subnav__tab { padding: .45rem .7rem; font-size: .82rem; }

    /* ── SMTP Health page ── */
    .smtp-check-grid {
        grid-template-columns: 1fr;
    }
    #smtpCheckPage .section__header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ── Trace timeline ── */
    .trace-timeline { padding: 10px 12px 10px 24px; }
    .trace-node__time { min-width: 0; font-size: .72rem; }
    .trace-node__header { gap: 3px 6px; }

    /* ── Page heading ── */
    .page-heading { font-size: 1.1rem; }

    /* ── Cards ── */
    .card { padding: 1rem; }
    .chart-card { padding: .75rem; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   SMALL PHONE — 480px breakpoint
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .container { padding: 0 8px; }

    /* Stats: single column */
    .stats-grid { grid-template-columns: 1fr; }

    /* Remedy stats: single column */
    .remedy-stats { grid-template-columns: 1fr; }

    /* Header */
    .header { padding: .5rem 0; }
    .header__logo { height: 18px; }
    .header h1 { font-size: .9rem; }
    .header__user { font-size: .75rem; }
    .header__profile-btn,
    .header__logout { padding: .2rem .5rem; font-size: .78rem; }

    /* Stat cards */
    .stat-value { font-size: 1.25rem; }

    /* Chart card headers */
    .chart-card__header { flex-direction: column; align-items: flex-start; gap: .3rem; }

    /* DKIM wizard */
    .dkim-wizard-body { padding: 2rem 1rem 1rem; }

    /* Main content padding */
    .main-content { padding: 0 0 1rem; }
}
