body {
    margin: 0;
    background: #f5f7fa;
    color: #101828;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    font-size: 17px;
    line-height: 1.5;
}

.app-container {
    max-width: 1700px;
    margin: 0 auto;
    padding: 22px 28px 36px 28px;
}


/* ==========================================================
   CABEÇALHO
   ========================================================== */

.executive-header {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 30px;

    background:
        linear-gradient(
            120deg,
            #101828 0%,
            #182230 58%,
            #202939 100%
        );

    border-radius: 18px;
    padding: 30px 34px;
    margin-bottom: 20px;

    box-shadow:
        0 8px 28px
        rgba(16, 24, 40, 0.13);
}

.executive-header::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -110px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 42px solid rgba(215, 25, 32, 0.10);
}

.header-left {
    position: relative;
    z-index: 2;
    flex: 1;
}

.header-brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.header-brand {
    font-size: 16px;
    font-weight: 850;
    letter-spacing: 2.2px;
    color: #ffffff;
}

.header-product {
    font-size: 15px;
    font-weight: 750;
    letter-spacing: 1.3px;
    color: #f04438;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.header-value-proposition {
    color: #ffffff;
    font-size: 30px;
    line-height: 1.22;
    font-weight: 760;
    max-width: 780px;
    margin-bottom: 8px;
}

.header-description {
    color: #b9c0cc;
    font-size: 17px;
    line-height: 1.55;
}

.header-meta-card {
    position: relative;
    z-index: 2;
    flex: 0 0 270px;

    background: rgba(255, 255, 255, 0.065);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;

    padding: 20px 22px;
}

.header-meta-label {
    color: #98a2b3;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.2px;
    margin-bottom: 8px;
}

.header-meta-value {
    color: #ffffff;
    font-size: 21px;
    font-weight: 760;
    margin-bottom: 4px;
}

.header-meta-subtitle {
    color: #b9c0cc;
    font-size: 15px;
    margin-bottom: 18px;
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: #d1fadf;
    background: rgba(18, 183, 106, 0.12);

    padding: 6px 9px;
    border-radius: 999px;

    font-size: 13px;
    font-weight: 700;
}

.status-dot {
    color: #12b76a;
}


/* ==========================================================
   FILTROS
   ========================================================== */

.filter-panel {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 14px;

    padding: 18px 20px 14px 20px;
    margin-bottom: 14px;

    box-shadow:
        0 2px 8px
        rgba(16, 24, 40, 0.035);
}

.filter-panel-title {
    color: #344054;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 13px;
}

.filter-label {
    display: block;
    color: #475467;
    font-size: 15px;
    font-weight: 650;
    margin-bottom: 6px;
}

.comparison-label {
    margin-top: 11px;
    color: #667085;
    font-size: 15px;
}

.comparison-valid {
    color: #475467;
}

.comparison-warning {
    display: inline-block;
    color: #b54708;
    background: #fffaeb;
    padding: 7px 10px;
    border-radius: 7px;
    font-weight: 650;
}


/* ==========================================================
   LEITURA EXECUTIVA
   ========================================================== */

.executive-alert {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-left: 4px solid #d71920;
    border-radius: 13px;

    padding: 17px 20px;
    margin-bottom: 18px;

    box-shadow:
        0 2px 8px
        rgba(16, 24, 40, 0.035);
}

.exec-title {
    color: #344054;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.9px;
    margin-bottom: 6px;
}

.executive-reading {
    color: #344054;
    font-size: 17px;
    line-height: 1.55;
}


/* ==========================================================
   ABAS
   ========================================================== */

.main-tabs {
    margin-top: 18px;
}

.main-tabs .nav-tabs {
    border-bottom: 1px solid #e4e7ec;
}

.main-tabs .nav-link {
    color: #667085;
    background: transparent;
    font-weight: 650;
    font-size: 17px;
    padding: 14px 20px;
    border: none;
    border-bottom: 3px solid transparent;
}

.main-tabs .nav-link:hover {
    color: #344054;
}

.main-tabs .nav-link.active {
    color: #101828;
    background: transparent;
    border: none;
    border-bottom: 3px solid #d71920;
    font-weight: 760;
}

.tab-content-wrapper {
    padding-top: 28px;
}


/* ==========================================================
   TÍTULOS
   ========================================================== */

.section-title {
    color: #101828;
    font-size: 21px;
    font-weight: 760;
    margin-top: 26px;
    margin-bottom: 14px;
}

.section-description {
    color: #667085;
    font-size: 16px;
    line-height: 1.5;
    margin-top: -7px;
    margin-bottom: 18px;
}


/* ==========================================================
   KPI CARDS
   ========================================================== */

.kpi-card {
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-left: 4px solid #98a2b3;
    border-radius: 13px;

    padding: 20px 20px 18px 20px;
    min-height: 138px;

    box-shadow:
        0 3px 12px
        rgba(16, 24, 40, 0.04);
}

.kpi-positive {
    border-color: #abefc6;
    border-left-color: #12b76a;
    background:
        linear-gradient(
            120deg,
            #ffffff 0%,
            #f6fef9 100%
        );
}

.kpi-negative {
    border-color: #fecdca;
    border-left-color: #f04438;
    background:
        linear-gradient(
            120deg,
            #ffffff 0%,
            #fffafa 100%
        );
}

.kpi-neutral {
    border-left-color: #98a2b3;
}

.kpi-title {
    color: #475467;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.kpi-value {
    color: #101828;
    font-size: 28px;
    line-height: 1.1;
    font-weight: 790;
    margin-bottom: 12px;
}

.kpi-change-row {
    display: flex;
    gap: 5px;
    align-items: center;
}

.kpi-change {
    color: #475467;
    font-size: 15px;
    font-weight: 650;
}

.kpi-positive-text {
    color: #039855;
}

.kpi-negative-text {
    color: #d92d20;
}

.kpi-neutral-text {
    color: #98a2b3;
}


/* ==========================================================
   GRÁFICOS
   ========================================================== */

.chart-row {
    margin-top: 18px;
}

