/* ── Instantly Domain Tracker Dashboard — Styles ──────────────────── */

:root {
    --bg-primary: #0a0c12;
    --bg-secondary: #11141e;
    --bg-card: #181c28;
    --bg-hover: #1e2332;
    --text-primary: #f1f3f6;
    --text-secondary: #8b919d;
    --text-muted: #6b7280;
    --border: rgba(255,255,255,0.05);
    --border-hover: rgba(255,255,255,0.10);
    --accent: #6366f1;
    --accent-hover: #4f46e5;

    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --gray: #6b7280;
    --gray-bg: rgba(107, 114, 128, 0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 14px;
}

/* ── Layout ──────────────────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ──────────────────────────────────────────────────────── */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.header h1 a {
    color: inherit;
    text-decoration: none;
}

.header h1 .accent {
    color: var(--accent);
}

.header nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

.header nav a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ── Status Badges ───────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-healthy {
    background: var(--green-bg);
    color: var(--green);
}

.badge-at-risk {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.badge-burned {
    background: var(--red-bg);
    color: var(--red);
}

.badge-unknown {
    background: var(--gray-bg);
    color: var(--gray);
}

/* ── Cards ───────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

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

.card-header h2,
.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Stat Grid ───────────────────────────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-card .stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.stat-burned .stat-value { color: var(--red); }
.stat-card.stat-at-risk .stat-value { color: var(--yellow); }
.stat-card.stat-healthy .stat-value { color: var(--green); }
.stat-card.stat-total .stat-value { color: var(--accent); }
.stat-card.stat-emails .stat-value { color: #38bdf8; }

/* Idle mailbox count in the domains table */
.idle-count { color: #f59e0b; font-weight: 600; }

/* ── Tables ──────────────────────────────────────────────────────── */

.table-container {
    overflow-x: auto;
    position: relative;
}

.table-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, var(--bg-card));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.table-container.is-scrollable::after {
    opacity: 0.5;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: rgba(24, 28, 40, 0.9) !important;
    backdrop-filter: blur(8px);
    color: var(--text-secondary) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.6px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

thead th a {
    color: var(--text-secondary) !important;
    text-decoration: none !important;
}

tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.025);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.12s;
    line-height: 1.4;
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.025);
}

tbody tr.row-burned {
    border-left: 3px solid var(--red);
}

tbody tr.row-at-risk {
    border-left: 3px solid var(--yellow);
}

tbody tr.row-healthy {
    border-left: 3px solid var(--green);
}

/* ── Domain Name Link ────────────────────────────────────────────── */

.domain-link {
    color: var(--accent) !important;
    font-weight: 600;
    text-decoration: none !important;
    border-bottom: 1px dotted transparent;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.15s;
}

.domain-link:hover {
    color: #a5b4fc !important;
    border-bottom-color: var(--accent);
}

/* ── Percentages ─────────────────────────────────────────────────── */

.pct-positive { color: var(--green); }
.pct-warning { color: var(--yellow); }
.pct-negative { color: var(--red); }
.pct-muted { color: var(--text-muted); }

/* ── Filter Controls (class-based, replaces inline styles) ─────── */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

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

.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-select:hover {
    border-color: var(--accent);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.filter-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}

.filter-date-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.filter-date-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.filter-date-input:hover {
    border-color: var(--accent);
}

.filter-date-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

/* ── Buttons ─────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
}

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

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

.btn-clear-filter {
    color: var(--yellow);
    border-color: rgba(234, 179, 8, 0.25);
}

.btn-clear-filter:hover {
    background: rgba(234, 179, 8, 0.1);
    border-color: var(--yellow);
}

/* ── Tabular Numbers ────────────────────────────────────────────── */

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ── Trend Controls ──────────────────────────────────────────────── */

.trend-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.trend-controls label {
    font-size: 13px;
    color: var(--text-secondary);
}

.trend-controls select,
.trend-controls input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
}

/* ── Chart Container ─────────────────────────────────────────────── */

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

/* ── Empty / No Data ─────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.7;
}

.empty-state code {
    display: inline-block;
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
    margin: 4px 2px;
}

/* ── Back Link ───────────────────────────────────────────────────── */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 16px;
    padding: 4px 0;
}

.back-link:hover {
    color: var(--accent);
}

/* ── Page Title ──────────────────────────────────────────────────── */

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 12px;
}

/* ── Campaign Tags ───────────────────────────────────────────────── */

.campaign-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.campaign-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    cursor: default;
}

.campaign-tag:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ── Tooltip / Hint ──────────────────────────────────────────────── */

.hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Footer ──────────────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 8px 0;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border);
    margin-top: 0;
}

/* ── Progress bar for reply rates ────────────────────────────────── */

