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

/* ═══════════════════════════════════════════
   Design Tokens
   ═══════════════════════════════════════════ */
:root {
    --bg: #0a0a0a;
    --bg-raised: #111111;
    --bg-surface: #161616;
    --bg-overlay: rgba(255, 255, 255, 0.03);
    --bg-overlay-hover: rgba(255, 255, 255, 0.06);

    --text-1: #f0f0f0;
    --text-2: #8a8a8a;
    --text-3: #555555;

    --accent: #5b8def;
    --accent-2: #7c3aed;
    --accent-glow: rgba(91, 141, 239, 0.2);
    --accent-gradient: linear-gradient(135deg, #5b8def 0%, #7c3aed 100%);

    --nwu-purple: #3A1A5E;
    --nwu-purple-glow: rgba(58, 26, 94, 0.4);

    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.12);

    --error: #ef4444;
    --success: #22c55e;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --dur: 0.2s;

    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
}

.light-theme {
    --bg: #f8f8f8;
    --bg-raised: #ffffff;
    --bg-surface: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.02);
    --bg-overlay-hover: rgba(0, 0, 0, 0.05);

    --text-1: #0a0a0a;
    --text-2: #5a5a5a;
    --text-3: #999999;

    --accent: #4f7df3;
    --accent-2: #8b5cf6;
    --accent-glow: rgba(79, 125, 243, 0.12);
    --accent-gradient: linear-gradient(135deg, #4f7df3 0%, #8b5cf6 100%);

    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.10);
}

/* Logo toggle */
.logo-dark { display: block !important; }
.logo-light { display: none !important; }
.light-theme .logo-dark { display: none !important; }
.light-theme .logo-light { display: block !important; }

/* ═══════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text-1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 0;
    color: var(--text-1);
}
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
p  { margin: 0; color: var(--text-2); }

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

::selection {
    background: var(--accent-glow);
    color: var(--text-1);
}

/* ═══════════════════════════════════════════
   Login & Registration
   ═══════════════════════════════════════════ */
.login-container {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
    z-index: 2;
    padding: 24px;
}

.login-container::before,
.login-container::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: float 20s infinite ease-in-out;
    z-index: -1;
    pointer-events: none;
}
.login-container::before {
    width: 400px; height: 400px;
    background: var(--accent);
    top: -15%; left: -5%;
}
.login-container::after {
    width: 320px; height: 320px;
    background: var(--accent-2);
    bottom: -15%; right: -5%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(20px, -20px); }
    66% { transform: translate(-15px, 15px); }
}

.login-card {
    position: relative;
    z-index: 10;
    background: var(--bg-overlay);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 40px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: 0 24px 48px rgba(0,0,0,0.12);
    width: min(95%, 420px);
    animation: cardIn 0.5s var(--ease-out);
}

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

.logo-img {
    display: block;
    max-height: 64px;
    width: auto;
    filter: none !important;
    background: transparent !important;
    object-fit: contain;
}

.login-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-input {
    background: var(--bg-overlay) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-1) !important;
    padding: 0 16px !important;
    font-size: 0.9375rem !important;
    font-weight: 400 !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 12px !important;
    width: 100%;
    height: 48px !important;
    transition: all var(--dur) var(--ease) !important;
    outline: none !important;
    font-family: inherit !important;
}
.form-input:hover {
    border-color: var(--border-hover) !important;
}
.form-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
}
.form-input::placeholder {
    color: var(--text-3) !important;
}

.login-button {
    background: var(--accent-gradient) !important;
    border: none !important;
    color: #fff !important;
    padding: 0 24px !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    font-size: 0.9375rem !important;
    width: 100%;
    height: 48px !important;
    cursor: pointer;
    transition: all var(--dur) var(--ease) !important;
    margin-top: 4px !important;
    box-shadow: 0 4px 16px var(--accent-glow) !important;
    position: relative;
    overflow: hidden;
}
.login-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow) !important;
}
.login-button:active { transform: translateY(0); }
.login-button:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.login-error:not(:empty) {
    margin-top: 16px;
    text-align: center;
    color: var(--error);
    background: rgba(239,68,68,0.08);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239,68,68,0.15);
    font-size: 0.8125rem;
    font-weight: 500;
}

.login-container:not(.logged-in) {
    overflow: hidden;
    position: relative;
    padding: 0;
    margin: 0;
    height: 100vh;
    width: 100vw;
}

/* Background Animations */
.bg-trendline-svg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
}

.trendline-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawPath 8s ease-in-out infinite;
}

