﻿@charset "UTF-8";
/* ═══════════════════════════════════════════════════════════════
   BILLER.css · AZURE AURORA PREMIUM
   Sistema visual del módulo de Facturación (Biller). Prefijo bl-*,
   alineado con qt-* (Cotizaciones), ia-* (Inventario) y dp-*
   (Despacho): firma aurora índigo→azul→violeta, sombras tintadas
   de azul, superficies tipo vidrio y acentos semánticos vívidos.

   Enlázalo una vez en el host/layout:
       <link rel="stylesheet" href="css/biller.css" />

   Segmentos:
   1. Variables            5. Botones y controles
   2. Página + Hero        6. Modal: Facturar (bl-bill)
   3. Toolbar              7. Modal: Ver factura
   4. Lista de facturas    8. Accesibilidad + micro-interacciones
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Variables ───────────────────────────────────────────── */
:root {
    --bl-primary: #3b6cf6;
    --bl-primary-hover: #2453e0;
    --bl-primary-ink: #1d3fb0;
    --bl-primary-soft: #e8effe;
    --bl-primary-soft-2: #dbe7ff;
    --bl-accent: #8b5cf6;
    --bl-indigo: #6366f1;
    --bl-aurora: #153286;
    --bl-aurora-strong: linear-gradient(120deg, #4f46e5 0%, #2453e0 50%, #7c3aed 100%);
    --bl-sky: linear-gradient(135deg, #eaf1ff 0%, #e6e9ff 100%);
    --bl-success: #0ea371;
    --bl-success-soft: #e7fbf0;
    --bl-success-border: #a7f0cb;
    --bl-success-grad: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --bl-warning: #e08a00;
    --bl-warning-soft: #fff6e2;
    --bl-warning-border: #fbd784;
    --bl-danger: #e11d48;
    --bl-danger-soft: #fdecf0;
    --bl-danger-border: #f9c0d1;
    --bl-danger-grad: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
    --bl-text: #263449;
    --bl-text-strong: #0d1b34;
    --bl-text-muted: #6b7a93;
    --bl-text-soft: #94a3b8;
    --bl-border: #e2e9f5;
    --bl-border-strong: #cdd8ec;
    --bl-bg: #f4f8ff;
    --bl-surface: #ffffff;
    --bl-radius-sm: 10px;
    --bl-radius: 15px;
    --bl-radius-lg: 22px;
    --bl-shadow-sm: 0 1px 2px rgba(29, 63, 176, 0.05), 0 2px 8px rgba(29, 63, 176, 0.04);
    --bl-shadow: 0 6px 16px rgba(29, 63, 176, 0.07), 0 14px 34px rgba(29, 63, 176, 0.06);
    --bl-shadow-lg: 0 12px 28px rgba(29, 63, 176, 0.10), 0 28px 60px rgba(29, 63, 176, 0.10);
    --bl-glow-primary: 0 10px 24px rgba(59, 108, 246, 0.35);
    --bl-glow-success: 0 10px 22px rgba(16, 185, 129, 0.30);
    --bl-glow-danger: 0 10px 22px rgba(225, 29, 72, 0.26);
    --bl-ring: 0 0 0 4px rgba(59, 108, 246, 0.16);
}

/* ── 2. Página + Hero ───────────────────────────────────────── */
.bl-page {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    /*gap: 1.15rem;*/
    color: var(--bl-text);
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /*background: radial-gradient(1200px 480px at 12% -8%, rgba(99, 102, 241, 0.10), transparent 60%), radial-gradient(1000px 460px at 108% 4%, rgba(139, 92, 246, 0.10), transparent 55%), linear-gradient(180deg, #eef3fb 0%, #f6f9fe 360px);*/
    padding: 1.25rem 1.25rem 2.5rem;
    border-radius: var(--bl-radius-lg);
    -webkit-font-smoothing: antialiased;
}

.bl-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bl-aurora);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--bl-radius);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--bl-glow-primary), var(--bl-shadow);
    overflow: hidden;
    isolation: isolate;
    color: #fff;
}

    .bl-hero::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(520px 220px at 8% -40%, rgba(255, 255, 255, 0.42), transparent 60%), radial-gradient(420px 260px at 100% 140%, rgba(255, 255, 255, 0.16), transparent 55%);
        pointer-events: none;
        z-index: -1;
    }

