/* Iron Man / Cyberpunk HUD Dashboard CSS v3.0 */
/* Jarvis HUD Theme - Full visual overhaul, zero functionality changes */

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

:root {
    /* Jarvis HUD Theme - Cyberpunk Palette */
    --primary: #00f0ff;
    --primary-light: #66f7ff;
    --primary-dark: #00b8cc;
    --secondary: #ff00aa;
    --success: #00ff88;
    --success-light: #44ffaa;
    --warning: #ffaa00;
    --warning-light: #ffcc44;
    --danger: #ff3344;
    --danger-light: #ff6677;
    --info: #00f0ff;
    --dark: #030b1a;
    --dark-light: #0a1628;
    --gray: #4a6080;
    --gray-light: #7a9ab8;
    --gray-lighter: #3a5068;
    --gray-lightest: #d0dce8;
    --white: #e8f4ff;
    --bg-primary: #030b1a;
    --bg-secondary: rgba(6, 18, 40, 0.85);
    --bg-tertiary: rgba(10, 30, 60, 0.5);
    --text-primary: #e8f4ff;
    --text-secondary: #b0c8e0;
    --text-tertiary: #7a9ab8;
    --border-color: rgba(0, 240, 255, 0.12);
    --bg-gradient: linear-gradient(135deg, #030b1a 0%, #061228 50%, #0a1830 100%);
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 240, 255, 0.05);
    --card-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 240, 255, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Fluid Typography */
    --font-xs: clamp(0.75rem, 0.65rem + 0.4vw, 0.875rem);
    --font-sm: clamp(0.875rem, 0.75rem + 0.4vw, 1rem);
    --font-base: clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
    --font-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
    --font-xl: clamp(1.5rem, 1.25rem + 0.75vw, 2rem);
    --font-2xl: clamp(1.75rem, 1.5rem + 1vw, 2.5rem);
    --font-3xl: clamp(2rem, 1.75rem + 1.25vw, 3rem);

    /* Problem Highlighting Colors */
    --problem-bg: rgba(255, 51, 68, 0.15);
    --problem-border: #ff3344;
    --problem-glow: 0 0 20px rgba(255, 51, 68, 0.4);
    --success-bg: rgba(0, 255, 136, 0.15);
    --success-border: #00ff88;
    --warning-bg: rgba(255, 170, 0, 0.15);
    --warning-border: #ffaa00;

    /* Fluid Spacing */
    --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --space-sm: clamp(0.5rem, 1vw, 0.75rem);
    --space-md: clamp(0.75rem, 1.5vw, 1.25rem);
    --space-lg: clamp(1rem, 2vw, 1.75rem);
    --space-xl: clamp(1.5rem, 2.5vw, 2.5rem);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #030b1a;
        --bg-secondary: #0a1628;
        --text-primary: #e8f4ff;
        --text-secondary: #b0c8e0;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
        /* Circuit grid - small */
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        /* Circuit grid - large */
        linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px),
        /* Base gradient */
        var(--bg-gradient);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px, 100% 100%;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: var(--font-base);
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

/* Scan line overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 10%, rgba(0, 240, 255, 0.3) 40%, rgba(0, 240, 255, 0.5) 50%, rgba(0, 240, 255, 0.3) 60%, transparent 90%);
    z-index: 9998;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(-2px); }
    100% { transform: translateY(100vh); }
}

/* FULL-WIDTH CONTAINER */
.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: var(--space-lg) var(--space-xl);
}

@media (min-width: 2560px) {
    .container {
        max-width: 2400px;
        margin: 0 auto;
    }
}

/* Modern Header - Full Width */
header {
    background: rgba(3, 11, 26, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.1);
    padding: var(--space-lg) var(--space-xl);
    border-radius: clamp(12px, 2vw, 24px);
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--primary) 0%,
        var(--secondary) 50%,
        var(--primary) 100%);
    background-size: 200% 100%;
    animation: header-gradient 3s linear infinite;
}

@keyframes header-gradient {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

header h1 {
    font-family: 'Orbitron', 'Inter', sans-serif;
    color: var(--text-primary);
    font-size: var(--font-2xl);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Stats Grid - Responsive */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

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

.stat-card {
    background: rgba(6, 18, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 240, 255, 0.1);
    padding: var(--space-lg);
    border-radius: clamp(12px, 1.5vw, 16px);
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    min-height: 44px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

/* HUD Frame Corner Brackets */
.stat-card.hud-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 0 0 / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 0 0 / 2px 16px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 100% 0 / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 100% 0 / 2px 16px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 0 100% / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 0 100% / 2px 16px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 100% 100% / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.25), rgba(0,240,255,0.25)) 100% 100% / 2px 16px no-repeat;
    border-radius: inherit;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1;
}