@keyframes drawPath {
    0% { stroke-dashoffset: 2000; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}

.particles-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

.particle-node {
    position: absolute;
    color: var(--text-3);
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.4;
    animation: floatParticle 15s infinite ease-in-out;
}

@keyframes floatParticle {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -50px); }
    66% { transform: translate(-20px, 40px); }
}

/* Landing Page Stage 1 */
.landing-stage {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
    padding: 40px;
    transition: all 0.8s var(--ease);
}

.landing-headline {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 900px;
}

.landing-subheadline {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: var(--text-2);
    margin-bottom: 48px;
    max-width: 700px;
    line-height: 1.6;
}

.feature-cards {
    display: flex;
    gap: 24px;
    margin-bottom: 64px;
    width: 100%;
    max-width: 1100px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    flex: 1;
    min-width: 280px;
    max-width: 340px;
    transition: all 0.3s var(--ease);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.feature-icon {
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 8px;
}

.feature-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-1);
}

.feature-desc {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.5;
}

.btn-get-started {
    background: var(--nwu-purple) !important;
    color: white !important;
    padding: 18px 48px !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    border-radius: var(--radius-full) !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 8px 32px var(--nwu-purple-glow) !important;
    animation: pulse 2.5s infinite;
    transition: all 0.3s var(--ease) !important;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 8px 32px var(--nwu-purple-glow); }
    50% { transform: scale(1.05); box-shadow: 0 8px 48px var(--nwu-purple-glow); }
    100% { transform: scale(1); box-shadow: 0 8px 32px var(--nwu-purple-glow); }
}

.btn-get-started:hover {
    transform: scale(1.05) !important;
    background-color: #4a2178 !important;
}

/* Stage 2 - Login Transition */
.login-stage {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
    transition: all 0.8s var(--ease);
}

.stage-active {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: scale(1) !important;
}

.stage-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(1.1) !important;
}

/* Glassmorphism Card */
.login-card-glass {
    background: rgba(16, 16, 16, 0.4) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4) !important;
    width: min(95%, 440px) !important;
    padding: 48px !important;
    border-radius: var(--radius-xl) !important;
    transition: all 0.5s ease;
}

.login-card-glass:hover {
    background: rgba(20, 20, 20, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px) !important; /* Slightly clearer on hover */
}

.login-card-footer {
    margin-top: 24px;
    font-size: 0.75rem;
    color: var(--text-3);
    text-align: center;
    font-style: italic;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.data-pulse-btn {
    animation: dataPulse 4s infinite;
}

@keyframes dataPulse {
    0%, 100% { box-shadow: 0 4px 16px var(--accent-glow); }
    50% { box-shadow: 0 4px 32px var(--accent); }
}

/* ═══════════════════════════════════════════
   Dashboard Shell
   ═══════════════════════════════════════════ */
#theme-main-container {
    min-height: 100vh;
    width: 100%;
    background: var(--bg);
    color: var(--text-1);
    position: relative;
    z-index: 2;
}

#dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ═══════════════════════════════════════════
   Theme Toggle
   ═══════════════════════════════════════════ */
.theme-switch-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--text-1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transition: all var(--dur) var(--ease);
    font-size: 1rem;
    outline: none;
}
.theme-switch-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 0 0 3px var(--accent-glow);
}

/* ═══════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    padding: 24px 16px;
    background: var(--bg-raised);
    border-right: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all 0.3s var(--ease);
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 28px;
    width: 24px;
    height: 24px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    transition: all var(--dur) var(--ease);
    font-size: 0.625rem;
    outline: none;
    padding: 0;
}
.sidebar-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 0 8px;
    margin-bottom: 32px;
}
.sidebar-logo img {
    height: 28px;
    width: auto;
    filter: none !important;
}

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

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-2);
    border-radius: var(--radius-md);
    transition: all var(--dur) var(--ease);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    position: relative;
    white-space: nowrap;
}
.nav-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-icon-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(53%) sepia(0%) saturate(0%) hue-rotate(173deg) brightness(95%) contrast(88%);
    transition: filter var(--dur) var(--ease);
}

/* Active state - white for gradient background */
.nav-link-custom.active .nav-icon-img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(7500%) hue-rotate(324deg) brightness(103%) contrast(103%);
}

/* Hover state */
.nav-link-custom:hover .nav-icon-img {
    filter: brightness(0) saturate(100%) invert(96%) sepia(0%) saturate(7500%) hue-rotate(324deg) brightness(103%) contrast(103%);
}

/* Light theme adjustments */
.light-theme .nav-icon-img {
    filter: brightness(0) saturate(100%) invert(35%) sepia(0%) saturate(0%) hue-rotate(173deg) brightness(95%) contrast(88%);
}

