/* ============================================================
   Predictions — Design system v2
   ============================================================ */

:root {
    --primary:    #2563eb;
    --primary-dk: #1d4ed8;
    --primary-lt: #eff6ff;
    --accent:     #7c3aed;
    --accent-lt:  #f5f3ff;
    --bg:         #f1f5f9;
    --surface:    #ffffff;
    --border:     #e2e8f0;
    --border-lt:  #f1f5f9;
    --text:       #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --success:    #059669;
    --warning:    #d97706;
    --danger:     #dc2626;
    --info:       #0284c7;
    --radius:     12px;
    --radius-sm:  8px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:     0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
    --shadow-md:  0 8px 24px rgba(0,0,0,.09), 0 4px 8px rgba(0,0,0,.05);
    --shadow-lg:  0 20px 60px rgba(0,0,0,.13);
}

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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
    background: rgba(15,23,42,.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 1rem;
    box-shadow: 0 1px 0 rgba(255,255,255,.06), var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.navbar-brand::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(37,99,235,.7);
}
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: .15rem;
    flex: 1;
}
.nav-links a {
    color: rgba(255,255,255,.65);
    text-decoration: none;
    padding: .35rem .85rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-links a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-links a.active {
    background: rgba(37,99,235,.35);
    color: #fff;
}
.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.nav-user {
    font-size: .8rem;
    color: rgba(255,255,255,.5);
    font-weight: 500;
}
.btn-logout {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.8) !important;
    padding: .3rem .9rem !important;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.btn-logout:hover {
    background: rgba(255,255,255,.15) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.3);
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 2rem 1.75rem;
    flex: 1;
}
.page-header {
    margin-bottom: 1.75rem;
}
/* Break an element out of the centered .container to span the full viewport width */
.full-bleed {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
}
.page-header p {
    color: var(--text-muted);
    font-size: .9rem;
    margin-top: .3rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow); }
.card-title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-lt);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ── Grid ─────────────────────────────────────────────────── */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ── Stat cards ───────────────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.accent::before  { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before  { background: var(--danger); }

.stat-card .stat-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    font-weight: 700;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    letter-spacing: -.03em;
}
.stat-card .stat-sub { font-size: .78rem; color: var(--text-light); margin-top: .1rem; }
.stat-card.accent .stat-value  { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value  { color: var(--danger); }

/* ── Plot containers ──────────────────────────────────────── */
.plot-box      { width: 100%; height: 340px; }
.plot-box-tall { width: 100%; height: 420px; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
    letter-spacing: .01em;
}
.form-control {
    width: 100%;
    padding: .6rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: var(--text-light); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary);  color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-primary:hover   { background: var(--primary-dk); box-shadow: 0 4px 16px rgba(37,99,235,.4); }
.btn-danger    { background: var(--danger);    color: #fff; box-shadow: 0 2px 8px rgba(220,38,38,.25); }
.btn-danger:hover    { opacity: .9; box-shadow: 0 4px 16px rgba(220,38,38,.35); }
.btn-secondary { background: var(--border);    color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success   { background: var(--success);   color: #fff; box-shadow: 0 2px 8px rgba(5,150,105,.25); }
.btn-success:hover   { opacity: .9; box-shadow: 0 4px 16px rgba(5,150,105,.35); }
.btn-warning   { background: var(--warning);   color: #fff; box-shadow: 0 2px 8px rgba(217,119,6,.25); }
.btn-warning:hover   { opacity: .9; box-shadow: 0 4px 16px rgba(217,119,6,.35); }
.btn-accent    { background: var(--accent);    color: #fff; box-shadow: 0 2px 8px rgba(124,58,237,.25); }
.btn-accent:hover    { opacity: .9; box-shadow: 0 4px 16px rgba(124,58,237,.35); }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; border-radius: 6px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: .9rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table th, table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border-lt); }
table th {
    background: var(--bg);
    font-weight: 700;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}
table tbody tr { transition: background .1s; }
table tbody tr:hover td { background: #fafbfd; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.badge-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-neutral { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Filter bar ───────────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; }

/* ── Source tag ───────────────────────────────────────────── */
.source-tag {
    font-size: .75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: .75rem;
}
.source-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.source-dot.live   { background: var(--success); box-shadow: 0 0 6px rgba(5,150,105,.5); }
.source-dot.sample { background: var(--warning); }
.source-dot.cache  { background: var(--info); }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: .85rem;
    font-size: .78rem;
    color: var(--text-light);
}

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.modal-box h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE — split layout
   ══════════════════════════════════════════════════════════════ */
body.login-body {
    display: block;
    background: var(--bg);
}
.login-split {
    display: flex;
    min-height: 100vh;
}

/* Left panel — hero */
.login-hero {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    background:
        linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #312e81 100%);
}
/* Decorative blobs */
.login-hero::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,.4) 0%, transparent 70%);
    top: -120px; right: -120px;
    pointer-events: none;
}
.login-hero::after {
    content: '';
    position: absolute;
    width: 360px; height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124,58,237,.3) 0%, transparent 70%);
    bottom: -80px; left: -60px;
    pointer-events: none;
}
.login-hero-blob {
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,.25) 0%, transparent 70%);
    bottom: 30%; left: 40%;
    pointer-events: none;
}
/* Grid pattern overlay */
.login-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.login-hero-brand {
    position: relative;
    z-index: 1;
}
.login-hero-brand .brand-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px rgba(37,99,235,.4);
}
.login-hero-brand h1 {
    color: #fff;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
}
.login-hero-brand p {
    color: rgba(255,255,255,.55);
    font-size: .9rem;
    margin-top: .5rem;
    max-width: 340px;
    line-height: 1.7;
}

.login-hero-features {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.login-feature {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255,255,255,.7);
    font-size: .85rem;
}
.login-feature-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 8px rgba(37,99,235,.8);
    flex-shrink: 0;
}

.login-hero-footer {
    position: relative;
    z-index: 1;
    color: rgba(255,255,255,.3);
    font-size: .75rem;
}

/* Right panel — form */
.login-form-panel {
    width: 440px;
    flex-shrink: 0;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.5rem;
    border-left: 1px solid var(--border);
}
.login-form-inner { width: 100%; max-width: 360px; }
.login-form-inner h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
    margin-bottom: .35rem;
}
.login-form-inner .login-sub {
    color: var(--text-muted);
    font-size: .875rem;
    margin-bottom: 2rem;
}
.login-btn {
    width: 100%;
    justify-content: center;
    padding: .75rem 1.25rem;
    font-size: .95rem;
    border-radius: var(--radius-sm);
    margin-top: .5rem;
    letter-spacing: .01em;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .login-hero { display: none; }
    .login-form-panel { width: 100%; border-left: none; padding: 2rem 1.5rem; }
}
@media (max-width: 640px) {
    .container { padding: 1rem; }
    .navbar { padding: 0 1rem; }
}