.js-plotly-plot {
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 13px;
    overflow: hidden;

    box-shadow:
        0 2px 8px
        rgba(16, 24, 40, 0.035);
}


/* ==========================================================
   ANALYTICS HEADER
   ========================================================== */

.analytics-heading {
    margin-bottom: 25px;
}

.analytics-eyebrow {
    color: #d71920;
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.analytics-main-title {
    color: #101828;
    font-size: 32px;
    font-weight: 780;
    margin-bottom: 9px;
}

.analytics-subtitle {
    max-width: 900px;
    color: #667085;
    font-size: 17px;
    line-height: 1.6;
    margin-bottom: 0;
}


/* ==========================================================
   RESUMO ANALÍTICO
   ========================================================== */

.analytics-summary-row {
    margin-bottom: 26px;
}

.analytics-summary-card {
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 13px;

    padding: 19px 20px;
    min-height: 104px;

    box-shadow:
        0 3px 12px
        rgba(16, 24, 40, 0.04);
}

.summary-signal {
    border-left: 4px solid #12b76a;
}

.summary-investigate {
    border-left: 4px solid #f79009;
}

.analytics-summary-number {
    color: #101828;
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
    margin-bottom: 10px;
}

.analytics-summary-label {
    color: #667085;
    font-size: 15px;
    font-weight: 650;
}


/* ==========================================================
   LETRAMENTO
   ========================================================== */

.statistical-literacy-box {
    background:
        linear-gradient(
            120deg,
            #ffffff 0%,
            #f8fafc 100%
        );

    border: 1px solid #d0d5dd;
    border-left: 4px solid #667085;
    border-radius: 13px;

    padding: 20px 22px;
    margin-bottom: 34px;
}

.literacy-heading {
    margin-bottom: 16px;
}

.literacy-title {
    color: #101828;
    font-size: 19px;
    font-weight: 760;
    margin-bottom: 5px;
}

.literacy-intro {
    color: #667085;
    font-size: 15px;
    line-height: 1.5;
}

.literacy-item {
    height: 100%;
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 10px;
    padding: 14px 15px;
}

.literacy-item-title {
    color: #344054;
    font-size: 15px;
    font-weight: 760;
    margin-bottom: 7px;
}

.literacy-item-text {
    color: #667085;
    font-size: 14px;
    line-height: 1.55;
}


/* ==========================================================
   CARDS ANALÍTICOS
   ========================================================== */

.analytics-card {
    height: 100%;
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 14px;

    padding: 21px 22px;

    box-shadow:
        0 3px 12px
        rgba(16, 24, 40, 0.05);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.analytics-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 22px
        rgba(16, 24, 40, 0.08);
}

.analytics-signal {
    border-left: 4px solid #12b76a;
}

.analytics-investigate {
    border-left: 4px solid #f79009;
}

.analytics-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

.analytics-tier {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.7px;
}

.tier-signal {
    color: #027a48;
    background: #ecfdf3;
}

.tier-investigate {
    color: #b54708;
    background: #fffaeb;
}

.evidence-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 750;
}

.evidence-high {
    color: #027a48;
    background: #ecfdf3;
}

.evidence-medium {
    color: #b54708;
    background: #fffaeb;
}

.evidence-low {
    color: #475467;
    background: #f2f4f7;
}

.analytics-card-title {
    color: #101828;
    font-size: 21px;
    line-height: 1.3;
    font-weight: 780;
    margin-bottom: 9px;
}

.analytics-card-message {
    color: #475467;
    font-size: 16px;
    line-height: 1.55;
    min-height: 44px;
    margin-bottom: 14px;
}


/* ==========================================================
   IMPLICAÇÃO GERENCIAL
   ========================================================== */

.management-box {
    background: #f8fafc;
    border: 1px solid #eaecf0;
    border-radius: 9px;
    padding: 12px 13px;
    margin-bottom: 17px;
}

.management-title {
    color: #344054;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.management-text {
    color: #475467;
    font-size: 15px;
    line-height: 1.5;
}


/* ==========================================================
   EVIDÊNCIA ESTATÍSTICA
   ========================================================== */

.statistics-title {
    color: #344054;
    font-size: 14px;
    font-weight: 760;
    margin-bottom: 5px;
}

.association-block {
    border-top: 1px solid #f2f4f7;
    border-bottom: 1px solid #f2f4f7;
    padding: 8px 0;
    margin-bottom: 11px;
}

.association-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 7px 0;
}