.stat-card:hover {
    transform: translateY(-4px);
    background: rgba(6, 18, 40, 0.95);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.1);
}

.stat-card.hud-frame:hover::after {
    background:
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 0 0 / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 0 0 / 2px 16px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 100% 0 / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 100% 0 / 2px 16px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 0 100% / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 0 100% / 2px 16px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 100% 100% / 16px 2px no-repeat,
        linear-gradient(rgba(0,240,255,0.7), rgba(0,240,255,0.7)) 100% 100% / 2px 16px no-repeat;
}

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

.stat-card:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.stat-card.success::before { background: var(--success); }
.stat-card.error::before { background: var(--danger); }
.stat-card.warning::before { background: var(--warning); }

/* Problem highlighting for Failed card when count > 0 */
.stat-card.error.has-problems {
    background: var(--problem-bg);
    border: 2px solid var(--problem-border);
    box-shadow: var(--problem-glow);
    transform: scale(1.02);
}

.stat-card.error.has-problems::before {
    opacity: 1;
}

.stat-card.error.has-problems .stat-value {
    color: #ff6677;
    text-shadow: 0 0 10px rgba(255, 51, 68, 0.5);
}

@keyframes attention-pulse {
    0%, 100% { box-shadow: var(--problem-glow); }
    50% { box-shadow: 0 0 30px rgba(255, 51, 68, 0.6); }
}

.stat-card.error.has-problems {
    animation: attention-pulse 2s ease-in-out infinite;
}

.stat-label {
    font-family: 'Orbitron', 'Inter', sans-serif;
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xs);
    font-weight: 500;
}

.stat-value {
    font-size: var(--font-3xl);
    font-weight: 700;
    color: #e8f4ff;
    transition: var(--transition);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-value.live-update {
    animation: pulse-value 0.5s ease;
}

@keyframes pulse-value {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); color: var(--primary-light); }
    100% { transform: scale(1); }
}

/* Active Job Card */
.active-job-section {
    margin-bottom: var(--space-lg);
}

.active-job-section h2,
.job-list-section h2 {
    font-family: 'Orbitron', 'Inter', sans-serif;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-size: var(--font-lg);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.active-job-card {
    background: rgba(6, 18, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 240, 255, 0.1);
    padding: var(--space-lg);
    border-radius: clamp(12px, 1.5vw, 16px);
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.job-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-sm);
    color: var(--primary-light);
}

.job-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.job-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.job-info-item strong {
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-light);
}

/* Progress Bar - Segmented HUD Style */
.progress-bar {
    height: 10px;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(0, 240, 255, 0.08) 0px,
            rgba(0, 240, 255, 0.08) 8px,
            transparent 8px,
            transparent 10px
        );
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 240, 255, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 3px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5));
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
    border-radius: 0 3px 3px 0;
}

/* Section Header with Filter Controls */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.filter-controls label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.filter-controls select {
    background: rgba(6, 18, 40, 0.9);
    border: 1px solid rgba(0, 240, 255, 0.2);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: 8px;
    font-size: var(--font-sm);
    min-height: 44px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

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

.filter-controls select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Search Input */
.search-input {
    background: rgba(6, 18, 40, 0.9);
    border: 1px solid rgba(0, 240, 255, 0.2);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: 8px;
    font-size: var(--font-sm);
    min-height: 44px;
    min-width: 220px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--gray);
    font-size: var(--font-xs);
}

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

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.search-label {
    flex: 1;
    min-width: 200px;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    margin-top: var(--space-sm);
}

.page-info {
    color: var(--text-secondary);
    font-size: var(--font-sm);
    white-space: nowrap;
}

.pagination-controls .btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Job Table - Desktop */
.job-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    contain: layout;
}

.job-table thead {
    background: var(--bg-secondary);
}

