/* Fase 9.3 — CSS verbatim de los bloques de estilo de Pages/CPP/CuentasPagarProveedorMainPage.razor. Igual que hoy, es global mientras el componente está en pantalla:
   se enlaza con <link> donde estaba el bloque. Cambios: @@ → @ y capas D-51. */
/* ============================================================================
   SISTEMA DE APARIENCIA CxP — ÚNICA definición de los 8 temas del módulo.
   Vive aquí (página principal) porque el selector solo existe aquí (Sección
   15 del encargo). CuentaPagarProveedorCCCModal / …Amortizacion / …Adelanto
   se renderizan como componentes hijos DENTRO del div [data-cxc-theme] de
   abajo, así que heredan estas variables por cascada CSS normal — no hace
   falta pasar el tema como [Parameter] a cada modal.
   ============================================================================ */
.cxc-app {
    font-family: 'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
    background: var(--cxc-surface-alt);
    color: var(--cxc-text);
    font-size: 13px;
    position: relative;
}

    .cxc-app * {
        box-sizing: border-box;
    }

    .cxc-app[data-cxc-theme="corporate"] {
        --cxc-primary: #2563eb;
        --cxc-primary-hover: #1d4ed8;
        --cxc-secondary: #475569;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #f8fafc;
        --cxc-border: #e2e8f0;
        --cxc-text: #0f172a;
        --cxc-text-muted: #64748b;
        --cxc-selected: #dbeafe;
        --cxc-hover: #f1f5f9;
        --cxc-success: #16a34a;
        --cxc-success-bg: #e6f4ea;
        --cxc-success-ink: #166534;
        --cxc-danger: #dc2626;
        --cxc-danger-bg: #fdecec;
        --cxc-danger-ink: #991b1b;
        --cxc-warning: #d97706;
        --cxc-warning-bg: #fff4e5;
        --cxc-warning-ink: #92400e;
        --cxc-info: #0891b2;
        --cxc-info-bg: #e3f2fd;
        --cxc-info-ink: #0c5a86;
        --cxc-focus-ring: #93c5fd;
        --cxc-border-w: 1px;
    }

    .cxc-app[data-cxc-theme="azul-oscuro"] {
        --cxc-primary: #1e3a5f;
        --cxc-primary-hover: #16304f;
        --cxc-secondary: #33475b;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #f2f5f8;
        --cxc-border: #d7dfe7;
        --cxc-text: #10202f;
        --cxc-text-muted: #5b7186;
        --cxc-selected: #cddced;
        --cxc-hover: #eef2f6;
        --cxc-success: #157a4a;
        --cxc-success-bg: #e2f2e9;
        --cxc-success-ink: #0f5735;
        --cxc-danger: #a3271f;
        --cxc-danger-bg: #f8e3e1;
        --cxc-danger-ink: #7a1c16;
        --cxc-warning: #8a5300;
        --cxc-warning-bg: #f7ecd8;
        --cxc-warning-ink: #5c3800;
        --cxc-info: #0f6e8c;
        --cxc-info-bg: #dcf0f5;
        --cxc-info-ink: #0a4f65;
        --cxc-focus-ring: #7ea3c9;
        --cxc-border-w: 1px;
    }

    .cxc-app[data-cxc-theme="indigo"] {
        --cxc-primary: #4f46e5;
        --cxc-primary-hover: #4338ca;
        --cxc-secondary: #6d5bd0;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #f6f5ff;
        --cxc-border: #e3e1fb;
        --cxc-text: #211c42;
        --cxc-text-muted: #6c669a;
        --cxc-selected: #e6e3fc;
        --cxc-hover: #f5f4ff;
        --cxc-success: #059669;
        --cxc-success-bg: #e2f5ec;
        --cxc-success-ink: #03633f;
        --cxc-danger: #e11d48;
        --cxc-danger-bg: #fde3ea;
        --cxc-danger-ink: #9c123a;
        --cxc-warning: #c2740a;
        --cxc-warning-bg: #faedd8;
        --cxc-warning-ink: #7a4a06;
        --cxc-info: #4f46e5;
        --cxc-info-bg: #eae8fd;
        --cxc-info-ink: #372fa8;
        --cxc-focus-ring: #c4bdf7;
        --cxc-border-w: 1px;
    }

    .cxc-app[data-cxc-theme="verde"] {
        --cxc-primary: #15803d;
        --cxc-primary-hover: #116430;
        --cxc-secondary: #4b5f52;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #f2f9f4;
        --cxc-border: #d9ece0;
        --cxc-text: #102a1b;
        --cxc-text-muted: #57756a;
        --cxc-selected: #d2ecdb;
        --cxc-hover: #eef8f1;
        --cxc-success: #15803d;
        --cxc-success-bg: #e2f3e7;
        --cxc-success-ink: #0f5b2b;
        --cxc-danger: #c0362c;
        --cxc-danger-bg: #f9e5e3;
        --cxc-danger-ink: #8a2721;
        --cxc-warning: #a4700a;
        --cxc-warning-bg: #f6ecd7;
        --cxc-warning-ink: #6b4a06;
        --cxc-info: #227a94;
        --cxc-info-bg: #e0f0f4;
        --cxc-info-ink: #175869;
        --cxc-focus-ring: #8fcba7;
        --cxc-border-w: 1px;
    }

    .cxc-app[data-cxc-theme="gris"] {
        --cxc-primary: #475569;
        --cxc-primary-hover: #334155;
        --cxc-secondary: #64748b;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #f4f5f7;
        --cxc-border: #dfe2e6;
        --cxc-text: #1a202c;
        --cxc-text-muted: #667080;
        --cxc-selected: #e2e5ea;
        --cxc-hover: #f2f3f5;
        --cxc-success: #16743f;
        --cxc-success-bg: #e2f0e7;
        --cxc-success-ink: #0f5028;
        --cxc-danger: #a3271f;
        --cxc-danger-bg: #f6e3e1;
        --cxc-danger-ink: #7a1c16;
        --cxc-warning: #8a5300;
        --cxc-warning-bg: #f3ecd9;
        --cxc-warning-ink: #5c3800;
        --cxc-info: #3f5b70;
        --cxc-info-bg: #e4ecf1;
        --cxc-info-ink: #2b3f4e;
        --cxc-focus-ring: #aab4c2;
        --cxc-border-w: 1px;
    }

    .cxc-app[data-cxc-theme="contraste"] {
        --cxc-primary: #000000;
        --cxc-primary-hover: #242424;
        --cxc-secondary: #000000;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #ffffff;
        --cxc-border: #000000;
        --cxc-text: #000000;
        --cxc-text-muted: #1f1f1f;
        --cxc-selected: #fff066;
        --cxc-hover: #efefef;
        --cxc-success: #0a5c22;
        --cxc-success-bg: #d8f0dd;
        --cxc-success-ink: #04370f;
        --cxc-danger: #b30000;
        --cxc-danger-bg: #ffe0e0;
        --cxc-danger-ink: #5c0000;
        --cxc-warning: #7a4d00;
        --cxc-warning-bg: #fff0cf;
        --cxc-warning-ink: #4a2e00;
        --cxc-info: #003b6f;
        --cxc-info-bg: #d9e9f7;
        --cxc-info-ink: #00294d;
        --cxc-focus-ring: #000000;
        --cxc-border-w: 2px;
    }

    .cxc-app[data-cxc-theme="claro"] {
        --cxc-primary: #3b6ea5;
        --cxc-primary-hover: #2f5883;
        --cxc-secondary: #6b7280;
        --cxc-surface: #ffffff;
        --cxc-surface-alt: #fafafa;
        --cxc-border: #e5e7eb;
        --cxc-text: #1f2937;
        --cxc-text-muted: #6b7280;
        --cxc-selected: #e5edf5;
        --cxc-hover: #f3f4f6;
        --cxc-success: #2e8555;
        --cxc-success-bg: #e5f2ea;
        --cxc-success-ink: #1e5c3a;
        --cxc-danger: #c23b3b;
        --cxc-danger-bg: #f8e6e6;
        --cxc-danger-ink: #8c2828;
        --cxc-warning: #b8860b;
        --cxc-warning-bg: #f7edd6;
        --cxc-warning-ink: #7a5a06;
        --cxc-info: #3b6ea5;
        --cxc-info-bg: #e5edf5;
        --cxc-info-ink: #28496b;
        --cxc-focus-ring: #a9c2db;
        --cxc-border-w: 1px;
    }

    .cxc-app[data-cxc-theme="oscuro"] {
        --cxc-primary: #3b82f6;
        --cxc-primary-hover: #60a5fa;
        --cxc-secondary: #94a3b8;
        --cxc-surface: #1a2028;
        --cxc-surface-alt: #141920;
        --cxc-border: #2c3542;
        --cxc-text: #e6ebf1;
        --cxc-text-muted: #93a1b0;
        --cxc-selected: #24344a;
        --cxc-hover: #1f2833;
        --cxc-success: #22c55e;
        --cxc-success-bg: #0f2b1c;
        --cxc-success-ink: #7ee3a4;
        --cxc-danger: #f87171;
        --cxc-danger-bg: #341717;
        --cxc-danger-ink: #feacac;
        --cxc-warning: #fbbf24;
        --cxc-warning-bg: #332506;
        --cxc-warning-ink: #fcd980;
        --cxc-info: #38bdf8;
        --cxc-info-bg: #0d2732;
        --cxc-info-ink: #93dcfa;
        --cxc-focus-ring: #3b82f6;
        --cxc-border-w: 1px;
    }

    /* ── controles base (equivalentes Bootstrap, sobre variables --cxc-*) ── */
    .cxc-app .btn {
        font-family: inherit;
        font-size: 12.5px;
        font-weight: 600;
        padding: 7px 13px;
        border-radius: 7px;
        border: 1px solid transparent;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: filter .12s ease;
        white-space: nowrap;
    }

        .cxc-app .btn:disabled {
            opacity: .5;
            cursor: not-allowed;
        }

    .cxc-app .btn-sm {
        padding: 4px 9px;
        font-size: 11.5px;
        border-radius: 6px;
    }

    .cxc-app .btn i {
        font-size: 12px;
    }

    .cxc-app .btn-primary {
        background: var(--cxc-primary);
        color: #fff;
    }

        .cxc-app .btn-primary:hover:not(:disabled) {
            background: var(--cxc-primary-hover);
        }

    .cxc-app .btn-outline-primary {
        background: transparent;
        border-color: var(--cxc-primary);
        color: var(--cxc-primary);
    }

        .cxc-app .btn-outline-primary:hover:not(:disabled) {
            background: var(--cxc-selected);
        }

    .cxc-app .btn-success {
        background: var(--cxc-success);
        color: #fff;
    }

    .cxc-app .btn-outline-success {
        background: transparent;
        border-color: var(--cxc-success);
        color: var(--cxc-success);
    }

        .cxc-app .btn-outline-success:hover:not(:disabled) {
            background: var(--cxc-success-bg);
        }

    .cxc-app .btn-danger {
        background: var(--cxc-danger);
        color: #fff;
    }

    .cxc-app .btn-outline-danger {
        background: transparent;
        border-color: var(--cxc-danger);
        color: var(--cxc-danger);
    }

        .cxc-app .btn-outline-danger:hover:not(:disabled) {
            background: var(--cxc-danger-bg);
        }

    .cxc-app .btn-light {
        background: var(--cxc-surface-alt);
        color: var(--cxc-text);
        border-color: var(--cxc-border);
    }

        .cxc-app .btn-light:hover:not(:disabled) {
            background: var(--cxc-hover);
        }

    .cxc-app .btn:focus-visible {
        outline: 2px solid var(--cxc-focus-ring);
        outline-offset: 2px;
    }

    .cxc-app .form-control, .cxc-app .form-select {
        font-family: inherit;
        font-size: 12.5px;
        padding: 6px 10px;
        border-radius: 7px;
        border: var(--cxc-border-w) solid var(--cxc-border);
        background: var(--cxc-surface);
        color: var(--cxc-text);
        width: 100%;
    }

        .cxc-app .form-control:focus, .cxc-app .form-select:focus {
            outline: 2px solid var(--cxc-focus-ring);
            outline-offset: 1px;
            border-color: var(--cxc-primary);
        }

    .cxc-app .form-label {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--cxc-text-muted);
        display: block;
        margin-bottom: 4px;
    }

    .cxc-app .input-icon {
        position: relative;
    }

        .cxc-app .input-icon i {
            position: absolute;
            left: 9px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 11px;
            color: var(--cxc-text-muted);
        }

        .cxc-app .input-icon input {
            padding-left: 26px;
        }

    .cxc-app .card {
        background: var(--cxc-surface);
        border: 1px solid var(--cxc-border);
        border-radius: 10px;
        overflow: hidden;
    }

    .cxc-app .card-header {
        padding: 10px 14px;
        border-bottom: 1px solid var(--cxc-border);
        font-weight: 700;
        font-size: 13px;
    }

    .cxc-app .card-body {
        padding: 14px;
    }

    .cxc-app .shadow-sm {
        box-shadow: 0 1px 2px rgba(15,23,42,.06);
    }

    .cxc-app .badge-cxc {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 10.5px;
        font-weight: 700;
        padding: 3px 9px;
        border-radius: 999px;
        text-transform: uppercase;
        letter-spacing: .03em;
    }

    .cxc-app .badge-success {
        background: var(--cxc-success-bg);
        color: var(--cxc-success-ink);
    }

    .cxc-app .badge-danger {
        background: var(--cxc-danger-bg);
        color: var(--cxc-danger-ink);
    }

    .cxc-app .badge-warning {
        background: var(--cxc-warning-bg);
        color: var(--cxc-warning-ink);
    }

    .cxc-app .badge-info {
        background: var(--cxc-info-bg);
        color: var(--cxc-info-ink);
    }

    .cxc-app .badge-neutral {
        background: var(--cxc-hover);
        color: var(--cxc-text-muted);
        border: 1px solid var(--cxc-border);
    }

    .cxc-app .num {
        font-variant-numeric: tabular-nums;
    }