.progress-bar {
    width: 60px;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* ── Column Sorting ──────────────────────────────────────────────── */

th {
    cursor: pointer;
    user-select: none;
}

th .sort-indicator {
    font-size: 10px;
    margin-left: 2px;
    color: var(--text-muted);
}

th[data-sort-dir] {
    color: var(--accent);
}

th[data-sort-dir] .sort-indicator {
    color: var(--accent);
}

/* ── Reply Rate Display (percentage above progress bar) ────────── */

.reply-rate-display {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.reply-rate-value {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

/* ── Replies Column ────────────────────────────────────────────── */

.replies-total {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
}

.replies-separator {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 2px;
}

.replies-human {
    font-size: 11px;
    color: var(--text-muted);
}



/* ── Dashboard Card Layout (table + sidebar legend) ────────── */

.card-dashboard {
    padding: 0;
}

.card-dashboard .card-header {
    padding: 16px;
}

.card-body-flex {
    display: flex;
    gap: 0;
}

.card-body-flex .table-container {
    flex: 1;
    min-width: 0;
}



/* ── Settings Form ──────────────────────────────────────────────── */

.settings-form .card {
    margin-bottom: 20px;
}

.settings-form .form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.settings-form .form-row .form-group {
    flex: 1;
}

.settings-form .form-group {
    margin-bottom: 16px;
}

.settings-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.settings-form input[type="number"] {
    width: 100%;
    max-width: 200px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
}

.settings-form input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

.settings-form .form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.settings-form .form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ── Alert ───────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

/* ── Provider SVG Logos ──────────────────────────────────────────── */

.provider-badge svg {
    vertical-align: middle;
    margin-right: 3px;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Settings Compact Grid ─────────────────────────────────────── */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.settings-col {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
}

.settings-col-header {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-col .form-group {
    margin-bottom: 8px;
}

.settings-col label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    display: block;
}

.settings-col input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.15s;
}

.settings-col input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Provider Badge ──────────────────────────────────────────────── */

.provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.provider-gmail {
    background: rgba(234, 67, 53, 0.12);
    color: #ea4335;
}

.provider-outlook {
    background: rgba(0, 120, 215, 0.12);
    color: #0078d7;
}

.provider-other {
    background: var(--gray-bg);
    color: var(--gray);
}

.provider-icon-g {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ea4335;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.provider-icon-o {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: #0078d7;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.provider-icon-globe {
    font-size: 14px;
    line-height: 1;
}

/* ── User Switcher ──────────────────────────────────────────────── */

.user-switcher select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 28px 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%239aa0a6' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
    min-width: 120px;
    transition: border-color 0.15s;
}

.user-switcher select:hover {
    border-color: var(--accent);
}

.user-switcher select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.user-switcher select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── Add User Form ──────────────────────────────────────────────── */

.add-user-container {
    max-width: 520px;
    margin: 0 auto;
}

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

.add-user-form-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.add-user-form-card input[type="text"],
.add-user-form-card input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
}

.add-user-form-card input[type="text"]:focus,
.add-user-form-card input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.add-user-form-card .form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.btn-submit {
    width: 100%;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.add-user-error {
    background: var(--red-bg);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--red);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
}

/* ── Trajectory Banner ────────────────────────────────────────────── */

.trajectory-banner {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid;
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.trajectory-banner .trajectory-icon {
    font-size: 20px;
    line-height: 1.4;
    flex-shrink: 0;
}

.trajectory-banner .trajectory-body {
    flex: 1;
}

.trajectory-banner .trajectory-label {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.trajectory-banner .trajectory-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

.trajectory-banner.trajectory-loading {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-muted);
}

.trajectory-banner.trajectory-error {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

.trajectory-healthy {
    background: var(--green-bg);
    border-color: var(--green);
}

.trajectory-healthy .trajectory-label {
    color: var(--green);
}

.trajectory-burned {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--red);
}

.trajectory-burned .trajectory-label {
    color: var(--red);
}

.trajectory-never-performed {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--red);
}

.trajectory-never-performed .trajectory-label {
    color: var(--red);
}

.trajectory-recovering {
    background: var(--yellow-bg);
    border-color: var(--yellow);
}

.trajectory-recovering .trajectory-label {
    color: var(--yellow);
}

.trajectory-at-risk {
    background: var(--yellow-bg);
    border-color: var(--yellow);
}

.trajectory-at-risk .trajectory-label {
    color: var(--yellow);
}

.trajectory-new {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--accent);
}

.trajectory-new .trajectory-label {
    color: var(--accent);
}

/* ── Multi-Timeframe Card Grid ───────────────────────────────────── */

.timeframe-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.timeframe-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.timeframe-card:hover {
    border-color: var(--accent);
}

.timeframe-card .tf-loading {
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.timeframe-card .tf-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.timeframe-card .tf-reply-rate {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.timeframe-card .tf-reply-rate .pct-sign {
    font-size: 16px;
    font-weight: 400;
}

.timeframe-card .tf-bounce-rate {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.timeframe-card .tf-sent {
    font-size: 11px;
    color: var(--text-muted);
}

.timeframe-card .tf-trend {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
}

.tf-trend-improving {
    color: var(--green);
}

.tf-trend-declining {
    color: var(--red);
}

.tf-trend-stable {
    color: var(--text-muted);
}

.timeframe-card .tf-status-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tf-status-healthy {
    background: var(--green-bg);
    color: var(--green);
}

.tf-status-at-risk {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.tf-status-burned {
    background: var(--red-bg);
    color: var(--red);
}

.tf-status-unknown {
    background: var(--gray-bg);
    color: var(--gray);
}

.timeframe-card.tf-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3);
}

/* ── Chart Controls & Inline Chart ───────────────────────────────── */

.chart-range-selector {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.chart-range-btn {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.chart-range-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(96, 165, 250, 0.08);
}

.chart-range-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.25);
}

.chart-container-inline {
    position: relative;
    height: 360px;
    width: 100%;
}

/* ── Y-axis Scale Control (Shrishti) ────────────────────────── */
.yaxis-scale-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.yaxis-scale-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}

.yaxis-scale-pills {
    display: flex;
    gap: 3px;
}

.yaxis-scale-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.yaxis-scale-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.08);
    background: var(--bg-hover);
}

.yaxis-scale-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.yaxis-scale-btn.yaxis-scale-auto {
    font-style: italic;
    color: var(--text-secondary);
}

.yaxis-scale-btn.yaxis-scale-auto.active {
    font-style: italic;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: none;
}

/* ── Responsive: stack next to header on narrow screens ── */
@media (max-width: 768px) {
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-header h3 {
        flex: 1 1 auto;
    }

    .yaxis-scale-control {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .yaxis-scale-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .yaxis-scale-label {
        font-size: 10px;
    }
}

/* ── Y-axis scale auto indicator on chart ── */
.chart-auto-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(17, 20, 30, 0.7);
    backdrop-filter: blur(4px);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.chart-auto-badge.is-visible {
    opacity: 1;
}

/* ── Chart Loading State ──────────────────────────────────────────── */

.chart-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 12px;
    color: var(--text-muted);
}

.chart-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: chart-spin 0.8s linear infinite;
}

@keyframes chart-spin {
    to { transform: rotate(360deg); }
}

.chart-loading-text {
    font-size: 13px;
}

/* ── Chart Empty State ──────────────────────────────────────────── */

.chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 240px;
    text-align: center;
    padding: 32px;
}

.chart-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.chart-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chart-empty-desc {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 360px;
    line-height: 1.5;
}

/* ── Chart Legend ───────────────────────────────────────────────── */

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 12px 0 4px 0;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 3px;
    border-radius: 1px;
    flex-shrink: 0;
}

.legend-bar {
    height: 10px;
    width: 10px;
    border-radius: 2px;
    background: rgba(147, 197, 253, 0.5);
    border: 1px solid rgba(147, 197, 253, 0.7);
}

.legend-line {
    height: 2px;
    border-top: 2px solid;
    background: transparent;
}

.legend-dash {
    height: 2px;
    border-top: 2px dashed;
    background: transparent;
}

.legend-threshold {
    height: 2px;
    border-top: 2px dashed;
    background: transparent;
}

.hidden-mobile {
    display: inline-flex;
}

/* ── Summary Bar ────────────────────────────────────────────────── */

.chart-summary {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    border-radius: 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    transition: background 0.2s;
}

.summary-status {
    font-size: 16px;
    flex-shrink: 0;
}

.summary-text {
    flex: 1;
}

.summary-range {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Skeleton Loading ────────────────────────────────────────────── */

@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.skeleton {
    background: var(--bg-hover);
    border-radius: 4px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    display: inline-block;
}

.skeleton-text {
    height: 14px;
    width: 80%;
    margin: 4px auto;
}

.skeleton-value {
    height: 28px;
    width: 60%;
    margin: 8px auto;
}

.skeleton-badge {
    height: 16px;
    width: 50px;
    border-radius: 20px;
    margin: 8px auto 0;
}

/* ── Responsive adjustments ──────────────────────────────────────── */

@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr 1fr;
    }
}

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

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .timeframe-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container-inline {
        height: 260px;
    }

    .chart-legend {
        gap: 6px 14px;
    }

    .hidden-mobile {
        display: inline-flex !important;
        font-size: 10px;
    }

    .chart-range-selector {
        gap: 6px;
        flex-wrap: wrap;
    }

    .chart-range-btn {
        padding: 6px 14px;
        min-width: 44px;
        font-size: 13px;
    }

    .chart-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 12px;
    }

    .filter-group {
        white-space: normal;
    }
}