.job-table th {
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.job-table tbody tr {
    background: rgba(6, 18, 40, 0.5);
    border-bottom: 1px solid rgba(0, 240, 255, 0.05);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    will-change: transform;
}

.job-table tbody tr:hover {
    background: rgba(6, 18, 40, 0.85);
    transform: translateX(3px);
}

.job-table tbody tr.updating {
    animation: row-flash 0.5s ease;
}

@keyframes row-flash {
    0% { background: rgba(0, 240, 255, 0.1); }
    100% { background: rgba(6, 18, 40, 0.5); }
}

.job-table td {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.job-id-cell {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-sm);
    color: var(--primary-light);
}

/* Status Badges */
.job-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    white-space: nowrap;
}

.job-status.status-queued {
    background: rgba(122, 154, 184, 0.2);
    color: #a0c0d8;
    border: 1px solid rgba(122, 154, 184, 0.3);
}

.job-status.status-processing,
.job-status.status-in_progress {
    background: rgba(0, 240, 255, 0.15);
    color: #66f7ff;
    border: 1px solid rgba(0, 240, 255, 0.4);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(0, 240, 255, 0.4); }
    50% { border-color: rgba(0, 240, 255, 0.8); box-shadow: 0 0 12px rgba(0, 240, 255, 0.4); }
}

.job-status.status-completed {
    background: rgba(0, 255, 136, 0.15);
    color: #44ffaa;
    border: 1px solid rgba(0, 255, 136, 0.4);
}

.job-status.status-failed {
    background: rgba(255, 51, 68, 0.15);
    color: #ff6677;
    border: 1px solid rgba(255, 51, 68, 0.4);
}

.job-status.status-scheduled {
    background: rgba(255, 170, 0, 0.15);
    color: #ffcc44;
    border: 1px solid rgba(255, 170, 0, 0.4);
}

/* Buttons */
.btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: var(--font-sm);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    background: rgba(0, 240, 255, 0.15);
    color: #66f7ff;
    border: 1px solid rgba(0, 240, 255, 0.3);
    min-height: 44px;
    white-space: nowrap;
}

