﻿
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');
/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    --ws-blue: #4a7fa8;
    --ws-blue-dark: #335f80;
    --ws-blue-light: #c4d4e6;
    --ws-blue-pale: #eef4f9;
    --ws-blue-soft: #f6f9fc;
    --ws-text: #1f2f3f;
    --ws-text-muted: #607487;
    --ws-border: #d9e4ee;
    --ws-border-strong: #c7d6e4;
    --ws-bg: #f4f7fa;
    --ws-white: #ffffff;
    --ws-total-bg: #3a6585;
    --ws-shadow: 0 6px 18px rgba(35, 56, 80, 0.06);
    --ws-radius: 10px;
    --ws-radius-sm: 8px;
    --font-ui: 'Inter', sans-serif;
    --font-num: 'JetBrains Mono', monospace;
}

/* ============================================================
   BASE
   ============================================================ */
html, body {
    font-family: var(--font-ui);
    color: var(--ws-text);
    background: var(--ws-bg);
}

/* ============================================================
   GENERIC AI HTML SUPPORT
   ============================================================ */
.ai-html-content {
    font-family: var(--font-ui);
    color: var(--ws-text);
    padding: 24px 30px 30px;
    background: var(--ws-bg);
}

    .ai-html-content > *:first-child {
        margin-top: 0 !important;
    }

    .ai-html-content > *:last-child {
        margin-bottom: 0 !important;
    }

/* ============================================================
   HEADERS / TEXT
   ============================================================ */
:is(.workspace-report, .ai-html-content) h1,
:is(.workspace-report, .ai-html-content) h2,
:is(.workspace-report, .ai-html-content) h3,
:is(.workspace-report, .ai-html-content) h4 {
    font-family: var(--font-ui);
    color: var(--ws-text);
    line-height: 1.2;
    margin-top: 0;
    letter-spacing: -0.02em;
}

:is(.workspace-report, .ai-html-content) h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 14px;
}

:is(.workspace-report, .ai-html-content) h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
}

:is(.workspace-report, .ai-html-content) h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--ws-blue-dark);
}

:is(.workspace-report, .ai-html-content) h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

:is(.workspace-report, .ai-html-content) p {
    font-size: 13.5px;
    line-height: 1.7;
    color: #3f5368;
    margin: 0 0 12px 0;
}

:is(.workspace-report, .ai-html-content) strong {
    color: var(--ws-text);
    font-weight: 700;
}

:is(.workspace-report, .ai-html-content) em {
    color: var(--ws-text-muted);
}

:is(.workspace-report, .ai-html-content) hr {
    border: 0;
    border-top: 1px solid var(--ws-border);
    margin: 18px 0;
}

/* ============================================================
   LISTS
   ============================================================ */
:is(.workspace-report, .ai-html-content) ul,
:is(.workspace-report, .ai-html-content) ol {
    margin: 0 0 10px 0;
    padding-left: 20px;
}

:is(.workspace-report, .ai-html-content) li {
    font-size: 13.5px;
    line-height: 1.65;
    color: #3f5368;
    margin-bottom: 6px;
}

/* ============================================================
   TABLES
   ============================================================ */
:is(.workspace-report, .ai-html-content) table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--ws-white);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius-sm);
    overflow: hidden;
    margin: 12px 0 18px;
    box-shadow: 0 2px 8px rgba(27, 49, 72, 0.03);
}

    :is(.workspace-report, .ai-html-content) table thead tr {
        background: linear-gradient(180deg, #edf4fa 0%, #e7eff7 100%);
    }

    :is(.workspace-report, .ai-html-content) table thead th {
        padding: 10px 16px;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ws-text-muted);
        border-bottom: 1px solid var(--ws-border);
        text-align: left;
        white-space: nowrap;
    }

        :is(.workspace-report, .ai-html-content) table thead th:not(:first-child) {
            text-align: right;
        }

    :is(.workspace-report, .ai-html-content) table tbody tr {
        background: var(--ws-white);
        transition: background 0.15s ease;
    }

        :is(.workspace-report, .ai-html-content) table tbody tr:hover {
            background: #fafcff;
        }

    :is(.workspace-report, .ai-html-content) table tbody td {
        padding: 10px 16px;
        font-size: 13px;
        color: var(--ws-text);
        border-bottom: 1px solid #edf3f8;
        vertical-align: middle;
    }

    :is(.workspace-report, .ai-html-content) table tbody tr:last-child td {
        border-bottom: none;
    }

    :is(.workspace-report, .ai-html-content) table tbody td:not(:first-child) {
        text-align: right;
        font-family: var(--font-num);
        font-variant-numeric: tabular-nums;
    }

