/* ═══════════════════════════════════════════════
   Compras — Facturación y Pagos
   Design system migration: --pv-* tokens + glassmorphism
   Owner: Agent 4
   ═══════════════════════════════════════════════ */

/* ── Header ──────────────────────────────────── */
.cp-fact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.cp-fact-header h2 {
    margin: 0;
    font-family: var(--pv-font-ui);
    font-size: var(--pv-text-lg);
    font-weight: 700;
    color: var(--pv-text-primary);
}

.cp-fact-controls {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Filter Group (label + select combo) ─────── */
.cp-filter-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cp-filter-group label {
    font-family: var(--pv-font-ui);
    font-size: var(--pv-text-xs);
    font-weight: 700;
    color: var(--pv-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.cp-filter-group select {
    padding: 0.35rem 0.6rem;
    font-family: var(--pv-font-ui);
    font-size: var(--pv-text-sm);
    background: var(--pv-bg-base);
    border: 1px solid var(--pv-card-border);
    border-radius: var(--pv-input-radius);
    color: var(--pv-text-primary);
    outline: none;
    transition: border-color var(--pv-duration-fast) ease,
        box-shadow var(--pv-duration-fast) ease;
    min-width: 120px;
}

.cp-filter-group select:focus {
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.08);
}

.cp-filter-group select option {
    background: var(--pv-card-surface-solid);
    color: var(--pv-text-primary);
}

/* ── Count Badge ─────────────────────────────── */
.cp-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-family: var(--pv-font-ui);
    font-size: var(--pv-text-xs);
    font-weight: 600;
    color: var(--pv-text-secondary);
    background: var(--pv-glass-surface);
    border: 1px solid var(--pv-glass-border);
    white-space: nowrap;
}

/* ── Table ────────────────────────────────────── */
.cp-fact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.cp-fact-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--pv-card-surface-solid);
    font-family: var(--pv-font-ui);
    font-size: var(--pv-text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pv-text-secondary);
    padding: 0.75rem 0.6rem;
    border-bottom: 2px solid var(--pv-card-border);
    text-align: left;
}

.cp-fact-table tbody td {
    vertical-align: middle;
    font-family: var(--pv-font-ui);
    font-size: var(--pv-text-base);
    padding: 0.7rem 0.6rem;
    color: var(--pv-text-primary);
    border-bottom: 1px solid rgba(56, 73, 107, 0.15);
    transition: background var(--pv-duration-fast) ease,
        color var(--pv-duration-fast) ease;
}

.cp-fact-table tbody tr {
    transition: background var(--pv-duration-fast) ease;
}

.cp-fact-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

/* ── Money Colors ────────────────────────────── */
.cp-text-mxn {
    color: #90cdf4;
    font-weight: 700;
    text-align: right;
    font-feature-settings: 'tnum' 1;
}

.cp-text-usd {
    color: var(--pv-green-text);
    font-weight: 700;
    text-align: right;
    font-feature-settings: 'tnum' 1;
}

/* ── Counter text "(X de Y)" ─────────────────── */
.cp-text-counter {
    color: var(--pv-text-muted);
    font-size: var(--pv-text-xs);
}

/* ── Legacy compat: keep #compras-facturacion-table selectors ── */
#compras-facturacion-table td {
    vertical-align: middle;
    font-size: 0.73rem;
    padding: 5px 8px;
    color: #cbd5e1;
}

#compras-facturacion-table tr {
    transition: all var(--pv-duration-fast) ease;
    border-bottom: 1px solid rgba(56, 73, 107, 0.15);
}

#compras-facturacion-table tr:hover td {
    background: rgba(99, 102, 241, 0.07);
    color: #fff;
}

#compras-facturacion-table th,
#compras-facturacion-table td {
    white-space: nowrap;
}

#compras-facturacion-table {
    table-layout: fixed;
    font-size: 0.75rem;
}

#compras-facturacion-table .ho-th {
    padding: 7px 8px;
    font-size: 0.62rem;
}

#compras-facturacion-table .ho-td {
    padding: 5px 8px;
    font-size: 0.73rem;
}

#compras-facturacion-table .fp-contenido-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#compras-facturacion-table th[data-fp-col-filter="emision"] {
    display: none;
}