.association-description {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.association-label {
    color: #98a2b3;
    font-size: 13px;
    font-weight: 650;
}

.association-interpretation {
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

.association-statistics {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 175px;
    justify-content: flex-end;
}

.association-value {
    color: #101828;
    font-size: 14px;
    font-weight: 760;
}

.association-pvalue {
    color: #667085;
    font-size: 13px;
    min-width: 62px;
    text-align: right;
}

.causality-note {
    color: #98a2b3;
    font-size: 13px;
    font-style: italic;
}


/* ==========================================================
   ALERTAS
   ========================================================== */

.warning-card {
    height: 100%;
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 12px;
    padding: 17px 18px;
    min-height: 145px;
}

.warning-risk {
    border-color: #fecdca;
    border-left: 4px solid #f04438;
}

.warning-highlight {
    border-color: #abefc6;
    border-left: 4px solid #12b76a;
}

.warning-attention {
    border-color: #fedf89;
    border-left: 4px solid #f79009;
}

.warning-type-label {
    color: #667085;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.7px;
}

.warning-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 9px;
}

.warning-icon {
    color: #d92d20;
    font-size: 19px;
}

.warning-highlight .warning-icon {
    color: #039855;
}

.warning-attention .warning-icon {
    color: #dc6803;
}

.warning-title {
    color: #101828;
    font-size: 17px;
    font-weight: 760;
}

.warning-message {
    color: #667085;
    font-size: 15px;
    line-height: 1.55;
}


/* ==========================================================
   VAZIOS E METODOLOGIA
   ========================================================== */

.analytics-empty {
    color: #667085;
    background: #f9fafb;
    border: 1px dashed #d0d5dd;
    border-radius: 11px;
    padding: 19px;
    font-size: 15px;
}

.analytics-empty-positive {
    color: #027a48;
    background: #f6fef9;
    border-color: #abefc6;
}

.methodology-box {
    margin-top: 32px;
    background: #ffffff;
    border: 1px solid #eaecf0;
    border-radius: 11px;
    padding: 17px 19px;
}

.methodology-title {
    color: #344054;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.7px;
    margin-bottom: 6px;
}

.methodology-text {
    color: #667085;
    font-size: 14px;
    line-height: 1.6;
}


/* ==========================================================
   RODAPÉ
   ========================================================== */

.app-footer {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid #e4e7ec;
    color: #98a2b3;
    font-size: 13px;
}

.footer-brand {
    color: #475467;
    font-weight: 750;
}


/* ==========================================================
   RESPONSIVO
   ========================================================== */

@media (max-width: 900px) {

    .app-container {
        padding:
            16px
            14px
            28px
            14px;
    }

    .executive-header {
        flex-direction: column;
        padding: 24px 22px;
    }

    .header-meta-card {
        flex-basis: auto;
    }

    .header-value-proposition {
        font-size: 25px;
    }

    .analytics-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .association-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .association-statistics {
        justify-content: flex-start;
        min-width: 0;
    }
}


/* ==========================================================
   V2.1 — SAMPLE SUFFICIENCY + CARD REFINEMENT
   ========================================================== */

/* Cards neutros: sem barra lateral pesada */
.kpi-card.kpi-neutral {
    border: 1px solid #e4e7ec;
    background: #ffffff;
}

/* Cards analíticos: contorno sempre neutro */
.analytics-card.analytics-signal {
    border: 1px solid #eaecf0;
    border-left: 4px solid #12b76a;
}

.analytics-card.analytics-investigate {
    border: 1px solid #eaecf0;
    border-left: 4px solid #f79009;
}

/* Alertas: somente barra lateral colorida */
.warning-card.warning-risk {
    border: 1px solid #eaecf0;
    border-left: 4px solid #f04438;
}

.warning-card.warning-highlight {
    border: 1px solid #eaecf0;
    border-left: 4px solid #12b76a;
}

.warning-card.warning-attention {
    border: 1px solid #eaecf0;
    border-left: 4px solid #f79009;
}

/* Letramento estatístico mais leve */
.statistical-literacy-box {
    border: 1px solid #dfe3e8;
    border-left: 3px solid #667085;
}

/* Suficiência amostral */
.sample-warning {
    border-radius: 11px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.sample-insufficient {
    background: #fff8ed;
    border: 1px solid #fedf89;
    border-left: 4px solid #f79009;
}

.sample-partial {
    background: #f8fafc;
    border: 1px solid #d0d5dd;
    border-left: 4px solid #667085;
}

.sample-warning-title {
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.7px;
    color: #344054;
    margin-bottom: 5px;
}

.sample-warning-text {
    font-size: 15px;
    line-height: 1.55;
    color: #475467;
}

.analytics-empty-insufficient {
    background: #fff8ed;
    border-color: #fedf89;
    color: #b54708;
}


/* ==========================================================
   COMPARISON UX
   ========================================================== */

.comparison-availability-hint {
    margin-top: 7px;
    font-size: 13px;
    line-height: 1.45;
}

.comparison-hint-warning {
    color: #b54708;
}

.comparison-hint-valid {
    color: #027a48;
}


/* ==========================================================
   ALERTAS GERENCIAIS V4
   ========================================================== */

.warning-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.warning-source-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    opacity: 0.65;
}

.warning-detail-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.warning-section-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
    opacity: 0.65;
}

.warning-section-text {
    font-size: 15px;
    line-height: 1.55;
}


/* ==========================================================
   TENDÊNCIAS-CHAVE V5
   ========================================================== */

.key-trends-section {
    margin-top: 24px;
    margin-bottom: 24px;
}

.key-trend-card {
    height: 100%;
    padding: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-left-width: 4px;
    border-radius: 10px;
    background: #fff;
}

.key-trend-card-positive {
    border-left-color: #16a34a;
}

.key-trend-card-attention {
    border-left-color: #dc2626;
}

.key-trend-card-neutral {
    border-left-color: #94a3b8;
}

.key-trend-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
}

.key-trend-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.key-trend-status {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 3px 6px;
    border-radius: 999px;
    white-space: nowrap;
}

.key-trend-status-positive {
    background: rgba(22, 163, 74, 0.08);
    color: #15803d;
}

.key-trend-status-attention {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
}

.key-trend-status-neutral {
    background: rgba(100, 116, 139, 0.10);
    color: #64748b;
}

.key-trend-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.key-trend-icon {
    font-size: 29px;
    font-weight: 700;
    line-height: 1;
}

.key-trend-icon-positive {
    color: #16a34a;
}

.key-trend-icon-attention {
    color: #dc2626;
}

.key-trend-icon-neutral {
    color: #94a3b8;
}

.key-trend-direction {
    font-size: 16px;
    font-weight: 700;
}

.key-trend-strength {
    font-size: 13px;
    opacity: 0.62;
    margin-top: 2px;
}

.key-trend-reading {
    font-size: 14px;
    line-height: 1.45;
    margin-top: 12px;
    opacity: 0.72;
}


/* ==========================================================
   PRIORIDADES EXECUTIVAS V6
   ========================================================== */

.executive-priorities-panel {
    padding: 18px 20px;
    margin-bottom: 4px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: #ffffff;
}

.executive-priorities-heading {
    margin-bottom: 14px;
}

.executive-priorities-eyebrow {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.10em;
    color: #475569;
}

.executive-priorities-subtitle {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.5;
    color: #64748b;
}

.executive-priorities-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.executive-priority-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.65);
}

.executive-priority-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0f172a;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
}

.executive-priority-content {
    flex: 1;
    min-width: 0;
}

.executive-priority-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.executive-priority-title {
    font-size: 15px;
    font-weight: 750;
    color: #0f172a;
}