:is(.workspace-report, .ai-html-content) .totals-row td,
:is(.workspace-report, .ai-html-content) tr.total-row td {
    background: var(--ws-total-bg);
    color: var(--ws-white);
    font-weight: 700;
    border-bottom: none;
}

    :is(.workspace-report, .ai-html-content) .totals-row td:first-child,
    :is(.workspace-report, .ai-html-content) tr.total-row td:first-child {
        font-family: var(--font-ui);
    }

/* ============================================================
   NUMERIC HELPERS
   ============================================================ */
.num,
.metric-value,
.margin-badge,
:is(.workspace-report, .ai-html-content) td:not(:first-child),
:is(.workspace-report, .ai-html-content) th.num,
:is(.workspace-report, .ai-html-content) td.num {
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   WORKSPACE REPORT WRAPPER
   ============================================================ */
.workspace-report {
    font-family: var(--font-ui);
    color: var(--ws-text);
    background: var(--ws-bg);
    min-height: 100%;
}

    /* ============================================================
   REPORT HEADER
   ============================================================ */
    .workspace-report .report-header {
        padding: 18px 24px 14px;
    }

        .workspace-report .report-header h2 {
            font-size: 22px;
            font-weight: 800;
            margin: 0 0 4px 0;
            letter-spacing: -0.02em;
        }

        .workspace-report .report-header .report-scope {
            font-size: 12.5px;
            line-height: 1.45;
            font-weight: 500;
        }

    /* ============================================================
   REPORT META
   ============================================================ */
    .workspace-report .report-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 14px 22px;
        padding: 10px 28px;
        background: #edf4fa;
        border-bottom: 1px solid var(--ws-border);
        font-size: 12px;
        color: var(--ws-text-muted);
    }

        .workspace-report .report-meta strong {
            color: var(--ws-blue-dark);
            font-weight: 700;
        }

    /* ============================================================
   REPORT BODY
   ============================================================ */
    .workspace-report .report-body {
        padding: 18px 24px 24px;
        gap: 14px;
    }

    /* ============================================================
   METRIC CARDS
   ============================================================ */
    .workspace-report .metrics-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
    }
        .workspace-report .metrics-row > .metric-card:last-child:nth-child(odd) {
            max-width: 340px;
        }
    .workspace-report .metric-card {
        padding: 12px 14px;
        min-height: 72px;
        border-radius: 8px;
    }

    .workspace-report .metric-label {
        font-size: 10px;
        margin-bottom: 6px;
        letter-spacing: 0.05em;
    }

    .workspace-report .metric-value {
        font-size: 16px;
        line-height: 1.1;
        font-weight: 700;
    }

    .workspace-report .metric-subtext {
        margin-top: 4px;
        font-size: 11px;
    }

    /* ============================================================
   SECTION / CONTENT CARDS
   ============================================================ */
    .workspace-report .content-section,
    .workspace-report .detail-section,
    .workspace-report .summary-card {
        background: var(--ws-white);
        border: 1px solid var(--ws-border);
        border-radius: var(--ws-radius);
        overflow: hidden;
        box-shadow: var(--ws-shadow);
    }

        .workspace-report .content-section .section-header, .workspace-report .detail-section .section-header, .workspace-report .summary-card .card-header {
            padding: 9px 14px;
            font-size: 12.5px;
        }

        .workspace-report .content-section .section-body,
        .workspace-report .summary-card .card-body {
            padding: 16px;
        }
            .workspace-report .content-section .section-body p, .workspace-report .content-section .section-body .summary-note, .ai-html-content .summary-note {
                font-size: 12.5px;
                color: var(--ws-text-muted);
                margin-top: 8px;
                margin-bottom: 0;
            }

        .workspace-report .detail-section table {
            margin: 0;
            border: 0;
            border-radius: 0;
            box-shadow: none;
        }

    /* ============================================================
   SUMMARY GRID
   ============================================================ */
    .workspace-report .summary-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    /* ============================================================
   INSIGHTS SECTION
   ============================================================ */
    .workspace-report .insights-section {
        background: var(--ws-white);
        border: 1px solid var(--ws-border);
        border-left: 4px solid var(--ws-blue);
        border-radius: 0 var(--ws-radius) var(--ws-radius) 0;
        padding: 16px 18px;
        box-shadow: var(--ws-shadow);
    }

        .workspace-report .insights-section h3 {
            color: var(--ws-blue-dark);
            margin-bottom: 10px;
        }

        .workspace-report .insights-section ul {
            margin-bottom: 0;
        }