.fp-provider-cell {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-provider-text {
    color: #a5b4fc;
    font-weight: 600;
    font-size: 0.72rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#compras-facturacion-table .fp-contenido-text {
    display: block;
    color: #94a3b8;
    font-size: 0.73rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fp-date-link {
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease;
}

.fp-date-link:hover {
    color: #c7d2fe;
}

.fp-date-empty {
    color: #64748b;
    font-size: 0.72rem;
}

.fp-date-muted {
    color: #64748b;
    font-size: 0.74rem;
}

.fp-payment-date {
    color: #64748b;
    font-size: 0.68rem;
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
}

#compras-facturacion-table .fp-factura-cell {
    padding: 5px 8px !important;
}

#compras-facturacion-table .fp-factura-card {
    gap: 2px;
    line-height: 1.25;
}

#compras-facturacion-table .fp-factura-row {
    gap: 5px;
}

.fp-disconnect-banner {
    margin: 0 0 10px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 9px;
    background: rgba(245, 158, 11, 0.08);
    color: var(--pv-amber-text, #fbbf24);
    line-height: 1.4;
}
.fp-disconnect-banner[hidden] { display: none; }
.fp-disconnect-banner > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
}
.fp-disconnect-banner > summary::-webkit-details-marker { display: none; }
.fp-disconnect-banner__icon {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-weight: 800;
}
.fp-disconnect-banner__message {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
}
.fp-disconnect-banner__message > span { font-size: 0.74rem; color: #cbd5e1; }
.fp-disconnect-banner__review {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.fp-disconnect-banner__list {
    max-height: 280px;
    overflow-y: auto;
    padding: 0 16px;
}
.fp-disconnect-banner__order {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 10px 0;
    border-top: 1px solid rgba(245, 158, 11, 0.18);
    font-size: 0.76rem;
}
.fp-disconnect-banner__order > div { display: flex; gap: 10px; flex: 1 1 260px; }
.fp-disconnect-banner__order > span { color: #cbd5e1; }
.fp-disconnect-banner__status { padding: 0 16px 12px; font-size: 0.76rem; }
.fp-disconnect-banner button {
    padding: 5px 10px;
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 5px;
    background: rgba(245, 158, 11, 0.08);
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.fp-disconnect-banner button:disabled { opacity: 0.5; cursor: wait; }
.fp-disconnect-banner button:hover { background: rgba(245, 158, 11, 0.18); }
.fp-disconnect-banner > summary:focus-visible,
.fp-disconnect-banner button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 5px;
}
@media (max-width: 640px) {
    .fp-disconnect-banner > summary { flex-wrap: wrap; gap: 8px; }
    .fp-disconnect-banner__message { flex: 1 1 220px; }
    .fp-disconnect-banner__order > div { flex-wrap: wrap; gap: 4px 10px; }
}

#compras-facturacion-table .fp-add-btn {
    padding: 3px 10px;
    min-width: 78px;
    font-size: 0.7rem;
}

#compras-facturacion-table .fp-add-btn--sm {
    min-width: 28px;
    padding: 2px 8px;
}

#compras-facturacion-table .ho-status {
    padding: 3px 9px;
    font-size: 0.66rem;
}

.fp-summary-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
}

.fp-search-wrap {
    flex: 1 1 260px;
    min-width: 220px;
    max-width: 420px;
}

.fp-search-input {
    width: 100%;
    height: 30px;
}

.fp-summary-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fp-bulk-btn {
    display: inline-flex;
    align-items: center;
    height: 30px;
    border-color: rgba(129, 140, 248, 0.28);
}

.fp-bulk-btn--payment {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.26);
    background: rgba(34, 197, 94, 0.08);
}

.fp-bulk-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#fp-summary-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(129, 140, 248, 0.2);
    color: #c7d2fe;
    font-size: 0.66rem;
}

.fp-select-head,
.fp-id-wrap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.fp-id-wrap {
    width: 100%;
}

.fp-id-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

#compras-facturacion-table .fp-id-wrap .ho-conn-dot {
    flex: 0 0 8px;
    margin-left: 1px;
}

.fp-row-check,
.fp-select-all-check {
    width: 13px;
    height: 13px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #818cf8;
    cursor: pointer;
}

.fp-bulk-modal {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.fp-bulk-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 76px;
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.65);
}

.fp-bulk-targets span {
    color: #c7d2fe;
    font-size: 0.74rem;
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 999px;
    padding: 3px 8px;
}

.fp-bulk-label {
    color: #94a3b8;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.fp-bulk-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 14px;
    border: 2px dashed #30363d;
    border-radius: 8px;
    background: #0d1117;
    color: #818cf8;
    cursor: pointer;
    font-size: 0.86rem;
}

.fp-bulk-file-label--selected {
    color: #4ade80;
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.06);
}

.fp-bulk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.fp-bulk-input {
    width: 100% !important;
    margin: 4px 0 0 0 !important;
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    color: #e2e8f0 !important;
    font-size: 0.9rem !important;
}