.executive-priority-badge {
    padding: 3px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.executive-priority-high {
    background: rgba(220, 38, 38, 0.09);
    color: #b91c1c;
}

.executive-priority-medium {
    background: rgba(217, 119, 6, 0.10);
    color: #b45309;
}

.executive-priority-low {
    background: rgba(100, 116, 139, 0.10);
    color: #64748b;
}

.executive-priority-preliminary {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.executive-priority-description {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.45;
    color: #64748b;
}

.executive-priorities-footnote {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #94a3b8;
}

.executive-priorities-positive {
    border-left: 4px solid #16a34a;
}

@media (max-width: 991px) {
    .executive-priorities-list {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   FIX ALTURA DOS GRÁFICOS EXECUTIVOS
   ========================================================== */

.executive-chart {
    height: 360px !important;
    min-height: 360px !important;
    max-height: 360px !important;
    width: 100%;
}

.executive-chart .js-plotly-plot,
.executive-chart .plot-container,
.executive-chart .svg-container {
    height: 360px !important;
    max-height: 360px !important;
}

.chart-row {
    align-items: flex-start;
}

.chart-row > [class*="col"] {
    height: 360px;
    min-height: 360px;
    max-height: 360px;
}

@media (max-width: 991px) {
    .executive-chart,
    .executive-chart .js-plotly-plot,
    .executive-chart .plot-container,
    .executive-chart .svg-container,
    .chart-row > [class*="col"] {
        height: 340px !important;
        min-height: 340px !important;
        max-height: 340px !important;
    }
}


/* ==========================================================
   LEITURA EXECUTIVA INTEGRADA V7
   ========================================================== */

.integrated-reading-card {
    padding: 22px 24px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-left: 5px solid #64748b;
    border-radius: 12px;
    background: #ffffff;
}

.integrated-reading-attention {
    border-left-color: #d97706;
}

.integrated-reading-risk {
    border-left-color: #dc2626;
}

.integrated-reading-positive {
    border-left-color: #16a34a;
}

.integrated-reading-neutral {
    border-left-color: #64748b;
}

.integrated-reading-mixed {
    border-left-color: #2563eb;
}

.integrated-reading-insufficient {
    border-left-color: #94a3b8;
}

.integrated-reading-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.integrated-reading-eyebrow {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.11em;
    color: #475569;
}

.integrated-reading-confidence {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.integrated-reading-scenario {
    margin-top: 14px;
    font-size: 24px;
    font-weight: 750;
    color: #0f172a;
}

.integrated-reading-headline {
    margin-top: 6px;
    font-size: 17px;
    font-weight: 650;
    color: #334155;
}

.integrated-reading-message {
    margin-top: 10px;
    max-width: 1050px;
    font-size: 15px;
    line-height: 1.65;
    color: #64748b;
}

.integrated-reading-action {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 9px;
    background: rgba(248, 250, 252, 0.9);
}

.integrated-reading-action-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #475569;
}

.integrated-reading-action-text {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #475569;
}

.integrated-reading-footnote {
    margin-top: 10px;
    font-size: 12px;
    color: #94a3b8;
}


/* ==========================================================
   METODOLOGIA DINÂMICA — 6 A 11 MESES
   ========================================================== */

.preliminary-literacy-box {
    margin-top: 24px;
    margin-bottom: 28px;
    padding: 20px 22px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-left: 4px solid #64748b;
    border-radius: 12px;
    background: #ffffff;
}

.preliminary-literacy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.preliminary-literacy-title {
    font-size: 19px;
    font-weight: 750;
    color: #0f172a;
}

.preliminary-literacy-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.10);
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.preliminary-literacy-message {
    margin-top: 8px;
    max-width: 1050px;
    font-size: 15px;
    line-height: 1.6;
    color: #64748b;
}

.preliminary-literacy-detail {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 9px;
    background: rgba(248, 250, 252, 0.95);
}

.preliminary-literacy-detail-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #475569;
}

.preliminary-literacy-detail-text {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
}

.preliminary-literacy-footnote {
    margin-top: 10px;
    font-size: 12px;
    color: #94a3b8;
}


/* ==========================================================
   ACESSIBILIDADE TIPOGRÁFICA V1
   ========================================================== */

input,
button,
select,
textarea,
.Select-control,
.Select-menu-outer,
.Select-option,
.Select-value,
.Select-placeholder,
.Select-input,
.form-control {
    font-size: 16px !important;
}

.Select-value-label,
.Select-placeholder {
    line-height: 1.35 !important;
}

/* Plotly SVG text is controlled primarily by figure layout.
   This rule helps where browser CSS inheritance is respected. */
.js-plotly-plot text {
    font-size: 13px;
}
/* ==========================================================
   THEME TOGGLE V1 — CLARO / ESCURO
   ========================================================== */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(240, 68, 56, 0.35);
    outline-offset: 2px;
}

.theme-toggle:active {
    transform: translateY(1px);
}

.theme-toggle-icon {
    font-size: 17px;
    line-height: 1;
}

body {
    transition:
        background-color 0.20s ease,
        color 0.20s ease;
}


/* ----------------------------------------------------------
   DARK MODE — BASE
   ---------------------------------------------------------- */

body.dark-mode {
    background: #0b1220;
    color: #e5e7eb;
}

body.dark-mode .app-container {
    color: #e5e7eb;
}


/* ----------------------------------------------------------
   DARK MODE — PAINÉIS, CARDS E SUPERFÍCIES
   ---------------------------------------------------------- */

body.dark-mode .filter-panel,
body.dark-mode .executive-alert,
body.dark-mode .kpi-card,
body.dark-mode .kpi-card.kpi-neutral,
body.dark-mode .analytics-summary-card,
body.dark-mode .statistical-literacy-box,
body.dark-mode .literacy-item,
body.dark-mode .analytics-card,
body.dark-mode .warning-card,
body.dark-mode .methodology-box,
body.dark-mode .key-trend-card,
body.dark-mode .executive-priorities-panel,
body.dark-mode .integrated-reading-card,
body.dark-mode .preliminary-literacy-box,
body.dark-mode .forecast-card,
body.dark-mode .forecast-chart-card {
    background: #111827 !important;
    border-color: #334155 !important;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18) !important;
}

body.dark-mode .forecast-section {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%) !important;
    border-color: #334155 !important;
}

