/* ============================================================================
   Crown · Model Training Dashboard
   Aesthetic: Private banking × Linear/Raycast
   Surfaces: warm carbon (cocoa-tinted black) + paper cream + champagne gold
   Type:     Instrument Serif (display) + Geist (UI) + Geist Mono (numbers)
   ========================================================================= */

:root {
    /* ── Surfaces — warm carbon, NEVER pure black ─────────────────────── */
    --canvas:        #100D0A;
    --canvas-soft:   #15110D;
    --card:          #181410;
    --card-raised:   #1E1914;
    --card-pressed:  #110E0A;
    --hairline:      rgba(243, 234, 219, 0.06);
    --hairline-mid:  rgba(243, 234, 219, 0.10);
    --hairline-on:   rgba(243, 234, 219, 0.18);
    --glass:         rgba(24, 20, 16, 0.72);

    /* ── Cream — paper-white text scale ───────────────────────────────── */
    --cream:         #F3EADB;
    --cream-soft:    #DCD1BD;
    --cream-dim:     #9C9180;
    --cream-mute:    #645B4F;
    --cream-faint:   #3D362E;

    /* ── Champagne gold ───────────────────────────────────────────────── */
    --gold:          #C9A55C;
    --gold-bright:   #E8C97A;
    --gold-deep:     #8E7438;
    --gold-glow:     rgba(232, 201, 122, 0.16);
    --gold-glow-strong: rgba(232, 201, 122, 0.28);

    /* ── Semantic — muted, never neon ─────────────────────────────────── */
    --pos:           #A4C988;
    --pos-soft:      rgba(164, 201, 136, 0.14);
    --neg:           #D88876;
    --neg-soft:      rgba(216, 136, 118, 0.14);
    --neu:           #8FA3B8;

    /* ── Type ─────────────────────────────────────────────────────────── */
    --font-display:  'Instrument Serif', 'Cormorant', 'Times New Roman', serif;
    --font-body:     'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono:     'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

    /* ── Geometry ─────────────────────────────────────────────────────── */
    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  22px;
    --r-xl:  28px;
    --r-2xl: 36px;
    --r-pill: 999px;

    /* ── Shadows — Soft UI, dual-light direction ──────────────────────── */
    --shadow-soft:
        0 1px 0 0 rgba(243, 234, 219, 0.03) inset,
        0 -1px 0 0 rgba(0, 0, 0, 0.5) inset,
        0 24px 60px -32px rgba(0, 0, 0, 0.7),
        0 2px 8px -4px rgba(0, 0, 0, 0.5);
    --shadow-raised:
        0 1px 0 0 rgba(243, 234, 219, 0.05) inset,
        0 -1px 0 0 rgba(0, 0, 0, 0.6) inset,
        0 32px 80px -32px rgba(0, 0, 0, 0.75),
        0 8px 20px -8px rgba(0, 0, 0, 0.6);
    --shadow-pressed:
        inset 0 2px 6px 0 rgba(0, 0, 0, 0.55),
        inset 0 -1px 0 0 rgba(243, 234, 219, 0.04);
    --shadow-glow:
        0 0 0 1px var(--gold-glow), 0 0 32px -4px var(--gold-glow);
    --shadow-glow-strong:
        0 0 0 1px var(--gold-glow-strong),
        0 8px 32px -8px var(--gold-glow-strong),
        0 0 60px -12px var(--gold-glow);
}

/* ─── reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
    color: var(--cream);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'ss01', 'ss02', 'cv11';
    overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--gold-glow-strong); color: var(--gold-bright); }

/* ─── ambient atmosphere ─────────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 700px at 92% -10%, rgba(201, 165, 92, 0.10), transparent 55%),
        radial-gradient(700px 500px at 8% 105%, rgba(201, 165, 92, 0.05), transparent 60%),
        radial-gradient(1200px 800px at 50% 50%, rgba(40, 30, 20, 0.3), transparent 60%);
}
body::after {
    /* grain */
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
}

/* =========================================================================
   LOGIN
   ========================================================================= */
.page-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 24px;
    position: relative;
}

.login-shell { position: relative; z-index: 2; width: min(480px, 100%); }

.login-aurora {
    position: absolute;
    inset: -180px -120px;
    z-index: -1;
    background:
        radial-gradient(circle at 30% 30%, rgba(232, 201, 122, 0.22), transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(201, 165, 92, 0.14), transparent 55%);
    filter: blur(50px);
    animation: aurora-drift 24s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
    0%   { transform: translate(-10px, -10px) scale(1); }
    100% { transform: translate(20px, 20px)   scale(1.06); }
}

