/* ═══════════════════════════════════════════════════════════════
   AI QA Tester — Modern Dashboard Design System v3
   Sidebar layout, glassmorphism, refined components
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Brand */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-lighter: #a5b4fc;
    --primary-dark: #4f46e5;
    --primary-darker: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-900: #312e81;

    /* Accent */
    --accent: #06b6d4;
    --accent-light: #67e8f9;

    /* Semantic */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-lighter: #ecfdf5;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-lighter: #fef2f2;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-lighter: #fffbeb;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Neutrals */
    --gray-25: #fcfcfd;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gray-950: #030712;

    --white: #ffffff;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --surface-secondary: #f8fafc;

    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: rgba(99,102,241,0.15);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.03);
    --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px rgba(99,102,241,0.12);
    --shadow-glow-lg: 0 0 40px rgba(99,102,241,0.15);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-card-hover: 0 8px 25px -5px rgba(0,0,0,0.08), 0 4px 10px -4px rgba(0,0,0,0.04);

    /* Shape */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 0.2s;
    --duration-md: 0.3s;
    --duration-lg: 0.4s;
}

/* ── Reset ─────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--gray-700);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Prevent orphan SVGs from blowing up */
svg { max-width: 100%; max-height: 100%; }

::selection {
    background: var(--primary-100);
    color: var(--primary-900);
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR NAVIGATION
   ═══════════════════════════════════════════════════════════════ */

.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: width var(--duration-md) var(--ease);
    border-right: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}

.sidebar-brand {
    padding: 24px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
    min-height: 72px;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.sidebar-brand .brand-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-brand .brand-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.sidebar-brand .brand-sub {
    font-size: 11px;
    color: var(--sidebar-text);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(148,163,184,0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 12px 8px;
    white-space: nowrap;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--duration) var(--ease);
    position: relative;
    white-space: nowrap;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.7;
    transition: opacity var(--duration) var(--ease);
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.sidebar-link:hover svg { opacity: 1; }

.sidebar-link.active {
    background: var(--sidebar-active);
    color: var(--primary-light);
    font-weight: 600;
}
.sidebar-link.active svg {
    opacity: 1;
    color: var(--primary-light);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    transition: background var(--duration) var(--ease);
}

.sidebar-user:hover { background: var(--sidebar-hover); }

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--sidebar-text);
    text-transform: capitalize;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sidebar-text);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
    display: flex;
    align-items: center;
}
.sidebar-logout-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.sidebar-logout-btn svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Mobile sidebar toggle ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 199;
}
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 201;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle svg { width: 20px; height: 20px; stroke: var(--gray-700); fill: none; stroke-width: 2; }

@media (max-width: 768px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0 !important; }
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg);
    transition: margin-left var(--duration-md) var(--ease);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 32px;
}
.container-sm { max-width: 800px; margin: 0 auto; padding: 28px 32px; }

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}
.page-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.4px;
    line-height: 1.3;
}

.page-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS — Elevated, refined
   ═══════════════════════════════════════════════════════════════ */

.card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    padding: 24px;
    margin-bottom: 20px;
    transition: all var(--duration-md) var(--ease);
    box-shadow: var(--shadow-card);
}
.card:hover { box-shadow: var(--shadow-card-hover); }

.card-flush { padding: 0; }
.card-flush .card-body { padding: 24px; }
.card-flush .card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
}
.card-flush .card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-25);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--gray-900);
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-title .card-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.card-title .card-icon svg {
    width: 16px; height: 16px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.card-title .card-icon.icon-primary { background: var(--primary-50); color: var(--primary); }
.card-title .card-icon.icon-success { background: var(--success-lighter); color: var(--success-dark); }
.card-title .card-icon.icon-danger { background: var(--danger-lighter); color: var(--danger); }
.card-title .card-icon.icon-warning { background: var(--warning-lighter); color: var(--warning); }
.card-title .card-icon.icon-info { background: var(--info-light); color: var(--info); }

/* ═══════════════════════════════════════════════════════════════
   FORMS — Refined inputs
   ═══════════════════════════════════════════════════════════════ */

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.form-group label .optional {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 12px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    transition: all var(--duration) var(--ease);
    outline: none;
    font-family: inherit;
}
.form-input:hover, .form-select:hover, .form-textarea:hover {
    border-color: var(--gray-300);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-input::placeholder, .form-textarea::placeholder {
    color: var(--gray-400);
}

.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

.form-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Input with icon */
.input-group {
    position: relative;
}
.input-group .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}
.input-group .input-icon svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 1.75;
}
.input-group .form-input { padding-left: 40px; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS — Polished with micro-interactions
   ═══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    font-family: inherit;
    letter-spacing: -0.01em;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}