.bl-hero__info {
    display: flex;
    align-items: center;
    gap: 1.15rem;
}

.bl-hero__icon {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 20px rgba(13, 27, 52, 0.18);
    flex-shrink: 0;
}

    .bl-hero__icon .material-symbols-outlined {
        font-size: 32px;
        color: #fff;
    }

.bl-hero__type {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
}

.bl-hero__title {
    margin: 0.15rem 0 0.2rem;
    font-size: 1.6rem;
    font-weight: bold;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 1px 12px rgba(13, 27, 52, 0.18);
}

.bl-hero__subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.9rem;
}

.bl-hero__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── 3. Toolbar ─────────────────────────────────────────────── */
.bl-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    border-radius: var(--bl-radius);
    padding: 0.9rem 1.15rem;
    box-shadow: var(--bl-shadow);
    margin-bottom:15px;
}

.bl-search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.bl-search-box__icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bl-primary);
    font-size: 1.2rem;
    pointer-events: none;
}

.bl-search-box__input {
    width: 100%;
    background: var(--bl-bg);
    border: 1px solid var(--bl-border-strong);
    border-radius: var(--bl-radius-sm);
    padding: 0.6rem 1rem 0.6rem 2.7rem;
    font-size: 0.9rem;
    color: var(--bl-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

    .bl-search-box__input:focus {
        border-color: var(--bl-primary);
        background: #fff;
        box-shadow: var(--bl-ring);
    }

.bl-count-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: bold;
    color: var(--bl-primary-ink);
    background: var(--bl-primary-soft);
    border: 1px solid var(--bl-primary-soft-2);
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    white-space: nowrap;
}

    .bl-count-chip .material-symbols-outlined {
        font-size: 1.05rem;
    }

/* ── 4. Lista de facturas ───────────────────────────────────── */
.bl-list {
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    border-radius: var(--bl-radius);
    box-shadow: var(--bl-shadow);
    overflow: hidden;
}

.bl-inv-scroll {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: auto;
}

.bl-inv-table__head,
.bl-inv-row {
    display: grid;
    grid-template-columns: 96px 130px 170px 130px 1fr 150px 48px;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1.25rem;
}

.bl-inv-table__head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #f4f8ff, #eaf1ff);
    border-bottom: 2px solid var(--bl-border-strong);
    font-size: 0.68rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #47597a;
}

.bl-inv-row {
    border-bottom: 1px solid #eef2f9;
    transition: background 0.15s ease;
}

    .bl-inv-row:hover {
        background: #f6f9ff;
    }

    .bl-inv-row:last-child {
        border-bottom: none;
    }

.bl-inv-actions {
    display: flex;
    gap: 0.35rem;
}

.bl-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--bl-border-strong);
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    box-shadow: var(--bl-shadow-sm);
}

    .bl-icon-btn .material-symbols-outlined {
        font-size: 1.1rem;
    }

.bl-icon-btn--view {
    color: var(--bl-primary-hover);
}

    .bl-icon-btn--view:hover {
        background: var(--bl-primary-soft);
        border-color: #9db9fb;
        transform: translateY(-2px);
        box-shadow: var(--bl-shadow);
    }

.bl-icon-btn--bill {
    color: #0b7a52;
}

    .bl-icon-btn--bill:hover {
        background: var(--bl-success-soft);
        border-color: var(--bl-success-border);
        transform: translateY(-2px);
        box-shadow: var(--bl-shadow);
    }

.bl-icon-btn--delete {
    color: var(--bl-danger);
}

    .bl-icon-btn--delete:hover {
        background: var(--bl-danger-soft);
        border-color: var(--bl-danger-border);
        transform: translateY(-2px);
        box-shadow: var(--bl-shadow);
    }

.bl-inv-row__ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.78rem;
    color: var(--bl-primary-ink);
    background: var(--bl-primary-soft);
    border: 1px solid var(--bl-primary-soft-2);
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    width: fit-content;
}

.bl-inv-row__date {
    font-size: 0.82rem;
    color: var(--bl-text-muted);
    font-variant-numeric: tabular-nums;
}

.bl-inv-row__nit {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--bl-text);
    font-variant-numeric: tabular-nums;
}