.btn:hover {
    background: rgba(0, 240, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.3);
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-success {
    background: rgba(0, 255, 136, 0.15);
    color: #44ffaa;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.btn-success:hover {
    background: rgba(0, 255, 136, 0.25);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.btn-danger {
    background: rgba(255, 51, 68, 0.15);
    color: #ff3344;
    border: 1px solid rgba(255, 51, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 51, 68, 0.25);
    box-shadow: 0 4px 12px rgba(255, 51, 68, 0.3);
}

/* Modal - Holographic Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background: linear-gradient(160deg, rgba(6, 18, 40, 0.97) 0%, rgba(3, 11, 26, 0.97) 100%);
    margin: var(--space-md);
    padding: var(--space-xl);
    width: calc(100% - var(--space-lg));
    max-width: none;
    border-radius: clamp(16px, 2vw, 24px);
    max-height: calc(100vh - var(--space-lg));
    overflow-y: auto;
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.08);
    animation: slideUp 0.3s ease;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (min-width: 2560px) {
    .modal-content {
        max-width: 2200px;
        margin: var(--space-md) auto;
    }
}

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

.modal-content h2 {
    font-family: 'Orbitron', 'Inter', sans-serif;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-size: var(--font-xl);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.close {
    position: absolute;
    right: var(--space-lg);
    top: var(--space-lg);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 240, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    color: var(--gray-light);
    font-size: 20px;
    border: 1px solid rgba(0, 240, 255, 0.2);
    min-height: 44px;
    min-width: 44px;
}

.close:hover {
    background: rgba(0, 240, 255, 0.2);
    transform: rotate(90deg);
}

/* Pipeline Stages */
.pipeline-stages {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: rgba(3, 11, 26, 0.7);
    border-radius: clamp(12px, 1.5vw, 16px);
    margin-bottom: var(--space-md);
    overflow-x: auto;
    border: 1px solid rgba(0, 240, 255, 0.08);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: var(--space-md);
}

.stage {
    flex: 1;
    min-width: 110px;
    text-align: center;
    padding: var(--space-md);
    background: rgba(10, 30, 60, 0.6);
    border-radius: 12px;
    border: 2px solid rgba(0, 240, 255, 0.1);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    scroll-snap-align: start;
    min-height: 44px;
}

.stage:hover {
    transform: translateY(-2px);
    background: rgba(10, 30, 60, 0.85);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.stage:active {
    transform: scale(0.98);
}

.stage-icon {
    font-size: clamp(20px, 2vw, 28px);
    margin-bottom: var(--space-xs);
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-title {
    font-family: 'Orbitron', 'Inter', sans-serif;
    font-weight: 600;
    color: #e8f4ff;
    margin-bottom: 4px;
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stage-status {
    font-size: var(--font-xs);
    color: #7a9ab8;
    font-weight: 500;
}

.stage-pending {
    border-color: rgba(122, 154, 184, 0.2);
}

.stage-progress {
    border-color: rgba(0, 240, 255, 0.5);
    background: rgba(0, 240, 255, 0.08);
    animation: stage-pulse 2s infinite;
}

@keyframes stage-pulse {
    0%, 100% { background: rgba(0, 240, 255, 0.08); }
    50% { background: rgba(0, 240, 255, 0.15); box-shadow: 0 0 15px rgba(0, 240, 255, 0.2); }
}

.stage-completed {
    border-color: rgba(0, 255, 136, 0.5);
    background: rgba(0, 255, 136, 0.08);
}

.stage-failed {
    border-color: rgba(255, 51, 68, 0.5);
    background: rgba(255, 51, 68, 0.08);
}

.stage-partial {
    border-color: rgba(255, 170, 0, 0.5);
    background: rgba(255, 170, 0, 0.08);
}

/* Stage Connectors (replace arrows) */
.stage-connector {
    width: 40px;
    height: 4px;
    background: rgba(0, 240, 255, 0.08);
    border-radius: 2px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.stage-connector.connector-active {
    background: rgba(0, 240, 255, 0.12);
}

.stage-connector.connector-active::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 100%;
    background: linear-gradient(90deg, transparent, #00f0ff, transparent);
    border-radius: 2px;
    animation: energy-flow 1.5s linear infinite;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

@keyframes energy-flow {
    0% { left: -14px; }
    100% { left: calc(100% + 14px); }
}

.stage-connector.connector-lit {
    background: linear-gradient(90deg, #00f0ff, #00ff88);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.25);
}

/* Legacy arrow class (keep for compatibility) */
.stage-arrow {
    color: rgba(0, 240, 255, 0.3);
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Health Domains Grid */
.health-domains {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

@media (min-width: 1600px) {
    .health-domains {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

.health-domain {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease, background 0.2s ease;
    min-height: 56px;
    gap: var(--space-md);
}

.health-domain:hover {
    transform: translateX(3px);
    background: rgba(10, 30, 60, 0.6);
}

.health-domain.live-update {
    animation: health-flash 0.5s ease;
}

@keyframes health-flash {
    0% { background: rgba(0, 240, 255, 0.15); }
    100% { background: rgba(6, 18, 40, 0.85); }
}

.health-healthy {
    border-color: rgba(0, 255, 136, 0.3);
}

.health-failed {
    border-color: rgba(255, 51, 68, 0.3);
}

.health-checking {
    border-color: rgba(0, 240, 255, 0.3);
}

.health-pending {
    border-color: rgba(122, 154, 184, 0.2);
}

.health-domain-name {
    font-weight: 500;
    font-size: var(--font-sm);
    color: var(--text-primary);
    word-break: break-word;
    flex: 1;
}

.health-domain-status {
    font-size: var(--font-sm);
    color: var(--gray-light);
    text-align: right;
    min-width: 80px;
    flex-shrink: 0;
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: var(--space-lg);
}

@media (min-width: 1600px) {
    .detail-grid {
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    }
}

.detail-section {
    background: rgba(6, 18, 40, 0.7);
    padding: var(--space-lg);
    border-radius: clamp(12px, 1.5vw, 16px);
    border: 1px solid rgba(0, 240, 255, 0.08);
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-section h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-size: var(--font-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.detail-section pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-base);
    line-height: 2;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

/* Copy buttons */
.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: var(--space-xs);
    padding: 4px;
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
    min-height: 44px;
    min-width: 44px;
}

.copy-btn:hover {
    background: rgba(0, 240, 255, 0.25);
    border-color: rgba(0, 240, 255, 0.6);
    transform: scale(1.05);
}

.copy-btn.copied {
    background: rgba(0, 255, 136, 0.25);
    border-color: rgba(0, 255, 136, 0.6);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--white);
    fill: none;
    stroke-width: 2;
}

.data-field {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.data-value {
    font-family: 'JetBrains Mono', monospace;
    color: #66f7ff;
    font-weight: 500;
}

/* Loading States */
.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--gray-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

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

.no-active-job {
    text-align: center;
    padding: var(--space-xl);
    color: var(--gray-light);
    background: rgba(6, 18, 40, 0.5);
    border-radius: 12px;
    border: 1px dashed rgba(0, 240, 255, 0.1);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 9999;
}

.toast {
    background: var(--dark-light);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: 12px;
    margin-bottom: var(--space-sm);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    animation: slideInRight 0.3s ease;
    transition: var(--transition);
    max-width: min(350px, calc(100vw - 2rem));
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(3, 11, 26, 0.8);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    border-radius: 10px;
    border: 2px solid rgba(3, 11, 26, 0.8);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-dark) rgba(3, 11, 26, 0.8);
}

/* Virtual scroll container */
.virtual-scroll-container {
    height: clamp(400px, 60vh, 700px);
    overflow-y: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.virtual-scroll-content {
    position: relative;
}

/* =========================================
   RESPONSIVE BREAKPOINTS
   ========================================= */

/* Mobile: max-width 640px */
@media (max-width: 640px) {
    header {
        flex-direction: column;
        text-align: center;
        padding: var(--space-md);
    }

    header h1 {
        font-size: var(--font-lg);
    }

    .header-controls {
        justify-content: center;
        width: 100%;
    }

    .filter-controls {
        flex-direction: column;
        width: 100%;
        gap: var(--space-sm);
    }

    .filter-controls label {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .filter-controls select,
    .filter-controls .btn,
    .filter-controls .search-input {
        width: 100%;
    }

    .search-label {
        min-width: unset;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    /* Full-screen modal on mobile */
    .modal-content {
        width: 100%;
        margin: 0;
        min-height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: var(--space-md);
        padding-top: calc(env(safe-area-inset-top, 0) + var(--space-md));
    }

    .close {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0) + var(--space-sm));
        right: var(--space-sm);
        z-index: 100;
        background: rgba(3, 11, 26, 0.9);
    }

    .modal-content h2 {
        margin-top: var(--space-xl);
    }
}

/* Tablet: max-width 768px */
@media (max-width: 768px) {
    .pipeline-stages {
        flex-direction: column;
        padding: var(--space-md);
    }

    .stage {
        min-width: unset;
        width: 100%;
    }

    .stage-arrow {
        transform: rotate(90deg);
    }

    /* Connectors become vertical on mobile */
    .stage-connector {
        width: 4px;
        height: 24px;
        margin: 0 auto;
    }

    .stage-connector.connector-active::after {
        width: 100%;
        height: 10px;
        animation: energy-flow-v 1.5s linear infinite;
    }

    /* Job Table Card View */
    .job-table thead {
        display: none;
    }

    .job-table tbody {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
    }

    .job-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xs);
        padding: var(--space-md);
        border-radius: 12px;
        background: rgba(6, 18, 40, 0.7);
        border: 1px solid rgba(0, 240, 255, 0.08);
        transform: none;
    }

    .job-table tbody tr:hover {
        transform: none;
        background: rgba(6, 18, 40, 0.9);
    }

    .job-table td {
        padding: var(--space-xs);
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .job-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-tertiary);
        font-size: 0.65rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .job-table td.job-id-cell {
        grid-column: 1 / -1;
        border-bottom: 1px solid rgba(0, 240, 255, 0.08);
        padding-bottom: var(--space-sm);
        margin-bottom: var(--space-xs);
    }

    .job-table td:has(.job-status) {
        grid-column: 1 / -1;
    }

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

    .job-status {
        padding: 10px 16px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .copy-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .job-id-cell {
        word-break: break-all;
        font-size: 11px;
    }

    .health-domain-name {
        word-break: break-all;
        font-size: 12px;
    }

    .stage-arrow {
        font-size: 16px;
    }
}

/* Additional mobile enhancements */
@media (max-width: 640px) {
    .close {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0) + 12px);
        right: 12px;
        z-index: 1001;
        background: rgba(3, 11, 26, 0.95);
        width: 44px;
        height: 44px;
        backdrop-filter: blur(10px);
    }

    .pipeline-stages {
        padding: var(--space-sm);
    }

    .stage {
        padding: 12px;
    }

    .stage-icon {
        font-size: 18px;
    }

    .stage-title {
        font-size: 12px;
    }

    .stage-status {
        font-size: 10px;
    }

    .job-id-cell {
        font-size: 10px;
    }

    .stat-card {
        padding: var(--space-md);
    }

    .stat-value {
        font-size: var(--font-xl);
    }

    .stat-label {
        font-size: 9px;
    }
}

@media (min-width: 1280px) {
    .stats-grid {
        gap: var(--space-lg);
    }

    .health-domains {
        gap: var(--space-lg);
    }

    .detail-grid {
        gap: var(--space-xl);
    }
}

@media (min-width: 1920px) {
    :root {
        --font-base: 1rem;
        --font-lg: 1.25rem;
        --font-xl: 1.75rem;
        --font-2xl: 2.25rem;
    }

    .stat-card {
        padding: var(--space-xl);
    }

    .health-domains {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* Loading Overlay */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
    background: rgba(6, 18, 40, 0.95);
    padding: var(--space-xl);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 240, 255, 0.15);
    max-width: min(400px, calc(100vw - 2rem));
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-md);
    border: 4px solid rgba(0, 240, 255, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-message {
    color: var(--text-primary);
    font-size: var(--font-base);
    line-height: 1.6;
    white-space: pre-line;
    margin-top: var(--space-md);
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* =========================================
   SMARTLEAD MAILBOX STATUS SECTION
   ========================================= */

.smartlead-section {
    background: rgba(6, 18, 40, 0.7);
    padding: var(--space-lg);
    border-radius: clamp(12px, 1.5vw, 16px);
    border: 1px solid rgba(0, 240, 255, 0.08);
}

.smartlead-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.smartlead-header h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.instantly-section {
    background: rgba(6, 18, 40, 0.7);
    padding: var(--space-lg);
    border-radius: clamp(12px, 1.5vw, 16px);
    border: 1px solid rgba(56, 152, 236, 0.15);
}

.instantly-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.instantly-header h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: var(--font-base);
    font-weight: 600;
}

.status-badge.success {
    background: var(--success-bg);
    color: var(--success-border);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.status-badge.danger {
    background: var(--problem-bg);
    color: var(--problem-border);
    border: 1px solid rgba(255, 51, 68, 0.3);
}

.status-badge.danger.highlight {
    animation: attention-pulse 2s ease-in-out infinite;
    border-width: 2px;
}

.status-badge.warning {
    background: var(--warning-bg);
    color: var(--warning-border);
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.mailbox-list {
    max-height: 450px;
    overflow-y: auto;
    border-radius: 8px;
    background: rgba(3, 11, 26, 0.6);
}

.mailbox-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.06);
    gap: var(--space-md);
    transition: background 0.2s ease;
}

.mailbox-row:last-child {
    border-bottom: none;
}

.mailbox-row:hover {
    background: rgba(10, 30, 60, 0.5);
}

.mailbox-row.failed {
    background: var(--problem-bg);
    border-left: 4px solid var(--problem-border);
}

.mailbox-row.pending {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning-border);
}

.mailbox-email {
    font-family: 'JetBrains Mono', monospace;
    font-size: var(--font-base);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mailbox-status {
    font-size: var(--font-base);
    font-weight: 600;
    min-width: 110px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mailbox-status.uploaded { color: var(--success-border); }
.mailbox-status.failed { color: var(--problem-border); }
.mailbox-status.pending { color: var(--warning-border); }

.mailbox-actions {
    display: flex;
    gap: var(--space-xs);
}

@media (max-width: 640px) {
    .smartlead-header,
    .instantly-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-summary {
        width: 100%;
    }

    .mailbox-row {
        flex-wrap: wrap;
        padding: 12px;
    }

    .mailbox-email {
        width: 100%;
        flex: none;
        margin-bottom: 8px;
        font-size: var(--font-sm);
    }

    .mailbox-status {
        min-width: auto;
        font-size: var(--font-sm);
    }
}

/* =========================================
   STATUS COUNT INDICATORS
   ========================================= */

.count-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-lg);
    font-weight: 700;
}

.count-indicator.success { color: var(--success-border); }
.count-indicator.danger { color: var(--problem-border); }
.count-indicator.warning { color: var(--warning-border); }

.count-indicator .icon {
    font-size: 1.2em;
}

.count-indicator .label {
    font-weight: 500;
    opacity: 0.9;
}

/* =========================================
   HUD STAGE ANIMATIONS
   ========================================= */

/* Stage Animation Container */
.stage-anim {
    width: 32px;
    height: 32px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Pending state: dim outlines === */
.stage-anim.stage-anim-pending {
    opacity: 0.25;
}

.stage-anim-dkim.stage-anim-pending::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 26px;
    border: 2px solid #00f0ff;
    border-radius: 3px 3px 11px 11px;
}

.stage-anim-zones.stage-anim-pending {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #00f0ff;
}

.stage-anim-infra.stage-anim-pending::before {
    content: '';
    position: absolute;
    width: 26px;
    height: 2px;
    background: #00f0ff;
}

.stage-anim-infra.stage-anim-pending::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 26px;
    background: #00f0ff;
}

.stage-anim-mailbox.stage-anim-pending .bar {
    display: block;
    width: 5px;
    background: #00f0ff;
    border-radius: 2px 2px 0 0;
}

.stage-anim-mailbox.stage-anim-pending .bar-1 { height: 12px; }
.stage-anim-mailbox.stage-anim-pending .bar-2 { height: 18px; }
.stage-anim-mailbox.stage-anim-pending .bar-3 { height: 10px; }

.stage-anim-health.stage-anim-pending::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #00ff88;
}

.stage-anim-smartlead.stage-anim-pending::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 16px solid #ffaa00;
}

.stage-anim-final.stage-anim-pending::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid #ff00aa;
    border-radius: 4px;
}

/* === 1. DKIM - Rotating Shield with Glow === */
.stage-anim-dkim.stage-anim-active {
    animation: spin-glow 3s linear infinite;
}

.stage-anim-dkim.stage-anim-active::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 26px;
    background: rgba(0, 240, 255, 0.06);
    border: 2px solid #00f0ff;
    border-radius: 3px 3px 11px 11px;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4), inset 0 0 6px rgba(0, 240, 255, 0.1);
}

.stage-anim-dkim.stage-anim-active::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 7px;
    background: #00f0ff;
    border-radius: 1px;
    box-shadow: 0 5px 0 0 #00f0ff;
    top: 7px;
}

@keyframes spin-glow {
    0% { transform: rotate(0deg); filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.3)); }
    50% { filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.7)); }
    100% { transform: rotate(360deg); filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.3)); }
}