/* ============================================================
   BADGES / INLINE ELEMENTS
   ============================================================ */
.margin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #deedf9;
    color: var(--ws-blue-dark);
    font-size: 11px;
    font-weight: 700;
    border: 1px solid #c9dff0;
}

/* ============================================================
   TAB BAR / TAB STYLE
   Ajustado para que se vea más integrado con el workspace
   ============================================================ */
.workspace-tabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding: 0 8px;
    background: #f7fafc;
    border-bottom: 1px solid var(--ws-border);
    overflow-x: auto;
    scrollbar-width: none;
}

    .workspace-tabs-bar::-webkit-scrollbar {
        display: none;
    }

.workspace-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 280px;
    min-height: 34px;
    padding: 0 10px 0 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ws-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

    .workspace-tab:hover {
        color: var(--ws-blue-dark);
        background: #eef4f9;
        border-color: #e0eaf3;
    }

    .workspace-tab.active {
        color: var(--ws-blue-dark);
        background: var(--ws-white);
        border-color: var(--ws-border);
        border-bottom-color: var(--ws-white);
        box-shadow: 0 -1px 0 var(--ws-white), 0 1px 0 var(--ws-white);
    }

    .workspace-tab .tab-title {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
    }

    .workspace-tab .tab-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        border: none;
        background: transparent;
        color: #94a7b8;
        border-radius: 4px;
        font-size: 13px;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
        transition: background 0.15s ease, color 0.15s ease;
    }

        .workspace-tab .tab-close:hover {
            background: #e8f0f7;
            color: var(--ws-blue-dark);
        }

/* ============================================================
   TAB CONTENT
   ============================================================ */
.workspace-tab-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--ws-bg);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.workspace-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 48px 24px;
    text-align: center;
}

    .workspace-empty h3 {
        color: var(--ws-blue-dark);
        margin-bottom: 8px;
    }

    .workspace-empty p {
        color: var(--ws-text-muted);
        max-width: 340px;
    }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .workspace-report .metrics-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .workspace-report .report-header {
        padding: 16px 18px 12px;
    }

        .workspace-report .report-header h2 {
            font-size: 19px;
        }

    .workspace-report .report-body {
        padding: 16px 18px 20px;
    }

    .workspace-report .metrics-row {
        grid-template-columns: 1fr;
    }

    .workspace-report .metric-card {
        max-width: none;
    }
}

/* ============================================================
   OVERRIDES — volver al estilo de la segunda imagen
   Pegar al FINAL del css
   ============================================================ */