.fp-bulk-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.78rem;
}

.fp-bulk-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #cbd5e1;
    font-size: 0.9rem;
}

#fp-upload-progress-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    max-width: calc(100vw - 36px);
}

.fp-upload-progress {
    width: min(420px, calc(100vw - 64px));
    box-sizing: border-box;
    flex-shrink: 0;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35);
    color: #e2e8f0;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.fp-upload-progress__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    overflow-wrap: anywhere;
}

.fp-upload-progress__body strong {
    font-size: 0.82rem;
    line-height: 1.2;
}

.fp-upload-progress__body span {
    color: #94a3b8;
    font-size: 0.73rem;
    line-height: 1.25;
    white-space: pre-line;
}

.fp-upload-progress__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.fp-upload-progress__action {
    border: 1px solid #64748b;
    border-radius: 6px;
    padding: 8px 10px;
    color: #e2e8f0;
    background: #1e293b;
    font-size: 0.76rem;
    cursor: pointer;
}

.fp-upload-progress__action:hover,
.fp-upload-progress__action:focus-visible {
    background: #334155;
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.fp-upload-progress__action:disabled {
    opacity: 0.5;
    cursor: wait;
}

.fp-upload-progress--pending {
    border-color: #fbbf24;
}

.fp-upload-progress--pending .fp-upload-progress__icon {
    color: #fbbf24;
    background: #422006;
}

.fp-upload-progress__notice {
    color: #fcd34d;
    border-left: 2px solid #fbbf24;
    padding-left: 8px;
    font-size: 0.75rem;
    margin: 8px 0 0;
}

.fp-upload-progress__spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    border: 2px solid rgba(96, 165, 250, 0.25);
    border-top-color: #60a5fa;
    animation: fp-upload-spin 0.8s linear infinite;
}

.fp-upload-progress__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 0.62rem;
    font-weight: 800;
}

.fp-upload-progress--success {
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(20, 83, 45, 0.96);
}

.fp-upload-progress--success .fp-upload-progress__icon {
    color: #052e16;
    background: #86efac;
}

.fp-upload-progress--error {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(69, 10, 10, 0.96);
}

.fp-upload-progress--error .fp-upload-progress__icon {
    color: #450a0a;
    background: #fca5a5;
}

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

.fp-invoice-suggest {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid rgba(129, 140, 248, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
}

.fp-invoice-suggest__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.fp-invoice-suggest__title {
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 800;
}

.fp-invoice-suggest__subtitle {
    color: #64748b;
    font-size: 0.7rem;
    margin-top: 1px;
}

.fp-invoice-suggest__card {
    border: 1px solid rgba(51, 65, 85, 0.9);
    border-radius: 7px;
    padding: 8px;
    background: rgba(2, 6, 23, 0.45);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.fp-invoice-suggest__card:hover,
.fp-invoice-suggest__card:focus-visible {
    border-color: rgba(129, 140, 248, 0.62);
    background: rgba(15, 23, 42, 0.85);
    outline: none;
}

.fp-invoice-suggest__card--applied {
    border-color: rgba(34, 197, 94, 0.72);
    background: rgba(22, 101, 52, 0.16);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.18) inset;
}

.fp-invoice-suggest__card + .fp-invoice-suggest__card {
    margin-top: 7px;
}

.fp-invoice-suggest__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.fp-invoice-suggest__label {
    color: #94a3b8;
    font-size: 0.68rem;
    text-transform: uppercase;
    font-weight: 800;
}

.fp-invoice-suggest__confidence {
    color: #c7d2fe;
    font-size: 0.68rem;
    font-weight: 800;
}

.fp-invoice-suggest__card--applied .fp-invoice-suggest__label,
.fp-invoice-suggest__card--applied .fp-invoice-suggest__confidence {
    color: #86efac;
}

.fp-invoice-suggest__value {
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.86rem;
    font-weight: 800;
    margin-top: 3px;
}

.fp-invoice-suggest__reason,
.fp-invoice-suggest__message {
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1.35;
    margin-top: 5px;
}

.fp-invoice-suggest__message--error {
    color: #fca5a5;
}

.fp-invoice-suggest__quote {
    color: #cbd5e1;
    font-size: 0.7rem;
    line-height: 1.35;
    margin-top: 6px;
    padding: 6px 8px;
    border-left: 2px solid rgba(129, 140, 248, 0.55);
    background: rgba(129, 140, 248, 0.07);
    border-radius: 4px;
}

.fp-payment-suggest {
    margin-top: 4px;
}

.fp-payment-suggest__card {
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    border: 1px solid rgba(129, 140, 248, 0.24);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.64);
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
}

