/* =====================================================================================
   CxcTributos.css — CxC · retenciones/detracciones y saldo a favor (Cloud ERP) · 2026-10-14
   Archivo NUEVO. No redefine ninguna clase existente: todo usa el prefijo .cxt-
   Colores tomados de las variables --cxc-* del tema activo (8 temas de CuentasCobrarClienteMainPage.css).
   Modales: estilo Cobalt Elegante (cabecera degradada cobalto, contenedor 14px, controles 5px, overlay con spinner).
   Capas D-51: var(--z-modal) / var(--z-bloqueo).
   ===================================================================================== */
/* Tokens propios (solo en elementos .cxt-*; no se toca .cxc-app ni ninguna clase existente) */
[class^="cxt-"], [class*=" cxt-"] {
    --cxt-ret: #7c3aed;
    --cxt-det: #0f766e;
    --cxt-fav: #0891b2;
    --cxt-cobalt: #1a4fba;
    --cxt-cobalt-deep: #0f3494;
    --cxt-cobalt-light: #2d6ae0;
    --cxt-cobalt-pale: #e8eef9;
    --cxt-cobalt-subtle: #f0f4fb;
}

/* ── chip RET / DET en la fila del documento ── */
.cxt-chip {
    display: inline-flex;
    align-items: stretch;
    margin-left: 6px;
    border-radius: 5px;
    overflow: hidden;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.6;
    border: 1px solid var(--cxt-c);
    vertical-align: middle;
    white-space: nowrap;
}

    .cxt-chip .k {
        background: var(--cxt-c);
        color: #fff;
        padding: 0 6px;
    }

    .cxt-chip .s {
        background: color-mix(in srgb, var(--cxt-c) 12%, var(--cxc-surface));
        color: color-mix(in srgb, var(--cxt-c) 78%, var(--cxc-text));
        padding: 0 6px;
    }

.cxt-R { --cxt-c: var(--cxt-ret); }
.cxt-D { --cxt-c: var(--cxt-det); }
.cxt-F { --cxt-c: var(--cxt-fav); }
.cxt-N { --cxt-c: #64748b; } /* [2026-10-15] cubierta con cobros */

.cxt-btn-ic {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    color: #fff;
    background: var(--cxt-cobalt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    vertical-align: middle;
    cursor: pointer;
    font-size: 10px;
}

    .cxt-btn-ic:hover { filter: brightness(1.1); }

/* ── botones de acción (texto + icono) ── */
.cxt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    height: 31px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    white-space: nowrap;
}

    .cxt-btn:hover:not(:disabled) { filter: brightness(1.08); }
    .cxt-btn:disabled { opacity: .45; cursor: not-allowed; }

.cxt-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    height: 31px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--cxc-border);
    background: var(--cxc-surface);
    color: var(--cxc-text);
    cursor: pointer;
}

.cxt-btn-icono {
    width: 31px;
    height: 31px;
    border-radius: 6px;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ── KPIs de tributos (fila propia, debajo de .kpi-row) ── */
.cxt-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 16px 0;
}

@media (max-width: 1000px) {
    .cxt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .cxt-kpis { grid-template-columns: 1fr; }
}

.cxt-kpi {
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-left: 4px solid var(--cxt-c);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

    .cxt-kpi .lbl {
        font-size: 10.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--cxc-text-muted);
    }

    .cxt-kpi .val {
        font-size: 15.5px;
        font-weight: 700;
        color: var(--cxc-text);
        font-variant-numeric: tabular-nums;
    }

    .cxt-kpi .sub {
        font-size: 10.5px;
        color: var(--cxc-text-muted);
    }

/* ── banda tributaria dentro del detalle del documento ── */
.cxt-banda {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-left: 4px solid var(--cxt-c);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 0 0 10px;
}

    .cxt-banda .ttl { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
    .cxt-banda .ttl .t { font-weight: 700; font-size: 12.5px; color: color-mix(in srgb, var(--cxt-c) 85%, var(--cxc-text)); }
    .cxt-banda .ttl .d { font-size: 10.5px; color: var(--cxc-text-muted); }

.cxt-metricas {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}

    .cxt-metricas .l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cxc-text-muted); }
    .cxt-metricas .v { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cxc-text); }
    .cxt-metricas .e { font-size: 10.5px; color: var(--cxc-text-muted); }
    .cxt-metricas .ok { color: var(--cxc-success-ink); }
    .cxt-metricas .warn { color: var(--cxc-warning-ink); }