/* === 2. Zones - Radar Pulse Rings === */
.stage-anim-zones.stage-anim-active {
    width: 10px;
    height: 10px;
    background: #00f0ff;
    border-radius: 50%;
    animation: radar-pulse 2s ease-out infinite;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

@keyframes radar-pulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(0, 240, 255, 0.5),
            0 0 0 0 rgba(0, 240, 255, 0.3),
            0 0 0 0 rgba(0, 240, 255, 0.15);
    }
    100% {
        box-shadow:
            0 0 0 7px rgba(0, 240, 255, 0),
            0 0 0 14px rgba(0, 240, 255, 0),
            0 0 0 21px rgba(0, 240, 255, 0);
    }
}

/* === 3. Infrastructure - Circuit Pulse Crosshair === */
.stage-anim-infra.stage-anim-active::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00f0ff, transparent);
    animation: circuit-h 1.5s ease-in-out infinite;
}

.stage-anim-infra.stage-anim-active::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 28px;
    background: linear-gradient(180deg, transparent, #00f0ff, transparent);
    animation: circuit-v 1.5s ease-in-out infinite 0.5s;
}

@keyframes circuit-h {
    0%, 100% { opacity: 0.3; box-shadow: none; }
    50% { opacity: 1; box-shadow: 0 0 10px rgba(0, 240, 255, 0.5); }
}