.login-card {
    background:
        linear-gradient(180deg, rgba(243, 234, 219, 0.03) 0%, rgba(243, 234, 219, 0) 30%),
        linear-gradient(180deg, var(--card-raised), var(--card));
    border: 1px solid var(--hairline-mid);
    border-radius: var(--r-2xl);
    padding: 56px 48px 40px;
    box-shadow: var(--shadow-raised);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    /* top inner highlight */
    content: '';
    position: absolute;
    top: 0; left: 12%; right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-glow-strong), transparent);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 56px;
}
.login-mark {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
    color: var(--canvas);
    font-family: var(--font-display);
    font-size: 16px; font-weight: 400;
    box-shadow: 0 0 16px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.4);
}
.login-wordmark {
    font-family: var(--font-mono);
    font-size: 10px; font-weight: 500;
    letter-spacing: 0.32em;
    color: var(--cream-dim);
    text-transform: uppercase;
}

.login-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.login-eyebrow::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 10px var(--gold-glow-strong);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.85); }
}

.login-title {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 400;
    line-height: 1.0;
    letter-spacing: -0.02em;
    color: var(--cream);
    margin-bottom: 8px;
}
.login-title em {
    font-style: italic;
    color: var(--gold-bright);
    font-weight: 400;
}
.login-subtitle {
    color: var(--cream-dim);
    font-size: 14px;
    margin-bottom: 44px;
    max-width: 90%;
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 10px; }
.field-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.22em;
    color: var(--cream-dim);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}
.field-label-hint {
    color: var(--cream-mute);
    letter-spacing: 0.12em;
    font-size: 9px;
}
.field-input {
    height: 52px;
    padding: 0 20px;
    border-radius: var(--r-md);
    background: var(--card-pressed);
    border: 1px solid var(--hairline);
    color: var(--cream);
    font-size: 15px;
    font-family: var(--font-mono);
    transition: border-color .2s, box-shadow .2s, background .2s;
    box-shadow: var(--shadow-pressed);
}
.field-input::placeholder { color: var(--cream-mute); font-family: var(--font-body); }
.field-input:hover { border-color: var(--hairline-mid); }
.field-input:focus {
    border-color: var(--gold-deep);
    background: var(--canvas-soft);
    box-shadow: var(--shadow-pressed), 0 0 0 4px var(--gold-glow);
}

.btn {
    height: 52px;
    padding: 0 28px;
    border-radius: var(--r-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: transform .15s ease, box-shadow .2s, background .2s;
    position: relative;
    overflow: hidden;
}
.btn-primary {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 65%, var(--gold-deep) 100%);
    color: #1a1209;
    box-shadow:
        inset 0 1px 0 0 rgba(255, 245, 220, 0.6),
        inset 0 -1px 0 0 rgba(80, 56, 14, 0.3),
        0 8px 26px -8px rgba(201, 165, 92, 0.5),
        0 2px 6px -2px rgba(201, 165, 92, 0.4);
    margin-top: 16px;
    letter-spacing: 0.02em;
    font-weight: 600;
}
.btn-primary::after {
    /* sheen */
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: -100%;
    width: 60%;
    background: linear-gradient(110deg, transparent, rgba(255, 245, 220, 0.4), transparent);
    transition: left .65s ease;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 0 rgba(255, 245, 220, 0.7),
        inset 0 -1px 0 0 rgba(80, 56, 14, 0.3),
        0 14px 36px -8px rgba(201, 165, 92, 0.6),
        0 4px 10px -2px rgba(201, 165, 92, 0.5);
}
.btn-primary:hover::after { left: 120%; }
.btn-primary:active { transform: translateY(0); }
.btn-arrow {
    font-family: var(--font-display);
    font-size: 18px;
    transition: transform .25s ease;
}
.btn-primary:hover .btn-arrow { transform: translateX(4px); }

.login-error {
    color: var(--neg);
    font-size: 13px;
    text-align: center;
    margin-top: 8px;
    font-family: var(--font-mono);
}

.login-foot {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--cream-mute);
    text-transform: uppercase;
}
.login-foot-right { color: var(--cream-dim); }
.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    min-width: 22px;
    padding: 0 6px;
    border-radius: var(--r-sm);
    border: 1px solid var(--hairline-mid);
    background: var(--card-pressed);
    color: var(--cream-soft);
    font-family: var(--font-mono);
    font-size: 10px;
    box-shadow: inset 0 -1px 0 0 rgba(0, 0, 0, 0.5);
}

/* =========================================================================
   DASHBOARD
   ========================================================================= */
