/* =====================================================
   inventario.css  —  Estilos para el módulo Inventario
   Prefijo: inv-
   No modifica masterdata.css
   ===================================================== */


/* ══════════════════════════════════════════════════════
   1. PAGE & LAYOUT
   ══════════════════════════════════════════════════════ */
.inv-page {
    padding: 1.75rem 2rem;
    background: #f8fafc;
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.inv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.inv-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.inv-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.inv-subtitle {
    font-size: 0.82rem;
    color: #64748b;
    margin: 2px 0 0 0;
}


/* ══════════════════════════════════════════════════════
   2. BOTONES
   ══════════════════════════════════════════════════════ */
.inv-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.4rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

    .inv-btn-primary:hover {
        background: #1d4ed8;
        box-shadow: 0 6px 18px rgba(37,99,235,0.4);
    }

    .inv-btn-primary:disabled {
        background: #93c5fd;
        box-shadow: none;
        cursor: not-allowed;
    }

.inv-btn-grabar {
    flex: 1;
    padding: 0.7rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

    .inv-btn-grabar:hover {
        background: #1d4ed8;
    }

    .inv-btn-grabar:disabled {
        background: #93c5fd;
        cursor: not-allowed;
    }

.inv-btn-cancelar {
    flex: 1;
    padding: 0.7rem 1rem;
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

    .inv-btn-cancelar:hover {
        background: #e2e8f0;
    }

.inv-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.2rem;
    background: #059669;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.01em;
    white-space: nowrap;
    animation: invBtnEntra 0.2s ease;
}

    .inv-btn-export:hover {
        background: #047857;
    }

    .inv-btn-export:disabled {
        background: #6ee7b7;
        box-shadow: none;
        cursor: not-allowed;
    }

@keyframes invBtnEntra {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* ══════════════════════════════════════════════════════
   3. TABLA — scroll horizontal en pantallas pequeñas
   ══════════════════════════════════════════════════════ */
.inv-table-wrapper {
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* Scroll horizontal — la tabla no rompe el layout en móvil */
.inv-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.inv-table {
    width: 100%;
    min-width: 780px; /* mínimo para que las columnas respiren */
    border-collapse: collapse;
    font-size: 0.85rem;
}

    .inv-table thead tr {
        background: #f1f5f9;
    }

    .inv-table th {
        padding: 0.75rem 1rem;
        text-align: left;
        font-weight: 600;
        color: #475569;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        border-bottom: 1px solid #e2e8f0;
        white-space: nowrap;
    }

    .inv-table td {
        padding: 0.75rem 1rem;
        color: #0f172a;
        border-bottom: 1px solid #f1f5f9;
        vertical-align: middle;
    }

    .inv-table tbody tr:last-child td {
        border-bottom: none;
    }

    .inv-table tbody tr:hover td {
        background: #f8fafc;
    }

/* Columnas de texto largo: truncar con ellipsis */
.inv-td-truncate {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge código ambiente — monoespaciado */
.inv-codigo {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8rem;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Badge activo/inactivo */
.inv-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

    .inv-badge.activo {
        background: #f0fdf4;
        color: #15803d;
    }

    .inv-badge.inactivo {
        background: #fef2f2;
        color: #b91c1c;
    }

/* Checkbox */
.inv-check {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}

.inv-table tbody tr.inv-row-selected td {
    background: #eff6ff;
}


/* ══════════════════════════════════════════════════════
   4. MODAL / FORMULARIO — responsive
   ══════════════════════════════════════════════════════ */
.inv-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.inv-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: invModalEntra 0.22s ease;
}

@keyframes invModalEntra {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.inv-modal-header {
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

    .inv-modal-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 700;
        color: #0f172a;
    }

    .inv-modal-header p {
        margin: 3px 0 0;
        font-size: 0.8rem;
        color: #64748b;
    }

.inv-modal-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inv-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 0.75rem;
}


/* ══════════════════════════════════════════════════════
   5. CAMPOS CON LABEL FLOTANTE
   ══════════════════════════════════════════════════════ */
.inv-field {
    position: relative;
}

    .inv-field label {
        position: absolute;
        top: 50%;
        left: 0.85rem;
        transform: translateY(-50%);
        font-size: 0.875rem;
        color: #94a3b8;
        pointer-events: none;
        transition: all 0.18s ease;
        background: transparent;
        padding: 0 0.2rem;
        font-family: 'Segoe UI', system-ui, sans-serif;
    }

    .inv-field.has-value label,
    .inv-field:focus-within label {
        top: 0;
        font-size: 0.72rem;
        color: #2563eb;
        background: white;
    }

    .inv-field select,
    .inv-field input[type="number"],
    .inv-field input[type="text"] {
        width: 100%;
        padding: 0.85rem 0.85rem 0.45rem;
        background: #eff6ff;
        border: 1.5px solid #bfdbfe;
        border-radius: 10px;
        font-size: 0.875rem;
        color: #0f172a;
        outline: none;
        transition: border-color 0.2s, box-shadow 0.2s;
        font-family: 'Segoe UI', system-ui, sans-serif;
        appearance: none;
        -webkit-appearance: none;
    }

        .inv-field select:focus,
        .inv-field input:focus {
            border-color: #2563eb;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
            background: #fff;
        }

        .inv-field select:disabled {
            background: #f8fafc;
            border-color: #e2e8f0;
            color: #94a3b8;
            cursor: not-allowed;
        }

/* Fila de dos campos lado a lado */
.inv-row {
    display: flex;
    gap: 0.75rem;
}

    .inv-row .inv-field {
        flex: 1;
        min-width: 0;
    }


/* ══════════════════════════════════════════════════════
   6. PREVIEW DEL CÓDIGO EN TIEMPO REAL
   ══════════════════════════════════════════════════════ */
.inv-preview {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.inv-preview-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.inv-preview-codigo {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a8a;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.inv-preview-placeholder {
    font-size: 0.82rem;
    color: #94a3b8;
    font-style: italic;
}


/* ══════════════════════════════════════════════════════
   7. DENOMINACIONES DINÁMICAS
   ══════════════════════════════════════════════════════ */
.inv-denoms {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inv-denom-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inv-denom-badge {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1d4ed8;
    background: #dbeafe;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    min-width: 48px;
    text-align: center;
    white-space: nowrap;
}

.inv-denom-input {
    flex: 1;
    padding: 0.55rem 0.85rem;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

    .inv-denom-input:focus {
        border-color: #2563eb;
        background: #fff;
    }


/* ══════════════════════════════════════════════════════
   8. TOAST
   ══════════════════════════════════════════════════════ */
.inv-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: 50px;
    font-size: 0.83rem;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    white-space: nowrap;
    max-width: calc(100vw - 2rem);
    font-family: 'Segoe UI', system-ui, sans-serif;
    animation: invToastEntra 0.25s ease forwards;
}

    .inv-toast.saliendo {
        animation: invToastSale 0.3s ease forwards;
    }

    .inv-toast.success {
        background: #f0fdf4;
        color: #15803d;
        border-color: #bbf7d0;
    }

    .inv-toast.danger {
        background: #fef2f2;
        color: #b91c1c;
        border-color: #fecaca;
    }

@keyframes invToastEntra {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes invToastSale {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-12px);
    }
}


/* ══════════════════════════════════════════════════════
   9. EMPTY STATE
   ══════════════════════════════════════════════════════ */
.inv-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

    .inv-empty svg {
        width: 48px;
        height: 48px;
        margin-bottom: 0.75rem;
        opacity: 0.4;
    }

    .inv-empty p {
        margin: 0;
        font-size: 0.9rem;
    }


/* ══════════════════════════════════════════════════════
   10. RESPONSIVE — breakpoints
   ══════════════════════════════════════════════════════ */

/* Tablet: ≤ 768px */
@media (max-width: 768px) {
    .inv-page {
        padding: 1.25rem 1rem;
    }

    .inv-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .inv-topbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Modal ocupa casi toda la pantalla */
    .inv-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        margin-top: auto;
    }

    .inv-overlay {
        align-items: flex-end;
        padding: 0;
    }

    /* Dos campos de piso+cantidad van en columna */
    .inv-row {
        flex-direction: column;
        gap: 1rem;
    }

    .inv-modal-body {
        padding: 1rem;
    }

    .inv-modal-footer {
        padding: 0.75rem 1rem;
    }

    .inv-modal-header {
        padding: 1rem 1rem 0.75rem;
    }
}

/* Móvil: ≤ 480px */
@media (max-width: 480px) {
    .inv-page {
        padding: 1rem 0.75rem;
    }

    .inv-title {
        font-size: 1.1rem;
    }

    .inv-btn-primary,
    .inv-btn-export {
        padding: 0.55rem 1rem;
        font-size: 0.82rem;
    }

    .inv-topbar-actions {
        gap: 0.5rem;
    }
}


/* ══════════════════════════════════════════════════════
   FASE 2 — InventarioRegistro — Accordion + Cards
   Prefijo: inv-  (mismo archivo, sección separada)
   ══════════════════════════════════════════════════════ */


/* ── Layout responsive de dos paneles ───────────────── */
.inv-registro-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* Espacio para que el último accordion no quede tapado
       por la barra de navegación del browser en móvil */
    padding-bottom: env(safe-area-inset-bottom, 1rem);
    margin-bottom: 5rem;
}

@media (min-width: 1024px) {
    .inv-registro-layout {
        display: grid;
        grid-template-columns: 290px 1fr;
        gap: 1.5rem;
        align-items: start;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .inv-panel-izquierdo {
        position: sticky;
        top: 1.25rem;
    }
}


/* ── Step Card (Paso 1 — selector de ambiente) ───────── */
.inv-step-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    overflow: hidden;
}

.inv-step-body {
    padding: 1.1rem 1.25rem 1.25rem;
}

.inv-selector-row {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.inv-select-codigo {
    font-size: 0.875rem;
    font-weight: 600;
}


/* ── Barra de Progreso Global ────────────────────────── */
.inv-progress-global {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.inv-pg-label {
    font-size: 0.73rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.inv-pg-bar-wrap {
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.inv-pg-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    border-radius: 99px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.inv-pg-num {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
}


/* ── Accordion Card ──────────────────────────────────── */
.inv-accordion-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-bottom: 0.65rem;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.3s, background 0.3s;
}

    .inv-accordion-card.inv-acc-done {
        border-color: #bbf7d0;
        background: #f0fdf4;
    }


/* ── Cabecera del Accordion ──────────────────────────── */
.inv-acc-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    gap: 0.6rem;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

    .inv-acc-header:hover {
        background: #f8fafc;
    }

.inv-acc-done .inv-acc-header:hover {
    background: #dcfce7;
}

.inv-acc-left {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    flex: 1;
}

.inv-acc-right {
    flex-shrink: 0;
}

/* ▼ CRÍTICO: limita el SVG del chevron para evitar el triángulo gigante */
.inv-acc-icon {
    display: flex;
    align-items: center;
    color: #2563eb;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

    .inv-acc-icon svg {
        width: 20px;
        height: 20px;
        display: block;
    }

    .inv-acc-icon.abierto {
        transform: rotate(180deg);
    }

.inv-acc-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ── Badges de progreso ──────────────────────────────── */
.inv-badge-done {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.7rem;
    background: #dcfce7;
    color: #15803d;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

    .inv-badge-done svg {
        width: 13px;
        height: 13px;
    }

.inv-badge-prog {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1.5px solid #bfdbfe;
    white-space: nowrap;
}


/* ── Cuerpo del Accordion ────────────────────────────── */
.inv-acc-body {
    padding: 0 0.9rem 0.9rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}


/* ── Card de Elemento ────────────────────────────────── */
.inv-elemento-card {
    background: #f8fafc;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 0.9rem 1rem;
    transition: border-color 0.2s, background 0.2s;
}

    .inv-elemento-card.inv-elem-saved {
        border-color: #bbf7d0;
        background: #f0fdf4;
    }

.inv-elem-header {
    margin-bottom: 0.7rem;
}

.inv-elem-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
}

.inv-elem-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}

.inv-check-ico {
    width: 17px;
    height: 17px;
    color: #16a34a;
    flex-shrink: 0;
}


/* ── Campos del Elemento ─────────────────────────────── */
.inv-elem-fields {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}


/* ── Estado B/R/M — botones táctiles ────────────────── */
.inv-estado-group {
    display: flex;
    gap: 0.45rem;
}

.inv-estado-btn {
    flex: 1;
    min-height: 44px;
    padding: 0.45rem 0.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    letter-spacing: 0.02em;
}

/* BUENO */
.inv-estado-b {
    color: #15803d;
}

    .inv-estado-b:hover {
        border-color: #86efac;
        background: #f0fdf4;
    }

    .inv-estado-b.activo {
        background: #16a34a;
        color: white;
        border-color: #16a34a;
        box-shadow: 0 2px 8px rgba(22,163,74,0.3);
    }

/* REGULAR */
.inv-estado-r {
    color: #b45309;
}

    .inv-estado-r:hover {
        border-color: #fcd34d;
        background: #fffbeb;
    }

    .inv-estado-r.activo {
        background: #d97706;
        color: white;
        border-color: #d97706;
        box-shadow: 0 2px 8px rgba(217,119,6,0.3);
    }

/* MALO */
.inv-estado-m {
    color: #b91c1c;
}

    .inv-estado-m:hover {
        border-color: #fca5a5;
        background: #fef2f2;
    }

    .inv-estado-m.activo {
        background: #dc2626;
        color: white;
        border-color: #dc2626;
        box-shadow: 0 2px 8px rgba(220,38,38,0.3);
    }


/* ── Error inline ────────────────────────────────────── */
.inv-elem-error {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

    .inv-elem-error svg {
        width: 15px;
        height: 15px;
        flex-shrink: 0;
    }


/* ── Footer de la Card (Guardar / Limpiar) ───────────── */
.inv-elem-footer {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.8rem;
    align-items: center;
    justify-content: flex-end;
}

.inv-btn-guardar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.81rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    box-shadow: 0 3px 10px rgba(37,99,235,0.28);
    white-space: nowrap;
}

    .inv-btn-guardar svg {
        width: 15px;
        height: 15px;
    }

    .inv-btn-guardar:hover {
        background: #1d4ed8;
        box-shadow: 0 4px 14px rgba(37,99,235,0.38);
    }

    .inv-btn-guardar:disabled {
        background: #93c5fd;
        box-shadow: none;
        cursor: not-allowed;
    }


.inv-btn-actualizar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.81rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    box-shadow: 0 3px 10px rgba(22,163,74,0.28);
    white-space: nowrap;
}

    .inv-btn-actualizar svg {
        width: 15px;
        height: 15px;
    }

    .inv-btn-actualizar:hover {
        background: #15803d;
        box-shadow: 0 4px 14px rgba(22,163,74,0.38);
    }

    .inv-btn-actualizar:disabled {
        background: #86efac;
        box-shadow: none;
        cursor: not-allowed;
    }

.inv-btn-limpiar {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1.5px solid #fecaca;
    border-radius: 50px;
    font-size: 0.81rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    white-space: nowrap;
}

    .inv-btn-limpiar svg {
        width: 14px;
        height: 14px;
    }

    .inv-btn-limpiar:hover {
        background: #fee2e2;
        border-color: #fca5a5;
    }

    .inv-btn-limpiar:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }


/* ── Spinner dentro de botón ─────────────────────────── */
.md-btn-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: invSpin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

@keyframes invSpin {
    to {
        transform: rotate(360deg);
    }
}


/* ══════════════════════════════════════════════════════
   RESPONSIVE Fase 2
   ══════════════════════════════════════════════════════ */

/* Tablet 768–1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    .inv-acc-body {
        padding: 0 1.1rem 1.1rem;
    }

    .inv-estado-btn {
        font-size: 0.83rem;
        min-height: 46px;
    }
}

/* Móvil < 480px */
@media (max-width: 480px) {
    .inv-step-body {
        padding: 0.85rem;
    }

    .inv-acc-header {
        padding: 0.8rem 0.9rem;
    }

    .inv-acc-body {
        padding: 0 0.65rem 0.65rem;
    }

    .inv-elemento-card {
        padding: 0.75rem 0.8rem;
    }

    .inv-acc-title {
        font-size: 0.84rem;
    }

    /* Footer en columna: Limpiar arriba, Guardar abajo */
    .inv-elem-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .inv-btn-guardar,
    .inv-btn-limpiar {
        justify-content: center;
        width: 100%;
    }

    /* Estado B/R/M — etiquetas cortas en móvil muy pequeño */
    .inv-estado-btn {
        font-size: 0.73rem;
    }
}


/* ══════════════════════════════════════════════════════
   VISTA LISTA — InventarioRegistro
   ══════════════════════════════════════════════════════ */

.inv-lista-search-bar {
    padding: 0.75rem 1.25rem 0;
}

/* Filtro IPRESS — dropdown alineado con el searchbox */
.inv-filter-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.inv-filter-ico {
    width: 16px;
    height: 16px;
    color: #64748b;
    flex-shrink: 0;
}

.inv-filter-select {
    padding: 0.42rem 2rem 0.42rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    font-size: 0.82rem;
    color: #0f172a;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 0.5rem center / 18px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

    .inv-filter-select:focus {
        border-color: #2563eb;
        box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }

/* Limpiar filtros */
.inv-clear-filters {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    font-size: 0.73rem;
    color: #64748b;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    margin-left: 0.4rem;
}

    .inv-clear-filters:hover {
        background: #f1f5f9;
        border-color: #cbd5e1;
    }

/* Barra de progreso en la tabla */
.inv-lista-prog {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.inv-lista-prog-bar-wrap {
    width: 80px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    flex-shrink: 0;
}

.inv-lista-prog-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 3px;
}

.inv-lista-prog-num {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
}

/* Badges de estado en tabla */
.inv-badge-parcial {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    background: #fffbeb;
    color: #b45309;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1.5px solid #fde68a;
    white-space: nowrap;
}

.inv-badge-vacio {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    background: #f8fafc;
    color: #94a3b8;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1.5px solid #e2e8f0;
    white-space: nowrap;
}

/* Botón Registrar / Modificar */
.inv-btn-abrir {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    background: #eff6ff;
    color: #2563eb;
    border: 1.5px solid #bfdbfe;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    white-space: nowrap;
}

    .inv-btn-abrir svg {
        width: 14px;
        height: 14px;
    }

    .inv-btn-abrir:hover {
        background: #dbeafe;
        border-color: #93c5fd;
    }

/* Breadcrumb botón volver */
.inv-breadcrumb-back {
    background: none;
    border: none;
    color: #2563eb;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

    .inv-breadcrumb-back:hover {
        color: #1d4ed8;
    }

/* ── Info del ambiente (panel izquierdo accordion) ─── */
.inv-ambiente-info {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
}

.inv-ambiente-codigo {
    display: inline-block;
    padding: 0.2em 0.55em;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0369a1;
    white-space: nowrap;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-ambiente-nombre {
    font-size: 0.84rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

/* Botón volver a lista */
.inv-btn-volver {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    font-family: 'Segoe UI', system-ui, sans-serif;
    justify-content: center;
}

    .inv-btn-volver svg {
        width: 16px;
        height: 16px;
    }

    .inv-btn-volver:hover {
        background: #e2e8f0;
    }

/* Hint "editable" en slot guardado */
.inv-elem-editable-hint {
    font-size: 0.68rem;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: auto;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


/* ══════════════════════════════════════════════════════
   SEARCH BOX — usado en inv-lista-search-bar
   (md-search-box no está en masterdata.css — definido aquí)
   ══════════════════════════════════════════════════════ */
.md-search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    max-width: 420px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .md-search-box:focus-within {
        border-color: #2563eb;
        box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }

    /* ▼ CRÍTICO: limita el SVG de la lupa */
    .md-search-box svg {
        width: 17px;
        height: 17px;
        flex-shrink: 0;
        color: #94a3b8;
        display: block;
    }

    .md-search-box input {
        flex: 1;
        border: none;
        outline: none;
        font-size: 0.875rem;
        color: #0f172a;
        background: transparent;
        font-family: 'Segoe UI', system-ui, sans-serif;
        min-width: 0;
    }

        .md-search-box input::placeholder {
            color: #94a3b8;
        }


/* ══════════════════════════════════════════════════════
   COLORES POR IPRESS — diferencia visualmente cada
   establecimiento dentro de la misma MicroRed.
   - Usa solo el borde izquierdo + fondo muy suave
     para no interferir con badges, estados ni row-off.
   - inv-ipress-0 se deja sin color (blanco base)
     para que la primera IPRESS sea el "default".
   - row-off (inactivo) siempre gana sobre el color IPRESS
     gracias al orden de declaración.
   ══════════════════════════════════════════════════════ */

/* índice 0 — sin color, es el primer establecimiento */
tr.inv-ipress-0 td {
    background: #ffffff;
}

/* índice 1 — azul muy claro */
tr.inv-ipress-1 td {
    background: #eff6ff;
    border-left: 0;
}

    tr.inv-ipress-1 td:first-child {
        border-left: 3px solid #93c5fd;
    }

/* índice 2 — verde muy claro */
tr.inv-ipress-2 td {
    background: #f0fdf4;
}

    tr.inv-ipress-2 td:first-child {
        border-left: 3px solid #86efac;
    }

/* índice 3 — violeta muy claro */
tr.inv-ipress-3 td {
    background: #faf5ff;
}

    tr.inv-ipress-3 td:first-child {
        border-left: 3px solid #c4b5fd;
    }

/* índice 4 — naranja muy claro */
tr.inv-ipress-4 td {
    background: #fff7ed;
}

    tr.inv-ipress-4 td:first-child {
        border-left: 3px solid #fdba74;
    }

/* índice 5 — rosa muy claro */
tr.inv-ipress-5 td {
    background: #fff1f2;
}

    tr.inv-ipress-5 td:first-child {
        border-left: 3px solid #fda4af;
    }

/* índice 6 — cyan muy claro */
tr.inv-ipress-6 td {
    background: #ecfeff;
}

    tr.inv-ipress-6 td:first-child {
        border-left: 3px solid #67e8f9;
    }

/* índice 7 — amarillo muy claro */
tr.inv-ipress-7 td {
    background: #fefce8;
}

    tr.inv-ipress-7 td:first-child {
        border-left: 3px solid #fde047;
    }

/* row-off siempre gana — fila inactiva opaca sin importar el color IPRESS */
tr.row-off td,
tr.row-off.inv-ipress-0 td,
tr.row-off.inv-ipress-1 td,
tr.row-off.inv-ipress-2 td,
tr.row-off.inv-ipress-3 td,
tr.row-off.inv-ipress-4 td,
tr.row-off.inv-ipress-5 td,
tr.row-off.inv-ipress-6 td,
tr.row-off.inv-ipress-7 td {
    background: #f8fafc;
    opacity: 0.6;
}

/* fila seleccionada para export siempre gana también */
tr.inv-row-selected td {
    background: #eff6ff !important;
}


/* ══════════════════════════════════════════════════════
   CLASES FALTANTES — agregadas en fix
   ══════════════════════════════════════════════════════ */

/* ── Botón "Ningún elemento aplica en esta sección" ── */
.inv-acc-group-actions {
    padding: 0.3rem 0 0.1rem;
    display: flex;
    align-items: center;
}

.inv-btn-grupo-na {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border: 1.5px dashed #f59e0b;
    background: #fffbeb;
    color: #92400e;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

    /* CRÍTICO: limitar el SVG del ícono de aviso */
    .inv-btn-grupo-na svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        display: block;
    }

    .inv-btn-grupo-na:hover {
        background: #fef3c7;
        border-color: #d97706;
    }

.inv-grupo-na-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #92400e;
}

/* ── Banner "no aplica en el ambiente" (por elemento) ── */
.inv-elem-no-aplica-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

    .inv-elem-no-aplica-banner svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        color: #94a3b8;
        display: block;
    }

/* ── Botón "Registrar igual" (reactivar elemento) ── */
.inv-btn-reactivar {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    background: #f8fafc;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    border-radius: 50px;
    font-size: 0.79rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

    .inv-btn-reactivar svg {
        width: 14px;
        height: 14px;
    }

    .inv-btn-reactivar:hover {
        background: #e2e8f0;
        border-color: #cbd5e1;
    }

    .inv-btn-reactivar:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* ── Icono NA en elemento guardado sin datos ── */
.inv-na-ico {
    width: 15px;
    height: 15px;
    color: #94a3b8;
    flex-shrink: 0;
}

/* ── Hint "no aplica" en header del elemento ── */
.inv-elem-na-hint {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: auto;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Hint amarillo cuando tipo = NA desde combo ── */
.inv-tipo-na-hint {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 7px;
    font-size: 0.79rem;
    color: #92400e;
    font-weight: 500;
}

    .inv-tipo-na-hint svg {
        width: 15px;
        height: 15px;
        flex-shrink: 0;
        display: block;
        color: #f59e0b;
    }


/* ── Observaciones (campo opcional por elemento) ──────────────────── */
.inv-obs-wrap {
    position: relative;
}

.inv-obs-opcional {
    font-size: 0.7rem;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 0.4rem;
    font-style: italic;
}

.inv-obs-textarea {
    width: 100%;
    min-height: 62px;
    max-height: 140px;
    resize: vertical;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

    .inv-obs-textarea:focus {
        border-color: #2563eb;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    }

    .inv-obs-textarea::placeholder {
        color: #94a3b8;
        font-style: italic;
    }

.inv-obs-counter {
    position: absolute;
    bottom: 0.45rem;
    right: 0.65rem;
    font-size: 0.68rem;
    color: #94a3b8;
    pointer-events: none;
    font-family: 'Cascadia Code', 'Consolas', monospace;
}

/* En móvil el contador queda abajo del textarea para no tapar texto */
@media (max-width: 640px) {
    .inv-obs-counter {
        position: static;
        display: block;
        text-align: right;
        margin-top: 0.2rem;
    }
}