/* ── layout de página ── */
.cxc-page-header {
    padding: 16px 16px 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

    .cxc-page-header h2 {
        margin: 0;
        font-size: 19px;
        font-weight: 700;
    }

    .cxc-page-header .sub {
        font-size: 12px;
        color: var(--cxc-text-muted);
    }

.cxc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin: 12px 16px 0;
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-radius: 10px;
}

    .cxc-toolbar .grp {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .cxc-toolbar .divider {
        width: 1px;
        height: 22px;
        background: var(--cxc-border);
        margin: 0 2px;
    }

    .cxc-toolbar select.form-select {
        width: auto;
        min-width: 130px;
    }

.palette-wrap {
    position: relative;
}

.palette-pop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    width: 264px;
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px -8px rgba(15,23,42,.35);
    padding: 12px;
    display: none;
}

    .palette-pop.open {
        display: block;
    }

    .palette-pop .ptitle {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: var(--cxc-text-muted);
        margin: 0 0 8px 4px;
    }

.palette-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.palette-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid var(--cxc-border);
    background: var(--cxc-surface-alt);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--cxc-text);
    text-align: left;
    width: 100%;
}

    .palette-opt:hover {
        background: var(--cxc-hover);
    }

    .palette-opt.active {
        border-color: var(--cxc-primary);
        box-shadow: 0 0 0 1px var(--cxc-primary) inset;
    }