.app-shell {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 32px 80px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ─── topbar — floating glass capsule ────────────────────────────────── */
.topbar {
    position: sticky;
    top: 16px;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px 16px 12px 20px;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--hairline-mid);
    border-radius: var(--r-pill);
    box-shadow:
        0 1px 0 0 rgba(243, 234, 219, 0.04) inset,
        0 20px 50px -20px rgba(0, 0, 0, 0.65),
        0 4px 14px -4px rgba(0, 0, 0, 0.5);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.brand-mark {
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
    color: var(--canvas);
    font-family: var(--font-display);
    font-size: 14px;
    box-shadow: 0 0 14px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.4);
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.brand-name {
    font-family: var(--font-display);
    font-size: 17px;
    color: var(--cream);
    letter-spacing: -0.01em;
}
.brand-name em { font-style: italic; color: var(--gold-bright); }
.brand-sub {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--cream-mute);
    text-transform: uppercase;
}

.topbar-center { display: flex; justify-content: center; gap: 8px; }
.topbar-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.date-pill {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 6px 0 20px;
    background: var(--card);
    border: 1px solid var(--hairline-mid);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-pressed);
    gap: 14px;
    transition: border-color .2s;
}
.date-pill:hover { border-color: var(--hairline-on); }
.date-pill-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--cream-mute);
    text-transform: uppercase;
}
.date-pill-value {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.date-pill-select {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--gold-bright);
    appearance: none;
    cursor: pointer;
    padding-right: 16px;
    background: transparent;
}
.date-pill-select option { background: var(--card-raised); color: var(--cream); }
.date-pill-caret { color: var(--cream-mute); font-size: 9px; margin-left: -16px; pointer-events: none; }
.date-pill-nav {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    color: var(--cream-mute);
    transition: color .2s, background .2s;
}
.date-pill-nav:hover { color: var(--gold-bright); background: var(--card-raised); }

.kbar-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: var(--r-pill);
    background: var(--card);
    border: 1px solid var(--hairline);
    color: var(--cream-dim);
    font-size: 12px;
    transition: all .2s;
}
.kbar-hint:hover { border-color: var(--hairline-on); color: var(--cream); }

.ghost-btn {
    width: 38px; height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--card);
    color: var(--cream-soft);
    border: 1px solid var(--hairline);
    transition: all .2s;
}
.ghost-btn:hover {
    color: var(--gold-bright);
    border-color: var(--hairline-on);
    background: var(--card-raised);
}

/* ─── snapshot header — editorial ─────────────────────────────────────── */
.snapshot-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    padding: 12px 8px 0;
}
.snapshot-eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.32em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.snapshot-eyebrow::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 10px var(--gold-glow-strong);
}
.snapshot-title {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--cream);
}
.snapshot-title em {
    font-style: italic;
    color: var(--gold-bright);
}
.snapshot-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 12px;
    border-radius: var(--r-pill);
    background: var(--card);
    border: 1px solid var(--hairline);
    color: var(--cream-dim);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
}
.tag-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--pos);
    box-shadow: 0 0 8px rgba(164, 201, 136, 0.5);
    margin-right: 8px;
}
.tag.tag-warn .tag-dot { background: var(--neg); box-shadow: 0 0 8px rgba(216, 136, 118, 0.5); }
.tag.tag-gold { color: var(--gold); border-color: var(--gold-glow); }

/* ─── KPI strip ──────────────────────────────────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: 1.4fr 1.4fr 1fr 1fr;
    gap: 16px;
}
.kpi-card {
    position: relative;
    padding: 28px 28px 24px;
    background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    isolation: isolate;
}
.kpi-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 10%, var(--gold-glow-strong) 50%, transparent 90%);
    opacity: 0.4;
    z-index: 1;
}
.kpi-card.is-hero::before { opacity: 1; height: 2px; }

.kpi-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--cream-dim);
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.kpi-label-icon { color: var(--gold); font-size: 11px; }
.kpi-value {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 400;
    letter-spacing: -0.025em;
    color: var(--gold-bright);
    line-height: 1;
    margin-top: 18px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 24px rgba(232, 201, 122, 0.15);
}
.kpi-value-small {
    font-size: 44px;
}
.kpi-value.is-pos { color: var(--pos); text-shadow: 0 0 24px rgba(164, 201, 136, 0.15); }
.kpi-value.is-neg { color: var(--neg); text-shadow: 0 0 24px rgba(216, 136, 118, 0.15); }
.kpi-sub {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--cream-dim);
    letter-spacing: 0.02em;
}
.kpi-spark {
    margin-top: 12px;
    height: 28px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
}
.kpi-spark-bar {
    flex: 1;
    background: var(--gold-deep);
    border-radius: 1px;
    opacity: 0.5;
    transition: opacity .3s;
}
.kpi-spark-bar.is-top {
    background: var(--gold-bright);
    opacity: 1;
    box-shadow: 0 0 8px var(--gold-glow-strong);
}

/* ─── hero chart card ────────────────────────────────────────────────── */
.hero-card,
.runs-card {
    background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
    border: 1px solid var(--hairline);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 28px 32px 16px;
    gap: 24px;
}
.card-eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.card-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--cream);
}
.card-title em {
    font-style: italic;
    color: var(--gold-bright);
}
.card-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--cream-dim);
}