.fp-payment-suggest__card--static {
    cursor: default;
}

.fp-payment-suggest__card:hover:not(.fp-payment-suggest__card--static),
.fp-payment-suggest__card--applied {
    border-color: rgba(74, 222, 128, 0.72);
    background: rgba(20, 83, 45, 0.34);
}

.fp-payment-suggest__card span {
    color: #93c5fd;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.fp-payment-suggest__card strong {
    color: #f8fafc;
    font-size: 0.88rem;
}

.fp-payment-suggest__card small {
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1.25;
}

.fp-invoice-validation {
    margin-top: 8px;
    padding: 9px;
    border-radius: 7px;
    border: 1px solid rgba(34, 197, 94, 0.28);
    background: rgba(6, 78, 59, 0.12);
}

.fp-invoice-validation--warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(120, 53, 15, 0.18);
}

.fp-invoice-validation--info {
    border-color: rgba(96, 165, 250, 0.38);
    background: rgba(30, 64, 175, 0.14);
}

.fp-invoice-validation__title {
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 850;
}

.fp-invoice-validation__subtitle {
    color: #cbd5e1;
    font-size: 0.7rem;
    line-height: 1.35;
    margin-top: 2px;
}

.fp-invoice-validation__row {
    display: grid;
    grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.4fr);
    gap: 8px;
    align-items: start;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.fp-invoice-validation__row span {
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 750;
}

.fp-invoice-validation__row strong {
    color: #fde68a;
    font-size: 0.7rem;
    line-height: 1.35;
}

.fp-invoice-validation__row--unit strong {
    color: #bfdbfe;
}

.fp-invoice-validation__row--match {
    border-top-color: rgba(34, 197, 94, 0.24);
}

.fp-invoice-validation__row--match span,
.fp-invoice-validation__row--match strong {
    color: #bbf7d0;
}

.fp-invoice-validation__row--diff strong {
    color: #fde68a;
}

.fp-invoice-quantity-shortage,
.fp-invoice-shortage-dialog__line,
.fp-invoice-payment-equation {
    margin-top: 8px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.4fr);
    gap: 10px;
    border: 1px solid var(--pv-amber-border, rgba(245, 158, 11, 0.42));
    border-radius: var(--pv-radius-md, 8px);
    background: var(--pv-amber-soft, rgba(120, 53, 15, 0.16));
    text-align: left;
}

.fp-invoice-quantity-shortage div,
.fp-invoice-shortage-dialog__line,
.fp-invoice-payment-equation {
    min-width: 0;
}