.btn svg {
    width: 16px; height: 16px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(99,102,241,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(99,102,241,0.3);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(16,185,129,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-success:hover {
    background: var(--success-dark);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(239,68,68,0.2);
}
.btn-danger:hover { background: var(--danger-dark); transform: translateY(-1px); }

.btn-outline {
    background: var(--white);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-500);
    border: none;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius); }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; border-radius: var(--radius); }
.btn-icon-sm { padding: 5px; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════════════════════════════
   BADGES — Clean pill badges
   ═══════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-passed, .badge-active, .badge-completed { background: var(--success-light); color: var(--success-dark); }
.badge-passed::before, .badge-active::before, .badge-completed::before { background: var(--success); }

.badge-failed, .badge-inactive, .badge-error { background: var(--danger-light); color: var(--danger-dark); }
.badge-failed::before, .badge-inactive::before, .badge-error::before { background: var(--danger); }

.badge-not_testable { background: var(--warning-light); color: #92400e; }
.badge-not_testable::before { background: var(--warning); }

.goal-item.not_testable { border-left-color: var(--warning); }

.badge-running { background: var(--primary-100); color: var(--primary-dark); }
.badge-running::before { background: var(--primary); animation: pulse-dot 1.5s infinite; }

.badge-pending { background: var(--warning-light); color: #b45309; }
.badge-pending::before { background: var(--warning); }

.badge-admin { background: #f3e8fd; color: #7c3aed; }
.badge-admin::before { background: #7c3aed; }
.badge-tester { background: var(--info-light); color: #1d4ed8; }
.badge-tester::before { background: var(--info); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ═══════════════════════════════════════════════════════════════
   TABLES — Clean, modern
   ═══════════════════════════════════════════════════════════════ */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

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

th, td {
    padding: 12px 18px;
    text-align: left;
    font-size: 13px;
}
th {
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
td {
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-600);
}
tr:hover td { background: var(--surface-hover); }
tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE — Premium dark login
   ═══════════════════════════════════════════════════════════════ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #060918;
    position: relative;
    overflow: hidden;
    padding: 40px 24px;
}

/* Animated gradient background */
.login-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.login-bg .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    animation: float 20s infinite;
}
.login-bg .orb-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(99,102,241,0.25) 0%, transparent 65%);
    top: -250px; right: -150px;
    animation-duration: 25s;
}
.login-bg .orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(6,182,212,0.18) 0%, transparent 65%);
    bottom: -200px; left: -150px;
    animation-duration: 30s;
    animation-delay: -5s;
}
.login-bg .orb-3 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.18) 0%, transparent 65%);
    top: 40%; left: 25%;
    animation-duration: 22s;
    animation-delay: -10s;
}
.login-bg .orb-4 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 65%);
    top: 10%; left: 50%;
    animation-duration: 28s;
    animation-delay: -15s;
}

/* Noise texture overlay */
.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
}

/* Grid line decoration */
.login-grid-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
    background-image:
        linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at 30% 50%, black 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 30% 50%, black 0%, transparent 70%);
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 15px) scale(1.02); }
}

/* Centered wrapper */
.login-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 1040px;
    width: 100%;
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 40px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.03);
}

/* Left branding panel */
.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 52px 48px;
    position: relative;
}

.login-left .brand-block {
    max-width: 440px;
}