.light-theme .nav-link-custom.active .nav-icon-img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(7500%) hue-rotate(324deg) brightness(103%) contrast(103%);
}

.light-theme .nav-link-custom:hover .nav-icon-img {
    filter: brightness(0) saturate(100%) invert(10%) sepia(0%) saturate(0%) hue-rotate(173deg) brightness(95%) contrast(88%);
}
.nav-link-custom:hover {
    background: var(--bg-overlay-hover);
    color: var(--text-1);
}
.nav-link-custom.active {
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Sidebar Collapsed */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
    padding: 24px 8px;
}
.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    padding: 0;
    margin-bottom: 24px;
}
.sidebar-collapsed .sidebar-logo img { height: 22px; }
.sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .nav-link-custom {
    justify-content: center;
    padding: 10px;
    gap: 0;
}
.sidebar-collapsed .nav-icon { margin: 0; }
.sidebar-collapsed .nav-icon-img {
    width: 18px;
    height: 18px;
}
.sidebar-collapsed .content-area { margin-left: var(--sidebar-w-collapsed); }

/* ═══════════════════════════════════════════
   Content Area - Fill viewport
   ═══════════════════════════════════════════ */
.content-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 2vh 2.5vw;
    height: 100vh;
    background: var(--bg);
    transition: all 0.3s var(--ease);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════
   Page Layout - Clean Hierarchy
   ═══════════════════════════════════════════ */
.tab-content {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: min-content;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 2vh;
    flex-shrink: 0;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-1);
    margin-bottom: 6px;
}
.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.5;
}
.page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */
.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    padding: 0 24px;
    height: 40px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    box-shadow: 0 2px 8px var(--accent-glow);
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 0 16px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-overlay);
}

/* ═══════════════════════════════════════════
   Progress Card - Premium Loading
   ═══════════════════════════════════════════ */
.progress-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 2vh;
    animation: slideDown 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}
.progress-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0.5;
}

.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}
.progress-bar-custom {
    background: var(--bg-overlay) !important;
    border-radius: var(--radius-full) !important;
    overflow: hidden;
    height: 4px !important;
    flex: 1;
}
.progress-bar-custom .progress-bar {
    background: var(--accent-gradient) !important;
    border-radius: var(--radius-full) !important;
    transition: width 0.4s var(--ease) !important;
    box-shadow: 0 0 8px var(--accent-glow);
}
.progress-pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.progress-status {
    font-size: 0.8125rem;
    color: var(--text-2);
    margin-top: 10px;
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   Error Message
   ═══════════════════════════════════════════ */
.error-message:not(:empty) {
    color: var(--error);
    background: rgba(239,68,68,0.06);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(239,68,68,0.12);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 2vh;
}

/* ═══════════════════════════════════════════
   Visualization Container
   ═══════════════════════════════════════════ */
.viz-container {
    display: flex;
    flex-direction: column;
    gap: 1.5vh;
    width: 100%;
}

/* Predictor Selector Bar - Compact */
.predictor-bar {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    flex-shrink: 0;
}
.predictor-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.predictor-bar-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
}

/* Predictor Chips - Compact */
.predictor-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.predictor-checkbox-item {
    background: var(--bg-overlay);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    transition: all var(--dur) var(--ease);
    cursor: pointer;
}
.predictor-checkbox-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-overlay-hover);
}

.custom-checklist { margin: 0 !important; }
.custom-checklist label {
    display: flex !important;
    align-items: center !important;
    gap: 5px;
    color: var(--text-1) !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    text-transform: none !important;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.custom-checklist input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--border-hover);
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all var(--dur) var(--ease);
    flex-shrink: 0;
    margin: 0 !important;
}
.custom-checklist input[type="checkbox"]:hover {
    border-color: var(--accent);
}
.custom-checklist input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.custom-checklist input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* ═══════════════════════════════════════════
   Hero Chart - Fill available space
   ═══════════════════════════════════════════ */
.hero-chart {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--dur) var(--ease);
    width: 100%;
}
.hero-chart:hover {
    border-color: var(--border-hover);
}

/* Keep Plotly responsive without forcing nested heights */
.hero-chart .js-plotly-plot,
.hero-chart .plotly {
    width: 100% !important;
}

/* ═══════════════════════════════════════════
   Data Table
   ═══════════════════════════════════════════ */
.table-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    margin-top: 1.5vh;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}
.custom-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}
.custom-table th {
    background: var(--bg-surface);
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.custom-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}
.custom-table tbody tr {
    transition: background var(--dur) var(--ease);
}
.custom-table tbody tr:hover {
    background: var(--bg-overlay-hover);
}
.custom-table tr:last-child td {
    border-bottom: none;
}

