/* Vega dashboard - dark theme stylesheet */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #e8edf3;
    background: #080c12;
    line-height: 1.45;
}

a { color: #7ab7ff; }
a:hover { color: #a7cffc; }

.site-header {
    background:
        linear-gradient(135deg, rgba(77, 163, 255, 0.16), rgba(107, 212, 143, 0.08) 42%, rgba(246, 200, 95, 0.1)),
        #0d1520;
    color: #f4f7fb;
    padding: 1.85rem 0;
    border-bottom: 1px solid #24364a;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: flex-end;
}

.site-title { margin: 0 0 0.25rem 0; font-size: 2.35rem; color: #f4f7fb; }
.site-tagline { margin: 0; color: #c4d0dd; font-size: 0.95rem; }
.site-meta { margin: 0; font-size: 0.84rem; color: #c4d0dd; text-align: right; }

.back-link a { color: #8b949e; text-decoration: none; font-size: 0.85rem; }
.back-link a:hover { color: #c9d1d9; text-decoration: underline; }

.main-content {
    max-width: 1200px;
    margin: 1.4rem auto;
    padding: 0 1.25rem;
}

.site-footer {
    margin-top: 3rem;
    padding: 1.25rem;
    background: #0d1520;
    color: #9aa8b8;
    font-size: 0.8rem;
    text-align: center;
    border-top: 1px solid #24364a;
}

/* Drift banner */
.drift-banner {
    background: #2d2410;
    border-left: 4px solid #d29922;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    color: #f0d77a;
}

.drift-banner h3 { margin: 0 0 0.5rem; font-size: 1rem; color: #f0d77a; }
.drift-banner ul { margin: 0; padding-left: 1.25rem; }

.sector-drift { background: #3a1d1d; border-left-color: #f85149; color: #ffa198; }
.sector-drift p { margin: 0; }

/* Cards / sections */
.hero-panel, .nav-section, .sectors-section, .ledger-section,
.sector-summary, .sparkline-section, .factors-section,
.pulse-section, .kb-section {
    background: #101722;
    border: 1px solid #223044;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.section-accent-blue { border-top: 3px solid #4da3ff; }
.section-accent-green { border-top: 3px solid #6bd48f; }
.section-accent-gold { border-top: 3px solid #f6c85f; }
.section-accent-red { border-top: 3px solid #ff6b6b; }

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    background:
        linear-gradient(135deg, rgba(77, 163, 255, 0.13), rgba(246, 200, 95, 0.08)),
        #111b2a;
    border-color: #2a4058;
}

.hero-panel h2,
.section-heading h2,
.sector-summary h2,
.sparkline-section h2,
.factors-section h2,
.pulse-section h2,
.kb-section h2 {
    margin: 0;
    color: #f4f7fb;
    font-size: 1.2rem;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0.75rem;
    min-width: min(680px, 100%);
}

.hero-stats div {
    background: #0a111a;
    border: 1px solid #26374c;
    border-radius: 6px;
    padding: 0.75rem;
}

.hero-stats .stat-nav { border-color: #4da3ff; }
.hero-stats .stat-alpha { border-color: #f6c85f; background: #18140b; }

.hero-stats span,
.eyebrow,
.section-heading p,
.table-subtext {
    color: #9aa8b8;
    font-size: 0.78rem;
}

.hero-stats strong {
    display: block;
    margin-top: 0.25rem;
    color: #f4f7fb;
    font-size: 1.5rem;
}

.eyebrow {
    margin: 0 0 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-end;
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #223044;
}

.section-heading p {
    margin: 0;
    max-width: 420px;
    text-align: right;
}

.chart-wrap { position: relative; height: 280px; min-width: 0; width: 100%; overflow: hidden; }
.chart-wrap canvas { max-width: 100% !important; }
.chart-wrap-alpha { height: 220px; }
.chart-wrap-small { height: 200px; }
.chart-stack { display: grid; grid-template-columns: 1fr; gap: 1rem; min-width: 0; }
.chart-stack > * { min-width: 0; }

/* Sector grid */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.sector-card {
    background: #121c29;
    border: 1px solid #25364a;
    border-top: 4px solid #6e7d8f;
    border-radius: 8px;
    padding: 0.95rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sector-card.status-strong { border-top-color: #3fb950; }
.sector-card.status-maintaining { border-top-color: #2f81f7; }
.sector-card.status-weak { border-top-color: #d29922; }
.sector-card.status-broken { border-top-color: #f85149; }

.sector-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.sector-card header a {
    text-decoration: none;
    color: #e8edf3;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.card-ticker { font-weight: 800; font-size: 1.05rem; color: #f4f7fb; }
.card-name { font-size: 0.86rem; color: #9aa8b8; }

.card-conviction {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.5rem;
    align-items: baseline;
    margin: 0.35rem 0 0.65rem;
}

.card-conviction span { font-size: 0.75rem; color: #9aa8b8; text-transform: uppercase; letter-spacing: 0.06em; }
.card-conviction strong { font-size: 1.75rem; color: #f4f7fb; }
.card-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.45rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.meta-label { color: #9aa8b8; font-size: 0.72rem; }

.card-drift {
    margin: 0.4rem 0 0;
    padding: 0.4rem 0.6rem;
    background: #2d2410;
    border-left: 3px solid #d29922;
    border-radius: 2px;
    font-size: 0.8rem;
    color: #f0d77a;
}

.card-link { font-size: 0.82rem; color: #7ab7ff; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

.card-weights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin: 0.65rem 0;
}

.card-weights-grid div {
    background: #0a111a;
    border: 1px solid #223044;
    border-radius: 6px;
    padding: 0.5rem;
    min-width: 0;
}

.card-weights-grid span {
    display: block;
    color: #9aa8b8;
    font-size: 0.68rem;
}

.card-weights-grid strong {
    display: block;
    color: #f4f7fb;
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.tilt-more { color: #6bd48f; }
.tilt-less { color: #ff8b8b; }
.tilt-flat { color: #cfd6df; }

.tilt-pill, .score-change {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 6px;
    background: #202b3a;
    color: #cfd6df;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.valuation-badge {
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.25;
}

.signal-overweight { background: #173321; color: #6bd48f; }
.signal-neutral { background: #202b3a; color: #cfd6df; }
.signal-underweight { background: #3d2023; color: #ff8b8b; }

.zone-cheap { background: #173321; color: #6bd48f; }
.zone-fair { background: #202b3a; color: #cfd6df; }
.zone-expensive { background: #3d2023; color: #ff8b8b; }

.status-strong { background: #1f3a23; color: #56d364; }
.status-maintaining { background: #102a4c; color: #79b8ff; }
.status-weak { background: #2d2410; color: #f0d77a; }
.status-broken { background: #3a1d1d; color: #ffa198; }

.sector-card.status-strong,
.sector-card.status-maintaining,
.sector-card.status-weak,
.sector-card.status-broken,
.sector-card.status-unknown {
    background: #121c29;
    color: #e8edf3;
}

/* Sector page summary */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.summary-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: #0a111a;
    border: 1px solid #223044;
    border-radius: 6px;
    padding: 0.75rem;
}

.summary-note {
    grid-column: 1 / -1;
    margin: -0.25rem 0 0;
    color: #9aa8b8;
    font-size: 0.82rem;
}

.summary-label { font-size: 0.74rem; color: #9aa8b8; text-transform: uppercase; letter-spacing: 0.05em; }
.summary-value { font-size: 1.75rem; font-weight: 700; color: #f4f7fb; }
.summary-detail { font-size: 0.8rem; color: #9aa8b8; }

.hypothesis { margin-top: 1rem; padding: 0.75rem; background: #0d1117; border: 1px solid #21262d; border-radius: 4px; color: #c9d1d9; }

/* Factors */
.factors-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.factors-grid h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: #cfd6df; }
.factor-list { list-style: none; padding: 0; margin: 0; }
.factor-list li { padding: 0.4rem 0; border-bottom: 1px solid #223044; display: flex; gap: 0.5rem; align-items: baseline; color: #cfd6df; }
.factor-code { font-weight: 600; min-width: 140px; color: #e8edf3; }
.factor-delta { font-family: ui-monospace, monospace; }
.factor-count { font-size: 0.75rem; color: #9aa8b8; }

/* Pulse */
.pulse-list { list-style: none; padding: 0; margin: 0; }
.pulse-list li { padding: 0.5rem 0; border-bottom: 1px solid #223044; color: #cfd6df; }

.plain-note {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.plain-note div {
    background: #0a111a;
    border: 1px solid #223044;
    border-radius: 6px;
    padding: 0.75rem;
}

.plain-note strong,
.plain-note span { display: block; }
.plain-note strong { color: #f4f7fb; font-size: 0.9rem; }
.plain-note span { color: #9aa8b8; font-size: 0.8rem; margin-top: 0.2rem; }
/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; color: #cfd6df; }
.data-table th, .data-table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid #223044; vertical-align: top; }
.data-table thead th { background: #0a111a; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #9aa8b8; }
.data-table tbody tr:hover { background: #121d2c; }
.data-table a { color: #7ab7ff; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.table-subtext { display: block; margin-top: 0.15rem; }

.empty { color: #6e7681; font-style: italic; margin: 0; }

@media (max-width: 820px) {
    .header-inner, .hero-panel, .section-heading { display: block; }
    .site-meta { text-align: left; margin-top: 0.75rem; }
    .hero-stats { grid-template-columns: 1fr; min-width: 0; margin-top: 1rem; }
    .section-heading p { text-align: left; margin-top: 0.45rem; }
    .card-weights-grid { grid-template-columns: 1fr; }
    .plain-note { grid-template-columns: 1fr; }
}
