/* ============================================================
   TradeJournal — Analytics ("Edge Lab") Stylesheet
   Reuses chart-card / chart-row from dashboard-charts.css for
   the Command Center row. Adds insight cards, a radar chart
   shell, and a scorecard table — all still 100% Supabase tokens.
   ============================================================ */

/* ── Section shell ──────────────────────────────────────── */
.an-section {
    margin-bottom: var(--s-xxl, 40px);
}

.an-section__head {
    margin-bottom: var(--s-lg);
}

.an-section__title {
    font-size: 20px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.2px;
    margin-bottom: 4px;
}

.an-section__desc {
    font-size: 13px;
    color: var(--ink-mute);
}

/* ── SQN Gauge ──────────────────────────────────────────── */
.an-gauge-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 168px;
}

.an-gauge-label {
    font-family: var(--font);
    font-size: 11px;
    fill: var(--ink-mute-2);
}

.an-gauge-value {
    font-family: var(--font);
    font-size: 30px;
    font-weight: 600;
    fill: var(--ink);
}

.an-gauge-tag {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
}

/* ── Edge Finder insight cards ─────────────────────────── */
.an-insight-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-lg);
}

.an-insight-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--canvas);
    border: 1px solid var(--hairline-cool);
    border-left: 3px solid var(--hairline-strong);
    border-radius: var(--r-lg);
    padding: var(--s-lg) var(--s-xl);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.an-insight-card:hover {
    border-color: var(--hairline-strong);
}

/* ── (fade-in animation removed for now) ───────────────────── */
.an-fade-in {
    /* no animation */
}

.an-insight-card.is-strength {
    border-left-color: var(--primary);
}

.an-insight-card.is-leak {
    border-left-color: var(--loss);
}

.an-insight-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-md);
}

.an-insight-card__tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--r-full);
}

.an-insight-card.is-strength .an-insight-card__tag {
    background: var(--profit-tint);
    color: var(--primary-deep);
}

.an-insight-card.is-leak .an-insight-card__tag {
    background: var(--loss-tint);
    color: var(--loss-deep);
}

.an-insight-card__impact {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.an-insight-card.is-strength .an-insight-card__impact {
    color: var(--primary-deep);
}

.an-insight-card.is-leak .an-insight-card__impact {
    color: var(--loss-deep);
}

.an-insight-card__title {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.4;
}

.an-insight-card__title strong {
    font-weight: 600;
}

.an-insight-card__bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.an-insight-card__bar-track {
    flex: 1;
    position: relative;
    height: 6px;
    border-radius: var(--r-full);
    background: var(--canvas-soft);
    overflow: visible;
}

.an-insight-card__bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: var(--r-full);
}

.an-insight-card.is-strength .an-insight-card__bar-fill {
    background: var(--primary);
}

.an-insight-card.is-leak .an-insight-card__bar-fill {
    background: var(--loss);
}

.an-insight-card__bar-marker {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 12px;
    background: var(--ink-mute);
}

.an-insight-card__meta {
    font-size: 12px;
    color: var(--ink-mute-2);
}

.an-insight-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--s-xxl, 40px);
    color: var(--ink-mute);
    font-size: 13px;
    border: 1px dashed var(--hairline-cool);
    border-radius: var(--r-lg);
}

/* ── Setup Scorecard ────────────────────────────────────── */
.an-scorecard-row {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--s-xl);
    align-items: stretch;
}

.an-radar-card {
    align-items: center;
}

.an-radar-body {
    width: 100%;
    display: flex;
    justify-content: center;
}

.an-radar-body svg {
    width: 100%;
    max-width: 320px;
    height: auto;
    overflow: visible;
}

.an-radar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s-md) var(--s-lg);
    margin-top: var(--s-md);
}

.an-radar-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-mute);
}

.an-radar-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    flex: none;
}

.an-scorecard-table-wrap {
    background: var(--canvas);
    border: 1px solid var(--hairline-cool);
    border-radius: var(--r-lg);
    overflow-x: auto;
    display: flex;
    align-items: stretch;
}

.an-scorecard-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 13px;
}

.an-scorecard-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--ink-mute-2);
    padding: 12px 16px;
    border-bottom: 1px solid var(--hairline-cool);
}

.an-scorecard-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hairline-cool);
    color: var(--ink-secondary);
    white-space: nowrap;
}

.an-scorecard-table tbody tr:last-child td {
    border-bottom: none;
}

.an-scorecard-table tbody tr:hover td {
    background: var(--canvas-soft);
}

.an-scorecard-table .an-strategy-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--ink);
}

.an-strategy-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--r-full);
    flex: none;
}

.an-pnl-positive {
    color: var(--primary-deep);
    font-weight: 600;
}

.an-pnl-negative {
    color: var(--loss-deep);
    font-weight: 600;
}

/* ── Small inline legends under Phase 2 charts ─────────────── */
.an-scatter-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-md) var(--s-lg);
    margin-top: var(--s-md);
    padding-top: var(--s-md);
    border-top: 1px solid var(--hairline-cool);
}

.an-scatter-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--ink-mute);
}

.an-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--r-full);
    flex: none;
}

.an-dot--dash {
    width: 12px;
    height: 0;
    border-radius: 0;
    border-top: 1.5px dashed var(--ink);
}

.an-swatch {
    width: 14px;
    height: 10px;
    border-radius: 2px;
    flex: none;
}

.an-treemap-body svg,
.an-mc-body svg {
    width: 100%;
    height: auto;
}

.an-treemap-body {
    display: flex;
    justify-content: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .an-insight-grid {
        grid-template-columns: 1fr;
    }

    .an-scorecard-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .an-scorecard-table {
        font-size: 12px;
    }

    .an-scorecard-table thead th,
    .an-scorecard-table tbody td {
        padding: 10px 10px;
    }
}