/* ═══════════════════════════════════════════
   Model Page
   ═══════════════════════════════════════════ */
.model-top-row {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5vh;
    margin-bottom: 1.5vh;
}

.model-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 4px;
}
.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-3);
    margin-bottom: 20px;
}

/* Prediction Hero Card */
.prediction-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.prediction-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.prediction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.prediction-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
}
.prediction-date {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

.prediction-value {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-bottom: 8px;
}

.prediction-change {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 16px;
}
.change-negative { color: #EF4444; }
.change-positive { color: #10B981; }
.change-neutral  { color: var(--text-3); }

.prediction-baseline {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
}
.baseline-label { color: var(--text-3); }
.baseline-value { color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Feature Contributions */
.contrib-row {
    display: grid;
    grid-template-columns: 180px 1fr 64px;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.contrib-row:last-child { border-bottom: none; }

.contrib-info { display: flex; flex-direction: column; gap: 2px; }
.contrib-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-1);
}
.contrib-direction {
    font-size: 0.6875rem;
    color: var(--text-3);
}

.contrib-bar-container {
    height: 6px;
    background: var(--bg-overlay);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.contrib-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s var(--ease-out);
}

.contrib-value {
    font-size: 0.8125rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Model Chart */
.model-card {
    position: relative;
    min-height: 480px;
}

.model-chart {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 4px;
    width: 100%;
    height: calc(100% - 130px); /* Subtract padding, header, and selector space */
}

/* Data Chart */
.viz-container {
    width: 100%;
    padding: 0;
    min-height: 480px;
}

#zar-graph {
    width: 100%;
    height: calc(100% - 130px); /* Subtract padding, header, and selector space */
}

/* Ensure all plotly charts fill their containers */
.js-plotly-plot {
    width: 100% !important;
    height: 100% !important;
}

/* Plot container styling */
.plot-container {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

/* Model Info Grid */
.model-info-card { margin-top: 1.5vh; }

.model-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.info-pill {
    background: var(--bg-overlay);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}

.info-pill-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-pill-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
}

.info-pill-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}

.info-pill-description {
    font-size: 0.75rem;
    color: var(--text-2);
    line-height: 1.4;
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    opacity: 0.8;
}

@media (max-width: 900px) {
    .model-top-row {
        grid-template-columns: 1fr;
    }
    .contrib-row {
        grid-template-columns: 1fr 1fr 56px;
    }
}

/* ═══════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    color: var(--text-3);
}
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state h4 {
    color: var(--text-2);
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════ */
.page-transition {
    animation: pageIn 0.4s var(--ease-out);
}
@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s var(--ease-out) forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   Loading Bars
   ═══════════════════════════════════════════ */
#_dash-loading {
    display: block !important;
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 2px !important;
    z-index: 10001 !important;
    background: transparent !important;
    pointer-events: none !important;
    overflow: hidden !important;
}
#_dash-loading::after {
    content: "" !important;
    display: block !important;
    height: 100% !important;
    width: 30% !important;
    background: var(--accent-gradient) !important;
    animation: loadSlide 1.2s var(--ease) infinite !important;
}
@keyframes loadSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ═══════════════════════════════════════════
   Plotly Range Slider
   ═══════════════════════════════════════════ */
.js-plotly-plot .plotly { border-radius: var(--radius-lg); overflow: hidden; }
.js-plotly-plot .rangeslider .rangehandle {
    width: 10px !important;
    background: var(--accent) !important;
    border: none !important;
    border-radius: 3px !important;
    cursor: ew-resize !important;
}

/* ═══════════════════════════════════════════
   Focus
   ═══════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%) !important;
        position: fixed;
        height: 100vh;
    }
    .content-area {
        margin-left: 0 !important;
        padding: 20px 16px;
    }
    .sidebar-toggle { display: none !important; }
}

@media (max-width: 768px) {
    .page-header { flex-direction: column; gap: 16px; }
    .login-card { padding: 32px 24px; }
    .content-area { padding: 16px; }
    .hero-chart { min-height: 300px; }
}

@media (min-width: 1600px) {
    .tab-content { max-width: 1600px; }
    .hero-chart { min-height: 500px; }
}

@media (min-width: 2560px) {
    .tab-content { max-width: 1800px; }
    .hero-chart { min-height: 600px; }
}

@media print {
    .theme-switch-btn, .sidebar, .sidebar-toggle { display: none; }
    .content-area { margin-left: 0 !important; }
}