/* fondo general */
.workspace-tab-content,
.workspace-report,
.ai-html-content {
    background: var(--ws-bg);
}

    /* HEADER PRINCIPAL */
    .workspace-report .report-header {
        background: var(--ws-blue);
        color: var(--ws-white);
        padding: 20px 24px 16px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

        .workspace-report .report-header h2 {
            color: var(--ws-white);
            font-size: 21px;
            font-weight: 800;
            margin: 0 0 4px 0;
            letter-spacing: -0.02em;
        }

        .workspace-report .report-header .report-scope {
            color: #ffffff !important;
            font-size: 12.5px;
            line-height: 1.45;
            font-weight: 500;
        }

    /* si viene html simple y no workspace-report */
    .ai-html-content > h1:first-child,
    .ai-html-content > h2:first-child {
        background: var(--ws-blue);
        color: var(--ws-white) !important;
        margin: -24px -30px 14px -30px;
        padding: 20px 24px 16px;
        font-size: 21px;
        font-weight: 800;
        letter-spacing: -0.02em;
    }

        .ai-html-content > h1:first-child + p,
        .ai-html-content > h2:first-child + p {
            margin-top: -2px;
            margin-bottom: 18px;
            color: var(--ws-text-muted);
            font-size: 12.5px;
        }

    /* BODY */
    .workspace-report .report-body,
    .ai-html-content {
        padding: 18px 20px 22px;
    }

        /* SECTION CARDS */
        .workspace-report .content-section,
        .workspace-report .detail-section,
        .workspace-report .summary-card,
        .ai-html-content .content-section,
        .ai-html-content .detail-section {
            background: var(--ws-white);
            border: 1px solid var(--ws-border);
            border-radius: 10px;
            overflow: hidden;
            box-shadow: none;
        }

            /* SECTION HEADERS */
            .workspace-report .content-section .section-header,
            .workspace-report .detail-section .section-header,
            .workspace-report .summary-card .card-header,
            .ai-html-content .section-header,
            .ai-html-content > h3 {
                background: #edf3f8;
                color: var(--ws-blue-dark);
                border-bottom: 1px solid var(--ws-border);
                padding: 10px 14px;
                font-size: 12.5px;
                font-weight: 700;
                letter-spacing: -0.01em;
                margin: 0;
            }

        /* si el agente usa h3 simple, hacerlo parecer sección */
        .ai-html-content > h3 {
            border: 1px solid var(--ws-border);
            border-radius: 10px 10px 0 0;
            border-bottom: none;
            margin-top: 0;
        }

            .ai-html-content > h3 + table,
            .ai-html-content > h3 + .table-container table,
            .ai-html-content > h3 + ul,
            .ai-html-content > h3 + p {
                margin-top: 0;
            }

    /* EXECUTIVE SUMMARY / METRICS */
    .workspace-report .metrics-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
        align-items: start;
    }

    .workspace-report .metric-card {
        background: var(--ws-white);
        border: 1px solid var(--ws-border);
        border-radius: 8px;
        padding: 14px 16px;
        min-height: 84px;
        box-shadow: none;
    }

    .workspace-report .metric-label {
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--ws-text-muted);
        margin-bottom: 8px;
    }

    .workspace-report .metric-value {
        font-family: var(--font-num);
        font-size: 17px;
        line-height: 1.1;
        font-weight: 600;
        color: var(--ws-blue-dark);
    }

    .workspace-report .metric-subtext {
        margin-top: 4px;
        font-size: 11px;
        color: var(--ws-text-muted);
    }

    /* quinta card si queda abajo */
    .workspace-report .metrics-row > .metric-card:last-child:nth-child(odd) {
        max-width: 360px;
    }

    /* summary note / formula */
    .workspace-report .content-section .section-body p,
    .workspace-report .summary-note,
    .ai-html-content .summary-note {
        font-size: 12.5px;
        color: var(--ws-text-muted);
        margin-top: 8px;
        margin-bottom: 0;
    }

/* TABLAS */
:is(.workspace-report, .ai-html-content) table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--ws-white);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 0;
    box-shadow: none;
}

    :is(.workspace-report, .ai-html-content) table thead tr {
        background: #edf3f8;
    }

    :is(.workspace-report, .ai-html-content) table thead th {
        padding: 10px 16px;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ws-text-muted);
        border-bottom: 1px solid var(--ws-border);
        text-align: left;
        white-space: nowrap;
    }

        :is(.workspace-report, .ai-html-content) table thead th:not(:first-child) {
            text-align: right;
        }

    :is(.workspace-report, .ai-html-content) table tbody td {
        padding: 10px 16px;
        font-size: 13px;
        color: var(--ws-text);
        border-bottom: 1px solid #edf3f8;
        vertical-align: middle;
    }

        :is(.workspace-report, .ai-html-content) table tbody td:not(:first-child) {
            text-align: right;
            font-family: var(--font-num);
            font-variant-numeric: tabular-nums;
        }

    :is(.workspace-report, .ai-html-content) table tbody tr:last-child td {
        border-bottom: none;
    }