.fp-invoice-quantity-shortage span,
.fp-invoice-shortage-dialog span,
.fp-invoice-payment-equation span {
    display: block;
    color: var(--pv-amber-text, #fcd34d);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.fp-invoice-quantity-shortage strong,
.fp-invoice-shortage-dialog strong,
.fp-invoice-payment-equation strong {
    display: block;
    color: var(--pv-text-primary, #f8fafc);
    font-size: 0.78rem;
    line-height: 1.35;
}

.fp-invoice-quantity-shortage small,
.fp-invoice-shortage-dialog small,
.fp-invoice-payment-equation small {
    display: block;
    margin-top: 3px;
    color: var(--pv-text-muted, #94a3b8);
    font-size: 0.7rem;
    line-height: 1.35;
}

.fp-invoice-shortage-dialog {
    display: grid;
    gap: 10px;
}

.fp-invoice-shortage-dialog__line,
.fp-invoice-payment-equation {
    grid-template-columns: 1fr;
    margin-top: 0;
}

.fp-invoice-payment-equation {
    border-color: var(--pv-green-border, rgba(74, 222, 128, 0.35));
    background: var(--pv-green-soft, rgba(20, 83, 45, 0.22));
}

.fp-invoice-shortage-dialog__warning {
    padding: 10px 12px;
    border-radius: var(--pv-radius-md, 8px);
    color: var(--pv-amber-text, #fde68a);
    background: rgba(120, 53, 15, 0.2);
    font-size: 0.76rem;
    line-height: 1.45;
    text-align: left;
}

.fp-invoice-validation__section-title {
    color: #93c5fd;
    font-size: 0.68rem;
    font-weight: 850;
    margin-top: 9px;
    text-transform: uppercase;
}

.fp-invoice-detail {
    margin-top: 10px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
}

.fp-invoice-detail summary {
    padding: 9px 10px;
    color: #bfdbfe;
    font-size: 0.73rem;
    font-weight: 800;
    cursor: pointer;
}

.fp-invoice-detail__body {
    padding: 0 10px 10px;
    display: grid;
    gap: 8px;
}

.fp-invoice-detail__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.9fr);
    gap: 10px;
    padding: 9px;
    border-radius: 7px;
    border: 1px solid rgba(51, 65, 85, 0.9);
    background: rgba(2, 6, 23, 0.42);
}

.fp-invoice-detail__row div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fp-invoice-detail__row span {
    color: #93c5fd;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.fp-invoice-detail__row strong {
    color: #e2e8f0;
    font-size: 0.74rem;
    line-height: 1.25;
}

.fp-invoice-detail__row small {
    color: #94a3b8;
    font-size: 0.68rem;
    line-height: 1.25;
}

.fp-invoice-detail__row--ok {
    border-color: rgba(74, 222, 128, 0.28);
}

.fp-invoice-detail__row--ok span {
    color: #86efac;
}

.fp-invoice-detail__row--diff {
    border-color: rgba(245, 158, 11, 0.35);
}

.fp-invoice-detail__row--diff span {
    color: #facc15;
}

.fp-invoice-detail__row--pending {
    border-color: rgba(245, 158, 11, 0.42);
    background: rgba(120, 53, 15, 0.12);
}

.fp-invoice-detail__row--pending span {
    color: #fbbf24;
}

.fp-invoice-detail__row--omitido {
    border-color: rgba(148, 163, 184, 0.25);
}

@media (max-width: 720px) {
    .fp-invoice-detail__row,
    .fp-invoice-quantity-shortage {
        grid-template-columns: 1fr;
    }
}

.fp-invoice-validation__unmatched {
    margin-top: 7px;
    padding: 7px 8px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.42);
}

.fp-invoice-validation__unmatched span,
.fp-invoice-validation__unmatched strong,
.fp-invoice-validation__unmatched small {
    display: block;
}

.fp-invoice-validation__unmatched span {
    color: #93c5fd;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 800;
}

.fp-invoice-validation__unmatched strong {
    color: #e2e8f0;
    font-size: 0.72rem;
    margin-top: 2px;
}

.fp-invoice-validation__unmatched small {
    color: #94a3b8;
    font-size: 0.68rem;
    line-height: 1.35;
    margin-top: 3px;
}

.fp-invoice-validation__link-btn {
    width: 100%;
    margin-top: 9px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(37, 99, 235, 0.16);
    color: #bfdbfe;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.fp-invoice-validation__link-btn:hover {
    background: rgba(37, 99, 235, 0.24);
    border-color: rgba(147, 197, 253, 0.55);
}

.fp-invoice-validation__link-btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

.fp-invoice-total-only {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.08);
    color: #cbd5e1;
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: left;
}

.fp-invoice-total-only summary {
    cursor: pointer;
    color: #93c5fd;
    font-weight: 700;
}

.fp-invoice-total-only p {
    margin: 8px 0;
}

.fp-invoice-total-only .fp-invoice-validation__link-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.fp-concept-linker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.fp-concept-linker--inline {
    margin-top: 7px;
}

.fp-concept-link-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.1fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.48);
}

.fp-concept-link-row--inline {
    grid-template-columns: minmax(220px, 0.95fr) minmax(280px, 1.25fr);
    align-items: end;
}

.fp-concept-link-row__concept strong,
.fp-concept-link-row__concept span,
.fp-concept-link-row__concept small,
.fp-concept-link-row__target small {
    display: block;
}

.fp-concept-link-row__concept strong {
    color: #93c5fd;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
}

.fp-concept-link-row__concept span {
    color: #e2e8f0;
    font-size: 0.78rem;
    margin-top: 3px;
}

.fp-concept-link-row__concept small {
    color: #94a3b8;
    font-size: 0.68rem;
    margin-top: 3px;
}

.fp-concept-link-row__target .fp-concept-link-row__evidence {
    color: #fbbf24;
    font-weight: 700;
}

.fp-concept-link-row__target small {
    color: #bfdbfe;
    font-size: 0.68rem;
    font-weight: 750;
    margin-bottom: 4px;
}

