/* ── AI Report Modal ─────────────────────────────────────────── */

.ai-report-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 400;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 20px 0;
}

.ai-report-overlay--open {
    display: flex;
}

.ai-report-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 720px;
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* ── Header ── */

.ai-report-header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-report-header__left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.ai-report-header__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-report-header__symbol {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ai-report-header__close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--border);
    color: var(--text-primary);
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.ai-report-header__close:hover {
    background: var(--text-muted);
}

/* ── Meta bar ── */

.ai-report-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.ai-report-meta__label {
    color: var(--text-muted);
}

/* ── Body ── */

.ai-report-body {
    padding: 16px 20px 20px;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* ── Section Cards ── */

.ai-report-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.ai-report-card__header {
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(128, 128, 128, 0.06);
    border-bottom: 1px solid var(--border);
}

.ai-report-card__body {
    padding: 10px 14px 12px;
    font-size: 0.83rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* ── Summary Card (highlighted) ── */

.ai-report-card--summary {
    border-left-color: var(--yellow);
    background: rgba(255, 193, 7, 0.04);
}

.ai-report-card--summary .ai-report-card__header {
    color: var(--yellow);
}

/* ── Loading ── */

.ai-report-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── Error ── */

.ai-report-error {
    padding: 20px;
    text-align: center;
    color: var(--red);
    font-size: 0.85rem;
}

/* ── Retry button inside body ── */

.ai-report-retry {
    display: block;
    margin: 16px auto 0;
    padding: 6px 20px;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.ai-report-retry:hover {
    border-color: var(--blue);
    color: var(--blue);
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .ai-report-overlay {
        padding: 0;
    }
    .ai-report-modal {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .ai-report-header {
        padding: 12px 14px 10px;
    }
    .ai-report-meta {
        padding: 6px 14px;
    }
    .ai-report-body {
        padding: 14px;
    }
}