/* totals row como la imagen que te gustaba */
:is(.workspace-report, .ai-html-content) .totals-row td,
:is(.workspace-report, .ai-html-content) tr.total-row td {
    background: var(--ws-total-bg);
    color: var(--ws-white);
    font-weight: 700;
    border-bottom: none;
}

    :is(.workspace-report, .ai-html-content) .totals-row td:first-child,
    :is(.workspace-report, .ai-html-content) tr.total-row td:first-child {
        font-family: var(--font-ui);
    }

/* INSIGHTS */
.workspace-report .insights-section,
.ai-html-content .insights-section {
    background: var(--ws-white);
    border: 1px solid var(--ws-border);
    border-radius: 10px;
    padding: 0;
    box-shadow: none;
}

    .workspace-report .insights-section h3,
    .ai-html-content .insights-section h3 {
        background: #edf3f8;
        color: var(--ws-blue-dark);
        border-bottom: 1px solid var(--ws-border);
        padding: 10px 14px;
        font-size: 12.5px;
        font-weight: 700;
        margin: 0;
    }

    .workspace-report .insights-section ul,
    .ai-html-content .insights-section ul {
        padding: 14px 18px 16px 30px;
        margin: 0;
    }

    .workspace-report .insights-section li,
    .ai-html-content .insights-section li {
        font-size: 13px;
        line-height: 1.6;
        color: #3f5368;
        margin-bottom: 8px;
    }

/* TABS — volverlos más discretos como tu segunda imagen */
.workspace-tabs-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 30px;
    padding: 0 6px;
    background: var(--ws-white);
    border-bottom: 1px solid var(--ws-border);
    overflow-x: auto;
    scrollbar-width: none;
}

    .workspace-tabs-bar::-webkit-scrollbar {
        display: none;
    }

.workspace-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 260px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ws-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

    .workspace-tab:hover {
        color: var(--ws-blue-dark);
        background: #f7fafc;
    }

    .workspace-tab.active {
        color: var(--ws-blue-dark);
        background: transparent;
        border-bottom-color: var(--ws-blue);
        box-shadow: none;
        font-weight: 600;
    }

    .workspace-tab .tab-title {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
    }

    .workspace-tab .tab-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        border: none;
        background: transparent;
        color: #94a7b8;
        border-radius: 3px;
        font-size: 12px;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
    }

        .workspace-tab .tab-close:hover {
            background: #edf3f8;
            color: var(--ws-blue-dark);
        }

/* RESPONSIVE */
@media (max-width: 1200px) {
    .workspace-report .metrics-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .workspace-report .report-header {
        padding: 16px 18px 12px;
    }

        .workspace-report .report-header h2 {
            font-size: 19px;
        }

    .workspace-report .report-body,
    .ai-html-content {
        padding: 16px 18px 20px;
    }

    .workspace-report .metrics-row {
        grid-template-columns: 1fr;
    }

    .workspace-report .metric-card {
        max-width: none;
    }
}

/* ============================================================
   OVERRIDES — acercar img actual al estilo de img 2
   PEGAR AL FINAL
   ============================================================ */
/* ---------- TABS ---------- */
.workspace-tabs-bar {
    min-height: 32px;
    padding: 0 6px;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid #dfe8f0;
}

.workspace-tab {
    min-height: 32px;
    max-width: 290px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    color: #6d8093;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    box-shadow: none;
}

    .workspace-tab:hover {
        background: #f8fbfd;
        color: #3a6585;
    }

    .workspace-tab.active {
        background: transparent;
        color: #3a6585;
        border-bottom: 2px solid #4a7fa8;
        box-shadow: none;
        font-weight: 600;
    }

    .workspace-tab .tab-title {
        max-width: 235px;
    }

    .workspace-tab .tab-close {
        width: 15px;
        height: 15px;
        font-size: 11px;
        color: #97a8b8;
    }

        .workspace-tab .tab-close:hover {
            background: #edf4fa;
            color: #3a6585;
        }