@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .chart-legend {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
        padding: 10px 0 2px 0;
    }

    .legend-item {
        font-size: 11px;
    }

    .chart-summary {
        font-size: 12px;
        padding: 8px 10px;
        flex-wrap: wrap;
    }

    .chart-range-btn {
        padding: 6px 14px;
        min-width: 44px;
        font-size: 13px;
    }
}

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

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

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

    .chart-container-inline {
        height: 220px;
    }

    .tag-filter-dropdown {
        min-width: 200px;
        right: 0;
        left: auto;
    }

    .header-inner {
        flex-direction: column;
        gap: 8px;
    }

    .chart-range-selector {
        gap: 4px;
        flex-wrap: wrap;
    }
}

/* ══════════════════════════════════════════════════════════════════
   PREMIUM UI TWEAKS — Shrishti Design Spec
   ══════════════════════════════════════════════════════════════════ */

/* ── 1. Page Entrance Animations ──────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    @keyframes fade-slide-up {
        from { opacity: 0; transform: translateY(12px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .stat-card {
        animation: fade-slide-up 0.4s ease-out both;
    }
    .stat-card:nth-child(1) { animation-delay: 0.05s; }
    .stat-card:nth-child(2) { animation-delay: 0.10s; }
    .stat-card:nth-child(3) { animation-delay: 0.15s; }
    .stat-card:nth-child(4) { animation-delay: 0.20s; }
    .stat-card:nth-child(5) { animation-delay: 0.25s; }
    .stat-card:nth-child(6) { animation-delay: 0.30s; }

    .timeframe-card {
        animation: fade-slide-up 0.4s ease-out both;
    }
    .timeframe-card:nth-child(1) { animation-delay: 0.05s; }
    .timeframe-card:nth-child(2) { animation-delay: 0.10s; }
    .timeframe-card:nth-child(3) { animation-delay: 0.15s; }
    .timeframe-card:nth-child(4) { animation-delay: 0.20s; }

    .card {
        animation: fade-slide-up 0.4s ease-out both;
    }
    .card:nth-of-type(1) { animation-delay: 0.10s; }
    .card:nth-of-type(2) { animation-delay: 0.18s; }
    .card:nth-of-type(3) { animation-delay: 0.26s; }

    tbody tr {
        animation: fade-slide-up 0.3s ease-out both;
    }
}

/* ── 2. Modal Open/Close Animation ────────────────────────────── */
.modal {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.modal-content {
    transform: scale(0.92);
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
}

.modal.is-open .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* ── 3. Navigation Active State ───────────────────────────────── */
.header nav a.active {
    color: var(--text-primary);
    background: var(--bg-hover);
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
    border-radius: 6px 6px 0 0;
}

/* ── 4. Toast Notification System ─────────────────────────────── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.3s ease-out both;
    min-width: 280px;
    max-width: 420px;
}

.toast.toast-out {
    animation: toast-out 0.25s ease-in both;
}

.toast-success { border-left: 4px solid var(--green); }
.toast-error   { border-left: 4px solid var(--red); }
.toast-info    { border-left: 4px solid var(--accent); }

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

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ── 5. Custom Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
    transition: background 0.15s;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.table-container::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 2px;
}

/* ── 6. Backfill Progress Bar ─────────────────────────────────── */
.backfill-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.backfill-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #818cf8, var(--accent));
    background-size: 200% 100%;
    animation: progress-shimmer 2s linear infinite;
    transition: width 0.3s ease;
    width: 0%;
}

@keyframes progress-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 7. API Key Visibility Toggle ─────────────────────────────── */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    padding: 4px;
    line-height: 1;
    transition: color 0.15s;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* ── 8. Top Navigation Progress Bar ───────────────────────────── */
.nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #a78bfa, var(--accent));
    background-size: 200% 100%;
    z-index: 99999;
    transition: width 0.3s ease;
    pointer-events: none;
}

.nav-progress.active {
    animation: progress-sweep 0.8s ease-out forwards;
}

@keyframes progress-sweep {
    0%   { width: 0%; }
    60%  { width: 70%; }
    100% { width: 90%; opacity: 0.8; }
}

/* ── 9. Copyable Email ────────────────────────────────────────── */
.copy-email {
    cursor: pointer;
    transition: color 0.15s;
    position: relative;
}

.copy-email:hover {
    color: var(--accent);
}

.copy-email .copy-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid var(--border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.copy-email .copy-tooltip.show {
    opacity: 1;
}

/* ── 10. Button Loading & Success States ──────────────────────── */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
}

.btn-primary.loading::after {
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.btn.success {
    background: var(--green) !important;
    border-color: var(--green) !important;
    color: #fff !important;
}

.btn.success::after {
    content: none;
}

.btn.success::before {
    content: '\2713';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 700;
}

/* ── Mobile tap targets ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .filter-date-input {
        min-height: 44px;
    }

    .filter-select {
        min-height: 44px;
    }
}

/* ── Modal ──────────────────────────────────────────────────────── */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 12px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.modal-content input[type="text"],
.modal-content input[type="password"] {
    width: 100%;
    margin: 8px 0;
    padding: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.modal-content button {
    margin: 8px 4px 0 0;
}



/* ── Toggle Switch ──────────────────────────────────────────────── */

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 36px;
    height: 20px;
    background: #444;
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: #4CAF50;
}

.toggle input:checked + .toggle-slider::after {
    left: 18px;
}

.toggle:hover .toggle-slider {
    background: #555;
}

.toggle input:checked:hover + .toggle-slider {
    background: #43a047;
}

/* ── Tag Filter Multi-Select ───────────────────────────────── */
.tag-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-size: 13px;
}

.tag-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 100px;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    white-space: nowrap;
}

.tag-filter-trigger:hover {
    border-color: var(--accent);
}

.tag-filter-trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

.tag-filter-trigger .label {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.tag-filter-trigger .chevron {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
    margin-left: auto;
}

.tag-filter-trigger.open .chevron {
    transform: rotate(180deg);
}

.tag-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.5;
}

.tag-pill-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
}

.tag-pill-remove:hover {
    opacity: 1;
}

.tag-pill-more {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 1px 4px;
    white-space: nowrap;
}

.tag-pill-more:hover {
    color: var(--accent);
}

.tag-filter-all {
    color: var(--text-secondary);
    font-size: 13px;
}

.tag-filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1000;
    min-width: 280px;
    max-width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(99,102,241,0.08);
    margin-top: 0;
    display: none;
    overflow: hidden;
}

.tag-filter-dropdown.open {
    display: block;
    animation: dropdown-in 0.15s ease-out;
}

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

.tag-filter-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.tag-filter-search-wrap .search-icon {
    position: absolute;
    left: 12px;
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}