.swatch {
    width: 15px;
    height: 15px;
    border-radius: 5px;
    flex: none;
    border: 1px solid rgba(0,0,0,.12);
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(5,1fr);
    gap: 12px;
    padding: 14px 16px 0;
}

@media (max-width:1000px) {
    .kpi-row {
        grid-template-columns: repeat(3,1fr);
    }
}

@media (max-width:640px) {
    .kpi-row {
        grid-template-columns: repeat(2,1fr);
    }
}

.kpi-card {
    border-radius: 10px;
    padding: 12px 14px;
    color: #fff;
    min-height: 82px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

    .kpi-card .lbl {
        font-size: 10.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        opacity: .92;
    }

    .kpi-card .val {
        font-size: 16.5px;
        font-weight: 700;
    }

    .kpi-card .sub {
        font-size: 10px;
        opacity: .85;
    }

.kpi-primary {
    background: linear-gradient(135deg, var(--cxc-primary), color-mix(in srgb, var(--cxc-primary) 65%, #000));
}

.kpi-success {
    background: linear-gradient(135deg, var(--cxc-success), color-mix(in srgb, var(--cxc-success) 65%, #000));
}

.kpi-danger {
    background: linear-gradient(135deg, var(--cxc-danger), color-mix(in srgb, var(--cxc-danger) 65%, #000));
}

.kpi-warning {
    background: linear-gradient(135deg, var(--cxc-warning), color-mix(in srgb, var(--cxc-warning) 65%, #000));
}

.kpi-info {
    background: linear-gradient(135deg, var(--cxc-info), color-mix(in srgb, var(--cxc-info) 65%, #000));
}

.cxc-tabs {
    padding: 16px 16px 0;
}

.tab-nav {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--cxc-border);
    flex-wrap: wrap;
}

    .tab-nav button {
        font-family: inherit;
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        padding: 9px 14px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--cxc-text-muted);
        cursor: pointer;
        margin-bottom: -1px;
    }

        .tab-nav button.active {
            color: var(--cxc-primary);
            border-color: var(--cxc-primary);
        }

        .tab-nav button:hover:not(.active) {
            color: var(--cxc-text);
        }

.grid-card {
    border: 1px solid var(--cxc-border);
    border-radius: 10px;
    background: var(--cxc-surface);
    overflow: hidden;
}

.grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--cxc-border);
    flex-wrap: wrap;
}

    .grid-toolbar .search-box {
        position: relative;
        width: 220px;
        max-width: 100%;
    }

        .grid-toolbar .search-box input {
            padding-left: 26px;
        }

        .grid-toolbar .search-box i {
            position: absolute;
            left: 9px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 11px;
            color: var(--cxc-text-muted);
        }

.grid-scroll {
    overflow: auto;
    max-height: 360px;
}

table.cxc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11.5px;
    min-width: 760px;
}

    table.cxc-table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: linear-gradient(to bottom, color-mix(in srgb, var(--cxc-primary) 10%, var(--cxc-surface)), color-mix(in srgb, var(--cxc-primary) 6%, var(--cxc-surface)));
        color: var(--cxc-primary);
        text-align: left;
        padding: 8px 10px;
        font-weight: 700;
        border-bottom: 1px solid var(--cxc-border);
        white-space: nowrap;
        cursor: pointer;
        user-select: none;
    }

        table.cxc-table thead th.num-col, table.cxc-table td.num-col {
            text-align: right;
        }

        table.cxc-table thead th.center-col, table.cxc-table td.center-col {
            text-align: center;
        }

    table.cxc-table tbody td {
        padding: 6px 10px;
        border-bottom: 1px solid var(--cxc-border);
        color: var(--cxc-text);
    }

    table.cxc-table tbody tr:nth-child(even) {
        background: color-mix(in srgb, var(--cxc-primary) 3%, var(--cxc-surface));
    }

    table.cxc-table tbody tr.selectable:hover {
        background: var(--cxc-hover);
        cursor: pointer;
    }

    table.cxc-table tbody tr.row-selected {
        background: var(--cxc-selected) !important;
        font-weight: 600;
    }

    table.cxc-table tfoot td {
        padding: 8px 10px;
        font-weight: 700;
        background: var(--cxc-surface-alt);
        border-top: 2px solid var(--cxc-border);
    }

.group-row {
    background: var(--cxc-surface-alt) !important;
    cursor: pointer;
}

    .group-row td {
        padding: 8px 10px;
        font-weight: 700;
    }

    .group-row .g-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .group-row .g-left {
        display: flex;
        align-items: center;
        gap: 8px;
    }

.detail-inner {
    padding: 10px 16px 14px 30px;
    background: var(--cxc-surface-alt);
}

    .detail-inner h6 {
        margin: 0 0 8px;
        font-size: 11.5px;
        font-weight: 700;
    }

table.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-radius: 6px;
    overflow: hidden;
}

    table.mini-table th {
        background: var(--cxc-hover);
        padding: 5px 8px;
        text-align: left;
        font-weight: 700;
        color: var(--cxc-text-muted);
        font-size: 10px;
        text-transform: uppercase;
    }

    table.mini-table td {
        padding: 5px 8px;
        border-top: 1px solid var(--cxc-border);
    }

        table.mini-table td.num-col, table.mini-table th.num-col {
            text-align: right;
        }

.estado-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.row-toggle {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: var(--cxc-text-muted);
}

    .row-toggle i {
        display: inline-block;
        transition: transform .12s ease;
    }

    .row-toggle.open i {
        transform: rotate(90deg);
    }

.chk-cell {
    display: flex;
    justify-content: center;
}

    .chk-cell input {
        width: 14px;
        height: 14px;
        accent-color: var(--cxc-primary);
    }

.btn-amortizar {
    background: var(--cxc-success);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .btn-amortizar:hover {
        filter: brightness(.92);
    }

.chart-card {
    padding: 14px;
}

.chart-title {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 10px;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 150px;
    padding: 0 4px;
    overflow-x: auto;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 44px;
    height: 100%;
    justify-content: flex-end;
}

.bar-set {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 120px;
}

.bar {
    width: 13px;
    border-radius: 3px 3px 0 0;
}

.bar-group .glabel {
    font-size: 9.5px;
    color: var(--cxc-text-muted);
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 10.5px;
    color: var(--cxc-text-muted);
}

    .chart-legend span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

    .chart-legend i.dot {
        width: 9px;
        height: 9px;
        border-radius: 2px;
        display: inline-block;
    }

.empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--cxc-text-muted);
    font-size: 12px;
}

.sidebar-card .list-item {
    background: var(--cxc-surface-alt);
    border: 1px solid var(--cxc-border);
    border-radius: 8px;
    padding: 9px 10px;
    margin-bottom: 8px;
}

.sidebar-card .name {
    font-weight: 700;
    font-size: 12px;
}

.sidebar-card .doi {
    font-size: 10.5px;
    color: var(--cxc-text-muted);
}

/* ── modal de reversión (documento) ── */
.cxc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10,14,20,.5);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 26px 16px;
    overflow: auto;
}

.cxc-modal {
    background: var(--cxc-surface);
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,.5);
    border: 1px solid var(--cxc-border);
}