/* ---------- WORKSPACE CONTENT WIDTH / AIR ---------- */
.workspace-tab-content {
    background: #f4f7fa;
}

.workspace-report,
.ai-html-content {
    background: #f4f7fa;
}

    .workspace-report .report-body,
    .ai-html-content {
        padding: 18px 20px 22px;
    }

    /* ---------- HEADER ---------- */
    .workspace-report .report-header {
        background: #4f82aa;
        padding: 18px 20px 16px;
        border-bottom: none;
    }

        .workspace-report .report-header h1,
        .workspace-report .report-header h2,
        .workspace-report .report-header h3 {
            color: #fff !important;
            margin: 0 0 4px 0;
            font-size: 18px;
            font-weight: 700;
            letter-spacing: -0.01em;
        }

        .workspace-report .report-header .report-scope {
            color: #ffffff !important;
            font-size: 12px;
            line-height: 1.4;
            font-weight: 500;
        }

    /* si el agente manda h1/h2 simple al inicio */
    .ai-html-content > h1:first-child,
    .ai-html-content > h2:first-child {
        background: #4f82aa;
        color: #fff !important;
        margin: -18px -20px 0 -20px;
        padding: 18px 20px 8px;
        font-size: 18px;
        font-weight: 700;
        letter-spacing: -0.01em;
    }

        .ai-html-content > h1:first-child + p,
        .ai-html-content > h2:first-child + p {
            background: #4f82aa;
            color: rgba(255,255,255,0.82);
            margin: 0 -20px 14px -20px;
            padding: 0 20px 14px;
            font-size: 12px;
            line-height: 1.4;
        }

    /* ---------- META BAR como la imagen anterior ---------- */
    .workspace-report .report-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        padding: 8px 20px;
        background: #edf3f8;
        border-bottom: 1px solid #dce6ef;
        font-size: 11.5px;
        color: #72859a;
    }

        .workspace-report .report-meta strong {
            color: #557796;
            font-weight: 700;
        }

    /* ---------- SECTION CONTAINERS ---------- */
    .workspace-report .content-section,
    .workspace-report .detail-section,
    .workspace-report .summary-card,
    .workspace-report .insights-section,
    .ai-html-content .content-section,
    .ai-html-content .detail-section,
    .ai-html-content .insights-section {
        background: #fff;
        border: 1px solid #dce6ef;
        border-radius: 6px;
        box-shadow: none;
        overflow: hidden;
    }

        .workspace-report .content-section .section-header,
        .workspace-report .detail-section .section-header,
        .workspace-report .summary-card .card-header,
        .workspace-report .insights-section h3,
        .ai-html-content .section-header,
        .ai-html-content .insights-section h3,
        .ai-html-content > h3 {
            background: #edf3f8;
            color: #4d7394;
            border-bottom: 1px solid #dce6ef;
            padding: 10px 16px;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0;
            margin: 0;
        }

        .workspace-report .content-section .section-body,
        .workspace-report .summary-card .card-body {
            padding: 14px 16px;
        }

    /* ---------- METRICS STRIP ---------- */
    .workspace-report .metrics-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
    }

    .workspace-report .metric-card {
        min-height: 68px;
        padding: 14px 16px;
        border: 1px solid #dce6ef;
        border-radius: 6px;
        background: #fff;
        box-shadow: none;
    }

    .workspace-report .metric-label {
        font-size: 9px;
        letter-spacing: 0.08em;
        color: #8a9aab;
        font-weight: 700;
        margin-bottom: 7px;
    }

    .workspace-report .metric-value {
        font-size: 18px;
        line-height: 1;
        font-weight: 600;
        color: #24384a;
    }

    .workspace-report .metric-subtext {
        font-size: 10.5px;
        margin-top: 4px;
        color: #7c8ea0;
    }

    /* si sale una quinta card abajo */
    .workspace-report .metrics-row > .metric-card:last-child:nth-child(odd) {
        max-width: 320px;
    }