.bl-inv-row__customer {
    font-size: 0.88rem;
    color: var(--bl-text-strong);
    font-weight: lighter;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-inv-row__total {
    font-size: 0.92rem;
    font-weight: bold;
    color: #0b7a52;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--bl-text-muted);
}

    .bl-empty .material-symbols-outlined {
        font-size: 2.8rem;
        color: var(--bl-primary);
        opacity: 0.8;
    }

    .bl-empty p {
        margin: 0;
        font-weight: 700;
        font-size: 0.95rem;
        max-width: 40ch;
    }

/* ── 5. Botones y controles ─────────────────────────────────── */
.bl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--bl-border-strong);
    border-radius: var(--bl-radius-sm);
    background: linear-gradient(180deg, #ffffff, #f7faff);
    color: var(--bl-text);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: var(--bl-shadow-sm);
    transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease, filter 0.18s ease, border-color 0.18s ease;
}

    .bl-btn:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: var(--bl-shadow);
        border-color: #9db9fb;
    }

    .bl-btn:active:not(:disabled) {
        transform: translateY(0) scale(0.97);
    }

    .bl-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
        box-shadow: none !important;
        filter: grayscale(0.2);
    }

    .bl-btn .material-symbols-outlined {
        font-size: 1.1rem;
    }

.bl-btn--primary {
    background: var(--bl-aurora);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--bl-glow-primary);
}

    .bl-btn--primary:hover:not(:disabled) {
        background: var(--bl-aurora-strong);
        border-color: transparent;
        box-shadow: 0 14px 30px rgba(59, 108, 246, 0.45);
    }

.bl-btn--success {
    background: var(--bl-success-grad);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--bl-glow-success);
}

    .bl-btn--success:hover:not(:disabled) {
        filter: brightness(1.05);
        border-color: transparent;
    }

.bl-btn--danger {
    background: var(--bl-danger-grad);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--bl-glow-danger);
}

    .bl-btn--danger:hover:not(:disabled) {
        filter: brightness(1.04);
        border-color: transparent;
    }

.bl-btn--ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--bl-text-muted);
}

    .bl-btn--ghost:hover:not(:disabled) {
        background: var(--bl-primary-soft);
        color: var(--bl-primary-hover);
        border-color: transparent;
        box-shadow: none;
    }

.bl-btn--block {
    width: 100%;
}

.bl-input,
.bl-select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--bl-border-strong);
    border-radius: var(--bl-radius-sm);
    background: var(--bl-bg);
    font-size: 0.88rem;
    color: var(--bl-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

    .bl-input:focus,
    .bl-select:focus {
        border-color: var(--bl-primary);
        background: #fff;
        box-shadow: var(--bl-ring);
    }

.bl-select {
    cursor: pointer;
}

.bl-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.bl-field__label {
    font-size: 0.68rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bl-text-muted);
}

/* ── 6. Modal: Facturar (bl-bill) ───────────────────────────── */
.bl-bill {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.bl-bill__hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bl-aurora);
    border-radius: var(--bl-radius);
    padding: 1.1rem 1.35rem;
    box-shadow: var(--bl-glow-primary);
    color: #fff;
}

.bl-bill__hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .bl-bill__hero-icon .material-symbols-outlined {
        font-size: 26px;
        color: #fff;
    }

.bl-bill__hero-code {
    font-size: 1.15rem;
    font-weight: bold;
    color: #fff;
}

.bl-bill__hero-sub {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.1rem;
}

/* Formulario: prefijo + Nº factura + acción */
.bl-bill__form {
    display: grid;
    grid-template-columns: 180px 200px 1fr;
    gap: 0.9rem;
    align-items: end;
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    border-radius: var(--bl-radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--bl-shadow-sm);
}

@media (max-width: 720px) {
    .bl-bill__form {
        grid-template-columns: 1fr 1fr;
    }
}

.bl-bill__form-action {
    display: flex;
    align-items: end;
    height: 100%;
}

/* Fila nota + guardar (tras validar) */
.bl-bill__note-row {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

@media (max-width: 720px) {
    .bl-bill__note-row {
        grid-template-columns: 1fr;
    }
}

/* Banner de resultado de validación */
.bl-validate-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.05rem;
    border-radius: var(--bl-radius-sm);
    font-weight: 700;
    font-size: 0.86rem;
    border: 1px solid transparent;
    border-left-width: 4px;
}

    .bl-validate-banner .material-symbols-outlined {
        font-size: 1.25rem;
    }