.cxc-modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--cxc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--cxc-surface-alt);
    border-radius: 12px 12px 0 0;
}

    .cxc-modal-head h3 {
        margin: 0;
        font-size: 14.5px;
        font-weight: 700;
    }

    .cxc-modal-head .close-x {
        background: none;
        border: none;
        color: var(--cxc-text-muted);
        cursor: pointer;
        padding: 4px;
        border-radius: 6px;
        font-size: 16px;
    }

.cxc-modal-body {
    padding: 16px 18px;
    max-height: 70vh;
    overflow: auto;
}

.cxc-modal-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--cxc-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: var(--cxc-surface-alt);
    border-radius: 0 0 12px 12px;
}

.rev-info-grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.rev-field {
    background: var(--cxc-surface-alt);
    border: 1px solid var(--cxc-border);
    border-radius: 8px;
    padding: 8px 10px;
}

    .rev-field .l {
        font-size: 9.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--cxc-text-muted);
    }

    .rev-field .v {
        font-size: 13px;
        font-weight: 600;
        margin-top: 1px;
    }

.sim-result {
    border-radius: 10px;
    border: 1px solid var(--cxc-border);
    padding: 14px;
    background: var(--cxc-success-bg);
}

    .sim-result h4 {
        margin: 0 0 8px;
        font-size: 12.5px;
        color: var(--cxc-success-ink);
    }

    .sim-result ul {
        margin: 8px 0 0;
        padding-left: 18px;
        font-size: 12px;
        line-height: 1.7;
    }