.tag-filter-search {
    width: 100%;
    padding: 10px 12px;
    padding-left: 32px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.tag-filter-search::placeholder {
    color: var(--text-muted);
}

.tag-filter-search:focus {
    background: rgba(99,102,241,0.04);
}

.tag-filter-options {
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.tag-filter-options::-webkit-scrollbar {
    width: 4px;
}
.tag-filter-options::-webkit-scrollbar-track {
    background: transparent;
}
.tag-filter-options::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.tag-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.08s;
    user-select: none;
}

.tag-filter-option:hover {
    background: var(--bg-hover);
}

.tag-filter-option.highlighted {
    background: var(--bg-hover);
    outline: none;
}

.tag-filter-option.highlighted .tag-name {
    color: var(--accent);
}

.tag-count-muted {
    color: var(--text-muted) !important;
}

.tag-filter-option .checkbox-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.tag-filter-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: all 0.12s;
    flex-shrink: 0;
    position: relative;
}

.tag-filter-option input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.tag-filter-option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.tag-filter-option input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}

.tag-filter-option .tag-name {
    flex: 1;
    color: var(--text-primary);
}

.tag-filter-option .tag-count {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tag-filter-no-results {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.tag-filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    background: var(--bg-secondary);
}

.tag-filter-actions .tag-count-badge {
    color: var(--text-muted);
    font-size: 11px;
}

.tag-filter-actions .action-btn {
    padding: 4px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.12s;
}

.tag-filter-actions .action-btn.clear {
    color: var(--yellow);
    background: transparent;
}

.tag-filter-actions .action-btn.clear:hover {
    background: rgba(234,179,8,0.1);
}

.tag-filter-actions .action-btn.apply {
    color: #fff;
    background: var(--accent);
}

.tag-filter-actions .action-btn.apply:hover {
    background: var(--accent-hover);
}

.tag-filter-actions .action-btn.apply:disabled {
    opacity: 0.4;
    cursor: default;
}

.tag-filter-disabled {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.5);
}

.tag-filter-count-badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Tag Color Palette ──────────────────────────────────── */
.tag-color-0  { background: rgba(99,102,241,0.12); color: var(--accent); }
.tag-color-1  { background: rgba(34,197,94,0.12); color: var(--green); }
.tag-color-2  { background: rgba(234,179,8,0.12); color: var(--yellow); }
.tag-color-3  { background: rgba(168,85,247,0.12); color: #a855f7; }
.tag-color-4  { background: rgba(239,68,68,0.12); color: var(--red); }
.tag-color-5  { background: rgba(236,72,153,0.12); color: #ec4899; }
.tag-color-6  { background: rgba(14,165,233,0.12); color: #0ea5e9; }
.tag-color-7  { background: rgba(107,114,128,0.12); color: var(--gray); }

@media (max-width: 768px) {
    .tag-filter-dropdown {
        min-width: 240px;
    }
}


/* ── Settings: Data Management Card ──────────────── */
.data-mgmt-card .card-header h2 {
    font-size: 15px;
}

.data-mgmt-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.data-mgmt-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.data-mgmt-actions .btn {
    padding: 8px 18px;
    font-size: 13px;
    gap: 6px;
    font-weight: 600;
}

.data-mgmt-status {
    margin-top: 12px;
    font-size: 13px;
    min-height: 0;
}

.data-mgmt-status.is-active {
    min-height: 20px;
}

.data-mgmt-status.status-error .status-text {
    color: var(--red);
}

.data-mgmt-status.status-success .status-text {
    color: var(--green);
}

/* ── Danger Button ──────────────────────────────── */
.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
    transition: all 0.15s;
}

.btn-danger:hover {
    background: var(--red-bg);
    color: #fff;
    border-color: var(--red);
}

.btn-danger:disabled,
.btn-danger.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 768px) {
    .data-mgmt-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .data-mgmt-actions .btn {
        justify-content: center;
        padding: 10px 18px;
        min-height: 44px;
    }
}

/* ── Settings: Sync Days ─────────────────────────────── */
.sync-days-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.sync-days-row label {
    font-size: 13px;
    color: var(--text-secondary);
}

.sync-days-input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    background: var(--bg-secondary);
    color: var(--text);
}

.sync-days-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.sync-days-row .btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
}

.sync-days-row .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 768px) {
    .sync-days-row {
        flex-direction: column;
        align-items: stretch;
    }
    .sync-days-row .btn {
        justify-content: center;
        padding: 10px 18px;
        min-height: 44px;
    }
}


/* ══════════════════════════════════════════════════════════════════
   MILLION-DOLLAR REDESIGN — Shrishti · May 2026
   ══════════════════════════════════════════════════════════════════ */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99, 102, 241, 0.03), transparent),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(99, 102, 241, 0.02), transparent),
        var(--bg-primary);
}

:root {
    --bg-primary: #0a0c12;
    --bg-secondary: #11141e;
    --bg-card: #181c28;
    --bg-hover: #1e2332;
    --bg-elevated: #1c2130;
    --text-primary: #f1f3f6;
    --text-secondary: #8b919d;
    --border: rgba(255,255,255,0.05);
    --border-hover: rgba(255,255,255,0.10);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.20);
    --accent-subtle: rgba(99, 102, 241, 0.07);
}

/* ── Premium Card Redesign ─────────────────────────────────── */
.card {
    border-radius: 12px;
    padding: 20px;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.02) inset;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(255,255,255,0.06);
    box-shadow:
        0 4px 24px rgba(0,0,0,0.3),
        0 0 0 1px rgba(99,102,241,0.04) inset;
}

.card-header {
    margin-bottom: 14px;
    padding-bottom: 14px;
}