.cxt-prog {
    grid-column: 1 / -1;
    height: 6px;
    border-radius: 999px;
    background: var(--cxc-hover);
    overflow: hidden;
}

    .cxt-prog i { display: block; height: 100%; border-radius: 999px; background: var(--cxt-c); }

.cxt-banda .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 900px) {
    .cxt-banda { grid-template-columns: 1fr; }
    .cxt-banda .acts { justify-content: flex-start; }
    .cxt-metricas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── historial ── */
.cxt-hist-t { font-size: 11.5px; font-weight: 700; margin: 10px 0 6px; color: var(--cxc-text); }
.cxt-hist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.cxt-hrow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    background: var(--cxc-surface);
    border: 1px solid var(--cxc-border);
    border-radius: 8px;
    padding: 7px 10px;
}

    .cxt-hrow.x { opacity: .65; }
    .cxt-hrow .ic { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 800; color: #fff; background: var(--cxt-c); }
    .cxt-hrow.x .ic { background: var(--cxc-text-muted); }
    .cxt-hrow .a { font-weight: 700; font-size: 12px; color: var(--cxc-text); }
    .cxt-hrow .b { font-size: 11px; color: var(--cxc-text-muted); }
    .cxt-hrow .r { font-size: 11px; color: var(--cxc-danger-ink); }
    .cxt-hrow .f { font-size: 11px; color: color-mix(in srgb, var(--cxt-fav) 80%, var(--cxc-text)); }
    .cxt-hrow .tachado { text-decoration: line-through; }
    .cxt-hrow .lineas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
    .cxt-hrow .lineas span { font-size: 10.5px; background: var(--cxc-hover); border: 1px solid var(--cxc-border); border-radius: 4px; padding: 0 6px; font-variant-numeric: tabular-nums; }
    .cxt-hrow .acts { display: flex; align-items: center; gap: 6px; }

.cxt-pill { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .03em; }
.cxt-pill.ok { background: var(--cxc-success-bg); color: var(--cxc-success-ink); }
.cxt-pill.neu { background: var(--cxc-hover); color: var(--cxc-text-muted); border: 1px solid var(--cxc-border); }
.cxt-pill.inf { background: var(--cxc-info-bg); color: var(--cxc-info-ink); }

/* ── celda Ret./Det. en las cuotas ── */
.cxt-cuota { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.cxt-cuota .m { font-size: 9.5px; font-weight: 800; border-radius: 4px; padding: 0 4px; color: #fff; background: var(--cxt-c); }

/* ── modales Cobalt Elegante ── */
.cxt-back {
    position: fixed;
    inset: 0;
    background: rgba(9,20,52,.55);
    backdrop-filter: blur(3px);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 26px 16px;
    overflow: auto;
    outline: none;
}

.cxt-modal {
    position: relative;
    width: 100%;
    max-width: 860px;
    background: var(--cxc-surface);
    color: var(--cxc-text);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15,52,148,.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: cxt-in .28s cubic-bezier(.2,.8,.2,1);
}

    .cxt-modal.sm { max-width: 560px; }

@keyframes cxt-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.cxt-head {
    background: linear-gradient(135deg, var(--cxt-cobalt-deep), var(--cxt-cobalt) 55%, var(--cxt-cobalt-light));
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

    .cxt-head h3 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
    .cxt-head .s { font-size: 12px; opacity: .85; margin-top: 2px; }

.cxt-x {
    background: rgba(255,255,255,.16);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
}

.cxt-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }

.cxt-sec { border: 1px solid var(--cxc-border); border-radius: 10px; overflow: hidden; }

    .cxt-sec > h4 {
        margin: 0;
        font-size: 11.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: color-mix(in srgb, var(--cxt-cobalt) 80%, var(--cxc-text));
        background: color-mix(in srgb, var(--cxt-cobalt) 7%, var(--cxc-surface));
        padding: 8px 12px;
        border-bottom: 1px solid var(--cxc-border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .cxt-sec .in { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.cxt-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
    .cxt-kv .l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--cxc-text-muted); }
    .cxt-kv .v { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
    .cxt-kv .e { font-size: 11px; color: var(--cxc-text-muted); }

.cxt-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cxt-fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
    .cxt-fld.w2 { grid-column: span 2; }
    .cxt-fld.w4 { grid-column: 1 / -1; }
    .cxt-fld label { font-size: 11px; font-weight: 600; color: var(--cxc-text-muted); }
    .cxt-fld input, .cxt-fld select, .cxt-fld textarea {
        border: 1px solid var(--cxc-border);
        border-radius: 5px;
        padding: 6px 8px;
        font-size: 13px;
        background: var(--cxc-surface);
        color: var(--cxc-text);
        font-family: inherit;
        width: 100%;
    }
    .cxt-fld input:disabled { background: var(--cxc-hover); color: var(--cxc-text-muted); }
    .cxt-fld textarea { resize: vertical; min-height: 50px; }
    .cxt-fld .num { text-align: right; font-variant-numeric: tabular-nums; }
    .cxt-fld .h { font-size: 10.5px; color: var(--cxc-text-muted); }

@media (max-width: 760px) {
    .cxt-kv, .cxt-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cxt-modos { display: inline-flex; border: 1px solid var(--cxc-border); border-radius: 6px; overflow: hidden; background: var(--cxc-surface); }
    .cxt-modos button { border: none; background: transparent; color: var(--cxc-text); font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer; text-transform: none; letter-spacing: 0; }
    .cxt-modos button.on { background: var(--cxt-cobalt); color: #fff; }

.cxt-scroll { overflow-x: auto; }
table.cxt-dist { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 560px; }
    table.cxt-dist th { font-size: 10px; text-transform: uppercase; color: var(--cxc-text-muted); text-align: left; padding: 6px 8px; background: var(--cxc-hover); }
    table.cxt-dist td { padding: 6px 8px; border-top: 1px solid var(--cxc-border); }
    table.cxt-dist .n { text-align: right; font-variant-numeric: tabular-nums; }
    table.cxt-dist tr.hit td { background: color-mix(in srgb, var(--cxt-cobalt) 6%, var(--cxc-surface)); }
    table.cxt-dist tfoot td { font-weight: 700; background: var(--cxc-hover); }
    table.cxt-dist input { width: 110px; border: 1px solid var(--cxc-border); border-radius: 5px; padding: 4px 6px; text-align: right; font-variant-numeric: tabular-nums; background: var(--cxc-surface); color: var(--cxc-text); }
    table.cxt-dist input:disabled { background: var(--cxc-hover); color: var(--cxc-text-muted); }

.cxt-barra { display: inline-block; width: 80px; height: 5px; border-radius: 999px; background: var(--cxc-hover); overflow: hidden; vertical-align: middle; }
    .cxt-barra i { display: block; height: 100%; background: var(--cxt-cobalt-light); }

.cxt-msg { font-size: 12px; border-radius: 6px; padding: 7px 10px; }
    .cxt-msg.err { background: var(--cxc-danger-bg); color: var(--cxc-danger-ink); }
    .cxt-msg.ok { background: var(--cxc-success-bg); color: var(--cxc-success-ink); }
    .cxt-msg.inf { background: var(--cxc-info-bg); color: var(--cxc-info-ink); }
    .cxt-msg.warn { background: var(--cxc-warning-bg); color: var(--cxc-warning-ink); }

.cxt-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-top: 1px solid var(--cxc-border);
    background: color-mix(in srgb, var(--cxt-cobalt) 5%, var(--cxc-surface));
}

    .cxt-foot .tot { font-size: 12px; color: var(--cxc-text-muted); }
    .cxt-foot .tot b { color: var(--cxc-text); font-size: 14px; font-variant-numeric: tabular-nums; }
    .cxt-foot .bs { display: flex; gap: 8px; }

.cxt-bloqueo {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--cxc-surface) 78%, transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    color: color-mix(in srgb, var(--cxt-cobalt) 85%, var(--cxc-text));
}

.cxt-spin {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 4px solid var(--cxt-cobalt-pale);
    border-top-color: var(--cxt-cobalt);
    animation: cxt-spin .8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .cxt-modal { animation: none; }
    .cxt-spin { animation-duration: 3s; }
}

/* [2026-10-15] Historial global de retenciones/detracciones */
.cxt-modal.xl { max-width: 1320px; }
.cxt-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--cxc-text); padding-top: 6px; }
    .cxt-chk input { width: auto; }
table.cxt-hg { min-width: 1150px; }
    table.cxt-hg td { vertical-align: top; }
    table.cxt-hg .sub { font-size: 10.5px; color: var(--cxc-text-muted); }
    table.cxt-hg tr.rev td { opacity: .62; }
    table.cxt-hg td.vacio { text-align: center; color: var(--cxc-text-muted); padding: 18px; }
    table.cxt-hg .cxt-chip { margin-left: 0; }
.cxt-hg-cuotas { display: flex; flex-wrap: wrap; gap: 4px; }
    .cxt-hg-cuotas span { font-size: 10.5px; background: var(--cxc-hover); border: 1px solid var(--cxc-border); border-radius: 4px; padding: 0 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