@keyframes circuit-v {
    0%, 100% { opacity: 0.3; box-shadow: none; }
    50% { opacity: 1; box-shadow: 0 0 10px rgba(0, 240, 255, 0.5); }
}

/* === 4. Mailboxes - Bouncing Data Bars === */
.stage-anim-mailbox {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
}

.stage-anim-mailbox .bar {
    display: block;
    width: 5px;
    background: #00f0ff;
    border-radius: 2px 2px 0 0;
    box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.stage-anim-mailbox.stage-anim-active .bar-1 {
    animation: bar-bounce 1s ease-in-out infinite;
}

.stage-anim-mailbox.stage-anim-active .bar-2 {
    animation: bar-bounce 1s ease-in-out infinite 0.15s;
}

.stage-anim-mailbox.stage-anim-active .bar-3 {
    animation: bar-bounce 1s ease-in-out infinite 0.3s;
}

@keyframes bar-bounce {
    0%, 100% { height: 8px; }
    50% { height: 22px; }
}

/* === 5. Health - Heartbeat Pulse === */
.stage-anim-health.stage-anim-active::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
    animation: heartbeat 1.2s ease-in-out infinite;
}

.stage-anim-health.stage-anim-active::after {
    content: '+';
    position: absolute;
    color: #00ff88;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0, 255, 136, 0.6);
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(0, 255, 136, 0.4); }
    15% { transform: scale(1.2); box-shadow: 0 0 16px rgba(0, 255, 136, 0.6); }
    30% { transform: scale(0.95); }
    45% { transform: scale(1.1); box-shadow: 0 0 12px rgba(0, 255, 136, 0.5); }
}