.card-header h2,
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ── Premium Stat Cards ────────────────────────────────────── */
.stat-card {
    background: linear-gradient(
        145deg,
        var(--bg-card) 0%,
        rgba(24, 28, 40, 0.5) 100%
    );
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                border-color 0.2s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 30%;
    right: 30%;
    height: 2px;
    border-radius: 0 0 2px 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card:hover::before {
    opacity: 0.5;
}

.stat-total::before    { background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.stat-emails::before   { background: linear-gradient(90deg, transparent, #38bdf8, transparent); }
.stat-healthy::before  { background: linear-gradient(90deg, transparent, var(--green), transparent); }
.stat-at-risk::before  { background: linear-gradient(90deg, transparent, var(--yellow), transparent); }
.stat-burned::before   { background: linear-gradient(90deg, transparent, var(--red), transparent); }

.stat-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    border-color: rgba(99,102,241,0.15);
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 40%, #a0a5b0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Premium Header with Glass ─────────────────────────────── */
.header {
    background: rgba(17, 20, 30, 0.82);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding: 12px 0;
}

/* ── Premium Navigation ────────────────────────────────────── */
.header nav a {
    position: relative;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
}

.header nav a:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.header nav a.active {
    color: var(--accent);
    background: var(--accent-subtle);
    font-weight: 600;
}

.header nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* ── Premium Buttons ───────────────────────────────────────── */
.btn {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.15s ease;
}

.btn:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #4a7de0);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #3d72d4);
    box-shadow: 0 4px 14px rgba(91, 141, 239, 0.35);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ── Premium Filters ───────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-label {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1;
}

.filter-select,
.filter-date-input {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-select:hover,
.filter-date-input:hover {
    border-color: rgba(99,102,241,0.25);
}

.filter-select:focus,
.filter-date-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.06);
}

.date-range-input {
    width: 220px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .date-range-input {
        width: 160px;
    }
}

/* ── Collapsible Filter Bar (Shrishti Redesign) ────────── */
.filter-area {
  margin-bottom: 16px;
}

.filter-primary-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-search-wrap {
  flex: 1;
  position: relative;
  min-width: 180px;
}

.filter-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-search-wrap input::placeholder {
  color: var(--text-muted);
}

.filter-search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--accent-subtle);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-toggle-btn:hover {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.3);
  color: var(--accent);
}

.filter-toggle-btn .chevron {
  transition: transform 0.2s ease;
}

.filter-toggle-btn.is-open .chevron {
  transform: rotate(180deg);
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.filter-clear-btn {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.filter-clear-btn:hover {
  color: var(--yellow);
  background: rgba(234,179,8,0.08);
}

.filter-controls-panel {
  margin-top: 10px;
  padding: 12px;
  background: rgba(24, 28, 40, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
  position: relative;
  z-index: 50;
}

.filter-controls-panel.is-collapsed {
  max-height: 0;
  padding: 0 12px;
  margin-top: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
}

.pill-select,
.pill-date-input {
  padding: 7px 30px 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%239499a3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pill-select:hover,
.pill-date-input:hover {
  border-color: rgba(99,102,241,0.25);
}

.pill-select:focus,
.pill-date-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pill-date-input {
  width: 200px;
  cursor: pointer;
}

.filter-pill-tags .tag-filter-trigger {
  padding: 5px 12px;
  min-width: unset;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 13px;
}

.filter-pill-tags .tag-pill {
  font-size: 10px;
}

@media (max-width: 768px) {
  .filter-primary-row {
    flex-wrap: wrap;
  }

  .filter-search-wrap {
    min-width: 100%;
    order: 2;
  }

  .filter-toggle-btn {
    order: 1;
  }

  .filter-clear-btn {
    order: 1;
    margin-left: auto;
  }

  .pill-date-input {
    width: 160px;
  }

  .filter-pills-row {
    gap: 6px;
  }
}

/* ── Premium Table ─────────────────────────────────────────── */
thead th {
    background: rgba(24, 28, 40, 0.9) !important;
    backdrop-filter: blur(8px);
    color: var(--text-secondary) !important;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.025);
}

tbody tr {
    transition: background 0.12s;
    line-height: 1.4;
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.025);
}

/* ── Premium Badges ────────────────────────────────────────── */
.badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-healthy {
    background: linear-gradient(135deg, rgba(52,211,153,0.12), rgba(52,211,153,0.04));
    color: #34d399;
    border-color: rgba(52,211,153,0.12);
}

.badge-at-risk {
    background: linear-gradient(135deg, rgba(250,204,21,0.12), rgba(250,204,21,0.04));
    color: #facc15;
    border-color: rgba(250,204,21,0.12);
}

.badge-burned {
    background: linear-gradient(135deg, rgba(248,113,113,0.12), rgba(248,113,113,0.04));
    color: #f87171;
    border-color: rgba(248,113,113,0.12);
}

.badge-unknown {
    background: linear-gradient(135deg, rgba(107,114,128,0.12), rgba(107,114,128,0.04));
    color: #9ca3af;
    border-color: rgba(107,114,128,0.12);
}

/* ── Premium Tag Filter Dropdown ───────────────────────────── */
.tag-filter-dropdown {
    background: rgba(24, 28, 40, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.04);
    z-index: 1000;
}

.tag-filter-trigger {
    border-radius: 8px;
    padding: 7px 12px;
}

.tag-filter-trigger:hover {
    border-color: rgba(99,102,241,0.25);
}

/* ── Premium Timeframe Cards ───────────────────────────────── */
.timeframe-card {
    border-radius: 12px;
    padding: 20px 16px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.2s;
}

.timeframe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.timeframe-card:hover::before {
    opacity: 0.4;
}

.timeframe-card.tf-active {
    border-color: rgba(99,102,241,0.3);
    box-shadow: 0 0 0 1px rgba(99,102,241,0.15);
}

.timeframe-card.tf-active::before {
    opacity: 0.7;
}

.timeframe-card .tf-reply-rate {
    font-size: 30px;
    font-weight: 700;
}

/* ── Premium Modals ────────────────────────────────────────── */
.modal {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

/* ── Premium Trajectory Banners ────────────────────────────── */
.trajectory-banner {
    border-radius: 12px;
    padding: 18px 22px;
    border-left: 4px solid;
    gap: 14px;
}

.trajectory-banner .trajectory-icon {
    font-size: 22px;
}

.trajectory-banner .trajectory-label {
    font-size: 17px;
}

/* ── Shimmer Skeleton ──────────────────────────────────────── */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-hover) 25%,
        rgba(99, 102, 241, 0.06) 50%,
        var(--bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

/* ── Settings Page Refinements ─────────────────────────────── */
.settings-col {
    border-radius: 10px;
    padding: 16px;
}

.settings-col-header {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
}

.settings-col input[type="number"] {
    border-radius: 8px;
    padding: 8px 10px;
}

/* ── Chart Range Buttons ───────────────────────────────────── */
.chart-range-btn {
    padding: 6px 18px;
    border-radius: 8px;
    font-weight: 500;
}

.chart-range-btn.active {
    background: var(--accent);
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

/* ── Empty State Premium ───────────────────────────────────── */
.empty-state {
    padding: 100px 24px;
    text-align: center;
}

.empty-state .icon {
    font-size: 56px;
    margin-bottom: 20px;
    display: block;
    opacity: 0.8;
}

.empty-state h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 420px;
    margin: 0 auto 24px;
    line-height: 1.7;
}

/* ── Modal Re-optimizations ────────────────────────────────── */
.modal-content {
    padding: 28px;
}


/* ══════════════════════════════════════════════════════════════════
   DOMAIN DETAIL PREMIUM REFINEMENTS — Shrishti · May 2026
   ══════════════════════════════════════════════════════════════════ */

/* ── Breadcrumbs ────────────────────────────────────────────── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-link:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: rgba(255,255,255,0.08);
    font-size: 12px;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Domain Header ──────────────────────────────────────────── */
.domain-header + .filter-area {
    margin-top: 0;
}

.domain-favicon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.domain-favicon img {
    border-radius: 4px;
}

/* ── Timeframe Card — Premium Refinements ───────────────────── */
.timeframe-card {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s,
                box-shadow 0.2s;
}

.timeframe-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow:
        0 8px 24px rgba(0,0,0,0.2),
        0 0 0 1px rgba(99, 102, 241, 0.08);
}

.timeframe-card .tf-status-badge {
    order: -1;
    margin-top: 0;
    margin-bottom: 4px;
}

.timeframe-card .tf-label {
    font-size: 10px;
    letter-spacing: 0.8px;
    opacity: 0.6;
    order: 10;
    margin-bottom: 0;
    margin-top: 8px;
}

.timeframe-card .tf-trend {
    order: 9;
    margin-top: 0;
}

.timeframe-card .tf-meta {
    display: flex;
    gap: 4px;
    justify-content: center;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 2px;
}

.timeframe-card .tf-sent,
.timeframe-card .tf-bounce-rate {
    display: inline;
    font-size: 11px;
}

.tf-meta-sep {
    color: rgba(255,255,255,0.08);
}

/* ── Timeframe Skeleton Shimmer ─────────────────────────────── */
.timeframe-card .tf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
}

.tf-skeleton-value {
    width: 60px;
    height: 28px;
    background: linear-gradient(
        90deg,
        var(--bg-hover) 25%,
        rgba(99, 102, 241, 0.06) 50%,
        var(--bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.tf-skeleton-text {
    width: 100px;
    height: 12px;
    background: linear-gradient(
        90deg,
        var(--bg-hover) 25%,
        rgba(99, 102, 241, 0.06) 50%,
        var(--bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.tf-skeleton-badge {
    width: 50px;
    height: 16px;
    background: linear-gradient(
        90deg,
        var(--bg-hover) 25%,
        rgba(99, 102, 241, 0.06) 50%,
        var(--bg-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 20px;
}

/* ── Chart Card Elevation ───────────────────────────────────── */
.card.chart-card {
    position: relative;
    background: linear-gradient(
        180deg,
        var(--bg-card) 0%,
        rgba(24, 28, 40, 0.6) 100%
    );
}

.chart-container-inline {
    background: linear-gradient(
        180deg,
        rgba(99, 102, 241, 0.02) 0%,
        transparent 40%
    );
    border-radius: 8px;
    padding: 8px 0;
}

/* ── Chart Summary Bar Hover ────────────────────────────────── */
.chart-summary {
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.chart-summary:hover {
    background: rgba(99, 102, 241, 0.03);
    border-color: rgba(99, 102, 241, 0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ── Interactive Legend ─────────────────────────────────────── */
.legend-item {
    cursor: pointer;
    transition: opacity 0.15s;
    user-select: none;
}

.legend-item:hover {
    opacity: 1;
}

.legend-item.legend-hidden {
    opacity: 0.3;
    text-decoration: line-through;
}

/* ── Legend Line Colors ─────────────────────────────────────── */
.legend-line-total {
    height: 2px;
    border-top: 2px solid #f472b6;
    background: transparent;
}

.legend-line-human {
    height: 2px;
    border-top: 2px solid #34d399;
    background: transparent;
}

/* ── Table Gradient Left Borders ────────────────────────────── */
tbody tr.row-healthy {
    border-left: 3px solid;
    border-image: linear-gradient(
        180deg,
        rgba(52, 211, 153, 0.6),
        rgba(52, 211, 153, 0.2)
    ) 1;
}

tbody tr.row-at-risk {
    border-left: 3px solid;
    border-image: linear-gradient(
        180deg,
        rgba(250, 204, 21, 0.6),
        rgba(250, 204, 21, 0.2)
    ) 1;
}

tbody tr.row-burned {
    border-left: 3px solid;
    border-image: linear-gradient(
        180deg,
        rgba(248, 113, 113, 0.6),
        rgba(248, 113, 113, 0.2)
    ) 1;
}

/* ── Wider Progress Bars with Springy Animation ─────────────── */
.progress-bar {
    width: 72px;
    height: 5px;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s;
}

/* ── Table Badges (compact for table context) ───────────────── */
tbody .badge {
    font-size: 9px;
    padding: 2px 8px;
}

/* ── Copy Email Icon ────────────────────────────────────────── */
.copy-email {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.copy-email::after {
    content: '\1F4CB';
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s;
}

.copy-email:hover::after {
    opacity: 0.6;
}

/* ── Staggered Section Entrance Animations ──────────────────── */
@media (prefers-reduced-motion: no-preference) {
    .domain-header {
        animation: fade-slide-up 0.4s ease-out both;
        animation-delay: 0s;
    }

    .trajectory-banner {
        animation: fade-slide-up 0.4s ease-out both;
        animation-delay: 0.05s;
    }

    .stat-grid {
        animation: fade-slide-up 0.4s ease-out both;
        animation-delay: 0.1s;
    }

    .timeframe-grid {
        animation: fade-slide-up 0.4s ease-out both;
        animation-delay: 0.15s;
    }

    .card:nth-of-type(1) {
        animation-delay: 0.2s;
    }

    .card:nth-of-type(2) {
        animation-delay: 0.25s;
    }

    .card:nth-of-type(3) {
        animation-delay: 0.3s;
    }
}

/* ── Mobile Touch Targets ───────────────────────────────────── */
@media (max-width: 768px) {
    tbody td {
        padding: 14px 12px;
        min-height: 44px;
    }

    thead th {
        padding: 14px 12px;
    }
}

/* ── Mailbox Filter ───────────────────────────────────────────── */
.mailbox-filter-row {
    padding: 6px 20px 12px;
}

.mailbox-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 380px;
}

.mailbox-search-icon {
    position: absolute;
    left: 12px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0.6;
    line-height: 1;
}

.mailbox-search-input {
    width: 100%;
    padding: 8px 36px 8px 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 13px;
    font-family: Inter, -apple-system, sans-serif;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.mailbox-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.mailbox-search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.mailbox-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
    display: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.mailbox-search-clear:hover {
    opacity: 1;
}

.mailbox-search-clear.is-visible {
    display: block;
}

/* Highlight matching text in filtered rows */
.mailbox-filter-active tbody tr.mailbox-filter-hide {
    display: none;
}

/* ══════════════════════════════════════════════════════════════════
   BACKFILL PANEL — Shrishti Design · May 2026
   ══════════════════════════════════════════════════════════════════ */

@keyframes bf-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes bf-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes bf-badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ── Overview top row: combined graph (left) + backfill panel (right) ── */
.overview-top-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
}
.overview-graph-slot {
    flex: 1 1 0;
    min-width: 0;
}
/* ── Monitor row — full-width bar below the chart ───────── */
.overview-monitor-row {
    margin-bottom: 16px;
}

@media (max-width: 980px) {
    .overview-top-row {
        flex-direction: column;
    }
}

.backfill-panel {
    --panel-bg: linear-gradient(
        145deg,
        var(--bg-card) 0%,
        rgba(24, 28, 40, 0.5) 100%
    );

    background: var(--panel-bg);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.2),
        0 0 0 1px rgba(255,255,255,0.02) inset;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.backfill-panel:hover {
    border-color: rgba(255,255,255,0.06);
    box-shadow:
        0 4px 24px rgba(0,0,0,0.3),
        0 0 0 1px rgba(99, 102, 241, 0.04) inset;
}

.backfill-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 30%;
    right: 30%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 0 0 2px 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.backfill-panel:hover::before {
    opacity: 0.6;
}

.backfill-panel.is-caught-up {
    border-color: rgba(34, 197, 94, 0.08);
}

.backfill-panel.is-caught-up::before {
    background: linear-gradient(90deg, transparent, var(--green), transparent);
}

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

.backfill-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.backfill-panel-title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--yellow-bg);
    color: var(--yellow);
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
}

.backfill-panel-title-icon.is-ok {
    background: var(--green-bg);
    color: var(--green);
}

.backfill-panel-title-icon.is-empty {
    background: var(--accent-subtle);
    color: var(--accent);
}

.backfill-panel-title-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.backfill-panel-title-text h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.backfill-panel-title-text .sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.3;
}

.backfill-panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.backfill-panel-badge.badge-pending {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.backfill-panel-badge.badge-caught-up {
    background: var(--green-bg);
    color: var(--green);
}

.backfill-panel-badge .badge-count {
    font-size: 14px;
    font-weight: 700;
}

.backfill-panel-body {
    padding: 12px 20px 16px;
}

.pending-days-info {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.pending-days-calendar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 240px;
}

.pending-days-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.pending-days-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pending-day-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pending-day-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.pending-day-chip.is-today {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.pending-day-chip .chip-dayname {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    margin-right: 4px;
}

.pending-day-chip .chip-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}

.chip-status-dot.is-today-dot {
    background: var(--accent);
}

.chip-status-dot.is-past-dot {
    background: var(--yellow);
}

.pending-days-chips .more-count {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px dashed var(--border);
    cursor: default;
}

.pending-days-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--green);
    font-size: 13px;
    font-weight: 500;
}

.pending-days-empty svg {
    flex-shrink: 0;
}

.backfill-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.bf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    user-select: none;
}

.bf-btn:hover {
    transform: translateY(-1px);
}

.bf-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.bf-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.bf-btn .bf-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bf-btn-primary {
    background: linear-gradient(135deg, var(--accent), #4a7de0);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(91, 141, 239, 0.25);
}

.bf-btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #3d72d4);
    box-shadow: 0 4px 14px rgba(91, 141, 239, 0.35);
}

.bf-btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}

.bf-btn-secondary:hover {
    background: var(--bg-hover);
    border-color: rgba(255,255,255,0.08);
}

.backfill-progress-block {
    display: none;
    margin-top: 4px;
}

.backfill-progress-block.is-active {
    display: block;
    animation: bf-fade-in 0.25s ease-out;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-track-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), #818cf8, var(--accent));
    background-size: 200% 100%;
    animation: bf-shimmer 2s linear infinite;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.progress-step-label {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
}

.progress-pct-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.backfill-success-msg {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: var(--green);
    font-size: 13px;
    font-weight: 500;
    animation: bf-fade-in 0.3s ease-out;
}

.backfill-success-msg.is-active {
    display: flex;
}

.backfill-success-msg .success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--green-bg);
    flex-shrink: 0;
}

.backfill-error-msg {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    animation: bf-fade-in 0.3s ease-out;
}

.backfill-error-msg.is-active {
    display: flex;
}

.backfill-error-msg .error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--red-bg);
    color: var(--red);
    font-size: 14px;
    flex-shrink: 0;
}

.backfill-error-msg .error-text {
    font-size: 13px;
    color: var(--red);
    flex: 1;
}

.backfill-error-msg .error-retry-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--red);
    background: transparent;
    color: var(--red);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.backfill-error-msg .error-retry-btn:hover {
    background: var(--red-bg);
}

/* ── Skeleton states ───────────────────────────────── */
.bf-skeleton {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    background: var(--bg-hover);
    border-radius: 6px;
}

.bf-skeleton-text {
    height: 14px;
    width: 180px;
    margin: 4px 0;
}

.bf-skeleton-chip {
    height: 28px;
    width: 90px;
    display: inline-block;
    margin-right: 6px;
}

.bf-skeleton-btn {
    height: 36px;
    width: 120px;
    display: inline-block;
    border-radius: 8px;
}

/* ── Badge count pulse ──────────────────────────────── */
.badge-pending .badge-count {
    animation: bf-badge-pulse 2s ease-in-out 3;
}

/* ── Error state panel ─────────────────────────────── */
.backfill-panel.has-error {
    border-color: rgba(239, 68, 68, 0.12);
}

/* ── Mobile responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .backfill-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px 16px 10px;
    }

    .backfill-panel-body {
        padding: 10px 16px 14px;
    }

    .pending-days-info {
        flex-direction: column;
        gap: 12px;
    }

    .backfill-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .bf-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .pending-days-chips {
        gap: 4px;
    }

    .pending-day-chip {
        padding: 3px 8px;
        font-size: 11px;
    }

    .bf-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ── Premium External Tooltip ─────────────────────────────── */
.chartjs-tooltip {
  opacity: 0;
  position: absolute;
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.15s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chartjs-tooltip.visible {
  opacity: 1;
}

.chartjs-tooltip-inner {
  background: rgba(17, 20, 30, 0.97);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 300px;
}

/* ── Header row: date left, reply rate badge right ──── */
.tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tt-date {
  font-size: 13px;
  font-weight: 600;
  color: #f1f3f6;
  letter-spacing: -0.01em;
}

.tt-rate-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 10px;
  border-radius: 8px;
  line-height: 1;
}

.tt-rate-badge-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  margin-bottom: 2px;
}

.tt-rate-badge-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── Divider ──────────────────────────────────────── */
.tt-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

/* ── Section header ──────────────────────────────── */
.tt-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 8px;
}