body.dark-mode .management-box,
body.dark-mode .integrated-reading-action,
body.dark-mode .preliminary-literacy-detail,
body.dark-mode .forecast-methodology-note {
    background: #172033 !important;
    border-color: #334155 !important;
}

body.dark-mode .executive-priority-item {
    background: rgba(30, 41, 59, 0.78);
    border-color: #334155;
}


/* ----------------------------------------------------------
   DARK MODE — KPI SEMÂNTICO
   ---------------------------------------------------------- */

body.dark-mode .kpi-positive {
    background:
        linear-gradient(
            120deg,
            #111827 0%,
            rgba(18, 183, 106, 0.08) 100%
        ) !important;
    border-color: rgba(18, 183, 106, 0.35) !important;
    border-left-color: #12b76a !important;
}

body.dark-mode .kpi-negative {
    background:
        linear-gradient(
            120deg,
            #111827 0%,
            rgba(240, 68, 56, 0.09) 100%
        ) !important;
    border-color: rgba(240, 68, 56, 0.34) !important;
    border-left-color: #f04438 !important;
}

body.dark-mode .analytics-card.analytics-signal {
    border-left-color: #12b76a !important;
}

body.dark-mode .analytics-card.analytics-investigate {
    border-left-color: #f79009 !important;
}

body.dark-mode .warning-card.warning-risk {
    border-left-color: #f04438 !important;
}

body.dark-mode .warning-card.warning-highlight {
    border-left-color: #12b76a !important;
}

body.dark-mode .warning-card.warning-attention {
    border-left-color: #f79009 !important;
}


/* ----------------------------------------------------------
   DARK MODE — TIPOGRAFIA
   ---------------------------------------------------------- */

body.dark-mode .section-title,
body.dark-mode .analytics-main-title,
body.dark-mode .analytics-summary-number,
body.dark-mode .literacy-title,
body.dark-mode .analytics-card-title,
body.dark-mode .warning-title,
body.dark-mode .kpi-value,
body.dark-mode .key-trend-title,
body.dark-mode .executive-priority-title,
body.dark-mode .integrated-reading-scenario,
body.dark-mode .preliminary-literacy-title,
body.dark-mode .forecast-card-value {
    color: #f8fafc !important;
}

body.dark-mode .filter-panel-title,
body.dark-mode .filter-label,
body.dark-mode .exec-title,
body.dark-mode .executive-reading,
body.dark-mode .kpi-title,
body.dark-mode .kpi-change,
body.dark-mode .analytics-card-message,
body.dark-mode .management-title,
body.dark-mode .management-text,
body.dark-mode .statistics-title,
body.dark-mode .association-interpretation,
body.dark-mode .association-value,
body.dark-mode .warning-message,
body.dark-mode .warning-section-text,
body.dark-mode .executive-priorities-eyebrow,
body.dark-mode .integrated-reading-eyebrow,
body.dark-mode .integrated-reading-headline,
body.dark-mode .integrated-reading-action-label,
body.dark-mode .integrated-reading-action-text,
body.dark-mode .preliminary-literacy-detail-title,
body.dark-mode .preliminary-literacy-detail-text,
body.dark-mode .forecast-card-title,
body.dark-mode .forecast-methodology-primary {
    color: #cbd5e1 !important;
}

body.dark-mode .comparison-label,
body.dark-mode .section-description,
body.dark-mode .analytics-subtitle,
body.dark-mode .analytics-summary-label,
body.dark-mode .literacy-intro,
body.dark-mode .literacy-item-text,
body.dark-mode .association-pvalue,
body.dark-mode .causality-note,
body.dark-mode .methodology-text,
body.dark-mode .key-trend-strength,
body.dark-mode .key-trend-reading,
body.dark-mode .executive-priorities-subtitle,
body.dark-mode .executive-priority-description,
body.dark-mode .executive-priorities-footnote,
body.dark-mode .integrated-reading-message,
body.dark-mode .integrated-reading-footnote,
body.dark-mode .preliminary-literacy-message,
body.dark-mode .preliminary-literacy-footnote,
body.dark-mode .forecast-card-origin,
body.dark-mode .forecast-card-arrow,
body.dark-mode .forecast-card-footnote,
body.dark-mode .forecast-methodology-secondary {
    color: #94a3b8 !important;
}

body.dark-mode .association-label,
body.dark-mode .warning-type-label,
body.dark-mode .warning-source-label,
body.dark-mode .warning-section-label {
    color: #94a3b8 !important;
    opacity: 1;
}


/* ----------------------------------------------------------
   DARK MODE — ABAS
   ---------------------------------------------------------- */

body.dark-mode .main-tabs .nav-tabs {
    border-bottom-color: #334155;
}

body.dark-mode .main-tabs .nav-link {
    color: #94a3b8;
}

body.dark-mode .main-tabs .nav-link:hover {
    color: #e2e8f0;
}

body.dark-mode .main-tabs .nav-link.active {
    color: #f8fafc;
    border-bottom-color: #f04438;
}


/* ----------------------------------------------------------
   DARK MODE — INPUTS / DROPDOWNS DASH
   ---------------------------------------------------------- */

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .form-control,
body.dark-mode .Select-control,
body.dark-mode .Select-menu-outer,
body.dark-mode .Select-menu,
body.dark-mode .Select-input,
body.dark-mode .Select-value,
body.dark-mode .Select-placeholder {
    background: #111827 !important;
    color: #e5e7eb !important;
    border-color: #475569 !important;
}

body.dark-mode .Select-control:hover {
    border-color: #64748b !important;
}

body.dark-mode .Select-value-label,
body.dark-mode .Select-placeholder,
body.dark-mode .Select-input > input {
    color: #e5e7eb !important;
}

body.dark-mode .Select-arrow {
    border-color: #94a3b8 transparent transparent !important;
}