/* ---------- TABLE ---------- */
:is(.workspace-report, .ai-html-content) table {
    margin: 0;
    border: 1px solid #dce6ef;
    border-radius: 6px;
    box-shadow: none;
    background: #fff;
}

    :is(.workspace-report, .ai-html-content) table thead tr {
        background: #edf3f8;
    }

    :is(.workspace-report, .ai-html-content) table thead th {
        padding: 8px 16px;
        font-size: 9.5px;
        font-weight: 700;
        color: #73869a;
        letter-spacing: 0.07em;
        border-bottom: 1px solid #dce6ef;
        text-transform: uppercase;
    }

    :is(.workspace-report, .ai-html-content) table tbody td {
        padding: 9px 16px;
        font-size: 12.5px;
        color: #24384a;
        border-bottom: 1px solid #edf3f8;
    }

        :is(.workspace-report, .ai-html-content) table tbody td:not(:first-child) {
            font-family: var(--font-num);
            font-size: 12.5px;
        }

    :is(.workspace-report, .ai-html-content) table tbody tr:hover {
        background: #f9fbfd;
    }

:is(.workspace-report, .ai-html-content) .totals-row td,
:is(.workspace-report, .ai-html-content) tr.total-row td {
    background: #446f93;
    color: #fff;
    font-weight: 700;
    border-bottom: 0;
}

/* ---------- INSIGHTS ---------- */
.workspace-report .insights-section,
.ai-html-content .insights-section {
    border-left: 0;
    padding: 0;
}

    .workspace-report .insights-section ul,
    .ai-html-content .insights-section ul {
        padding: 12px 18px 14px 30px;
        margin: 0;
    }

    .workspace-report .insights-section li,
    .ai-html-content .insights-section li {
        font-size: 12.5px;
        line-height: 1.6;
        color: #415567;
        margin-bottom: 8px;
    }

/* ---------- GENERIC TEXT ---------- */
:is(.workspace-report, .ai-html-content) p {
    font-size: 12.5px;
    line-height: 1.6;
    color: #5d7186;
}

:is(.workspace-report, .ai-html-content) h1 {
    font-size: 18px;
}

:is(.workspace-report, .ai-html-content) h2 {
    font-size: 22px;
    font-weight: 800;
    padding:12px;
}