/* === 6. Smartlead - Rising Chevron Flame === */
.stage-anim-smartlead.stage-anim-active::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 16px solid #ffaa00;
    filter: drop-shadow(0 0 6px rgba(255, 170, 0, 0.6));
    animation: chevron-rise 1.5s ease-in-out infinite;
}

.stage-anim-smartlead.stage-anim-active::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #ff6633;
    top: 8px;
    filter: drop-shadow(0 0 4px rgba(255, 102, 51, 0.5));
    animation: chevron-rise 1.5s ease-in-out infinite 0.2s;
    opacity: 0.7;
}

@keyframes chevron-rise {
    0%, 100% { transform: translateY(2px); opacity: 0.7; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* === 7. Final - Scanning Box === */
.stage-anim-final.stage-anim-active::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid #ff00aa;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 0, 170, 0.3);
}

.stage-anim-final.stage-anim-active::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #ff00aa;
    box-shadow: 0 0 8px rgba(255, 0, 170, 0.6);
    animation: scan-sweep 1.5s ease-in-out infinite;
    left: 50%;
    transform: translateX(-50%);
}

@keyframes scan-sweep {
    0%, 100% { top: 5px; }
    50% { top: 23px; }
}

/* =========================================
   SVG DRAW ANIMATIONS (Completed/Failed)
   ========================================= */