body.dark-mode .Select-menu-outer {
    background: #111827 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

body.dark-mode .Select-option,
body.dark-mode .VirtualizedSelectOption {
    background: #111827 !important;
    color: #e5e7eb !important;
}

body.dark-mode .Select-option.is-focused,
body.dark-mode .VirtualizedSelectFocusedOption {
    background: #1e293b !important;
    color: #ffffff !important;
}

body.dark-mode .Select-option.is-selected {
    background: #334155 !important;
    color: #ffffff !important;
}


/* ----------------------------------------------------------
   DARK MODE — GRÁFICOS PLOTLY
   ---------------------------------------------------------- */

body.dark-mode .js-plotly-plot {
    background: #111827 !important;
    border-color: #334155 !important;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.18) !important;
}

body.dark-mode .modebar {
    background: transparent !important;
}


/* ----------------------------------------------------------
   DARK MODE — ALERTAS / ESTADOS AUXILIARES
   ---------------------------------------------------------- */

body.dark-mode .analytics-empty {
    background: #111827;
    border-color: #475569;
    color: #94a3b8;
}

body.dark-mode .analytics-empty-positive {
    background: rgba(18, 183, 106, 0.08);
    border-color: rgba(18, 183, 106, 0.35);
    color: #6ce9a6;
}

body.dark-mode .comparison-warning,
body.dark-mode .sample-insufficient {
    background: rgba(247, 144, 9, 0.10);
    border-color: rgba(247, 144, 9, 0.35);
    color: #fec84b;
}

body.dark-mode .sample-partial {
    background: #172033;
    border-color: #475569;
}

body.dark-mode .comparison-hint-valid {
    color: #6ce9a6;
}

body.dark-mode .comparison-hint-warning {
    color: #fec84b;
}


/* ----------------------------------------------------------
   DARK MODE — FOOTER
   ---------------------------------------------------------- */

body.dark-mode .app-footer {
    border-top-color: #334155;
    color: #64748b;
}

body.dark-mode .footer-brand {
    color: #cbd5e1;
}


/* ----------------------------------------------------------
   MOBILE
   ---------------------------------------------------------- */

@media (max-width: 900px) {
    .theme-toggle {
        width: auto;
        min-width: 150px;
    }
}

/* ==========================================================
   THEME TOGGLE V1.3 — DASH 4 NATIVE THEME VARIABLES
   ========================================================== */

/*
 * Dash 4 redesenhou dcc.Dropdown e demais DCCs para usar variáveis CSS.
 * Em vez de perseguir classes internas geradas dinamicamente, definimos
 * o tema na raiz do dashboard.
 */

body,
.app-container {
    --Dash-Stroke-Strong: #d0d5dd;
    --Dash-Stroke-Weak: #e4e7ec;
    --Dash-Fill-Interactive-Strong: #d71920;
    --Dash-Fill-Interactive-Weak: rgba(215, 25, 32, 0.08);
    --Dash-Fill-Inverse-Strong: #ffffff;
    --Dash-Fill-Weak: #f8fafc;
    --Dash-Fill-Primary-Hover: #f2f4f7;
    --Dash-Fill-Primary-Active: #eaecf0;
    --Dash-Fill-Disabled: #f2f4f7;
    --Dash-Text-Primary: #101828;
    --Dash-Text-Strong: #101828;
    --Dash-Text-Weak: #667085;
    --Dash-Text-Disabled: #98a2b3;
    --Dash-Shading-Strong: rgba(16, 24, 40, 0.18);
    --Dash-Shading-Weak: rgba(16, 24, 40, 0.08);
}

body.dark-mode,
body.dark-mode .app-container,
body.dark-mode .filter-panel {
    --Dash-Stroke-Strong: #64748b;
    --Dash-Stroke-Weak: #334155;
    --Dash-Fill-Interactive-Strong: #f04438;
    --Dash-Fill-Interactive-Weak: rgba(240, 68, 56, 0.14);
    --Dash-Fill-Inverse-Strong: #111827;
    --Dash-Fill-Weak: #172033;
    --Dash-Fill-Primary-Hover: #1e293b;
    --Dash-Fill-Primary-Active: #334155;
    --Dash-Fill-Disabled: #172033;
    --Dash-Text-Primary: #f8fafc;
    --Dash-Text-Strong: #f8fafc;
    --Dash-Text-Weak: #cbd5e1;
    --Dash-Text-Disabled: #94a3b8;
    --Dash-Shading-Strong: rgba(0, 0, 0, 0.42);
    --Dash-Shading-Weak: rgba(0, 0, 0, 0.22);
}

/*
 * Segurança adicional para a superfície externa dos dropdowns,
 * sem depender das classes internas do Dash 4.
 */
body.dark-mode #granularity,
body.dark-mode #start-period,
body.dark-mode #end-period,
body.dark-mode #comparison-type,
body.dark-mode #forecast-metric {
    background: #111827 !important;
    color: #f8fafc !important;
    border-radius: 7px;
}

/* ==========================================================
   DARK MODE — BORDAS SEMÂNTICAS
   ========================================================== */

/* KPIs */
body.dark-mode .kpi-positive {
    border-color: rgba(18, 183, 106, 0.55) !important;
    border-left-color: #12b76a !important;
}

body.dark-mode .kpi-negative {
    border-color: rgba(240, 68, 56, 0.55) !important;
    border-left-color: #f04438 !important;
}

body.dark-mode .kpi-neutral {
    border-color: #475569 !important;
    border-left-color: #64748b !important;
}

/* Relações analíticas */
body.dark-mode .analytics-card.analytics-signal {
    border-color: rgba(18, 183, 106, 0.45) !important;
    border-left-color: #12b76a !important;
}

body.dark-mode .analytics-card.analytics-investigate {
    border-color: rgba(247, 144, 9, 0.48) !important;
    border-left-color: #f79009 !important;
}

/* Alertas */
body.dark-mode .warning-card.warning-risk {
    border-color: rgba(240, 68, 56, 0.52) !important;
    border-left-color: #f04438 !important;
}