.fp-concept-link-row__select {
    width: 100%;
    height: 36px;
    min-height: 36px;
    border-radius: 7px;
    border: 1px solid rgba(71, 85, 105, 0.9);
    background: #0d1117;
    color: #e2e8f0;
    padding: 5px 34px 5px 10px;
    font-size: 0.76rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swal-dark-popup .fp-concept-link-row__select {
    font-size: 0.76rem !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 5px 34px 5px 10px !important;
}

.fp-concept-link-row__select option {
    font-size: 0.8rem;
}

.fp-invoice-reconcile {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--pv-amber, #f59e0b) 38%, transparent);
    border-radius: var(--pv-input-radius, 10px);
    background: color-mix(in srgb, var(--pv-amber, #f59e0b) 7%, var(--pv-card-surface-solid, #121828));
    color: var(--pv-text-primary, #e2e8f0);
    text-align: left;
}

.fp-invoice-reconcile--pending {
    color: var(--pv-text-secondary, #94a3b8);
    font-size: 0.76rem;
}

.fp-invoice-reconcile--ready {
    border-color: color-mix(in srgb, var(--pv-green, #22c55e) 42%, transparent);
    background: color-mix(in srgb, var(--pv-green, #22c55e) 6%, var(--pv-card-surface-solid, #121828));
}

.fp-invoice-reconcile__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.fp-invoice-reconcile__header strong {
    color: var(--pv-text-primary, #e2e8f0);
    font-size: 0.82rem;
}

.fp-invoice-reconcile__header span {
    color: var(--pv-text-secondary, #94a3b8);
    font-size: 0.7rem;
}

.fp-invoice-reconcile__row {
    min-width: 0;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--pv-card-border, rgba(71, 85, 105, 0.58));
    border-radius: var(--pv-input-radius, 10px);
    background: color-mix(in srgb, var(--pv-card-surface-solid, #121828) 88%, transparent);
}

.fp-invoice-reconcile__row legend {
    max-width: 100%;
    padding: 0 6px;
    color: var(--pv-amber-text, #fbbf24);
    font-size: 0.7rem;
    font-weight: 800;
}

.fp-invoice-reconcile__row--blocked {
    border-color: color-mix(in srgb, var(--pv-red, #ef4444) 38%, transparent);
}

.fp-invoice-reconcile__quantity,
.fp-invoice-reconcile__price,
.fp-invoice-reconcile__payment {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.fp-invoice-reconcile__price {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fp-invoice-reconcile__quantity span,
.fp-invoice-reconcile__price span,
.fp-invoice-reconcile__payment span,
.fp-invoice-reconcile__payment strong {
    display: block;
    padding: 7px 8px;
    border-radius: 7px;
    background: color-mix(in srgb, var(--pv-card-surface, rgba(18, 24, 40, 0.75)) 88%, transparent);
    color: var(--pv-text-secondary, #94a3b8);
    font-size: 0.68rem;
}

.fp-invoice-reconcile__quantity strong,
.fp-invoice-reconcile__price strong,
.fp-invoice-reconcile__payment strong {
    color: var(--pv-text-primary, #e2e8f0);
}

.fp-invoice-reconcile__fixed-note {
    display: block;
    margin-top: 6px;
    color: var(--pv-text-muted, #64748b);
    font-size: 0.65rem;
}

.fp-invoice-reconcile__choices {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.fp-invoice-reconcile__choice,
.fp-invoice-reconcile__confirm {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 9px;
    border: 1px solid var(--pv-card-border, rgba(71, 85, 105, 0.58));
    border-radius: 8px;
    background: color-mix(in srgb, var(--pv-card-surface, rgba(18, 24, 40, 0.75)) 82%, transparent);
    color: var(--pv-text-primary, #e2e8f0);
    font-size: 0.7rem;
    line-height: 1.35;
    cursor: pointer;
}

.fp-invoice-reconcile__choice:has(input:checked),
.fp-invoice-reconcile__confirm:has(input:checked) {
    border-color: color-mix(in srgb, var(--pv-green, #22c55e) 48%, transparent);
    background: color-mix(in srgb, var(--pv-green, #22c55e) 9%, var(--pv-card-surface-solid, #121828));
}

.fp-invoice-reconcile__choice input,
.fp-invoice-reconcile__confirm input {
    flex: 0 0 auto;
    margin-top: 2px;
    accent-color: var(--pv-green, #22c55e);
}

.fp-invoice-reconcile__payment {
    margin-top: 8px;
}

.fp-invoice-reconcile__confirm {
    margin-top: 7px;
}

.fp-invoice-reconcile__block,
.fp-invoice-reconcile__issue {
    padding: 8px 9px;
    border: 1px solid color-mix(in srgb, var(--pv-red, #ef4444) 32%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--pv-red, #ef4444) 7%, transparent);
    color: var(--pv-red-text, #fca5a5);
    font-size: 0.68rem;
    line-height: 1.35;
}

.fp-invoice-reconcile__status {
    padding: 8px 9px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 750;
}

.fp-invoice-reconcile__status--pending {
    color: var(--pv-amber-text, #fbbf24);
    background: color-mix(in srgb, var(--pv-amber, #f59e0b) 9%, transparent);
}

.fp-invoice-reconcile__status--ready {
    color: var(--pv-green-text, #4ade80);
    background: color-mix(in srgb, var(--pv-green, #22c55e) 9%, transparent);
}

@media (max-width: 720px) {
    .fp-concept-link-row,
    .fp-concept-link-row--inline,
    .fp-invoice-reconcile__quantity,
    .fp-invoice-reconcile__price,
    .fp-invoice-reconcile__payment {
        grid-template-columns: 1fr;
    }

    .fp-invoice-reconcile__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
}

.fp-factura-ver[data-facurl=""] {
    display: none;
}

.fp-factura-xml,
.fp-validation-badge {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 2px 6px;
    border-radius: 5px;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
}

.fp-factura-xml {
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: rgba(37, 99, 235, 0.12);
    cursor: pointer;
}

.fp-validation-badge {
    cursor: default;
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.34);
    background: rgba(6, 78, 59, 0.18);
}

.fp-factura-xml.fp-validation-badge,
.fp-validation-badge--clickable {
    cursor: pointer;
}

.fp-validation-badge--warning {
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.42);
    background: rgba(120, 53, 15, 0.2);
}

.fp-validation-badge--info {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.34);
    background: rgba(30, 64, 175, 0.16);
}

.fp-validation-badge--pending {
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(51, 65, 85, 0.16);
}

.text-right {
    text-align: right;
}

/* ═══════════════════════════════════════════════
   Missing Badge Variants
   Used by pagos.js for T.C. status badges
   ═══════════════════════════════════════════════ */

.badge-soft-secondary {
    background-color: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-soft-purple {
    background-color: rgba(168, 85, 247, 0.12);
    color: var(--pv-purple-text);
    border: 1px solid rgba(168, 85, 247, 0.22);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge-soft-dark {
    background-color: rgba(30, 41, 59, 0.8);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}
.fp-shared-payment__table { overflow-x: auto; max-height: 320px; }
.fp-shared-payment table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.fp-shared-payment th, .fp-shared-payment td { padding: 9px 6px; border-bottom: 1px solid #334155; text-align: right; white-space: nowrap; }
.fp-shared-payment th:first-child, .fp-shared-payment td:first-child { text-align: left; }
.fp-shared-payment__warning { color: #fbbf24; }
.fp-shared-payment { font-size: 0.87rem; line-height: 1.45; }
.fp-shared-payment > div, .fp-shared-payment > details { min-width: 0; }
.fp-shared-payment__selection { padding: 10px 12px; border: 1px solid #334155; border-radius: 8px; }
.fp-shared-payment__selection summary { color: #a5b4fc; cursor: pointer; }
#fp-shared-payment-targets { max-height: 180px; overflow-y: auto; margin-top: 8px; }
#fp-shared-payment-targets label { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; overflow-wrap: anywhere; }
#fp-shared-payment-targets label > span:last-child { white-space: nowrap; color: #cbd5e1; }
.fp-selection-summary { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 10px; border: 1px solid #334155; border-radius: 8px; background: #111827; color: #a5b4fc; font-size: .8rem; }
.fp-selection-summary[hidden] { display: none; }
.fp-selection-summary strong { display: block; margin-top: 3px; font-size: 1.1rem; color: #e2e8f0; }
.fp-selection-summary small { display: block; max-width: 540px; margin-top: 3px; color: #94a3b8; }
#fp-shared-payment-tolerance { font-size: .85rem; }
.fp-shared-payment__file { padding: 12px; margin-bottom: 8px; background: #0d1117; border: 1px solid #334155; border-radius: 8px; }
.fp-shared-payment__file-head, .fp-shared-payment__file-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fp-shared-payment__file-head strong { color: #c7d2fe; overflow-wrap: anywhere; min-width: 0; }
.fp-shared-payment__file-head button { flex-shrink: 0; white-space: nowrap; }
.fp-shared-payment__file-meta { margin: 9px 0 5px; flex-wrap: wrap; }
.fp-shared-payment__file-meta label { display: flex; align-items: center; gap: 8px; color: #94a3b8; font-size: 0.78rem; }
.fp-shared-payment__file-meta input { width: 148px; margin: 0; padding: 6px; font-size: 0.84rem; color-scheme: dark; }
.fp-shared-payment button { background: #1e293b; color: #cbd5e1; border: 1px solid #475569; border-radius: 5px; padding: 4px 9px; cursor: pointer; font-size: 0.78rem; }
.fp-shared-payment button:disabled { opacity: 0.5; cursor: wait; }
.fp-shared-payment small { color: #94a3b8; font-size: 0.74rem; }
.fp-shared-payment__totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px; background: #0d1117; border: 1px solid #334155; border-radius: 8px; }
.fp-shared-payment__totals strong { display: block; color: #e2e8f0; font-size: 1rem; }
.fp-shared-payment__rounding { padding: 11px 12px; border: 1px solid #276749; background: #102c24; color: #bbf7d0; border-radius: 8px; }
.fp-shared-payment__ready { color: #86efac; }
.fp-shared-payment__allocation { display: block; }
#fp-shared-payment-review { display: grid; gap: 12px; }
#fp-shared-payment-status { color: #cbd5e1; }
#fp-shared-payment-status:empty, #fp-shared-payment-review:empty, #fp-shared-payment-files:empty { display: none; }
@media (max-width: 480px) {
    .fp-shared-payment__file-meta label { width: 100%; justify-content: space-between; }
    .fp-shared-payment__totals { gap: 8px; padding: 9px; }
    .fp-shared-payment__totals strong { font-size: 0.88rem; }
}

.fp-bulk-existing {
    padding: 12px 14px;
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.08);
    color: #cbd5e1;
    font-size: 0.8rem;
    line-height: 1.5;
}
.fp-bulk-existing__title { color: #c7d2fe; font-weight: 700; }
.fp-bulk-existing__meta { color: #cbd5e1; overflow-wrap: anywhere; }
.fp-bulk-existing__files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.fp-bulk-existing button {
    background: #0d1117;
    border: 1px solid #475569;
    border-radius: 5px;
    color: #a5b4fc;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.76rem;
}
.fp-bulk-existing__row { padding: 8px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.15); }
.fp-bulk-existing__row:last-child { border-bottom: 0; }
.fp-bulk-existing details { margin-top: 6px; }
.fp-bulk-existing summary { cursor: pointer; color: #a5b4fc; }
.fp-bulk-existing details[open] { max-height: 220px; overflow-y: auto; }
.fp-bulk-label small { font-size: 0.72rem; font-weight: 400; color: #fbbf24; }

/* Irregular credit needs an explicit start date before it can be scheduled. */
.fp-row--credit-pending > td { background: rgba(245, 158, 11, .055); }
.fp-row--credit-pending > td:first-child { box-shadow: inset 3px 0 #fbbf24; }
.fp-credit-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border: 1px solid #fbbf24;
    border-radius: 50%;
    color: #fbbf24;
    font-weight: 800;
    flex-shrink: 0;
}
.fp-credit-start-warning {
    display: block;
    margin-top: 5px;
    padding: 4px 7px;
    border: 1px solid rgba(251, 191, 36, .45);
    border-radius: 5px;
    background: rgba(245, 158, 11, .10);
    color: #fbbf24;
    font: inherit;
    font-size: .7rem;
    cursor: pointer;
    text-align: left;
}
.fp-credit-start-warning:hover { background: rgba(245, 158, 11, .20); }
.fp-credit-start-date { display: block; margin-top: 4px; color: #94a3b8; font-size: .68rem; }

#fp-bulk-actions-btn[hidden] { display: none; }
#sub-facturacion .ho-toolbar-left { flex-wrap: wrap; min-width: 0; }
#sub-facturacion .ho-toolbar-title { flex-shrink: 0; }
.fp-multiple-actions, .fp-credit-bulk-review { text-align: left; font-size: .88rem; line-height: 1.5; }
.fp-multiple-action { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 14px; border: 1px solid #475569; border-radius: 9px; background: #1e293b; color: #c7d2fe; text-align: left; cursor: pointer; font: inherit; }
.fp-multiple-action span { color: #94a3b8; font-size: .8rem; }
.fp-multiple-action:hover, .fp-multiple-action:focus-visible { border-color: #818cf8; background: #252c47; }
.fp-credit-bulk-orders { list-style: none; margin: 10px 0; padding: 0 12px; max-height: 190px; overflow-y: auto; border: 1px solid #334155; border-radius: 8px; }
.fp-credit-bulk-orders li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-bottom: 1px solid #334155; overflow-wrap: anywhere; }
.fp-credit-bulk-orders li:last-child { border-bottom: 0; }
.fp-credit-bulk-orders span { color: #94a3b8; font-size: .8rem; }
.fp-credit-bulk-notice { color: #fbbf24; }
.fp-credit-bulk-notice summary { cursor: pointer; }
.fp-credit-start-input { color-scheme: dark; }