/* ── Metric grid (4 columns) ─────────────────────── */
.tt-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.tt-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tt-metric-label {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  white-space: nowrap;
}

.tt-metric-value {
  font-size: 13px;
  font-weight: 600;
  color: #f1f3f6;
  letter-spacing: -0.01em;
}

/* Mini bar (volume only) */
.tt-minibar {
  height: 4px;
  border-radius: 2px;
  margin-top: 1px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.tt-minibar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s ease;
}

/* ── Color dots for rate metrics ───────────────── */
.tt-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.dot-good { background: #22c55e; }
.dot-warn { background: #eab308; }
.dot-bad  { background: #ef4444; }

/* ── Footer (low-volume warning) ────────────── */
.tt-footer {
  font-size: 10px;
  font-weight: 500;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ══════════════════════════════════════════════════════════════════
   CAMPAIGN PAGES — Campaign Listing & Per-Account Breakdown
   ══════════════════════════════════════════════════════════════════ */

/* ── Campaign Status Badges ─────────────────────────────────── */

.campaign-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-active    { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.status-paused    { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.status-completed { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.status-draft     { background: rgba(107, 114, 128, 0.12); color: #6b7280; }

.campaign-status-emoji {
    font-size: 15px;
    cursor: default;
}

/* ── Campaign Name in table ─────────────────────────────────── */

.campaign-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.campaign-name-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s;
}

.campaign-name-link:hover {
    color: var(--accent);
}

/* ── Breadcrumbs ─────────────────────────────────────────────── */

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    flex-wrap: wrap;
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.breadcrumb-link:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 14px;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Note Banner (campaign-level info) ──────────────────────── */

.note-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.12);
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.note-banner .note-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.note-banner strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── No Results Message ──────────────────────────────────────── */

.no-results-msg {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.no-results-msg .icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.no-results-msg h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.no-results-msg p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ── Sortable Column Headers ──────────────────────────────────── */

th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 22px !important;
    transition: color 0.15s;
}

th.sortable:hover {
    color: var(--text-primary) !important;
}

th.sortable::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.2;
    transition: opacity 0.15s;
}

th.sortable.sort-asc::after {
    border-bottom: 5px solid var(--accent);
    opacity: 1;
}

th.sortable.sort-desc::after {
    border-top: 5px solid var(--accent);
    opacity: 1;
}

/* ── View Details Button ──────────────────────────────────────── */

.btn-view-details {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-view-details:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

/* ── Campaign Skeleton (loading placeholder) ──────────────────── */

.campaign-skeleton td {
    padding: 14px 16px;
}

.campaign-skeleton .skeleton-name {
    height: 16px;
    width: 60%;
    border-radius: 4px;
    display: inline-block;
}

.campaign-skeleton .skeleton-badge {
    height: 20px;
    width: 70px;
    border-radius: 20px;
    display: inline-block;
}

.campaign-skeleton .skeleton-num {
    height: 14px;
    width: 50px;
    border-radius: 4px;
    display: inline-block;
    float: right;
}

/* ── Campaign Page Responsive ─────────────────────────────────── */

@media (max-width: 768px) {
    .campaign-name { font-size: 13px; }
    .breadcrumbs { font-size: 12px; gap: 6px; }
    .filter-primary-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-primary-row .filter-search-wrap { min-width: 0; }
    .filter-primary-row .filter-pill { width: 100%; }
    .filter-primary-row .pill-select { width: 100%; }
    .note-banner { font-size: 12px; padding: 8px 12px; }

    /* Hide Last Activity column on small screens */
    #accounts-table th:nth-child(6),
    #accounts-table td:nth-child(6) {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Hide Domain and Replies columns on very small screens */
    #accounts-table th:nth-child(2),
    #accounts-table td:nth-child(2),
    #accounts-table th:nth-child(4),
    #accounts-table td:nth-child(4) {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════════
   DATA MONITOR PANEL v2 — 1×4 horizontal bar with em dash separators
   ══════════════════════════════════════════════════════════════════ */

.data-monitor-panel {
    background: var(--bg-card);
    border: 1px solid rgba(99, 102, 241, 0.08);
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(99, 102, 241, 0.04) inset;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Accent glow on top */
.data-monitor-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
    border-radius: 0 0 2px 2px;
}

.data-monitor-panel.is-active {
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(99, 102, 241, 0.08) inset;
}

.data-monitor-panel.is-active::before {
    opacity: 0.8;
}

/* ── Header row ──────────────────────────────────────── */
.dm-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.dm-head-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.dm-head-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.dm-head-badge {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: all 0.2s ease;
}

/* ── 1×4 inline row with em dash separators ──────────── */
.dm-row {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
}

.dm-sep {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 18px;
    font-weight: 300;
    padding: 0 8px;
    user-select: none;
}

/* Each metric item — icon + label + value on one line */
.dm-item {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex: 1;
    padding: 6px 0;
    min-width: 0;
}

.dm-item-icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.dm-item-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.dm-item-val {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Emphasized metric (Reply Rate) */
.dm-item-emph .dm-item-label {
    color: var(--accent);
    font-weight: 600;
}

/* ── Status ghost spans (hidden — value color suffices) ─ */
.dm-status-ghost {
    display: none !important;
}

/* ── Active (hovering a data point) — value colors ──── */
.data-monitor-panel.is-active .dm-item-val {
    transition: color 0.15s ease;
}

/* ── Responsive: narrow screens ──────────────────────── */
@media (max-width: 900px) {
    .data-monitor-panel {
        padding: 12px 16px;
    }
    .dm-item-icon {
        font-size: 12px;
    }
    .dm-item-label {
        font-size: 11px;
    }
    .dm-item-val {
        font-size: 13px;
    }
    .dm-sep {
        padding: 0 5px;
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .dm-row {
        flex-wrap: wrap;
        gap: 2px 0;
    }
    .dm-sep {
        display: none;
    }
    .dm-item {
        flex: none;
        padding: 3px 0;
        width: 100%;
    }
}

/* ══════════════════════════════════════════════════════════════════
   COLLAPSIBLE SYNC BAR — Shrishti Design
   ══════════════════════════════════════════════════════════════════ */

.sync-collapsible-wrap {
    margin-top: 16px;
}

.sync-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 13px;
    transition: border-color 0.2s;
    cursor: pointer;
    user-select: none;
}

.sync-status-bar:hover {
    border-color: var(--border-hover);
}

.sync-status-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--yellow-bg);
    color: var(--yellow);
    font-size: 14px;
}

.sync-status-icon.is-ok {
    background: var(--green-bg);
    color: var(--green);
}

.sync-status-label {
    font-weight: 500;
    color: var(--text-primary);
}

.sync-status-detail {
    color: var(--text-muted);
    font-size: 12px;
}

.sync-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin: 0 6px 0 4px;
    vertical-align: middle;
}

.sync-status-dot.is-pending {
    background: var(--yellow);
}

.sync-status-dot.is-ok {
    background: var(--green);
}

.sync-status-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-status-link {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.15);
    background: rgba(99, 102, 241, 0.06);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.sync-status-link:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
}

/* ── Expandable body ───────────────────────────────── */
.sync-bar-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease;
}

.sync-bar-body-inner {
    padding: 16px 0 4px;
}

.sync-bar-body .backfill-panel {
    margin-bottom: 0;
}

/* ── Backfill button in filter bar ─────────────────── */
.bf-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: var(--yellow-bg);
    border: 1px solid rgba(234, 179, 8, 0.15);
    border-radius: 10px;
    color: var(--yellow);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.bf-header-btn:hover {
    background: rgba(234, 179, 8, 0.18);
    border-color: rgba(234, 179, 8, 0.3);
    color: #facc15;
}

/* ── Hosted Country (lazy-loaded column) ────────────────── */

.hosted-cell {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.hosted-loading {
    display: inline-block;
    width: 18px;
    text-align: center;
}

.hosted-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: hosted-spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes hosted-spin {
    to { transform: rotate(360deg); }
}

.hosted-country {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: default;
    transition: background 0.15s;
}

.hosted-country.country-in {
    background: #dc2626;
    color: #fff;
}

.hosted-country.country-in:hover {
    background: #b91c1c;
}

.hosted-country.country-us,
.hosted-country.country-eu {
    background: #16a34a;
    color: #fff;
}

.hosted-country.country-us:hover,
.hosted-country.country-eu:hover {
    background: #15803d;
}

.hosted-country.country-other {
    background: #ea580c;
    color: #fff;
}

.hosted-country.country-other:hover {
    background: #c2410c;
}

.hosted-na {
    color: var(--text-muted);
    font-size: 11px;
}

.hosted-country-badge {
    display: inline-block;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.hosted-country-badge.country-in {
    background: #dc2626;
    color: #fff;
}

.hosted-country-badge.country-us,
.hosted-country-badge.country-eu {
    background: #16a34a;
    color: #fff;
}

.hosted-country-badge.country-other {
    background: #ea580c;
    color: #fff;
}

/* ── Per-domain notes (inline editable) ─────────────────── */

.note-input {
    width: 100%;
    min-width: 140px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}

.note-input:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.04));
}

.note-input:focus {
    outline: none;
    background: var(--bg-hover, rgba(255, 255, 255, 0.06));
    border-color: var(--accent);
}

.note-input::placeholder {
    color: var(--text-muted);
}

.note-input.note-saved {
    border-color: #16a34a;
}

.note-input.note-error {
    border-color: #dc2626;
}