body.dark-mode .warning-card.warning-highlight {
    border-color: rgba(18, 183, 106, 0.48) !important;
    border-left-color: #12b76a !important;
}

body.dark-mode .warning-card.warning-attention {
    border-color: rgba(247, 144, 9, 0.50) !important;
    border-left-color: #f79009 !important;
}

/* Tendências-chave */
body.dark-mode .key-trend-card-positive {
    border-color: rgba(22, 163, 74, 0.48) !important;
    border-left-color: #16a34a !important;
}

body.dark-mode .key-trend-card-attention {
    border-color: rgba(220, 38, 38, 0.50) !important;
    border-left-color: #dc2626 !important;
}

body.dark-mode .key-trend-card-neutral {
    border-color: #475569 !important;
    border-left-color: #94a3b8 !important;
}

/* Leitura integrada */
body.dark-mode .integrated-reading-attention {
    border-color: rgba(217, 119, 6, 0.48) !important;
    border-left-color: #d97706 !important;
}

body.dark-mode .integrated-reading-risk {
    border-color: rgba(220, 38, 38, 0.50) !important;
    border-left-color: #dc2626 !important;
}

body.dark-mode .integrated-reading-positive {
    border-color: rgba(22, 163, 74, 0.48) !important;
    border-left-color: #16a34a !important;
}

body.dark-mode .integrated-reading-mixed {
    border-color: rgba(37, 99, 235, 0.50) !important;
    border-left-color: #2563eb !important;
}

body.dark-mode .integrated-reading-neutral,
body.dark-mode .integrated-reading-insufficient {
    border-color: #475569 !important;
    border-left-color: #64748b !important;
}

/* Forecast */
body.dark-mode .forecast-positive {
    border-color: rgba(25, 135, 84, 0.48) !important;
    border-top: 4px solid #198754 !important;
}

body.dark-mode .forecast-negative {
    border-color: rgba(220, 53, 69, 0.50) !important;
    border-top: 4px solid #dc3545 !important;
}

body.dark-mode .forecast-neutral {
    border-color: #475569 !important;
    border-top: 4px solid #6c757d !important;
}

/* ==========================================================
   THEME TOGGLE V1.4 — BORDAS SEMÂNTICAS DO RESUMO ANALÍTICO
   ========================================================== */

/* Sinais relevantes — verde */
body.dark-mode .analytics-summary-card.summary-signal,
body.dark-mode .summary-signal {
    border-color: rgba(18, 183, 106, 0.48) !important;
    border-left: 4px solid #12b76a !important;
}

/* Pontos para investigar — laranja */
body.dark-mode .analytics-summary-card.summary-investigate,
body.dark-mode .summary-investigate {
    border-color: rgba(247, 144, 9, 0.50) !important;
    border-left: 4px solid #f79009 !important;
}

/* Cards informativos/neutros permanecem discretos */
body.dark-mode .analytics-summary-card:not(.summary-signal):not(.summary-investigate) {
    border-color: #334155 !important;
    border-left: 1px solid #334155 !important;
}


/* ==========================================================
   V8.13A — CHAT CONVERSATIONAL
   ========================================================== */

.financial-chat-shell {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 8px 36px;
}

.financial-chat-header {
    margin-bottom: 22px;
}

.financial-chat-title {
    margin: 4px 0 6px;
    font-weight: 700;
}

.financial-chat-subtitle {
    margin: 0;
    opacity: 0.72;
    max-width: 760px;
}

.financial-chat-messages {
    min-height: 430px;
    max-height: 62vh;
    overflow-y: auto;
    padding: 24px;
    border: 1px solid rgba(127, 127, 127, 0.20);
    border-radius: 18px;
    background: rgba(127, 127, 127, 0.035);
}

.financial-chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
    align-items: flex-start;
}

.financial-chat-message-user {
    flex-direction: row-reverse;
}

.financial-chat-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.financial-chat-avatar-assistant {
    background: #c8202f;
    color: white;
}

.financial-chat-avatar-user {
    background: rgba(127, 127, 127, 0.18);
}

.financial-chat-bubble {
    max-width: min(820px, 86%);
    padding: 15px 18px;
    border-radius: 16px;
}

.financial-chat-bubble-assistant {
    border: 1px solid rgba(127, 127, 127, 0.16);
}

.financial-chat-bubble-user {
    background: rgba(127, 127, 127, 0.10);
}

.financial-chat-author {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.64;
    margin-bottom: 7px;
}

.financial-chat-markdown p:last-child {
    margin-bottom: 0;
}

.financial-chat-composer {
    margin-top: 16px;
    border: 1px solid rgba(127, 127, 127, 0.22);
    border-radius: 18px;
    padding: 14px;
}

.financial-chat-input {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    padding: 4px 6px 10px;
}

.financial-chat-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.financial-chat-hint {
    font-size: 12px;
    opacity: 0.55;
}

.financial-chat-send {
    min-width: 96px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .financial-chat-shell {
        padding-top: 18px;
    }

    .financial-chat-messages {
        min-height: 360px;
        padding: 16px;
    }

    .financial-chat-bubble {
        max-width: 92%;
    }

    .financial-chat-actions {
        align-items: flex-end;
    }

    .financial-chat-hint {
        max-width: 65%;
    }
}


/* ==========================================================
   V8.13A — CHAT RESPONSE UX
   ========================================================== */

.financial-chat-markdown {
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.financial-chat-markdown h1,
.financial-chat-markdown h2,
.financial-chat-markdown h3,
.financial-chat-markdown h4 {
    margin-top: 1.15em;
    margin-bottom: 0.55em;
    line-height: 1.25;
}

.financial-chat-markdown h1:first-child,
.financial-chat-markdown h2:first-child,
.financial-chat-markdown h3:first-child {
    margin-top: 0;
}

.financial-chat-markdown ul,
.financial-chat-markdown ol {
    padding-left: 1.35rem;
}

.financial-chat-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 18px;
    font-size: 0.94em;
    display: table;
}