/* ─── chip group (filter) ────────────────────────────────────────────── */
.chip-row {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--card-pressed);
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-pressed);
}
.chip {
    height: 30px;
    padding: 0 16px;
    border-radius: var(--r-pill);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    font-weight: 500;
    color: var(--cream-dim);
    text-transform: uppercase;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
}
.chip:hover { color: var(--cream); }
.chip-active {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 100%);
    color: var(--canvas);
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 0 rgba(255, 245, 220, 0.5),
        0 4px 12px -4px var(--gold-glow-strong);
}
.chip-muted {
    background: var(--card);
    border: 1px solid var(--hairline);
    color: var(--cream-dim);
    font-family: var(--font-mono);
    height: 28px;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.chart-wrap { height: 500px; padding: 8px 24px 28px; }

/* ─── run rows-as-cards ───────────────────────────────────────────────── */
.runs-list {
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.run-row {
    display: grid;
    grid-template-columns: 88px 1fr 64px 1.2fr repeat(5, minmax(86px, 1fr)) 24px;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background .15s, transform .15s;
    position: relative;
}
.run-row + .run-row { border-top: 1px solid var(--hairline); }
.run-row:hover {
    background: var(--card-raised);
}
.run-row:hover .run-arrow { color: var(--gold-bright); transform: translateX(4px); }
.run-row.is-top {
    background: linear-gradient(90deg, rgba(232, 201, 122, 0.04), transparent 70%);
}
.run-row.is-top::before {
    content: '';
    position: absolute;
    left: 0; top: 14px; bottom: 14px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
    box-shadow: 0 0 10px var(--gold-glow-strong);
}

.run-header {
    display: grid;
    grid-template-columns: 88px 1fr 64px 1.2fr repeat(5, minmax(86px, 1fr)) 24px;
    gap: 14px;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 6px;
}
.run-header .h {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--cream-mute);
    text-transform: uppercase;
    cursor: pointer;
    transition: color .2s;
    user-select: none;
}
.run-header .h:hover { color: var(--gold); }
.run-header .h.num { text-align: right; }
.run-header .h.is-sorted { color: var(--gold-bright); }
.run-header .h.is-sorted::after { content: attr(data-dir); margin-left: 4px; }

.run-row .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.run-row .col-period { text-align: center; }

.group-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: var(--r-pill);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    white-space: nowrap;
}
.group-ew {
    background: rgba(143, 163, 184, 0.10);
    color: var(--neu);
    border: 1px solid rgba(143, 163, 184, 0.25);
}
.group-linear {
    background: rgba(94, 142, 226, 0.10);
    color: #8bb1ed;
    border: 1px solid rgba(94, 142, 226, 0.25);
}
.group-nonlinear {
    background: var(--gold-glow);
    color: var(--gold-bright);
    border: 1px solid var(--gold-deep);
}

.col-model {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--cream);
    font-weight: 500;
    letter-spacing: -0.005em;
}
.col-model-sub {
    display: block;
    font-size: 10px;
    color: var(--cream-mute);
    margin-top: 2px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.period-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 24px;
    border-radius: var(--r-sm);
    background: var(--card-pressed);
    border: 1px solid var(--hairline);
    color: var(--cream-soft);
    font-family: var(--font-mono);
    font-size: 11px;
    box-shadow: var(--shadow-pressed);
}

.perf-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: var(--card-pressed);
    border: 1px solid var(--hairline);
    overflow: hidden;
    box-shadow: var(--shadow-pressed);
}
.perf-bar-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
    border-radius: 999px;
    box-shadow: 0 0 8px var(--gold-glow);
    transition: width .6s cubic-bezier(0.16, 1, 0.3, 1);
}
.perf-bar-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--gold-bright);
    margin-top: 6px;
    text-align: right;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.cell-num {
    font-family: var(--font-mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--cream-soft);
    letter-spacing: -0.01em;
}
.cell-num.is-pos { color: var(--pos); }
.cell-num.is-neg { color: var(--neg); }
.cell-num.is-gold { color: var(--gold-bright); font-weight: 500; }
.cell-num.is-dim { color: var(--cream-mute); }