.login-left .brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.login-left .brand-logo .logo-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(99,102,241,0.35), 0 0 40px rgba(99,102,241,0.15);
    overflow: hidden;
}
.login-left .brand-logo .logo-icon svg {
    width: 22px; height: 22px;
    stroke: white; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.login-left .brand-logo .logo-text {
    font-size: 19px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.3px;
}

.login-left h1 {
    font-size: 36px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -1px;
    line-height: 1.15;
    margin-bottom: 14px;
}
.login-left h1 span {
    background: linear-gradient(135deg, #818cf8 0%, #67e8f9 50%, #a78bfa 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 6s ease infinite;
}
@keyframes gradient-shift {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.login-left > .brand-block > p {
    font-size: 14.5px;
    color: #8896ab;
    line-height: 1.65;
    max-width: 400px;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}
.login-feature {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #8896ab;
    font-size: 14px;
    font-weight: 450;
    transition: color 0.2s;
}
.login-feature:hover { color: #b0bec5; }

.login-feature .feat-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.login-feature:hover .feat-icon {
    background: rgba(99,102,241,0.18);
    border-color: rgba(99,102,241,0.25);
}
.login-feature .feat-icon svg {
    width: 16px; height: 16px;
    stroke: var(--primary-light); fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Right login form panel */
.login-right {
    width: 420px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 48px 40px;
    background: rgba(255,255,255,0.03);
    border-left: 1px solid rgba(255,255,255,0.06);
}

.login-card {
    background: transparent;
    width: 100%;
    position: relative;
}

.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
    letter-spacing: -0.4px;
}
.login-card .login-subtitle {
    color: #7a8599;
    font-size: 14px;
    margin-bottom: 32px;
}

.login-card .form-group { margin-bottom: 22px; }
.login-card .form-group label {
    color: #94a3b8;
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 8px;
}

.login-card .input-group .input-icon { color: #64748b; }
.login-card .input-group .form-input { padding-left: 42px; }

.login-card .form-input {
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.08);
    color: var(--white);
    padding: 12px 16px;
    font-size: 14px;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}
.login-card .form-input::placeholder { color: rgba(148,163,184,0.4); }
.login-card .form-input:hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
}
.login-card .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15), 0 0 20px rgba(99,102,241,0.08);
    background: rgba(255,255,255,0.07);
}

.login-card .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 14.5px;
    font-weight: 600;
    margin-top: 8px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    box-shadow: 0 4px 16px rgba(99,102,241,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
    transition: all 0.25s ease;
    letter-spacing: -0.01em;
}
.login-card .btn-primary:hover {
    box-shadow: 0 6px 24px rgba(99,102,241,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
    transform: translateY(-1px);
    background: linear-gradient(135deg, #7366f1, #8b5cf6);
}
.login-card .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.login-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.18);
    color: #fca5a5;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 18px;
    display: none;
    font-weight: 500;
    line-height: 1.5;
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.login-pipeline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.login-pipeline .pipe-step {
    font-size: 11px;
    color: rgba(148,163,184,0.4);
    font-weight: 500;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    transition: all 0.2s;
}
.login-pipeline .pipe-step:hover {
    color: rgba(148,163,184,0.7);
    background: rgba(255,255,255,0.04);
}
.login-pipeline .pipe-arrow {
    color: rgba(148,163,184,0.2);
    font-size: 10px;
}

/* Responsive */
@media (max-width: 860px) {
    .login-wrapper { flex-direction: column; max-width: 440px; }
    .login-left { display: none; }
    .login-right {
        width: 100%;
        border-left: none;
        padding: 40px 32px;
    }
}
@media (min-width: 861px) and (max-width: 1100px) {
    .login-wrapper { max-width: 880px; }
    .login-left { padding: 40px 36px; }
    .login-left h1 { font-size: 30px; }
    .login-right { width: 380px; padding: 40px 32px; }
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD GRID
   ═══════════════════════════════════════════════════════════════ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } }

.test-config { grid-column: 1; }
.test-goals-input { grid-column: 2; }
.full-width { grid-column: 1 / -1; }

/* Start test CTA */
.start-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
}
.start-cta p {
    font-size: 13px;
    color: var(--primary-dark);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   PHASE PIPELINE — Stepper
   ═══════════════════════════════════════════════════════════════ */

.phase-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    position: relative;
}

.phase-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-400);
    transition: all var(--duration-lg) var(--ease);
    white-space: nowrap;
    position: relative;
}
.phase-step .phase-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transition: all var(--duration-lg) var(--ease);
}

.phase-step.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 12px rgba(99,102,241,0.3);
    animation: phase-pulse 2s infinite;
}
.phase-step.active .phase-num {
    background: rgba(255,255,255,0.25);
    color: var(--white);
}

.phase-step.done {
    background: var(--success-light);
    color: var(--success-dark);
}
.phase-step.done .phase-num {
    background: var(--success);
    color: var(--white);
}

@keyframes phase-pulse {
    0%, 100% { box-shadow: 0 2px 12px rgba(99,102,241,0.3); }
    50% { box-shadow: 0 2px 20px rgba(99,102,241,0.45); }
}

.phase-connector {
    width: 32px;
    height: 2px;
    background: var(--gray-200);
    flex-shrink: 0;
    transition: background var(--duration-lg) var(--ease);
    position: relative;
}
.phase-connector.done { background: var(--success); }

/* ═══════════════════════════════════════════════════════════════
   LIVE PROGRESS
   ═══════════════════════════════════════════════════════════════ */

.progress-panel {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    min-height: 400px;
}
@media (max-width: 900px) { .progress-panel { grid-template-columns: 1fr; } }

.goal-list { list-style: none; }

.goal-item {
    padding: 12px 16px;
    border-left: 3px solid var(--gray-200);
    margin-bottom: 6px;
    font-size: 13px;
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: all var(--duration-md) var(--ease);
    background: var(--white);
    line-height: 1.5;
}
.goal-item.running {
    border-left-color: var(--primary);
    background: var(--primary-50);
    box-shadow: var(--shadow-xs);
}
.goal-item.passed {
    border-left-color: var(--success);
    background: var(--success-lighter);
}
.goal-item.failed {
    border-left-color: var(--danger);
    background: var(--danger-lighter);
}

.live-view {
    background: var(--gray-900);
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: var(--shadow-lg);
}