.stage-check-svg,
.stage-x-svg {
    display: block;
    margin: 0 auto;
}

/* Completed checkmark */
.stage-check-svg .svg-draw-circle {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: svg-draw 0.6s ease forwards;
    filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.5));
}

.stage-check-svg .svg-draw-check {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: svg-draw-short 0.4s ease forwards 0.5s;
    filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.5));
}

/* Failed X */
.stage-x-svg .svg-draw-circle {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: svg-draw 0.6s ease forwards;
    filter: drop-shadow(0 0 4px rgba(255, 51, 68, 0.5));
}

.stage-x-svg .svg-draw-x1 {
    stroke-dasharray: 15;
    stroke-dashoffset: 15;
    animation: svg-draw-x 0.3s ease forwards 0.5s;
    filter: drop-shadow(0 0 4px rgba(255, 51, 68, 0.5));
}

.stage-x-svg .svg-draw-x2 {
    stroke-dasharray: 15;
    stroke-dashoffset: 15;
    animation: svg-draw-x 0.3s ease forwards 0.65s;
    filter: drop-shadow(0 0 4px rgba(255, 51, 68, 0.5));
}

@keyframes svg-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes svg-draw-short {
    to { stroke-dashoffset: 0; }
}

@keyframes svg-draw-x {
    to { stroke-dashoffset: 0; }
}

/* Partial warning - SVG */
.stage-warn-svg .svg-draw-circle {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: svg-draw 0.6s ease forwards;
    filter: drop-shadow(0 0 4px rgba(255, 170, 0, 0.5));
}

.stage-warn-svg .svg-draw-warn {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: svg-draw-short 0.4s ease forwards 0.5s;
    filter: drop-shadow(0 0 4px rgba(255, 170, 0, 0.5));
}

/* =========================================
   VERTICAL CONNECTOR ANIMATION
   ========================================= */

@keyframes energy-flow-v {
    0% { top: -10px; }
    100% { top: calc(100% + 10px); }
}

/* =========================================
   PROVIDER BADGE (Maildoso / KumoMTA)
   ========================================= */

.provider-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.provider-maildoso {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}