.run-arrow {
    color: var(--cream-mute);
    transition: color .2s, transform .2s;
    font-family: var(--font-display);
    font-size: 16px;
    text-align: right;
}

/* ─── drawer ─────────────────────────────────────────────────────────── */
.drawer {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s;
}
.drawer[aria-hidden="false"] { pointer-events: auto; opacity: 1; }
.drawer-scrim {
    position: absolute; inset: 0;
    background: rgba(8, 6, 4, 0.6);
    backdrop-filter: blur(10px) saturate(110%);
    -webkit-backdrop-filter: blur(10px) saturate(110%);
}
.drawer-panel {
    position: absolute;
    top: 20px; right: 20px; bottom: 20px;
    width: min(640px, 96vw);
    background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
    border: 1px solid var(--hairline-mid);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-raised);
    transform: translateX(40px);
    transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.drawer-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-glow-strong), transparent);
}
.drawer[aria-hidden="false"] .drawer-panel { transform: translateX(0); }
.drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 32px 36px 24px;
    border-bottom: 1px solid var(--hairline);
}
.drawer-eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.drawer-eyebrow::before {
    content: '';
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--gold);
}
.drawer-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--cream);
}
.drawer-title em { font-style: italic; color: var(--gold-bright); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px 36px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.drawer-body::-webkit-scrollbar { width: 6px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--hairline-mid); border-radius: 3px; }

.hero-stat {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 24px 24px 26px;
    background: var(--canvas-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-pressed);
}
.hero-stat-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hero-stat-cell + .hero-stat-cell { padding-left: 20px; border-left: 1px solid var(--hairline); }
.hero-stat-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.24em;
    color: var(--cream-mute);
    text-transform: uppercase;
}
.hero-stat-value {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--gold-bright);
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
}
.hero-stat-value.is-pos { color: var(--pos); }
.hero-stat-value.is-neg { color: var(--neg); }
.hero-stat-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--cream-dim);
}

.section-title {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.28em;
    color: var(--cream-mute);
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--hairline);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    overflow: hidden;
}
.stat-cell {
    padding: 14px 16px;
    background: var(--card);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.stat-cell-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.18em;
    color: var(--cream-mute);
    text-transform: uppercase;
}
.stat-cell-value {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--cream);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.stat-cell-value.is-pos { color: var(--pos); }
.stat-cell-value.is-neg { color: var(--neg); }
.stat-cell-value.is-gold { color: var(--gold-bright); }

.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.meta-cell {
    padding: 10px 12px;
    background: var(--canvas-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.png-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.png-card {
    background: var(--canvas-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    overflow: hidden;
}
.png-card-caption {
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--cream-dim);
    text-transform: uppercase;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    align-items: center;
    gap: 8px;
}
.png-card-caption::before {
    content: '';
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--gold);
}
.png-card img { display: block; width: 100%; height: auto; }

/* ─── toast ──────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 22px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--cream);
    border: 1px solid var(--hairline-on);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-raised);
    font-size: 12px;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    z-index: 100;
    animation: toast-in .35s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.toast::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 8px var(--gold-glow-strong);
}
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── reveal animations on mount ─────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(8px); animation: reveal .8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.reveal-1 { animation-delay: .05s; }
.reveal-2 { animation-delay: .12s; }
.reveal-3 { animation-delay: .19s; }
.reveal-4 { animation-delay: .26s; }
.reveal-5 { animation-delay: .33s; }
@keyframes reveal {
    to { opacity: 1; transform: translateY(0); }
}

/* ─── responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .run-row, .run-header { grid-template-columns: 70px 1fr 50px 1fr repeat(3, minmax(70px, 1fr)) 24px; }
    .run-row .col-mdd, .run-row .col-calmar, .run-header .h.col-mdd, .run-header .h.col-calmar { display: none; }
}
@media (max-width: 760px) {
    .app-shell { padding: 16px; }
    .topbar { grid-template-columns: 1fr auto; padding: 10px 12px 10px 16px; }
    .topbar-center { display: none; }
    .snapshot-title { font-size: 36px; }
    .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-value { font-size: 42px; }
    .chart-wrap { height: 360px; padding: 0 8px 16px; }
    .runs-list { overflow-x: auto; }
    .run-row, .run-header { min-width: 720px; }
}