.live-view-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.live-view-header .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
}
.live-view-header .dot-red { background: #ef4444; }
.live-view-header .dot-yellow { background: #f59e0b; }
.live-view-header .dot-green { background: #10b981; }
.live-view-header .url-bar {
    flex: 1;
    margin-left: 8px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    font-size: 11px;
    color: var(--gray-400);
    font-family: 'JetBrains Mono', monospace;
}

.live-screenshot {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--gray-950);
    position: relative;
}
.live-screenshot img {
    max-width: 100%;
    max-height: 360px;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transition: transform var(--duration) var(--ease);
}
.live-screenshot img:hover { transform: scale(1.02); }
.live-screenshot p { color: var(--gray-500); font-size: 13px; }

.ai-reasoning {
    background: rgba(255,255,255,0.03);
    padding: 14px 18px;
    color: var(--gray-400);
    font-size: 13px;
    border-top: 1px solid rgba(255,255,255,0.06);
    line-height: 1.6;
    font-family: 'JetBrains Mono', 'Inter', monospace;
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   UPLOAD AREA
   ═══════════════════════════════════════════════════════════════ */

.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    color: var(--gray-400);
    font-size: 14px;
    background: var(--gray-50);
    position: relative;
}
.upload-area:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}
.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-50);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.08);
    transform: scale(1.01);
}
.upload-area input { display: none; }
.upload-area svg {
    width: 32px; height: 32px;
    stroke: currentColor; fill: none;
    stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   STATS ROW — Metric cards
   ═══════════════════════════════════════════════════════════════ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 22px 20px;
    border: 1px solid var(--gray-200);
    transition: all var(--duration-md) var(--ease);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-200);
    border-radius: 3px 3px 0 0;
}
.stat-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

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

.stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value.passed { color: var(--success); }
.stat-value.failed { color: var(--danger); }
.stat-value.total { color: var(--primary); }

/* ═══════════════════════════════════════════════════════════════
   MODAL — Glass overlay
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
    animation: fadeIn 0.2s var(--ease);
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-2xl);
    animation: slideUp 0.3s var(--ease-spring);
}

.modal h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
    color: var(--gray-900);
}

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

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.4s var(--ease-spring);
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 2; flex-shrink: 0;
}
.toast.success { background: var(--success-dark); }
.toast.error { background: var(--danger-dark); }
.toast.warning { background: var(--warning); color: white; }
.toast.info { background: var(--primary-dark); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════════════════ */

.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--primary);
}

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

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--gray-400);
}
.empty-state svg {
    width: 48px; height: 48px;
    stroke: var(--gray-300); fill: none;
    stroke-width: 1.5; margin-bottom: 16px;
}
.empty-state p { font-size: 14px; margin-top: 4px; }
.empty-state a { color: var(--primary); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════
   PHASE DETAILS PANEL
   ═══════════════════════════════════════════════════════════════ */

.phase-details-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.phase-details-card .details-header {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 13px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}
.phase-details-card pre {
    padding: 18px 20px;
    font-size: 12px;
    white-space: pre-wrap;
    color: var(--gray-600);
    line-height: 1.8;
    max-height: 260px;
    overflow-y: auto;
    background: var(--white);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   ASSERTION RESULTS
   ═══════════════════════════════════════════════════════════════ */

.assertion-block {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.8;
}
.assertion-block.pass { background: var(--success-lighter); border: 1px solid rgba(16,185,129,0.15); }
.assertion-block.fail { background: var(--danger-lighter); border: 1px solid rgba(239,68,68,0.15); }

.assertion-line { display: flex; align-items: baseline; gap: 6px; }
.assertion-line .icon-pass { color: var(--success-dark); font-weight: 700; }
.assertion-line .icon-fail { color: var(--danger-dark); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   STEP LOG
   ═══════════════════════════════════════════════════════════════ */

.step-log {
    max-height: 240px;
    overflow-y: auto;
    font-size: 13px;
    padding: 18px;
}
.step-log-title {
    display: block;
    margin-bottom: 10px;
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.step-log::-webkit-scrollbar { width: 5px; }
.step-log::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

.step-entry {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.step-entry:last-child { border-bottom: none; }
.step-entry .step-num {
    font-weight: 700;
    color: var(--primary);
    font-size: 11px;
    min-width: 48px;
    font-family: 'JetBrains Mono', monospace;
}
.step-entry .step-action {
    font-weight: 600;
    color: var(--gray-700);
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════════ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-gray { color: var(--gray-500); }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* Divider */
.divider {
    height: 1px;
    background: var(--gray-200);
    margin: 20px 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Page transitions */
.page-enter {
    animation: pageEnter 0.25s var(--ease);
}
@keyframes pageEnter {
    from { opacity: 0.6; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