:is(.workspace-report, .ai-html-content) h3 {
    font-size: 12px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1200px) {
    .workspace-report .metrics-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .workspace-report .report-header {
        padding: 16px 16px 14px;
    }

    .workspace-report .report-body,
    .ai-html-content {
        padding: 14px 16px 18px;
    }

    .workspace-report .metrics-row {
        grid-template-columns: 1fr;
    }

    .ai-html-content > h1:first-child,
    .ai-html-content > h2:first-child {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

        .ai-html-content > h1:first-child + p,
        .ai-html-content > h2:first-child + p {
            margin-left: -16px;
            margin-right: -16px;
            padding-left: 16px;
            padding-right: 16px;
        }
}

/* ============================================================
   AJUSTE FINAL — scope + key insights
   ============================================================ */
/* SCOPE DEL HEADER */
.workspace-report .report-header {
    padding-bottom: 18px;
}

    .workspace-report .report-header .report-scope {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 16px;
        margin-top: 8px;
        color: #ffffff !important;
        font-size: 12px;
        line-height: 1.45;
        font-weight: 500;
    }

    .workspace-report .report-header .report-scope span,
    .workspace-report .report-header .report-scope div {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .workspace-report .report-header .report-scope strong {
        color: #ffffff;
        font-weight: 700;
    }

.ai-html-content > h1:first-child + p,
.ai-html-content > h2:first-child + p {
    background: #4f82aa;
    color: rgba(255,255,255,0.88);
    margin: 0 -20px 14px -20px;
    padding: 0 20px 14px;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 500;
}

    .ai-html-content > h1:first-child + p strong,
    .ai-html-content > h2:first-child + p strong {
        color: #ffffff;
        font-weight: 700;
    }

.workspace-report .insights-section,
.ai-html-content .insights-section {
    background: #ffffff;
    border: 1px solid #dce6ef;
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
}

    .workspace-report .insights-section h3,
    .ai-html-content .insights-section h3 {
        background: #edf3f8;
        color: #4d7394;
        border-bottom: 1px solid #dce6ef;
        padding: 10px 16px;
        margin: 0;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0;
    }

    .workspace-report .insights-section ul,
    .ai-html-content .insights-section ul {
        margin: 0;
        padding: 14px 18px 16px 30px;
        list-style: disc;
    }

    .workspace-report .insights-section li,
    .ai-html-content .insights-section li {
        margin-bottom: 10px;
        font-size: 12.5px;
        line-height: 1.65;
        color: #42576b;
    }

        .workspace-report .insights-section li:last-child,
        .ai-html-content .insights-section li:last-child {
            margin-bottom: 0;
        }

.ai-html-content > h3:last-of-type {
    background: #edf3f8;
    color: #4d7394;
    border: 1px solid #dce6ef;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 10px 16px;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
}

    .ai-html-content > h3:last-of-type + ul {
        border: 1px solid #dce6ef;
        border-top: none;
        border-radius: 0 0 6px 6px;
        background: #fff;
        padding: 14px 18px 16px 30px;
        margin: 0 0 14px 0;
    }

@media (max-width: 700px) {
    .workspace-report .report-header .report-scope {
        gap: 6px 12px;
        font-size: 11.5px;
    }
}

/* ===== INSIGHTS MÁS PREMIUM ===== */
.workspace-report .insights-section,
.ai-html-content .insights-section {
    margin-top: 10px;
    border: 1px solid #dce6ef;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

    .workspace-report .insights-section h3,
    .ai-html-content .insights-section h3 {
        background: #edf3f8;
        color: #4d7394;
        padding: 10px 16px;
        margin: 0;
        font-size: 12px;
        font-weight: 700;
        border-bottom: 1px solid #dce6ef;
    }

    .workspace-report .insights-section ul,
    .ai-html-content .insights-section ul {
        padding: 14px 18px 16px 30px;
        margin: 0;
    }

.workspace-report .insights-section li {
    margin-bottom: 10px;
    font-size: 12.5px;
    line-height: 1.6;
    color: #42576b;
}

    /* bullet más limpio */
    .workspace-report .insights-section li::marker {
        color: #4a7fa8;
    }
/* ===== TOTAL ROW MÁS FINANCIERO ===== */
.workspace-report table tr.total-row td,
.workspace-report table .totals-row td {
    background: #446f93;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    border-bottom: none;
}

/* label del total */
.workspace-report table tr.total-row td:first-child {
    font-family: var(--font-ui);
    letter-spacing: 0.02em;
}

/* número más marcado */
.workspace-report table tr.total-row td:not(:first-child) {
    font-family: var(--font-num);
    font-size: 13px;
}
.workspace-report .report-header .report-scope {
    color: #ffffff !important;
    opacity: 1;
}
    /* quitar diferencias entre label y valor */

    .workspace-report .report-header .report-scope strong {
        color: #ffffff !important;
        opacity: 1;
        font-weight: 600;
    }
    /* spans también */

    .workspace-report .report-header .report-scope span {
        color: #ffffff !important;
    }
        /* separadores más sutiles */

        .workspace-report .report-header .report-scope span::after {
            color: #ffffff !important;
        }

.ai-html-content > h1:first-child + p, .ai-html-content > h2:first-child + p {
    color: #ffffff !important;
    opacity: 1;
}

    .ai-html-content > h1:first-child + p strong, .ai-html-content > h2:first-child + p strong {
        color: #ffffff !important;
    }

.workspace-report .report-header .report-scope p {
    margin: 0;
    color: #ffffff !important;
    font-size: 12px;
    line-height: 1.45;
    font-weight: 500;
}

    .workspace-report .report-header .report-scope p strong {
        color: #ffffff !important;
        font-weight: 700;
    }