.financial-chat-markdown thead {
    border-bottom: 2px solid rgba(127, 127, 127, 0.30);
}

.financial-chat-markdown th,
.financial-chat-markdown td {
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.financial-chat-markdown th {
    font-weight: 700;
}

.financial-chat-markdown tbody tr:last-child td {
    border-bottom: 0;
}

.financial-chat-markdown code {
    font-size: 0.90em;
    padding: 2px 5px;
    border-radius: 5px;
    background: rgba(127, 127, 127, 0.10);
}

.financial-chat-markdown blockquote {
    margin: 12px 0;
    padding: 4px 0 4px 14px;
    border-left: 3px solid rgba(200, 32, 47, 0.65);
}

@media (max-width: 768px) {
    .financial-chat-markdown {
        overflow-x: auto;
    }

    .financial-chat-markdown table {
        min-width: 620px;
    }
}


/* ==========================================================
   V8.13B — CONVERSATION MANAGEMENT
   ========================================================== */

.financial-chat-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 340px) minmax(0, 1fr);
    gap: 24px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 8px 36px;
}

.financial-chat-main {
    min-width: 0;
}

.financial-chat-sidebar {
    min-width: 0;
}

.financial-chat-new {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 10px;
}

.financial-chat-sidebar-title {
    margin: 0 8px 8px;
    font-size: 12px;
    font-weight: 700;
    opacity: 0.62;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.financial-chat-conversation-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.financial-chat-conversation-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 4px;
    border-radius: 10px;
}

.financial-chat-conversation-open {
    width: 100%;
    min-width: 0;
    text-align: left;
    text-decoration: none;
    overflow: hidden;
    white-space: normal;
    padding: 8px 10px;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    line-height: 1.25rem;
    max-height: 2.5rem;
    overflow-wrap: anywhere;
}

.financial-chat-conversation-active {
    font-weight: 700;
    background: rgba(127, 127, 127, 0.10);
}

.financial-chat-conversation-delete {
    width: 28px;
    min-width: 28px;
    text-decoration: none;
    opacity: 0.45;
    padding: 6px 4px;
    align-self: center;
}

.financial-chat-conversation-delete:hover {
    opacity: 1;
}

.financial-chat-conversation-empty {
    padding: 10px 8px;
    font-size: 13px;
    opacity: 0.55;
}

@media (max-width: 900px) {
    .financial-chat-workspace {
        grid-template-columns: 1fr;
    }

    .financial-chat-sidebar {
        border-bottom: 1px solid rgba(127, 127, 127, 0.18);
        padding-bottom: 16px;
    }

    .financial-chat-conversation-list {
        max-height: 180px;
        overflow-y: auto;
    }
}

/* V8.13B — SIDEBAR HORIZONTAL OPTIMIZATION 2C.5A */

.financial-chat-workspace {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;

    grid-template-columns:
        minmax(410px, 450px)
        minmax(0, 1fr);

    gap: 28px;
}

.financial-chat-sidebar {
    width: 100%;
    min-width: 0;
}

.financial-chat-conversation-open {
    -webkit-line-clamp: 3;
    line-height: 1.25rem;
    max-height: 3.75rem;
}

@media (max-width: 1200px) {
    .financial-chat-workspace {
        grid-template-columns:
            minmax(330px, 380px)
            minmax(0, 1fr);

        gap: 22px;
    }

    .financial-chat-conversation-open {
        -webkit-line-clamp: 2;
        max-height: 2.5rem;
    }
}

@media (max-width: 900px) {
    .financial-chat-workspace {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .financial-chat-conversation-open {
        -webkit-line-clamp: 2;
        max-height: 2.5rem;
    }
}


/* ==========================================================
   V8.13C — Financial Chat Rich Responses
   ========================================================== */

.financial-chat-rich-artifacts {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.financial-chat-rich-block {
    width: 100%;
    padding: 14px;
    border: 1px solid rgba(127, 127, 127, 0.18);
    border-radius: 12px;
    background: rgba(127, 127, 127, 0.035);
}

.financial-chat-rich-title {
    margin-bottom: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.financial-chat-rich-kpi-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.financial-chat-rich-kpi {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid rgba(127, 127, 127, 0.16);
    border-radius: 10px;
}

.financial-chat-rich-kpi-positive {
    border-left: 4px solid #12b76a;
}

.financial-chat-rich-kpi-negative {
    border-left: 4px solid #f04438;
}

.financial-chat-rich-kpi-neutral {
    border-left: 4px solid #98a2b3;
}

.financial-chat-rich-kpi-label {
    margin-bottom: 5px;
    font-size: 0.72rem;
    opacity: 0.72;
}

.financial-chat-rich-kpi-value {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.financial-chat-rich-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.financial-chat-rich-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.financial-chat-rich-table th,
.financial-chat-rich-table td {
    padding: 8px 9px;
    border-bottom:
        1px solid rgba(127, 127, 127, 0.14);
    text-align: right;
    vertical-align: top;
}

.financial-chat-rich-table th:first-child,
.financial-chat-rich-table td:first-child {
    text-align: left;
}

.financial-chat-rich-table th {
    font-weight: 700;
    white-space: nowrap;
}

.financial-chat-rich-chart {
    width: 100%;
    height: 300px;
    min-height: 300px;
    max-height: 300px;
    overflow: hidden;
}

.financial-chat-rich-chart .js-plotly-plot,
.financial-chat-rich-chart .plot-container,
.financial-chat-rich-chart .svg-container {
    height: 300px !important;
    max-height: 300px !important;
}

.financial-chat-signal-grid {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.financial-chat-signal-card {
    padding: 11px 12px;
    border: 1px solid rgba(127, 127, 127, 0.16);
    border-radius: 10px;
}

.financial-chat-signal-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.financial-chat-signal-severity,
.financial-chat-signal-score {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.financial-chat-signal-title {
    font-size: 0.84rem;
    font-weight: 700;
}

.financial-chat-signal-evidence {
    margin-top: 6px;
    font-size: 0.74rem;
    line-height: 1.45;
    opacity: 0.78;
    overflow-wrap: anywhere;
}