.sim-warn-box {
    display: flex;
    gap: 8px;
    background: var(--cxc-warning-bg);
    border: 1px solid var(--cxc-border);
    color: var(--cxc-warning-ink);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    margin-top: 10px;
}

.err-box {
    display: flex;
    gap: 8px;
    background: var(--cxc-danger-bg);
    border: 1px solid var(--cxc-border);
    color: var(--cxc-danger-ink);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    margin-top: 10px;
}

.spin-ic {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: cxc-spin .7s linear infinite;
}

    .spin-ic.dark {
        border-color: var(--cxc-border);
        border-top-color: var(--cxc-primary);
    }

@keyframes cxc-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .spin-ic {
        animation-duration: 1.6s;
    }
}

/* ── toasts ── */
.toast-wrap {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-cxc {
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-left: 4px solid var(--cxc-success);
    color: var(--cxc-text);
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 8px 24px -8px rgba(0,0,0,.3);
    font-size: 12.5px;
    min-width: 220px;
}

    .toast-cxc.err {
        border-left-color: var(--cxc-danger);
    }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.55);
    z-index: var(--z-bloqueo);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid var(--cxc-border, #e2e8f0);
    border-top-color: var(--cxc-primary,#2563eb);
    border-radius: 50%;
    animation: cxc-spin .8s linear infinite;
}

@media (max-width:700px) {
    .cxc-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

        .cxc-toolbar .grp {
            justify-content: space-between;
        }

    .rev-info-grid {
        grid-template-columns: 1fr;
    }
}