.bl-validate-banner--ok {
    background: var(--bl-success-soft);
    border-color: var(--bl-success-border);
    border-left-color: var(--bl-success);
    color: #0b7a52;
}

.bl-validate-banner--error {
    background: var(--bl-danger-soft);
    border-color: var(--bl-danger-border);
    border-left-color: var(--bl-danger);
    color: #b31450;
}

/* Tabla de detalle */
.bl-bill-table {
    border: 1px solid var(--bl-border);
    border-radius: var(--bl-radius);
    overflow: hidden;
    box-shadow: var(--bl-shadow-sm);
}

.bl-bill-scroll {
    max-height: calc(100vh - 420px);
    overflow-y: auto;
}

.bl-bill-row,
.bl-bill-head,
.bl-bill-foot {
    display: grid;
    grid-template-columns: 44px 64px 1fr 120px 80px 120px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
}

.bl-bill-head {
    background: linear-gradient(180deg, #f4f8ff, #eaf1ff);
    border-bottom: 2px solid var(--bl-border-strong);
    font-size: 0.66rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #47597a;
    text-align: center;
}

.bl-bill-row {
    border-bottom: 1px solid #eef2f9;
    transition: background 0.15s ease;
}

    .bl-bill-row:hover {
        background: #f6f9ff;
    }

.bl-bill-row__validate {
    display: flex;
    align-items: center;
    justify-content: center;
}

    .bl-bill-row__validate .material-symbols-outlined {
        font-size: 1.35rem;
    }

.bl-bill-row__validate--ok {
    color: var(--bl-success);
}

.bl-bill-row__validate--bad {
    color: var(--bl-danger);
}

.bl-bill-row__thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--bl-radius-sm);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--bl-border);
    box-shadow: var(--bl-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .bl-bill-row__thumb img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.bl-bill-row__info {
    min-width: 0;
}

.bl-bill-row__code {
    font-weight: bold;
    color: var(--bl-primary-hover);
    font-size: 0.85rem;
}

.bl-bill-row__name {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    color: var(--bl-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-bill-cell {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bl-text);
    font-variant-numeric: tabular-nums;
}

.bl-bill-cell--right {
    text-align: right;
}

.bl-price-old {
    display: block;
    text-decoration: line-through;
    color: var(--bl-text-soft);
    font-size: 0.72rem;
    font-weight: 500;
}

.bl-price-new {
    display: block;
    font-weight: bold;
    color: #0b7a52;
}

.bl-bill-foot {
    background: var(--bl-sky);
    border-top: 2px solid var(--bl-border-strong);
    font-weight: bold;
    color: var(--bl-primary-ink);
}

    .bl-bill-foot .bl-bill-cell {
        color: var(--bl-primary-ink);
        font-weight: bold;
    }

/* ── 7. Modal: Ver factura ──────────────────────────────────── */
.bl-invoice-viewer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── 8. Accesibilidad + micro-interacciones ────────────────── */
.bl-page :is(button, [role="button"], input, select, a):focus-visible,
.bl-bill :is(button, input, select):focus-visible {
    outline: 3px solid rgba(59, 108, 246, 0.6);
    outline-offset: 2px;
    border-radius: 10px;
}

.bl-page ::selection,
.bl-bill ::selection {
    background: rgba(99, 102, 241, 0.25);
    color: var(--bl-text-strong);
}

.bl-hero,
.bl-toolbar,
.bl-list,
.bl-bill__form,
.bl-bill-table {
    animation: blFadeSlideIn 0.3s ease both;
}

@keyframes blFadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bl-inv-scroll,
.bl-bill-scroll {
    scrollbar-width: thin;
    scrollbar-color: #bcd0fb transparent;
}

    .bl-inv-scroll::-webkit-scrollbar,
    .bl-bill-scroll::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    .bl-inv-scroll::-webkit-scrollbar-thumb,
    .bl-bill-scroll::-webkit-scrollbar-thumb {
        background: #bcd0fb;
        border-radius: 999px;
    }

@media (prefers-reduced-motion: reduce) {
    .bl-page *, .bl-page *::before, .bl-page *::after,
    .bl-bill *, .bl-bill *::before {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   9 · VISOR DE FACTURA (UIInvoiceViewer) · AZURE AURORA PREMIUM
   ───────────────────────────────────────────────────────────────
   Anexar al FINAL de biller.css.

   Pareja del componente UIInvoiceViewer reescrito: TODAS las clases
   son propias (iv-*). No hay nombres de Bootstrap, ni !important,
   ni selectores de atributo contra estilos inline: el markup ya
   viene limpio.

   ⚠️ Este bloque REEMPLaza al anterior (invoice-viewer-append.css).
      No los uses juntos.
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Alias portables: si biller.css está cargado toman su valor;
       si no, caen al literal. */
    --iv-primary: var(--bl-primary, #3b6cf6);
    --iv-primary-hover: var(--bl-primary-hover, #2453e0);
    --iv-primary-ink: var(--bl-primary-ink, #1d3fb0);
    --iv-primary-soft: var(--bl-primary-soft, #e8effe);
    --iv-aurora: var(--bl-aurora, linear-gradient(120deg, #6366f1 0%, #3b6cf6 48%, #8b5cf6 100%));
    --iv-sky: var(--bl-sky, linear-gradient(135deg, #eaf1ff 0%, #e6e9ff 100%));
    --iv-success: var(--bl-success, #0ea371);
    --iv-success-soft: var(--bl-success-soft, #e7fbf0);
    --iv-success-border: var(--bl-success-border, #a7f0cb);
    --iv-success-grad: var(--bl-success-grad, linear-gradient(135deg, #10b981 0%, #059669 100%));
    --iv-warning-soft: var(--bl-warning-soft, #fff6e2);
    --iv-warning-border: var(--bl-warning-border, #fbd784);
    --iv-danger: var(--bl-danger, #e11d48);
    --iv-text: var(--bl-text, #263449);
    --iv-text-strong: var(--bl-text-strong, #0d1b34);
    --iv-text-muted: var(--bl-text-muted, #6b7a93);
    --iv-text-soft: var(--bl-text-soft, #94a3b8);
    --iv-border: var(--bl-border, #e2e9f5);
    --iv-border-strong: var(--bl-border-strong, #cdd8ec);
    --iv-tint: var(--bl-bg, #f4f8ff);
    --iv-radius: var(--bl-radius, 15px);
    --iv-radius-sm: var(--bl-radius-sm, 10px);
    --iv-shadow-sm: var(--bl-shadow-sm, 0 1px 2px rgba(29,63,176,.05), 0 2px 8px rgba(29,63,176,.04));
    --iv-shadow: var(--bl-shadow, 0 6px 16px rgba(29,63,176,.07), 0 14px 34px rgba(29,63,176,.06));
    --iv-glow-primary: var(--bl-glow-primary, 0 10px 24px rgba(59,108,246,.35));
    --iv-glow-success: var(--bl-glow-success, 0 10px 22px rgba(16,185,129,.30));
}

/* ── 9.1 Contenedor ─────────────────────────────────────────── */
.iv-viewer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--iv-text);
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

    .iv-viewer *,
    .iv-viewer *::before,
    .iv-viewer *::after {
        box-sizing: border-box;
    }

/* ── 9.2 Encabezado opcional (showHeader) ──────────────────── */
.iv-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--iv-aurora);
    border-radius: var(--iv-radius);
    padding: 1.1rem 1.35rem;
    box-shadow: var(--iv-glow-primary);
    color: #fff;
}

.iv-hero__icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .iv-hero__icon .material-symbols-outlined {
        font-size: 26px;
    }

.iv-hero__label {
    font-size: 0.66rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.85);
}

.iv-hero__title {
    margin: 0.1rem 0 0;
    font-size: 1.25rem;
    font-weight: bold;
    letter-spacing: -0.01em;
}

.iv-hero__sub {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
}

/* ── 9.3 Pestañas ───────────────────────────────────────────── */
.iv-tabs {
    display: inline-flex;
    align-self: center;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem;
    background: #fff;
    border: 1px solid var(--iv-border-strong);
    border-radius: 999px;
    box-shadow: var(--iv-shadow-sm);
}

.iv-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--iv-text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.55rem 1.15rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

    .iv-tab .material-symbols-outlined {
        font-size: 1.05rem;
    }

    .iv-tab:hover {
        background: var(--iv-primary-soft);
        color: var(--iv-primary-hover);
    }

    .iv-tab.active {
        background: var(--iv-aurora);
        color: #fff;
        box-shadow: var(--iv-glow-primary);
    }

    .iv-tab:focus-visible {
        outline: 3px solid rgba(59, 108, 246, 0.6);
        outline-offset: 2px;
    }

/* ── 9.4 Cuerpo desplazable ─────────────────────────────────── */
.iv-body {
    max-height: calc(100vh - 340px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: #bcd0fb transparent;
}

    .iv-body::-webkit-scrollbar {
        width: 8px;
    }

    .iv-body::-webkit-scrollbar-thumb {
        background: #bcd0fb;
        border-radius: 999px;
    }

/* ── 9.5 Rejilla de 2 columnas ──────────────────────────────── */
.iv-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.iv-col {
    flex: 1 1 340px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── 9.6 Fichas de datos ────────────────────────────────────── */
.iv-card {
    background: #fff;
    border: 1px solid var(--iv-border);
    border-radius: var(--iv-radius);
    box-shadow: var(--iv-shadow-sm);
    overflow: hidden;
}

.iv-card__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.1rem;
    background: var(--iv-sky);
    border-bottom: 1px solid var(--iv-border);
    font-size: 0.72rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--iv-primary-ink);
}

    .iv-card__head .material-symbols-outlined {
        font-size: 1.15rem;
        color: var(--iv-primary);
    }

.iv-info {
    display: flex;
    flex-direction: column;
}

.iv-info__row {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.55rem 1.1rem;
    border-bottom: 1px solid #f1f5fb;
}

    .iv-info__row:last-child {
        border-bottom: none;
    }

    .iv-info__row:nth-child(odd) {
        background: #fcfdff;
    }

.iv-info__label {
    font-size: 0.68rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--iv-text-muted);
}

.iv-info__value {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--iv-text-strong);
    overflow-wrap: anywhere;
}

.iv-info__value--num {
    font-variant-numeric: tabular-nums;
    font-weight: bold;
}

.iv-info__value--debt {
    color: var(--iv-danger);
}

/* Badges de estado */
.iv-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--iv-primary-soft);
    color: var(--iv-primary-ink);
    border: 1px solid #cfddff;
}

.iv-badge--ok {
    background: var(--iv-success-soft);
    color: #0b7a52;
    border-color: var(--iv-success-border);
}

.iv-badge--pending {
    background: var(--iv-warning-soft);
    color: #92590a;
    border-color: var(--iv-warning-border);
}

/* ── 9.7 Línea de tiempo ────────────────────────────────────── */
/* Riel lateral izquierdo: cabe mejor en media columna y se lee
   como un tracker de progreso. */
.iv-timeline {
    position: relative;
    padding: 1rem 1.1rem 1.1rem;
}

    .iv-timeline::before {
        content: "";
        position: absolute;
        top: 1.6rem;
        bottom: 1.6rem;
        left: calc(1.1rem + 17px);
        width: 2px;
        background: var(--iv-aurora);
        opacity: 0.28;
        border-radius: 999px;
    }

.iv-tl-step {
    position: relative;
    padding-left: 58px;
    margin-bottom: 0.7rem;
}

    .iv-tl-step:last-child {
        margin-bottom: 0;
    }

.iv-tl-icon {
    position: absolute;
    top: 10px;
    left: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: bold;
    color: #fff;
    border: 3px solid #fff;
    z-index: 1;
}

.iv-tl-card {
    padding: 0.75rem 1rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--iv-border);
    box-shadow: var(--iv-shadow-sm);
    transition: transform 0.16s ease, box-shadow 0.2s ease;
}

    .iv-tl-card:hover {
        transform: translateX(3px);
        box-shadow: var(--iv-shadow);
    }

.iv-tl-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.84rem;
    font-weight: bold;
    color: var(--iv-text-strong);
}

    .iv-tl-title .material-symbols-outlined {
        font-size: 1.1rem;
    }

.iv-tl-meta {
    font-size: 0.74rem;
    color: var(--iv-text-muted);
    margin-top: 0.15rem;
}

/* Paso completado */
.iv-tl-step--done .iv-tl-icon {
    background: var(--iv-success-grad);
    box-shadow: var(--iv-glow-success);
}

.iv-tl-step--done .iv-tl-card {
    background: var(--iv-success-soft);
    border-color: var(--iv-success-border);
}

.iv-tl-step--done .iv-tl-title .material-symbols-outlined {
    color: var(--iv-success);
}

/* Paso pendiente */
.iv-tl-step--pending .iv-tl-icon {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}

.iv-tl-step--pending .iv-tl-card {
    background: #fbfcfe;
    border-style: dashed;
    box-shadow: none;
}

.iv-tl-step--pending .iv-tl-title {
    color: var(--iv-text-muted);
}

    .iv-tl-step--pending .iv-tl-title .material-symbols-outlined {
        color: var(--iv-text-soft);
    }

/* ── 9.8 Tabla de productos ─────────────────────────────────── */
.iv-table-wrap {
    border: 1px solid var(--iv-border);
    border-radius: var(--iv-radius);
    overflow: hidden;
    box-shadow: var(--iv-shadow-sm);
    background: #fff;
}

.iv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

    .iv-table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: linear-gradient(180deg, #f4f8ff, #eaf1ff);
        border-bottom: 2px solid var(--iv-border-strong);
        padding: 0.6rem 0.75rem;
        text-align: left;
        font-size: 0.66rem;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #47597a;
        white-space: nowrap;
    }

    .iv-table tbody td {
        padding: 0.55rem 0.75rem;
        border-bottom: 1px solid #eef2f9;
        vertical-align: middle;
    }

    .iv-table tbody tr:last-child td {
        border-bottom: none;
    }

    .iv-table tbody tr:hover td {
        background: #f6f9ff;
    }

.iv-th-img {
    width: 70px;
}

.iv-th-num {
    text-align: right !important;
}

.iv-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    /*font-weight: 700;*/
    color: var(--iv-text-strong);
    white-space: nowrap;
}

.iv-thumb {
    width: 54px;
    height: 54px;
    object-fit: contain;
    padding: 3px;
    background: #fff;
    border: 1px solid var(--iv-border);
    border-radius: var(--iv-radius-sm);
    box-shadow: var(--iv-shadow-sm);
    display: block;
}

.iv-code {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--iv-primary-hover);
}

.iv-name {
    margin-top: 0.15rem;
    font-size: x-small;
    color: var(--iv-text-muted);
    line-height: 1.4;
}

.iv-price-old {
    display: block;
    text-decoration: line-through;
    color: var(--iv-text-soft);
    font-size: 0.72rem;
    font-weight: 500;
}

.iv-price-new {
    display: block;
    font-weight: bold;
    color: #0b7a52;
}

/* Fila de agrupación por almacén */
.iv-group td {
    background: var(--iv-aurora);
    padding: 0.55rem 0.9rem !important;
    border-bottom: none !important;
}

.iv-group td,
.iv-group .material-symbols-outlined {
    color: #fff;
    font-weight: bold;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.iv-group .material-symbols-outlined {
    font-size: 1.1rem;
    margin-right: 0.35rem;
}

.iv-table tbody tr.iv-group:hover td {
    background: var(--iv-aurora);
}

/* ── 9.9 Totales ────────────────────────────────────────────── */
.iv-totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.7rem;
}

@media (max-width: 640px) {
    .iv-totals {
        grid-template-columns: repeat(2, 1fr);
    }
}

.iv-total {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.65rem 1rem;
    background: var(--iv-tint);
    border: 1px solid var(--iv-border);
    border-radius: var(--iv-radius-sm);
    text-align: right;
    overflow: hidden;
}

    .iv-total::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: var(--iv-primary);
    }

.iv-total__label {
    font-size: 0.66rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--iv-text-muted);
}

.iv-total__value {
    /*font-size: 1.05rem;*/
    font-weight: bold;
    color: var(--iv-text-strong);
    font-variant-numeric: tabular-nums;
}

.iv-total--grand {
    background: var(--iv-success-soft);
    border-color: var(--iv-success-border);
}

    .iv-total--grand::before {
        background: var(--iv-success);
    }

    .iv-total--grand .iv-total__value {
        color: #0b7a52;
    }

/* ── 9.10 Accesibilidad ─────────────────────────────────────── */
.iv-viewer ::selection {
    background: rgba(99, 102, 241, 0.25);
    color: var(--iv-text-strong);
}

@media (prefers-reduced-motion: reduce) {
    .iv-tl-card,
    .iv-tab {
        transition-duration: 0.01ms;
    }
}
