/* ================= GENERAL ================= */
:root {
    --bg-main: #f4f6f9;
    --bg-panel: #ffffff;
    --bg-header: #ffffff;
    --bg-window: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #d1d5db;
    --accent: #2563eb;
    --win-bg: #ffffff;
    --win-text: #1f2937;
    --win-border: #d1d5db;
    --win-header-bg: linear-gradient(to bottom, #f3f4f6, #e5e7eb);
    --win-header-text: #111827;
    --header-h: 56px;
    --footer-h: 40px;
}


html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: "Segoe UI", sans-serif;
    background-color: #ffffff;
    color: #333;

    display: flex;
    flex-direction: column;
    min-height: 100vh;

    background: var(--bg-main);
    color: var(--text-main);
}

h1,
h2 {
    margin-bottom: 15px;
    color: #2c2c2c;
}

.contenido {
    padding: 0px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ================= BOTONES GENERALES ================= */
.btn {
    padding: 7px 14px;
    background: #0078d4;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    min-width: 120px;
    /* ajusta si deseas */
    text-align: center;
}

.btn:hover {
    background: #005a9e;
}

/* ================= TABLAS ================= */
table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 0px;
}

table th {
    background: #e1e1e1;
    padding: 10px;
}

table td {
    border: 1px solid #ccc;
    padding: 8px;
}

/* ================= FORMULARIOS BÁSICOS ================= */

/* Solo inputs normales (NO checkbox/radio) */
input:not([type="checkbox"]):not([type="radio"]),
select {
    padding: 7px;
    width: 300px;
    border-radius: 4px;
    border: 1px solid #aaa;
}

/* Checkbox y radio con tamaño real */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
}


/* ================= TEMA OSCURO ================= */
.dark {
    background-color: #1e1e1e !important;
    color: #f0f0f0 !important;
}

.dark table th {
    background: #333 !important;
}

.dark table td {
    border-color: #555 !important;
    color: #eee !important;
}

.dark input,
.dark select {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

.dark .btn {
    background: #2296f3;
}


/* ================= PANEL ================= */
.panel-contenido {
    position: relative;
    padding: 14px 18px;
    color: #ffffff;
    font-family: "Segoe UI", sans-serif;
}



/* CAPA DE FONDO */
.panel-contenido::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("../img/img01.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.45);
    z-index: -1;
}

.panel-card {
    background: rgba(0, 0, 0, 0.55);
    margin: 20px;
    padding: 20px 25px;
    border-radius: 10px;
    max-width: 800px;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

/* ================= LOGIN ================= */
.login-container {
    width: 350px;
    margin: auto;
    margin-top: 100px;
    padding: 25px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f9f9f9;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

.login-error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 12px;
    border-left: 5px solid #dc2626;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 15px;
}

.login-forgot-link {
    color: #7f1d1d;
    font-weight: bold;
    text-decoration: underline;
    font-size: 14px;
}

.login-forgot-link:hover {
    color: #b91c1c;
}

.login-container input {
    width: 100%;
    margin-bottom: 12px;
}

.btn-full {
    width: 100%;
    text-align: center;
}

/* Dark login */
.dark .login-container {
    background: #2c2c2c;
    border-color: #555;
}

.dark .login-error {
    background: #552222;
    border-left-color: #ff5555;
}

.dark .login-container input {
    background: #333;
    border: 1px solid #666;
    color: #fff;
}

/* ================= HEADER TIPO OFFICE ================= */
.main-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f3f3f3;
    border-bottom: 1px solid #d0d0d0;
    padding: 0px 20px;
}

.logo {
    height: 50px;
}

/* Menu */
.menu-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

.menu-item {
    background: #2563eb;
    color: white;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
}


/* ===== ORDENAMIENTO PROFESIONAL DE SUBMENÚ ===== */
.submenu a {
    display: block;
    /* Cada item en una línea */
    padding: 8px 14px;
    /* Espaciado interno */
    text-decoration: none;
    color: #1f2937;
    /* Gris elegante */
    font-size: 15px;
    white-space: nowrap;
    /* Evita saltos raros */
}

.submenu a:hover {
    background: #e8edff;
}

/* Línea divisora entre grupos */
.submenu-divider {
    border-bottom: 1px solid #d1d5db;
    margin: 6px 0;
}

.menu-item .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    /* <-- ALINEA DESDE LA IZQUIERDA */
    background: #fff;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 180px;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: left;
    direction: ltr;
    z-index: 999;
}

.menu-item:hover {
    background: #1e40af;
}

/* Mostrar submenú */
.menu-item:hover .submenu {
    display: block;
}

.menu-left a,
.menu-right a,
.menu-right button {
    margin-right: 6px;
}

.menu-right a:last-child,
.menu-left a:last-child {
    margin-right: 0;
}

.dark .main-header {
    background: #2d2d2d !important;
}

.btn-active {
    background: #0a58ca !important;
    color: #fff !important;
    font-weight: bold;
}

/* ================= FORGOT ================= */
.forgot-container {
    margin-top: 20px;
    text-align: center;
}

.forgot-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.forgot-link:hover {
    text-decoration: underline;
    color: #1e3a8a;
}

/* ================= FORMULARIOS MODERNOS (GRID 2 COL) ================= */
.form-modern {
    display: grid;
    gap: 18px 25px;
    max-width: 1100px;
    margin-bottom: 25px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
}

.form-modern label {
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
}

.form-modern .input,
.form-modern select {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
}

/* Elementos que ocupan toda la fila */
.form-modern .full {
    grid-column: span 2;
}

/* ================= BOTONERA GUARDAR / VOLVER ================= */
.botonera-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.btn-save,
.btn-cerrar,
.btn-delete {
    height: 36px;
    padding: 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    cursor: pointer;
}

.btn-save {
    background: #2563eb;
    color: #fff;
}

.btn-save:hover {
    background: #1e40af;
}

.btn-cerrar {
    background: #4b5563;
    color: #fff;
    text-decoration: none;
}

.btn-cerrar:hover {
    background: #374151;
    text-decoration: none;
}

.btn-delete {
    background: #dc2626;
    color: #fff;
    text-decoration: none;
    /* rojo */
    box-shadow: 0 0 0 1px rgba(220, 38, 38, .35);
}

.btn-delete:hover {
    background: #b91c1c;
    text-decoration: none;
    /* rojo oscuro */
}

/* ===== BOTONERA CON ELIMINAR SEPARADO ===== */
.botonera-acciones {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
}

/* Grupo izquierdo */
.acciones-izq {
    display: flex;
    gap: 12px;
}


/* ================= BUSCAR EN LISTADOS ================= */
.acciones-superior {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.buscar-input {
    max-width: 280px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.buscar-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0px 0px 3px #60a5fa;
}

/* ===== LOGIN PROFESIONAL ===== */
.login-wrapper {
    display: flex;
    justify-content: center;
    padding-top: 80px;
}

.login-box {
    width: 900px;
    background: white;
    border-radius: 10px;
    padding: 35px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.10);
}

.login-left {
    padding-right: 30px;
}

.login-title {
    font-size: 26px;
    text-align: left;
    margin-bottom: 20px;
    color: #222;
}

.login-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 15px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

.btn-login:hover {
    background: #1e40af;
}

.forgot-link {
    display: block;
    margin-top: 15px;
    text-align: left;
    color: #2563eb;
}

.login-error {
    background: #fee2e2;
    padding: 12px;
    border-left: 5px solid #dc2626;
    margin-bottom: 15px;
    border-radius: 6px;
    font-size: 15px;
    color: #b91c1c;
}

/* Columna derecha */
.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* LOGIN – IMAGEN AJUSTADA */
.login-logo {
    max-width: 320px;
    width: 100%;
    display: block;
    margin: 25px auto 0;
}

/* LOGO DEL PANEL (HEADER) */
.panel-logo {
    height: 55px;
    width: auto;
    margin-right: 15px;
}

/* =================== MENÚ TIPO OFFICE =================== */
/* Logo panel */
.panel-logo {
    height: 45px;
    width: auto;
}

/* Contenedor menú */
.menu-container {
    display: flex;
    gap: 12px;
    /* Más estilo Office */
    align-items: center;
}

/* Ítems del menú principal */
.menu-item {
    background: none !important;
    /* ❗ Sin cajas azules */
    color: #222;
    font-size: 13px;
    /* ❗ Tamaño Office */
    padding: 4px 6px;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    /* Subrayado al activar */
}

/* ===== BOTÓN TEMA ESTILO OFFICE ===== */
.btn-tema {
    background: none !important;
    border: 1px solid #aaa;
    padding: 4px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    color: #222;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s ease-in-out;
}

.btn-tema:hover {
    border-color: #0056d6;
    color: #0056d6;
}

/* Ícono dentro del botón */
.btn-tema .icono-tema {
    font-size: 14px;
}

/* Oscuro */
.dark .btn-tema {
    border-color: #666;
    color: #fff;
}

.dark .btn-tema:hover {
    border-color: #ffd700;
    color: #ffd700;
}

/* Hover */
.menu-item:hover {
    color: #0056d6;
    border-bottom: 2px solid #0056d6;
}

/* Activo */
.menu-active {
    font-weight: bold;
    border-bottom: 2px solid #0056d6;
}

/* Submenús */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    padding: 8px 0;
    min-width: 180px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    display: none;
}

.menu-item:hover .submenu {
    display: block;
}

/* Enlaces del submenú */
.submenu a {
    display: block;
    padding: 8px 14px;
    color: #222;
    text-decoration: none;
    font-size: 13px;
}

.submenu a:hover {
    background: #e8edff;
}

/* ------ TEMA OSCURO ------ */
.dark .main-header {
    background: #1f1f1f;
    border-color: #333;
}

.dark .menu-item {
    color: #e8e8e8;
}

.dark .menu-item:hover {
    color: #ffd700;
    border-bottom: 2px solid #ffd700;
}

.dark .menu-active {
    border-bottom: 2px solid #ffd700;
    color: #ffd700;
}

.dark .submenu {
    background: #2a2a2a;
}

.dark .submenu a {
    color: #ffffff;
}

.dark .submenu a:hover {
    background: #444;
}

/* ============================
   FOOTER PROFESIONAL
   ============================ */
.main-footer {
    height: 40px;
    /* 👈 ALTURA REAL */
    padding: 0px 16px;
    /* ❌ sin padding vertical */
    background: #f1f1f1;
    border-top: 1px solid #ddd;
    color: #555;
    font-size: 12px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}


/* ZONAS */
.footer-left {
    justify-self: start;
}

.footer-center {
    justify-self: center;
    font-weight: 500;
}

.footer-right {
    justify-self: end;
    display: flex;
    gap: 8px;
}

/* Separador */
.footer-sep {
    margin: 0 6px;
    color: #999;
}

/* Indicadores teclado */
.kbd-indicator {
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #aaa;
    font-size: 11px;
    color: #888;
}

.kbd-indicator.active {
    background: #0078d4;
    color: #fff;
    border-color: #0078d4;
}

.dark .main-footer {
    background: #202020;
    border-top: 1px solid #444;
    color: #ccc;
}

.footer-right strong {
    color: #0078d4;
}

.dark .footer-right strong {
    color: #ffd700;
}

body.dark .main-footer {
    background: #1f1f1f;
    color: #ccc;
    border-top-color: #333;
}

body.dark .kbd-indicator {
    border-color: #555;
    color: #aaa;
}

body.dark .kbd-indicator.active {
    background: #f9c74f;
    color: #000;
    border-color: #f9c74f;
}

/* CONTENEDOR PRINCIPAL DE MÓDULOS */
.app-window {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 20px 24px;
    margin: 20px auto;
    width: calc(100% - 40px);
    max-width: 1200px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* TÍTULO DE MÓDULO */
.app-window h2 {
    margin-top: 0;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

/* SUBTÍTULO */
.app-subtitle {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

/* ===========================
   FIX TEXTO EN TABLAS
   =========================== */
/* CONTENEDOR PRINCIPAL DE CADA MÓDULO */
.app-window {
    width: 90%;
    max-width: 1400px;
    margin: 30px auto;
    padding: 22px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    color: #1f2937;
    display: flex;
    flex-direction: column;
}

.table-wrapper {
    /* max-height: 520px; */
    /* 👈 ajusta a tu gusto */
    overflow: hidden;
    margin-top: 10px;
    flex: 1;
}

/* Barra superior */
.acciones-superior {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tabla */
.tabla-modern {
    width: 100%;
    border-collapse: collapse;
    font-family: "Segoe UI", sans-serif;
    font-size: 13px;
}

.tabla-modern th {
    background: #e5e7eb;
    padding: 10px;
    text-align: left;
}

.tabla-modern td {
    padding: 9px;
    border-bottom: 1px solid #ddd;
}

/* Acciones */
.acciones-tabla a {
    margin-right: 6px;
}

/* Badges */
.badge-m {
    background: #3b82f6;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.badge-f {
    background: #ec4899;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .app-window {
        width: 95%;
        padding: 16px;
        /* margin: 20px auto; */
    }
}

@media (max-width: 480px) {
    .app-window {
        width: 98%;
        padding: 12px;
        /*  border-radius: 8px; */
    }
}


/* Encabezados */
.app-window table th {
    background: #e5e7eb;
    color: #111827;
}

/* Celdas */
.app-window table td {
    background: #ffffff;
    color: #111827;
}

/* ===========================
   TABLAS EN MODO OSCURO
   =========================== */
.dark .app-window {
    background: rgba(30, 30, 30, 0.92);
    color: #e5e7eb;
}

.dark .app-window table th {
    background: #374151;
    color: #f9fafb;
}

.dark .app-window table td {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
}


/* ===============================
   LISTADOS / VENTANAS
================================ */

.listado-card {
    width: 90%;
    max-width: 1400px;
    margin: 20px auto;
    min-height: calc(100vh - 220px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

/* CABECERA */
.card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

/* BUSCADOR */
.search-box input {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #ccc;
    width: 220px;
}

/* BOTÓN */
.btn-primary {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
    text-decoration: none;
}

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

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}


.tabla {
    width: 100%;
    border-collapse: collapse;
    font-family: "Segoe UI", sans-serif;
    font-size: 13px;
}

.tabla th {
    background: #e5e7eb;
    padding: 8px;
    font-weight: 600;
    border-bottom: 1px solid #ccc;
}

.tabla td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

/* SEXO */
.tag {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.tag.femenino {
    background: #f472b6;
    color: #fff;
}

.tag.masculino {
    background: #3b82f6;
    color: #fff;
}

/* ACCIONES */
.acciones {
    text-align: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    text-decoration: none;
    margin: 0 2px;
}

.icon-btn.edit {
    background: #e0f2fe;
    color: #0369a1;
}

.icon-btn.delete {
    background: #fee2e2;
    color: #b91c1c;
}

.icon-btn:hover {
    opacity: 0.8;
}

/* FOOTER TABLA */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    font-size: 12px;
}

.paginacion a {
    margin: 0 4px;
    text-decoration: none;
    color: #2563eb;
}

.paginacion a.active {
    font-weight: bold;
    text-decoration: underline;
}

.workspace {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
}

.app-frame {
    width: 100%;
    max-width: 1500px;
    min-height: calc(100vh - 190px);

    background: #ffffff;
    border-radius: 14px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 22px 26px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dark .app-frame {
    background: #1e1e1e;
    color: #e5e7eb;
    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* CAPA GLOBAL */
#window-layer {
    position: fixed;
    inset: 0;
    z-index: 999999;
    pointer-events: none;
}

/* CUANDO HAY MODAL ABIERTO */
#window-layer.active {
    pointer-events: auto;
    /* 🔒 BLOQUEA TODO */
}

/* Fondo oscuro */
#window-layer.active::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

/* CADA VENTANA (SÍ CAPTURA CLICS) */
#window-layer .overlay-window-instance {
    pointer-events: auto;
}

.btn-close-window {
    background: transparent;
    border: none;
    color: var(--win-header-text);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: .7;
    transition: background 0.2s ease;
}

.btn-close-window:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ef4444;
    border-color: #c50f1f;
    opacity: 1;
}

/* 🌙 Tema oscuro */
body.dark {
    --win-bg: #1e1e1e;
    --win-text: #e5e7eb;
    --win-border: #2d2d2d;
    --win-header-bg: linear-gradient(to bottom, #2a2a2a, #1f1f1f);
    --win-header-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0f172a;
        --bg-panel: #020617;
        --bg-header: #020617;
        --bg-window: #020617;
        --text-main: #e5e7eb;
        --text-muted: #9ca3af;
        --border-color: #1e293b;
        --accent: #3b82f6;
    }
}

html[data-theme="dark"] {
    --bg-main: #0f172a;
    /* mismas variables del dark */
}

/* oscuro */
.dark .overlay-window-instance {
    background: #1e1e1e;
    color: #e5e7eb;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}

.overlay.show {
    display: block;
}

.overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
}

.overlay-window {
    position: relative;
    width: min(1500px, calc(100% - 60px));
    height: calc(100vh - 190px);
    margin: 30px auto;
    background: #ffffff;
    border-radius: 14px;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.overlay-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 16px;
    min-height: 38px;
    /*original min-height: 44px;*/
    height: 38px;
    /*original height: 44px;*/
    background: var(--win-header-bg);
    color: var(--win-header-text);
    border-bottom: 1px solid var(--win-border);
    font-family: "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: move;
}

.overlay-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--win-header-text);
}

.overlay-topbar span {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: none;
    padding-left: 2px;
    /* micro-ajuste fino */
}

.overlay-close {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
}

.overlay-close:hover {
    opacity: .85;
}

.overlay-body {
    padding: 16px;
    background: var(--win-bg);
    color: var(--win-text);
    font-family: "Segoe UI", sans-serif;
    font-size: 13px;
}

/* MODO OSCURO (usa tu .dark existente) */
.dark .overlay-backdrop {
    background: rgba(0, 0, 0, .55);
}

.dark .overlay-window {
    background: #1e1e1e;
    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

.dark .overlay-topbar {
    border-bottom-color: #2b2b2b;
}

.dark .overlay-title {
    color: #e5e7eb;
}

.dark .overlay-close {
    background: #1e1e1e;
    border-color: #444;
    color: #e5e7eb;
}

.tabla thead th {
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 10;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.paginacion button {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    margin: 0 2px;
    border-radius: 4px;
    cursor: pointer;
}

.paginacion button:hover {
    background: var(--accent);
    color: #fff;
}

/* === SELECCIÓN DE FILA === */
.tabla tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.tabla tbody tr:hover {
    background: rgba(37, 99, 235, 0.08);
}

.tabla tbody tr.selected {
    background: #2563eb !important;
    color: #ffffff;
}

.tabla tbody tr.selected td {
    color: #ffffff;
}

.tabla tbody tr {
    cursor: pointer;
}

.tabla tbody tr.selected {
    background: var(--accent);
    color: #fff;
}

.tabla tbody tr.selected td {
    color: #fff;
}

/* ===== FIX CABECERA TABLA EN OVERLAY ===== */
.overlay-window-instance .tabla thead th {
    background: var(--win-header-bg) !important;
    color: var(--win-header-text) !important;
    box-shadow: inset 0 -1px 0 var(--win-border);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .3px;
}

/* Dark explícito */
body.dark .overlay-window-instance .tabla thead th {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* === VENTANA SIN SCROLL === */
.overlay-window-instance {
    position: fixed;
    /* position: fixed; */
    top: var(--header-h);
    bottom: var(--footer-h);
    left: 0;
    right: 0;
    background: var(--win-bg);
    color: var(--win-text);
    border: 1px solid var(--win-border);
    border-radius: 0px;
    border: 1px solid var(--win-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.window-body {
    padding: 12px;
    box-sizing: border-box;
}

/* ===== FIX CABECERA TABLA EN OVERLAY-2 PARA EDICION DE REGISTROS MAESTROS ===== */
.overlay-window-instance-2 {
    position: fixed;
    z-index: 1;
    top: 5vh;
    bottom: 5vh;
    left: 8vw;
    right: 8vw;
    max-width: 1300px;
    margin: auto;
    background: var(--win-bg);
    color: var(--win-text);
    border: 1px solid var(--win-border);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* padding: 18px 22px; */
    padding: 0 !important;
    /* ✅ esto pega la topbar a los bordes */
}



.overlay-window-instance-2 .tabla-2 thead th {
    background: var(--win-header-bg) !important;
    color: var(--win-header-text) !important;
    box-shadow: inset 0 -1px 0 var(--win-border);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .3px;
}

body.dark .overlay-window-instance-2 .tabla-2 thead th {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

/* CADA VENTANA (SÍ CAPTURA CLICS) */
#window-layer .overlay-window-instance-2 {
    pointer-events: auto;
}

.btn-close-window {
    background: transparent;
    border: none;
    color: var(--win-header-text);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    opacity: .7;
    transition: background 0.2s ease;
}

/* ================= BOTÓN ELIMINAR ================= */
.btn-delete {
    background: #dc2626;
}

.btn-delete:hover {
    background: #b91c1c;
}

form[data-mode="view"] input,
form[data-mode="view"] select {
    background: #f3f4f6;
    cursor: not-allowed;
}

.panel-contenido,
.overlay-body,
.window-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-box {
    /* flex: 1; */
    max-height: calc(100vh - 220px);
    min-height: 0;
    /* 🔑 BUG FIX DE FLEXBOX */
    overflow-y: auto;
    /* ✅ ÚNICO SCROLL */
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* Ventanas normales */
.overlay-window-instance {
    z-index: 100;
}

/* Backdrop modal */
#window-layer.active::before {
    z-index: 200;
}

/* Ventana MODAL */
.overlay-window-instance-2 {
    z-index: 300 !important;
}

/* EXCEPCIÓN: solo modales con formulario largo */
.overlay-window-instance-2 .overlay-body {
    overflow: hidden;
    /* el scroll lo maneja .table-box */
    overflow-y: auto;
    padding: 18px 22px;
}

/* ===== MODAL VENTANA EDICION ===== */

/* El modal completo NO scrollea */
.overlay-window-instance-2 {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* SOLO el cuerpo del modal scrollea */
.overlay-window-instance-2 .overlay-body.form-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
}

/* Grid del formulario */
.form-modern {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
}

/* ===============================
   MODO OSCURO – CAMPOS DESHABILITADOS
=============================== */

body.dark input:disabled,
body.dark select:disabled,
body.dark textarea:disabled,
body.dark input[readonly],
body.dark textarea[readonly] {
    background-color: #2b2b2b !important;
    color: #dcdcdc !important;
    border: 1px solid #444 !important;
    opacity: 1 !important;
    /* 🔑 evita el efecto lavado */
    cursor: not-allowed;
}

/* Placeholder en modo oscuro */
body.dark input:disabled::placeholder,
body.dark textarea:disabled::placeholder {
    color: #888;
}

/* Select deshabilitado */
body.dark select:disabled {
    appearance: none;
}

body.dark input:disabled {
    background-color: #262626;
    color: #aaa;
}

/* ============================= */
/* DISCIPLINAS - layout aislado  */
/* ============================= */
/* ============================= */
/* TABLE-BOX-2 (OVERLAYS CHICOS) */
/* ============================= */

.table-box-2 {
    width: 100%;
    overflow-y: auto;
    /* scroll interno */
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
}

/* responsive: pantallas chicas */
@media (max-width: 768px) {
    .table-box-2 {
        max-height: 200px;
    }
}

.dsi-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
    padding: 10px 12px;

}

/* lista */
.dsi-browser {
    flex: 1;
    /* 🔑 crece */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* evita tabla encogida */
.dsi-browser .table-box-2 {
    width: 100%;
    max-width: none;
}

/* formulario */
.dsi-editor {
    width: 260px;
}

/* fuerza cabecera clara (igual a clientes) */
.dsi-browser .tabla thead th {
    background: #f2f3f5;
    color: #333;
}

.overlay-window-instance-3 {
    position: fixed;
    top: calc(var(--header-h) + 16px);
    bottom: calc(var(--footer-h) + 16px);
    left: 50%;
    transform: translateX(-50%);
    width: 620px;
    /* 👈 compacta */
    max-width: calc(100% - 32px);
    /* max-height: calc(100vh - 160px); */

    font-family: "Segoe UI", sans-serif;
    font-size: 11px;

    background: #fff;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .35);
    z-index: 1002;

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 768px) {
    .overlay-window-instance-3 {
        top: 60px;
        bottom: 20px;
        /* un poco más de aire abajo */
        width: 100%;
        max-width: calc(100% - 16px);
    }
}

/* tabla interna */
@media (max-width: 768px) {
    .overlay-window-instance-3 .table-box-2 {
        max-height: 45vh;
    }
}

.overlay-window-instance-3 .table-box-2 {
    flex: 1;
    /* 🔑 que crezca */
    min-height: 0;
    /* 🔑 permite que flex + scroll funcione */
    min-width: 0;
    /* 🔑 CLAVE PARA ANCHO */
    width: 100%;
    margin: 12px;

    overflow-y: auto;
    overflow-x: hidden;

    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
}


#tablaDisciplinas {
    /*  max-height: 220px; */
    overflow-y: auto;
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    /* ✅ más estable al achicar */
}

#tablaDisciplinas th,
#tablaDisciplinas td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* evita quiebres feos */
    vertical-align: middle;
}


.tabla-inline td {
    vertical-align: middle;
}

.tabla-inline input[type="text"] {
    width: 100%;
    height: 32px;
    padding: 4px 8px;
    font-size: 11px;
}

.tabla-inline .btn-inline {
    padding: 2px 6px;
    /* ⬅ solo aire mínimo */
    font-size: 11px;
    line-height: 1.2;
    margin: 0 2px;
    min-width: unset;
    /* ⬅ CLAVE */
    width: auto;
    /* ⬅ CLAVE */
    display: inline-flex;
    /* ⬅ se ajusta al texto */
    align-items: center;
    justify-content: center;
}


.tabla-inline tr.editing {
    background: #eef6ff;
}

/* Contenedor de botones en tabla */
.tabla-inline td:last-child {
    white-space: nowrap;
    /* evita salto de línea */
}

#tablaDisciplinas .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 3px 10px;
    line-height: 1.2;
}

.overlay-window-instance-3 .tabla-inline .btn-inline {
    padding: 2px 6px;
    font-size: 11px;
}

#tablaDisciplinas td:last-child {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* DISCIPLINAS: forzar 2 botones en 1 sola línea */
.overlay-window-instance-3 #tablaDisciplinas td:last-child {
    white-space: nowrap;
    /* no permitir salto */
}


.btn-table-chica {
    /*  padding: 2px 6px; */
    font-size: 11px;
    line-height: 1.2;
    border-radius: 4px;
    min-width: unset;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 2px;
}


.btn-table-chica.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-table-chica.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-table-chica.btn-danger {
    background: #dc3545;
    color: #fff;
}

.overlay-window-instance-3 .tabla-inline .btn-inline {
    padding: 2px 6px;
    font-size: 11px;
}

/* DISCIPLINAS: forzar 2 botones en 1 sola línea */
.overlay-window-instance-3 #tablaDisciplinas td:last-child {
    white-space: nowrap;
    /* no permitir salto */
}


/* botones compactos solo en esta tabla */
.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn,
.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn-table-chica {
    display: inline-flex;
    /* clave: ya no block */
    width: auto;
    /* que no se estire */
    padding: 3px 5px;
    margin: 0 3px;
    /* pequeño espacio lateral */
    line-height: 1.2;
    border-radius: 4px;
    vertical-align: middle;
}

/* opcional: que la celda "Opciones" no sea minúscula */
.overlay-window-instance-3 #tablaDisciplinas th:last-child,
.overlay-window-instance-3 #tablaDisciplinas td:last-child {
    min-width: 170px;
}

/* Centrar columna N° (header y celdas) */
#tablaDisciplinas th:first-child,
#tablaDisciplinas td:first-child {
    text-align: center;
    vertical-align: middle;
    width: 50px;
    /* opcional: ancho fijo elegante */
}



.overlay-window-instance-3 button,
.overlay-window-instance-3 input,
.overlay-window-instance-3 table {
    font-family: "Segoe UI", sans-serif;
    font-size: 11px;
}

.overlay-window-instance-3 .btn-table-chica {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: auto !important;
    /* 🔑 CLAVE */
    min-width: unset !important;
    text-align: center !important;

    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

/* DISCIPLINAS: celda Opciones = 2 botones en una sola línea */
.overlay-window-instance-3 #tablaDisciplinas td:last-child {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    /* o center si quieres centrarlos en la celda */
    white-space: nowrap;
}

/* Botones compactos SOLO dentro de esa tabla */
.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn,
.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn-table-chica {
    display: inline-flex !important;
    /* gana a display:block */
    align-items: center !important;
    justify-content: center !important;
    /* centra el texto */
    text-align: center !important;
    /* por si hay text-align:left global */
    width: auto !important;
    /* evita 100% */
    min-width: 0 !important;
    /* evita min-width global */
    padding: 5px 12px !important;
    /* menos “aire” lateral */
    line-height: 1.1;
    white-space: nowrap;
}

/* Si tu .btn tiene margin que empuja, lo neutralizamos aquí */
.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn,
.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn-table-chica {
    margin: 0 !important;
}

@media (max-width: 768px) {
    .overlay-window-instance-3 {
        top: 60px;
        bottom: 20px;
        /* un poco más de aire abajo */
        width: 100%;
        max-width: calc(100% - 16px);
    }
}


@media (max-width: 480px) {

    /* ocultar N° */
    #tablaDisciplinas th:first-child,
    #tablaDisciplinas td:first-child {
        display: none;
        text-align: center;
        width: 50px;
    }

    /* disciplina ocupa más espacio */
    #tablaDisciplinas th:nth-child(2),
    #tablaDisciplinas td:nth-child(2) {
        width: 60%;
    }

    /* opciones más compactas */
    #tablaDisciplinas th:last-child,
    #tablaDisciplinas td:last-child {
        width: 40%;
        text-align: center;
        padding: 6px 8px;
    }
}

.dark .overlay-window-instance-3 {
    background: #1e1e1e;
    color: #e5e5e5;
}

.dark .overlay-window-instance-3 .tabla {
    background: #1e1e1e;
    color: #e5e5e5;
    border-color: #3a3a3a;
}

.dark .overlay-window-instance-3 .tabla thead th {
    background: #2a2a2a;
    color: #ffffff;
    border-bottom: 1px solid #3a3a3a;
}

.dark .overlay-window-instance-3 .tabla tbody tr {
    background: #1e1e1e;
}

.dark .overlay-window-instance-3 .tabla tbody tr td {
    border-color: #3a3a3a;
}

.dark .overlay-window-instance-3 .tabla tbody tr:hover {
    background: #2a2a2a;
}

.dark .overlay-window-instance-3 .tabla-inline tr.editing {
    background: #263040;
}

.dark .overlay-window-instance-3 .tabla-inline input[type="text"] {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #444;
}

.dark .overlay-window-instance-3 .btn-table-chica {
    background: #2f80ed;
    color: #ffffff;
}

.dark .overlay-window-instance-3 .btn-table-chica.btn-danger {
    background: #c0392b;
}

.dsi-footer {
    padding: 12px 16px;
    /*     border-top: 1px solid var(--border-color); */
    display: flex;
    justify-content: flex-start;
    gap: 12px;
}

.dark .overlay-window-instance-3 .overlay-body,
.dark .overlay-window-instance-3 .dsi-layout,
.dark .overlay-window-instance-3 .dsi-browser {
    background: #1e1e1e;
}

.dark .overlay-window-instance-3 .table-box-2 {
    background: #1e1e1e;
    /* ← CLAVE */
}

.dark .dsi-footer {
    background: #1e1e1e;
    border-top: 1px solid #3a3a3a;
}

/* El cuerpo de la ventana debe ser flex y permitir que crezcan hijos */
.overlay-window-instance-3 .overlay-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* 🔑 clave para que el scroll funcione bien */
}

/* Tu layout interno también debe crecer */
.overlay-window-instance-3 .dsi-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px;
    gap: 12px;
}

/* La zona de tabla crece y ocupa TODO antes del footer */
.overlay-window-instance-3 .dsi-browser {
    flex: 1;
    min-height: 0;
    /* 🔑 clave */
    display: flex;
    flex-direction: column;
}

/* El body del overlay crece y reparte espacio */
.overlay-window-instance-3 .overlay-body.dsi-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    min-height: 0;
    /* ✅ CLAVE */
}

.overlay-window-instance-3 *,
.overlay-window-instance-3 *::before,
.overlay-window-instance-3 *::after {
    box-sizing: border-box;
}

.col-numero {
    text-align: center;
    vertical-align: middle;
    width: 50px;
}

/* === FIX CHROME: botones dentro de tabla Disciplinas === */
.overlay-window-instance-3 #tablaDisciplinas .btn {
    min-width: unset !important;
    width: auto !important;
    padding: 5px 10px;
    font-size: 11px;
    white-space: nowrap;
}

/* Columna Opciones estable */
.overlay-window-instance-3 #tablaDisciplinas th:last-child,
.overlay-window-instance-3 #tablaDisciplinas td:last-child {
    width: 180px;
    min-width: 180px;
}

#tablaDisciplinas th:first-child,
#tablaDisciplinas td:first-child {
    text-align: center;
    width: 50px;
}



/* =========================================================
   DISCIPLINAS (overlay-window-instance-3) — FIX CHROME
   Pegar AL FINAL de estilos.css
========================================================= */

/* 1) Evita que el contenedor se pase de ancho por margin + width */
.overlay-window-instance-3 .table-box-2 {
    width: calc(100% - 24px);
    /* 12px + 12px */
    margin: 12px;
    box-sizing: border-box;
    min-width: 0;
    overflow-x: hidden;
}

/* 2) Tabla estable en Chrome */
#tablaDisciplinas {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

/* 3) Columnas con ancho fijo (N° y Opciones) */
#tablaDisciplinas th:first-child,
#tablaDisciplinas td:first-child {
    width: 60px;
    text-align: center;
}

#tablaDisciplinas th:last-child,
#tablaDisciplinas td:last-child {
    width: 200px;
    /* suficiente para 2 botones compactos */
    min-width: 200px;
}

/* 4) NO uses min-width global de .btn dentro de esta tabla */
.overlay-window-instance-3 #tablaDisciplinas .btn {
    min-width: 0 !important;
    /* mata el min-width:120 global */
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 11px !important;
    line-height: 1.1;
    white-space: nowrap;
}

/* 5) Alineación de botones SIN romper la tabla */
.overlay-window-instance-3 #tablaDisciplinas td:last-child {
    text-align: left;
    /* o center si quieres */
    white-space: nowrap;
}

.overlay-window-instance-3 #tablaDisciplinas td:last-child .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 6px 0 0 !important;
    /* separa botones */
}

/* 6) Evita cortes raros de texto */
#tablaDisciplinas th,
#tablaDisciplinas td {
    overflow: hidden;
    text-overflow: ellipsis;
}

#tablaLocales {
    table-layout: fixed;
    width: 100%;
}

/* el contenedor real con scroll */
.overlay-window-instance-2 .table-box {
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: auto;
    /* ✅ si aún no cabe, aparece scroll horizontal (sin salirse) */
}

/* tabla estable dentro del contenedor */
#tablaLocales {
    width: 100%;
    table-layout: fixed;
}

/* Evita que textos largos empujen columnas */
#tablaLocales th,
#tablaLocales td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* Columnas por porcentaje (no se sale) */
#tablaLocales th:nth-child(1),
#tablaLocales td:nth-child(1) {
    width: 6%;
}

/* # */
#tablaLocales th:nth-child(2),
#tablaLocales td:nth-child(2) {
    width: 24%;
}

/* Nombre */
#tablaLocales th:nth-child(3),
#tablaLocales td:nth-child(3) {
    width: 26%;
}

/* Dirección */
#tablaLocales th:nth-child(4),
#tablaLocales td:nth-child(4) {
    width: 22%;
}

/* Distrito */
#tablaLocales th:nth-child(5),
#tablaLocales td:nth-child(5) {
    width: 10%;
}

/* Estado */
#tablaLocales th:nth-child(6),
#tablaLocales td:nth-child(6) {
    width: 12%;
}

/* Acciones */

/* #tablaLocales th:nth-child(1),
#tablaLocales td:nth-child(1) {
    width: 50px;
}

#tablaLocales th:nth-child(2),
#tablaLocales td:nth-child(2) {
    width: 260px;
}

#tablaLocales th:nth-child(3),
#tablaLocales td:nth-child(3) {
    width: 280px;
}

#tablaLocales th:nth-child(4),
#tablaLocales td:nth-child(4) {
    width: 220px;
}

#tablaLocales th:nth-child(5),
#tablaLocales td:nth-child(5) {
    width: 120px;
}

#tablaLocales th:nth-child(6),
#tablaLocales td:nth-child(6) {
    width: 180px;
} */

#tablaLocales input,
#tablaLocales select {
    width: 100%;
    box-sizing: border-box;
}

/*Campos de Edición Personal*/
.w-80 {
    width: 80px;
}

.w-120 {
    width: 120px;
}

.w-150 {
    width: 150px;
}

.w-180 {
    width: 180px;
}

.w-220 {
    width: 220px;
}

.w-260 {
    width: 260px;
}

.w-300 {
    width: 300px;
}

.w-350 {
    width: 350px;
}

.w-400 {
    width: 400px;
}

.personal-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

.especialidades-box {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    color: var(--text-color);
    padding: 16px 18px;
    border-radius: 14px;
}

.modal,
.swal2-container,
.toast-container {
    z-index: 1000000 !important;
}

/* ===== FLATPICKR ESTILO MATERIAL ===== */
.flatpickr-calendar {
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    font-family: Segoe UI, sans-serif;
}

.flatpickr-months {
    background: #1976d2;
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.flatpickr-months .flatpickr-month {
    color: #fff;
}

.flatpickr-weekdays {
    background: #f5f5f5;
}

.flatpickr-day {
    border-radius: 50%;
}

.flatpickr-day.selected,
.flatpickr-day.today {
    background: #1976d2;
    color: #fff;
    border: none;
}

.flatpickr-day:hover {
    background: rgba(25, 118, 210, .15);
}

/* ===== FLATPICKR – HEADER GRIS CLARO ===== */
.flatpickr-months {
    background: #f2f2f2;
    /* gris claro */
    border-bottom: 1px solid #dcdcdc;
    /* línea sutil */
}

.flatpickr-months .flatpickr-month,
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: #333;
    /* texto oscuro */
    fill: #333;
    /* flechas */
}

.flatpickr-current-month select,
.flatpickr-current-month input {
    color: #333;
    font-weight: 500;
    background: transparent;
}

/* ===== FLATPICKR TEMA OSCURO ===== */
body.dark .flatpickr-calendar {
    background: #2b2b2b;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}

/* Header (mes / año) */
body.dark .flatpickr-months {
    background: #3a3a3a;
    border-bottom: 1px solid #4a4a4a;
}

body.dark .flatpickr-months,
body.dark .flatpickr-month,
body.dark .flatpickr-prev-month,
body.dark .flatpickr-next-month {
    color: #f0f0f0;
    fill: #f0f0f0;
}

/* Días de la semana */
body.dark .flatpickr-weekdays {
    background: #2f2f2f;
}

body.dark .flatpickr-weekday {
    color: #bdbdbd;
}

/* Días */
body.dark .flatpickr-day {
    color: #e0e0e0;
}

body.dark .flatpickr-day:hover {
    background: rgba(255, 255, 255, .12);
}

/* Día seleccionado */
body.dark .flatpickr-day.selected,
body.dark .flatpickr-day.startRange,
body.dark .flatpickr-day.endRange {
    background: #1976d2;
    color: #fff;
    border: none;
}

/* Hoy */
body.dark .flatpickr-day.today {
    border-color: #1976d2;
}

/* Mes anterior / siguiente */
body.dark .flatpickr-day.prevMonthDay,
body.dark .flatpickr-day.nextMonthDay {
    color: #7a7a7a;
}

.especialidad-item {
    display: grid;
    grid-template-columns: 22px 1fr;
    column-gap: 10px;

    align-items: center;
    padding: 6px 0;
    cursor: pointer;
}

.especialidad-item span {
    grid-column: 2;
    line-height: 1.35;
    display: block;
    /* word-wrap: break-word; */
}

.especialidad-item input[type="checkbox"] {
    grid-column: 1;
    justify-self: start;
    /* clave: ya NO end */
    margin: 0;
    transform: translateY(1px);
    /* 🔑 micro ajuste vertical */
}

/* Checkbox marcado pero deshabilitado */
.especialidad-item input[type="checkbox"]:disabled:checked {
    accent-color: #198754;
    /* verde */
    opacity: 1;
    filter: brightness(1.1);
}

/* Checkbox deshabilitado no marcado */
.especialidad-item input[type="checkbox"]:disabled:not(:checked) {
    opacity: 0.5;
}

/* =========================================
   FORMULARIO COMPACTO REAL
========================================= */

.form-modern.compacto {
    gap: 8px 18px;
    column-gap: 32px;
    /* separación ENTRE columna izquierda y derecha */
}

/* ===== FORMULARIO HORIZONTAL (label + input en una línea) ===== */
.form-modern .field-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: center;
    column-gap: 10px;
}

/* Label alineado y compacto */
.form-modern .field-row label {
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
}

/* Inputs ocupan todo el espacio restante */
.form-modern .field-row input,
.form-modern .field-row select {
    width: 100%;
}

/* === FIX DEFINITIVO: alineación checkbox + texto === */
.especialidad-item {
    display: flex;
    /* 🔑 cambio CLAVE */

    flex-direction: row-reverse;
    /* 🔑 invierte el orden */
    justify-content: flex-end;

    align-items: center;
    /* centra vertical real */
    gap: 10px;
    padding: 6px 0;
    cursor: pointer;
}

/* quitar herencia problemática */
.especialidad-item {
    margin-bottom: 0;
    font-weight: normal;
}

/* checkbox limpio */
.especialidad-item input[type="checkbox"] {
    margin: 0;
    /*   flex-shrink: 0; */
}

/* texto */
.especialidad-item span {
    line-height: normal;
    /* 🔑 evita desfase */
    /*   display: inline-block; */
}

/* ===== BOTONERA OVERLAY-2 ===== */
.overlay-window-instance-2 .botonera-form,
.overlay-window-instance-2 .botonera-acciones {
    margin-top: 10px;
    /* separa del formulario */
    margin-bottom: 25px;
    /* evita que quede pegado abajo */
    padding-left: 22px;
    /* 👈 margen izquierdo */
}

.overlay-window-instance-2 .overlay-body {
    padding-left: 22px;
}

/* ==============================
   LOCALES: AJUSTE RESPONSIVE 1366
   (sin tocar overlays globales)
================================= */

/* 1) Evita que la columna Acciones se agrande por min-width global */
#tablaLocales td:last-child,
#tablaLocales th:last-child {
    white-space: nowrap;
}

#tablaLocales td:last-child .btn {
    min-width: 0 !important;
    /* mata el min-width:120 global */
    width: auto !important;
    padding: 5px 10px !important;
    /* botones más compactos */
    font-size: 12px !important;
    line-height: 1.1;
}

/* 2) Evita que Dirección/Distrito rompan el layout (muestran ... si es largo) */
#tablaLocales td,
#tablaLocales th {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 3) Cuando la pantalla sea 1366 o menos: reduce paddings/ancho columnas */
@media (max-width: 1366px) {

    /* más compacto */
    #tablaLocales {
        font-size: 12px;
    }

    #tablaLocales th,
    #tablaLocales td {
        padding: 6px !important;
    }

    /* ajusta anchos para que entren mejor */
    #tablaLocales th:nth-child(1),
    #tablaLocales td:nth-child(1) {
        width: 45px;
    }

    #tablaLocales th:nth-child(2),
    #tablaLocales td:nth-child(2) {
        width: 210px;
    }

    /* Nombre del local */

    #tablaLocales th:nth-child(3),
    #tablaLocales td:nth-child(3) {
        width: 240px;
    }

    /* Dirección */

    #tablaLocales th:nth-child(4),
    #tablaLocales td:nth-child(4) {
        width: 170px;
    }

    /* Distrito */

    #tablaLocales th:nth-child(5),
    #tablaLocales td:nth-child(5) {
        width: 95px;
    }

    /* Estado */

    #tablaLocales th:nth-child(6),
    #tablaLocales td:nth-child(6) {
        width: 140px;
    }

    /* Acciones */

    /* si aún así algún navegador recorta, mejor permitir scroll horizontal SOLO ahí */
    .overlay-window-instance-2 .table-box {
        overflow-x: auto;
    }
}


/* ===== FIX CABECERA LOCALES (overlay-2) ===== */

.overlay-window-instance-2 #tablaLocales thead th {
    background: #e5e7eb !important;
    /* gris claro fijo */
    color: #111827 !important;
    /* texto oscuro */
    font-weight: 600;
    border-bottom: 1px solid #d1d5db;
}

/* modo oscuro */
body.dark .overlay-window-instance-2 #tablaLocales thead th {
    background: #2a2a2a !important;
    color: #ffffff !important;
}

.filtro-estado-personal {
    min-width: 180px;
}

.acciones-superior {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.acciones-izquierda,
.acciones-derecha {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filtro-estado-personal {
    min-width: 170px;
}

#buscarPersonal {
    min-width: 240px;
}

/* =========================================================
   PERSONAL - FIX contador visible sobre footer principal
========================================================= */

/* La ventana principal debe repartir altura correctamente */
.overlay-window-instance {
    bottom: calc(var(--footer-h) + 2px);
    /* pequeño margen de seguridad */
}

/* El body de la ventana trabaja en columna */
.overlay-window-instance .overlay-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* La zona lista debe crecer y dejar espacio al footer interno */
.overlay-window-instance #personal-lista {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* La caja de tabla ocupa el alto disponible real */
.overlay-window-instance #personal-lista .table-box {
    flex: 1;
    min-height: 0;
    max-height: none;
    /* anulamos el cálculo fijo */
    overflow-y: auto;
    overflow-x: auto;
}


/* CLIENTES La zona lista debe crecer y dejar espacio al footer interno */
.overlay-window-instance #clientes-lista {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* CLIENTES La caja de tabla ocupa el alto disponible real */
.overlay-window-instance #clientes-lista .table-box {
    flex: 1;
    min-height: 0;
    max-height: none;
    /* anulamos el cálculo fijo */
    overflow-y: auto;
    overflow-x: auto;
}



/* El contador queda siempre visible */
.overlay-window-instance .table-footer {
    flex: 0 0 auto;
    margin-top: 8px;
    padding: 8px 4px 10px;
    border-top: 1px solid var(--border-color);
    background: var(--win-bg);
    position: relative;
    z-index: 2;
}

/* Ajuste fino para pantallas 1366x768 */
@media (max-width: 1366px) {
    .overlay-window-instance .overlay-body {
        padding: 12px;
    }

    .overlay-window-instance .table-footer {
        font-size: 12px;
        padding-bottom: 8px;
    }
}

.modal-aviso-azul {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000001;
}

.modal-aviso-azul__box {
    width: min(420px, 92vw);
    background: #ffffff;
    border: 1px solid #cfe0ff;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: modalFadeIn .18s ease-out;
}

.modal-aviso-azul__titulo {
    background: linear-gradient(180deg, #2f6df6 0%, #1f5ae0 100%);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    padding: 14px 18px;
}

.modal-aviso-azul__mensaje {
    padding: 22px 18px 14px;
    color: #24324a;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.modal-aviso-azul__acciones {
    display: flex;
    justify-content: center;
    padding: 0 18px 18px;
}

.modal-aviso-azul__ok {
    min-width: 110px;
    border-radius: 10px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.98);
    }

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

.modal-confirmacion-roja {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000001;
}

.modal-confirmacion-roja__box {
    width: min(430px, 92vw);
    background: #ffffff;
    border: 1px solid #ffd3d3;
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    animation: modalFadeIn .18s ease-out;
}

.modal-confirmacion-roja__titulo {
    background: linear-gradient(180deg, #e53935 0%, #c62828 100%);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    padding: 14px 18px;
}

.modal-confirmacion-roja__mensaje {
    padding: 22px 18px 14px;
    color: #3b2b2b;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.modal-confirmacion-roja__acciones {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 0 18px 18px;
}

.modal-confirmacion-roja__confirm,
.modal-confirmacion-roja__cancel {
    min-width: 120px;
    border-radius: 10px;
}

/* ===== Checkbox Vendedor ===== */

.checkbox-row {
    display: grid;
    grid-template-columns: 140px auto;
    align-items: center;
}

.checkbox-row .check-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    margin: 0;
    flex: none;
}

.checkbox-row .check-inline label {
    margin: 0;
    font-weight: 400;
}

/*=====================================================
  CHECKBOX ESTÁNDAR OLCOT
=====================================================*/

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.check-inline input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    margin: 0;
    flex: none;
}

.check-inline label {
    margin: 0;
    font-weight: 400;
}

.field-row input[type="checkbox"] {
    width: auto !important;
    height: auto;
}

/* =====================================================
   LINEAS - FIX ANCHO TABLA EN OVERLAY-2
===================================================== */

#winLineas *,
#winLineas *::before,
#winLineas *::after {
    box-sizing: border-box;
}

#winLineas .overlay-body.dsi-layout {
    padding: 12px 18px;
    width: 100%;
    min-width: 0;
}

#winLineas .dsi-browser {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

#winLineas .table-box-2 {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

#tablaLineas {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#tablaLineas th,
#tablaLineas td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tablaLineas th:nth-child(1),
#tablaLineas td:nth-child(1) {
    width: 70px;
    text-align: center;
}

#tablaLineas th:nth-child(2),
#tablaLineas td:nth-child(2) {
    width: 28%;
}

#tablaLineas th:nth-child(3),
#tablaLineas td:nth-child(3) {
    width: 32%;
}

#tablaLineas th:nth-child(4),
#tablaLineas td:nth-child(4) {
    width: 220px;
}

#tablaLineas td:last-child .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    margin-right: 6px;
}

/* =====================================================
   ARTÍCULOS - OLCOT
===================================================== */

#winArticulos .overlay-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#winArticulos #articulos-lista {
    flex: 1;
    min-height: 0;
}

#winArticulos .table-box {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: auto;
}

#tablaArticulos {
    min-width: 1250px;
    table-layout: fixed;
}

#tablaArticulos th,
#tablaArticulos td {
    /*  white-space: nowrap; */
    overflow: hidden;
    text-overflow: ellipsis;
}

#tablaArticulos .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
}

.art-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 18px;
}

.art-panel {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    background: var(--win-bg);
}

.art-panel h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.art-ayuda {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.art-colores-box {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.art-color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    cursor: pointer;
}

.art-color-item input {
    width: 16px !important;
    height: 16px !important;
    margin: 0;
}

.art-img-box {
    height: 150px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    background: rgba(148, 163, 184, .08);
}

.art-img-box img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
}

#winArticuloForm textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px;
    font-family: "Segoe UI", sans-serif;
}

@media (max-width: 1366px) {
    .art-grid {
        grid-template-columns: 1fr 300px;
        gap: 12px;
    }

    .art-colores-box {
        grid-template-columns: 1fr;
        max-height: 210px;
    }

    #winArticuloForm .form-modern.compacto {
        gap: 7px 14px;
    }
}

@media (max-width: 900px) {
    .art-grid {
        grid-template-columns: 1fr;
    }
}

.art-colores-box {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 170px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
}

.art-color-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    cursor: pointer;
    font-size: 13px;
}

.art-color-item input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 0;
}

.art-sin-colores {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px;
}

/* =====================================================
   LOGIN - FIX COLORES TEMA CLARO / OSCURO
===================================================== */

/* Tema claro */
.login-container {
    background: #f9f9f9 !important;
    color: #1f2937 !important;
}

.login-container h2,
.login-container label {
    color: #1f2937 !important;
}

/* Tema oscuro */
body.dark .login-container {
    background: #2c2c2c !important;
    color: #f3f4f6 !important;
    border-color: #555 !important;
}

body.dark .login-container h2,
body.dark .login-container label {
    color: #f3f4f6 !important;
}

/* Inputs */
.login-container input {
    background: #eaf2ff;
    color: #111827;
}

body.dark .login-container input {
    background: #333 !important;
    color: #ffffff !important;
    border-color: #666 !important;
}

.articulos-cards {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;

    align-content: start;
    align-items: start;
}

.art-card {
    background: #f8fafc;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px;
    text-align: center;

    overflow: visible;
}

.art-card-titulo {
    font-weight: 600;
    font-size: 14px;
    min-height: 40px;
    margin-bottom: 10px;
    color: #111827;
}

.art-card-img {
    height: 160px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.art-card-img img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.art-card-info {
    text-align: left;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 10px;
}

body.dark .art-card {
    background: #1f2937;
    border-color: #374151;
}

body.dark .art-card-titulo,
body.dark .art-card-info {
    color: #e5e7eb;
}

body.dark .art-card-img {
    background: #111827;
    border-color: #374151;
}

/* =====================================================
   ARTÍCULOS - AJUSTE COLUMNAS Y COLORES EN 2 LÍNEAS
===================================================== */

#tablaArticulos th:nth-child(3),
#tablaArticulos td:nth-child(3) {
    width: 30%;
    /* Descripción más chica */
}

#tablaArticulos th:nth-child(7),
#tablaArticulos td:nth-child(7) {
    width: 180px;
    /* Más espacio para colores */
    white-space: normal !important;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    /* max-height: 38px;   */
    /* permite aprox. 2 líneas */
}

#tablaArticulos th:nth-child(4),
#tablaArticulos td:nth-child(4) {
    width: 130px;
}

#tablaArticulos th:nth-child(5),
#tablaArticulos td:nth-child(5) {
    width: 130px;
}

#tablaArticulos th:nth-child(6),
#tablaArticulos td:nth-child(6) {
    width: 120px;
}

#tablaArticulos th:nth-child(8),
#tablaArticulos td:nth-child(8) {
    width: 90px;
    text-align: center;
}

#tablaArticulos th:nth-child(9),
#tablaArticulos td:nth-child(9) {
    width: 100px;
    text-align: center;
}

#tablaArticulos th:nth-child(10),
#tablaArticulos td:nth-child(10) {
    width: 120px;
    text-align: center;
}

/* =====================================================
   ARTÍCULOS - ZOOM DE IMAGEN AL PASAR EL MOUSE
===================================================== */

.art-card-img {
    overflow: visible;
    position: relative;
}

.art-card-img img {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    cursor: zoom-in;
    position: relative;
    z-index: 1;
}

.art-card-img:hover img {
    transform: scale(1.85);
    z-index: 50;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
}

/* =====================================================
   ARTÍCULOS - ZOOM IMAGEN EN LISTADO
===================================================== */

#tablaArticulos td:nth-child(8) {
    overflow: visible !important;
    position: relative;
}

#tablaArticulos td:nth-child(8) img {
    cursor: zoom-in;
    position: relative;
    z-index: 1;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#tablaArticulos td:nth-child(8):hover img {
    transform: scale(5);
    z-index: 1000;

    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* =====================================================
   ARTÍCULOS - PREVIEW FLOTANTE DE IMAGEN
===================================================== */

#artZoomPreview {
    position: fixed;
    width: 320px;
    height: 320px;
    display: none;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .35);
    z-index: 10000000;
    pointer-events: none;
    padding: 10px;
}

#artZoomPreview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

body.dark #artZoomPreview {
    background: #111827;
    border-color: #374151;
}

#articulosCards .art-card[style*="display: none"] {
    display: none !important;
}

/* =====================================================
   COTIZACIONES - OLCOT
===================================================== */

#tablaCotizaciones {
    min-width: 1500px;
    table-layout: fixed;
}

#tablaCotizaciones th,
#tablaCotizaciones td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tablaCotizaciones .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 9px !important;
    font-size: 12px !important;
}

.cot-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.cot-borrador {
    background: #fef3c7;
    color: #92400e;
}

.cot-emitida {
    background: #dbeafe;
    color: #1e40af;
}

.cot-pendiente {
    background: #ede9fe;
    color: #5b21b6;
}

.cot-aprobada {
    background: #dcfce7;
    color: #166534;
}

.cot-anulada {
    background: #fee2e2;
    color: #991b1b;
}

.cot-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
    background: rgba(148, 163, 184, .06);
}

.cot-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}



.cot-precios {
    margin-top: 10px;
    margin-bottom: 10px;
}

.cot-precios input {
    width: 100% !important;
    box-sizing: border-box;
}

.cot-precios th,
.cot-precios td {
    padding: 6px;
}

.cot-totales {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 12px 4px;
    font-size: 14px;
}

.cot-autosave {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

body.dark .cot-item {
    background: rgba(31, 41, 55, .65);
}

/* =====================================================
   OVERLAY 4 - COTIZACIONES AMPLIAS
===================================================== */

.overlay-window-instance-4 {
    position: fixed;
    z-index: 400 !important;

    top: calc(var(--header-h) + 8px);
    bottom: calc(var(--footer-h) + 8px);
    left: 2vw;
    right: 2vw;

    background: var(--win-bg);
    color: var(--win-text);
    border: 1px solid var(--win-border);
    border-radius: 12px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, .40);

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.overlay-window-instance-4 .overlay-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px;
}

#window-layer .overlay-window-instance-4 {
    pointer-events: auto;
}

body.dark .overlay-window-instance-4 {
    background: #1e1e1e;
    color: #e5e7eb;
}

/* =====================================================
   COTIZACIÓN - DATOS GENERALES COMPACTOS DEFINITIVO
===================================================== */

.cot-datos-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.15fr) 290px;

    gap: 8px 12px;
    align-items: start;
    width: 100%;
}

.cot-datos-grid .field-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.cot-datos-grid .field-row label {
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
}

.cot-datos-grid .field-row input,
.cot-datos-grid .field-row select {
    width: 100%;
    height: 34px;
    box-sizing: border-box;
}


/* =====================================================
   POSICIONES
===================================================== */

.cot-datos-grid .field-row:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

.cot-datos-grid .field-row:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.cot-datos-grid .field-row:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
}

.cot-datos-grid .field-row:nth-child(4) {
    grid-column: 1;
    grid-row: 2;
}

.cot-datos-grid .field-row:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
}

.cot-datos-grid .field-row:nth-child(6) {
    grid-column: 3;
    grid-row: 2;
}

.cot-datos-grid .field-row:nth-child(7) {
    grid-column: 1;
    grid-row: 3;
}

.cot-datos-grid .field-row:nth-child(8) {
    grid-column: 2;
    grid-row: 3;
}

.cot-datos-grid .field-row:nth-child(9) {
    grid-column: 3;
    grid-row: 3;
}


/* =====================================================
   OBSERVACIÓN
===================================================== */

.cot-observacion {
    grid-column: 4;
    grid-row: 1 / span 3;

    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cot-observacion label {
    font-weight: 600;
    margin: 0;
}

.cot-observacion textarea {
    width: 100%;
    height: 106px;

    box-sizing: border-box;
    resize: none;

    padding: 8px;

    border: 1px solid #cbd5e1;
    border-radius: 6px;

    font-family: "Segoe UI", sans-serif;
    font-size: 13px;
}


/* =====================================================
   TEMA OSCURO
===================================================== */

body.dark .cot-observacion textarea {
    background: #333;
    color: #fff;
    border-color: #555;
}


/* =====================================================
   1366 x 768
===================================================== */

@media (max-width: 1366px) {

    .cot-datos-grid {
        grid-template-columns:
            minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 240px;

        gap: 7px 10px;
    }

    .cot-datos-grid .field-row {
        grid-template-columns: 75px minmax(0, 1fr);
    }

    .cot-observacion textarea {
        height: 103px;
    }
}

/* =====================================================
   COTIZACIÓN - ÍTEM COMPACTO PROFESIONAL
===================================================== */

.cot-item {
    position: relative;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid #1f2937;
    border-radius: 10px;
    background: rgba(248, 250, 252, .95);
}

.cot-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cot-item-header strong {
    font-size: 13px;
}

.cot-item-header .btn-delete {
    min-width: 85px !important;
    height: 30px;
    padding: 0 14px !important;
}

/* Layout principal */
.cot-art-layout {
    display: grid;
    grid-template-columns: 145px minmax(520px, 1fr) 560px;
    gap: 16px;
    align-items: start;
}

/* Imagen */
.cot-art-img {
    width: 130px;
    height: 130px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}

.cot-art-img img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}

/* Datos artículo */
.cot-art-grid {
    display: grid;
    grid-template-columns: 95px minmax(0, 1fr) 80px 130px;
    gap: 7px 8px;
    align-items: center;
}

.cot-art-grid label {
    font-weight: 600;
    font-size: 12px;
    margin: 0;
    white-space: nowrap;
}

.cot-art-grid input,
.cot-art-grid textarea {
    width: 100%;
    box-sizing: border-box;
    height: 29px;
    font-size: 13px;
    padding: 4px 7px;
}

.cot-art-grid textarea {
    height: 46px;
    resize: none;
    font-family: "Segoe UI", sans-serif;
}

/* Posiciones */
.cot-articulo-row {
    grid-column: 1 / 5;
    display: grid;
    grid-template-columns: 95px 1fr 60px 60px;
    gap: 8px;
    align-items: center;
}

.cot-desc-color-row,
.cot-presentacion-row,
.cot-desc-larga-row,
.cot-entrega-row {
    grid-column: 1 / 5;
    display: grid;
    grid-template-columns: 95px 1fr;
    gap: 8px;
    align-items: center;
}

.cot-codigo-row {
    display: grid;
    grid-template-columns: 60px 130px;
    gap: 8px;
    align-items: center;
}

/* Precios derecha */
.cot-precios-box {
    border-left: 1px solid #e5e7eb;
    padding-left: 14px;
}

.cot-precios-titulo {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
}

.cot-precios {
    width: 100%;
    max-width: 560px;
    margin: 0 0 8px 0;
    table-layout: fixed;
}

.cot-precios th {
    background: #020617 !important;
    color: #ffffff !important;
    font-size: 12px;
    padding: 5px !important;
    text-align: center;
}

.cot-precios td {
    padding: 4px 5px !important;
}

.cot-precios input {
    height: 27px;
    padding: 3px 6px !important;
    font-size: 12px;
}

.cot-precios th:nth-child(1),
.cot-precios td:nth-child(1) {
    width: 160px;
}

.cot-precios th:nth-child(2),
.cot-precios td:nth-child(2) {
    width: 160px;
}

.cot-precios th:nth-child(3),
.cot-precios td:nth-child(3) {
    width: 160px;
}

.cot-precios th:nth-child(4),
.cot-precios td:nth-child(4) {
    width: 60px;
    text-align: center;
}

.cot-precios .btn-delete {
    min-width: 0 !important;
    width: 42px !important;
    height: 27px;
    padding: 0 !important;
}

.cot-precios-box .btn-secondary {
    min-width: 0 !important;
    width: auto !important;
    height: 28px;
    padding: 0 12px !important;
    font-size: 12px;
}

/* Botón agregar artículo */
#winCotizacionForm>.overlay-body .btn-secondary {
    margin-top: 4px;
}

/* Responsive 1366 */
@media (max-width: 1366px) {
    .cot-art-layout {
        grid-template-columns: 125px minmax(430px, 1fr) 480px;
        gap: 12px;
    }

    .cot-art-img {
        width: 115px;
        height: 115px;
    }

    .cot-art-img img {
        max-width: 105px;
        max-height: 105px;
    }

    .cot-precios {
        max-width: 480px;
    }
}

body.dark .cot-item {
    background: #1f2937;
    border-color: #475569;
}

body.dark .cot-art-img {
    background: #111827;
}


/* =====================================================
   COTIZACIÓN - AJUSTE FINAL ÍTEM / PRECIOS
   Alineación artículo + botones y tabla compacta
===================================================== */

/* -----------------------------------------------------
   DISTRIBUCIÓN PRINCIPAL DEL ÍTEM
----------------------------------------------------- */

.cot-art-layout {
    display: grid;
    grid-template-columns:
        145px minmax(0, 1fr) 500px;

    gap: 16px;
    align-items: start;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}


/* -----------------------------------------------------
   BLOQUE CENTRAL - DATOS DEL ARTÍCULO
----------------------------------------------------- */

.cot-art-grid {
    display: grid;
    grid-template-columns: 95px minmax(0, 1fr);
    gap: 7px 8px;
    align-items: center;

    width: 100%;
    min-width: 0;
}


/* -----------------------------------------------------
   ARTÍCULO
   Label | Campo | Buscar | Nuevo
----------------------------------------------------- */

.cot-articulo-row {
    grid-column: 1 / 3;

    display: grid;
    grid-template-columns:
        95px minmax(0, 1fr) 58px 58px;

    gap: 8px;
    align-items: center;

    width: 100%;
    min-width: 0;
}

.cot-articulo-row input {
    width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
}


/* Botones Buscar / Nuevo */

.cot-articulo-row .btn {
    min-width: 0 !important;
    width: 58px !important;
    height: 29px;

    padding: 0 !important;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    box-sizing: border-box;
}


/* -----------------------------------------------------
   CÓDIGO
----------------------------------------------------- */

.cot-codigo-row {
    grid-column: 1 / 3;

    display: grid;
    grid-template-columns: 95px 180px;
    gap: 8px;
    align-items: center;
}

.cot-codigo-row input {
    width: 180px !important;
    height: 29px;
    box-sizing: border-box;
}


/* -----------------------------------------------------
   FILAS COMPLETAS
----------------------------------------------------- */

.cot-desc-color-row,
.cot-presentacion-row,
.cot-desc-larga-row,
.cot-entrega-row {
    grid-column: 1 / 3;

    display: grid;
    grid-template-columns: 95px minmax(0, 1fr);

    gap: 8px;
    align-items: center;

    width: 100%;
    min-width: 0;
}


/* -----------------------------------------------------
   CAMPOS ARTÍCULO
----------------------------------------------------- */

.cot-art-grid label {
    margin: 0;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.cot-art-grid input,
.cot-art-grid textarea {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;

    font-size: 13px;
    padding: 4px 7px;
}

.cot-art-grid input {
    height: 29px;
}

.cot-art-grid textarea {
    height: 46px;
    resize: none;
    font-family: "Segoe UI", sans-serif;
}


/* -----------------------------------------------------
   PRECIOS
----------------------------------------------------- */

.cot-precios-box {
    width: 500px;
    min-width: 0;

    border-left: 1px solid #e5e7eb;
    padding-left: 12px;

    box-sizing: border-box;
}

.cot-precios-titulo {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
}


/* -----------------------------------------------------
   TABLA PRECIOS COMPACTA
----------------------------------------------------- */

.cot-precios {
    width: 100%;
    max-width: 100%;

    margin: 0 0 8px 0;

    table-layout: fixed;
    border-collapse: collapse;
}

.cot-precios th {
    background: #020617 !important;
    color: #ffffff !important;

    font-size: 11px;
    padding: 5px 3px !important;

    text-align: center;
}

.cot-precios td {
    padding: 4px !important;
    box-sizing: border-box;
}


/* Cantidad */

.cot-precios th:nth-child(1),
.cot-precios td:nth-child(1) {
    width: 135px;
}


/* Precio Unitario */

.cot-precios th:nth-child(2),
.cot-precios td:nth-child(2) {
    width: 145px;
}


/* Total */

.cot-precios th:nth-child(3),
.cot-precios td:nth-child(3) {
    width: 145px;
}


/* Eliminar */

.cot-precios th:nth-child(4),
.cot-precios td:nth-child(4) {
    width: 48px;
    text-align: center;
}


/* -----------------------------------------------------
   INPUTS DE PRECIOS
----------------------------------------------------- */

.cot-precios input {
    width: 100% !important;
    min-width: 0 !important;

    height: 27px;

    padding: 3px 5px !important;

    font-size: 12px;

    box-sizing: border-box;
}


/* -----------------------------------------------------
   BOTÓN X
----------------------------------------------------- */

.cot-precios .btn-delete {
    min-width: 0 !important;

    width: 38px !important;
    height: 27px;

    padding: 0 !important;
    margin: 0 !important;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
}


/* -----------------------------------------------------
   BOTÓN AGREGAR PRECIO
----------------------------------------------------- */

.cot-precios-box .btn-secondary {
    min-width: 0 !important;
    width: auto !important;

    height: 28px;

    padding: 0 12px !important;

    font-size: 12px;
}


/* =====================================================
   AJUSTE 1366 x 768
===================================================== */

@media (max-width: 1366px) {

    .cot-art-layout {
        grid-template-columns:
            125px minmax(0, 1fr) 430px;

        gap: 12px;
    }

    .cot-art-img {
        width: 115px;
        height: 115px;
    }

    .cot-art-img img {
        max-width: 105px;
        max-height: 105px;
    }

    .cot-precios-box {
        width: 430px;
        padding-left: 10px;
    }

    .cot-precios th:nth-child(1),
    .cot-precios td:nth-child(1) {
        width: 112px;
    }

    .cot-precios th:nth-child(2),
    .cot-precios td:nth-child(2) {
        width: 122px;
    }

    .cot-precios th:nth-child(3),
    .cot-precios td:nth-child(3) {
        width: 122px;
    }

    .cot-precios th:nth-child(4),
    .cot-precios td:nth-child(4) {
        width: 44px;
    }

    .cot-precios .btn-delete {
        width: 34px !important;
    }

    .cot-articulo-row {
        grid-template-columns:
            95px minmax(0, 1fr) 54px 54px;
    }

    .cot-articulo-row .btn {
        width: 54px !important;
        font-size: 11px;
    }
}

/* =====================================================
   COTIZACIÓN - ALINEACIÓN NUMÉRICA DE PRECIOS
===================================================== */

.cot-precios input {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.cot-precios th:nth-child(1),
.cot-precios th:nth-child(2),
.cot-precios th:nth-child(3) {
    text-align: right !important;
    padding-right: 9px !important;
}

/* =====================================================
   COTIZACIÓN - REDISTRIBUCIÓN ÍTEM / PRECIOS
===================================================== */

.cot-art-layout {
    grid-template-columns:
        145px minmax(0, 1fr) 620px !important;

    gap: 16px;
}


/* =====================================================
   BLOQUE DATOS DEL ARTÍCULO
===================================================== */

.cot-art-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}


/* ARTÍCULO */

.cot-articulo-row {
    grid-template-columns:
        95px minmax(0, 1fr) 58px 58px !important;
}


/* CAMPOS LARGOS */

.cot-desc-color-row,
.cot-presentacion-row,
.cot-desc-larga-row,
.cot-entrega-row {
    grid-template-columns:
        95px minmax(0, 1fr) !important;

    width: 100%;
}


/* =====================================================
   PRECIOS - MÁS ESPACIO
===================================================== */

.cot-precios-box {
    width: 620px !important;
    max-width: 620px !important;

    padding-left: 12px;
    box-sizing: border-box;
}


/* TABLA */

.cot-precios {
    width: 100% !important;
    max-width: 100% !important;

    table-layout: fixed;
}


/* CANTIDAD */

.cot-precios th:nth-child(1),
.cot-precios td:nth-child(1) {
    width: 145px !important;
}


/* PRECIO UNITARIO */

.cot-precios th:nth-child(2),
.cot-precios td:nth-child(2) {
    width: 155px !important;
}


/* TOTAL */

.cot-precios th:nth-child(3),
.cot-precios td:nth-child(3) {
    width: 165px !important;
}


/* ELIMINAR */

.cot-precios th:nth-child(4),
.cot-precios td:nth-child(4) {
    width: 46px !important;
}

/* =====================================================
   COTIZACIÓN - IMAGEN MÁS GRANDE EN ÍTEM
===================================================== */

.cot-art-layout {
    grid-template-columns:
        250px minmax(0, 1fr) 620px !important;
}

.cot-art-img {
    width: 230px !important;
    height: 230px !important;
}

.cot-art-img img {
    max-width: 220px !important;
    max-height: 220px !important;
}

/* Reducir un poco el ancho visual de los campos del artículo */
.cot-art-grid {
    max-width: 760px;
}

.cot-articulo-row,
.cot-desc-color-row,
.cot-presentacion-row,
.cot-desc-larga-row,
.cot-entrega-row,
.cot-codigo-row {
    max-width: 760px;
}

/* Campo entrega sigue más corto */
.cot-entrega-row input {
    max-width: 300px;
}

/* Ajuste para pantallas 1366 */
@media (max-width: 1366px) {
    .cot-art-layout {
        grid-template-columns:
            210px minmax(0, 1fr) 430px !important;
    }

    .cot-art-img {
        width: 190px !important;
        height: 190px !important;
    }

    .cot-art-img img {
        max-width: 180px !important;
        max-height: 180px !important;
    }

    .cot-art-grid {
        max-width: 620px;
    }
}

/* =====================================================
   COTIZACIÓN - BUSCADOR CLIENTE
===================================================== */

.cot-cliente-select {
    display: grid;
    grid-template-columns: 1fr 65px;
    gap: 8px;
    width: 100%;
}

.cot-cliente-select input {
    width: 100% !important;
}

.cot-cliente-select .btn {
    min-width: 0 !important;
    width: 65px !important;
    height: 34px;
    padding: 0 !important;
    font-size: 12px;
}

#tablaClientesCot {
    min-width: 1100px;
    table-layout: fixed;
}

#tablaClientesCot .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
}

/* =====================================================
   COTIZACIÓN - DATOS GENERALES NUEVA DISTRIBUCIÓN
===================================================== */

.cot-datos-grid {
    display: grid !important;
    grid-template-columns:
        minmax(360px, 1.35fr) minmax(260px, 1fr) minmax(120px, .45fr) minmax(300px, 1fr) minmax(130px, .45fr) 290px;
    gap: 8px 12px;
    align-items: start;
    width: 100%;
}

.cot-datos-grid .field-row {
    display: grid !important;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.cot-datos-grid .field-row:nth-child(1) {
    grid-column: 1 / 6;
    grid-row: 1;
}

.cot-datos-grid .field-row:nth-child(2) {
    grid-column: 1 / 2;
    grid-row: 2;
}

.cot-datos-grid .field-row:nth-child(3) {
    grid-column: 2 / 4;
    grid-row: 2;
}

.cot-datos-grid .field-row:nth-child(4) {
    grid-column: 4 / 6;
    grid-row: 2;
}

.cot-datos-grid .field-row:nth-child(5) {
    grid-column: 1;
    grid-row: 3;
}

.cot-datos-grid .field-row:nth-child(6) {
    grid-column: 2;
    grid-row: 3;
}

.cot-datos-grid .field-row:nth-child(7) {
    grid-column: 3;
    grid-row: 3;
}

.cot-datos-grid .field-row:nth-child(8) {
    grid-column: 4;
    grid-row: 3;
}

.cot-datos-grid .field-row:nth-child(9) {
    grid-column: 5;
    grid-row: 3;
}

.cot-observacion {
    grid-column: 6;
    grid-row: 1 / 4;
}

.cot-observacion textarea {
    height: 90px !important;
}

.cot-cliente-select {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 65px 65px;
    gap: 8px;
}

.cot-cliente-select input {
    width: 100% !important;
}

.cot-cliente-select .btn {
    min-width: 0 !important;
    width: 65px !important;
    height: 34px;
    padding: 0 !important;
    font-size: 12px;
}

/* =====================================================
   COTIZACIÓN - AJUSTE CAMPO IGV
===================================================== */

.cot-datos-grid .field-row:nth-child(7) {
    grid-template-columns: 45px 120px !important;
}

.cot-datos-grid .field-row:nth-child(7) select {
    min-width: 120px !important;
    width: 120px !important;
    padding-right: 28px !important;
}

/* =====================================================
   COTIZACIÓN - CONTACTO CON BOTÓN NUEVO
===================================================== */

.cot-contacto-select {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 65px;
    gap: 8px;
    width: 100%;
}

.cot-contacto-select select {
    width: 100% !important;
}

.cot-contacto-select .btn {
    min-width: 0 !important;
    width: 65px !important;
    height: 34px;
    padding: 0 !important;
    font-size: 12px;
}

/* =====================================================
   COTIZACIÓN - CABECERA BUSCADOR DE CLIENTES
===================================================== */

#tablaClientesCot thead,
#tablaClientesCot thead tr,
#tablaClientesCot thead th {
    background: #020718 !important;
}

#tablaClientesCot thead th {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-align: center !important;
    opacity: 1 !important;
}

/* =====================================================
   COTIZACIÓN - AJUSTE ANCHO MONEDA / IGV
===================================================== */

.cot-datos-grid .field-row:nth-child(6) {
    grid-template-columns: 70px 200px !important;
}

.cot-datos-grid .field-row:nth-child(6) select {
    width: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
}

/* =====================================================
   COTIZACIÓN - AJUSTE POSICIÓN IGV / FORMA DE PAGO
===================================================== */

.cot-datos-grid .field-row:nth-child(7) {
    grid-template-columns: 40px 120px !important;
    margin-left: -70px !important;
    margin-right: 0 !important;
}

.cot-datos-grid .field-row:nth-child(7) select {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding-right: 28px !important;
}

.cot-datos-grid .field-row:nth-child(8) {
    margin-left: 15px !important;
}

/* =====================================================
   COTIZACIÓN - BUSCADOR ARTÍCULO
===================================================== */

#tablaArticulosCot {
    min-width: 1300px;
    table-layout: fixed;
}

#tablaArticulosCot thead,
#tablaArticulosCot thead tr,
#tablaArticulosCot thead th {
    background: #020718 !important;
}

#tablaArticulosCot thead th {
    color: #ffffff !important;
    font-weight: 600 !important;
    text-align: center !important;
    opacity: 1 !important;
}

#tablaArticulosCot th,
#tablaArticulosCot td {
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

#tablaArticulosCot th:nth-child(1),
#tablaArticulosCot td:nth-child(1) {
    width: 80px;
    text-align: center;
}

#tablaArticulosCot th:nth-child(2),
#tablaArticulosCot td:nth-child(2) {
    width: 120px;
}

#tablaArticulosCot th:nth-child(3),
#tablaArticulosCot td:nth-child(3) {
    width: 320px;
}

#tablaArticulosCot th:nth-child(4),
#tablaArticulosCot td:nth-child(4),
#tablaArticulosCot th:nth-child(5),
#tablaArticulosCot td:nth-child(5),
#tablaArticulosCot th:nth-child(6),
#tablaArticulosCot td:nth-child(6) {
    width: 160px;
}

#tablaArticulosCot th:nth-child(7),
#tablaArticulosCot td:nth-child(7) {
    width: 230px;
    white-space: normal;
    line-height: 1.35;
}

#tablaArticulosCot th:nth-child(8),
#tablaArticulosCot td:nth-child(8) {
    width: 120px;
    text-align: center;
}

#tablaArticulosCot .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
}

.cot-articulo-img-tabla img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

/* =====================================================
   COTIZACIÓN - BUSCADOR ARTÍCULOS CARDS
===================================================== */

.cot-art-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.cot-art-card {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 285px;
}

.cot-art-card-img {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 8px;
}

.cot-art-card-img img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}

.cot-art-card-body {
    flex: 1;
}

.cot-art-card-codigo {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.cot-art-card-title {
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.25;
}

.cot-art-card-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
}

.cot-art-card-colores {
    font-size: 12px;
    margin-top: 6px;
    color: #1e293b;
}

.cot-art-card .btn {
    width: 100% !important;
}

body.dark .cot-art-card {
    background: #1f2937;
    border-color: #475569;
}

body.dark .cot-art-card-img {
    background: #111827;
}

/* =========================================================
   COTIZACIÓN - MINIATURA ARTÍCULO EN LISTADO
   ========================================================= */

#tablaArticulosCot .cot-art-thumb {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;

    object-fit: contain;

    display: block;
    margin: 0 auto;

    border-radius: 4px;
}

/* Ajustar altura de fila */
#tablaArticulosCot tbody tr {
    height: 48px;
}

/* Centrar celda de imagen */
#tablaArticulosCot tbody td:first-child {
    width: 70px;
    padding: 4px !important;
    text-align: center;
    vertical-align: middle;
}

.cot-card-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cot-card-check input,
.chk-art-lista {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* =====================================================
   COTIZACIÓN - ÍTEM SIN NUEVO NI DESC/COLOR
===================================================== */

.cot-articulo-row {
    grid-template-columns: 95px minmax(0, 1fr) 65px !important;
}

.cot-articulo-row .btn {
    width: 65px !important;
}

.cot-presentacion-row textarea {
    height: 52px !important;
}

.cot-desc-larga-row textarea {
    height: 88px !important;
}

.cot-art-grid {
    gap: 8px 8px !important;
}

/* =====================================================
   COTIZACIÓN - LISTADO ARTÍCULOS ORDEN DEFINITIVO
===================================================== */

#tablaArticulosCot {
    table-layout: fixed;
    width: 100%;
}

#tablaArticulosCot th:nth-child(1),
#tablaArticulosCot td:nth-child(1) {
    width: 45px !important;
    text-align: center;
}

#tablaArticulosCot th:nth-child(2),
#tablaArticulosCot td:nth-child(2) {
    width: 70px !important;
    text-align: center;
}

#tablaArticulosCot th:nth-child(3),
#tablaArticulosCot td:nth-child(3) {
    width: 95px !important;
}

#tablaArticulosCot th:nth-child(4),
#tablaArticulosCot td:nth-child(4) {
    width: 150px !important;
}

#tablaArticulosCot th:nth-child(5),
#tablaArticulosCot td:nth-child(5) {
    width: 150px !important;
}

#tablaArticulosCot th:nth-child(6),
#tablaArticulosCot td:nth-child(6) {
    width: 360px !important;
}

#tablaArticulosCot th:nth-child(7),
#tablaArticulosCot td:nth-child(7) {
    width: 170px !important;
}

#tablaArticulosCot th:nth-child(8),
#tablaArticulosCot td:nth-child(8) {
    width: 170px !important;
}

#tablaArticulosCot td {
    vertical-align: middle;
}

#tablaArticulosCot .cot-art-thumb {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
}

/* =====================================================
   COTIZACIÓN - DESCRIPCIÓN + ACTUALIZAR MAESTRO
===================================================== */

.cot-desc-larga-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 95px;
    gap: 10px;
    align-items: center;
}

.cot-desc-larga-wrap textarea {
    width: 100% !important;
    min-height: 88px !important;
    resize: vertical;
}

.btn-actualizar-maestro {
    width: 95px !important;
    height: 58px !important;
    padding: 6px 8px !important;
    line-height: 1.2 !important;
    font-size: 12px !important;
}

/* =====================================================
   COTIZACIONES - AJUSTE COLUMNAS PARA BOTÓN PDF
===================================================== */

#tablaCotizaciones {
    min-width: 1380px !important;
    table-layout: fixed;
}

/* N° Cotización */
#tablaCotizaciones th:nth-child(1),
#tablaCotizaciones td:nth-child(1) {
    width: 130px;
}

/* Fecha - reducir */
#tablaCotizaciones th:nth-child(2),
#tablaCotizaciones td:nth-child(2) {
    width: 85px;
    text-align: center;
}

/* Razón Social */
#tablaCotizaciones th:nth-child(3),
#tablaCotizaciones td:nth-child(3) {
    width: 150px;
}

/* Contacto */
#tablaCotizaciones th:nth-child(4),
#tablaCotizaciones td:nth-child(4) {
    width: 140px;
}

/* Correo */
#tablaCotizaciones th:nth-child(5),
#tablaCotizaciones td:nth-child(5) {
    width: 150px;
}

/* Asesor */
#tablaCotizaciones th:nth-child(6),
#tablaCotizaciones td:nth-child(6) {
    width: 135px;
}

/* Moneda - reducir */
#tablaCotizaciones th:nth-child(7),
#tablaCotizaciones td:nth-child(7) {
    width: 65px;
    text-align: center;
}

/* IGV - reducir */
#tablaCotizaciones th:nth-child(8),
#tablaCotizaciones td:nth-child(8) {
    width: 80px;
    text-align: center;
}

/* Forma pago */
#tablaCotizaciones th:nth-child(9),
#tablaCotizaciones td:nth-child(9) {
    width: 145px;
}

/* Validez */
#tablaCotizaciones th:nth-child(10),
#tablaCotizaciones td:nth-child(10) {
    width: 80px;
    text-align: center;
}

/* Estado */
#tablaCotizaciones th:nth-child(11),
#tablaCotizaciones td:nth-child(11) {
    width: 95px;
    text-align: center;
}

/* Opciones - dar espacio a Abrir / Duplicar / PDF */
#tablaCotizaciones th:nth-child(12),
#tablaCotizaciones td:nth-child(12) {
    width: 170px;
    text-align: center;
    white-space: nowrap;
}

#tablaCotizaciones td:nth-child(12) .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 8px !important;
    margin-right: 3px;
    font-size: 12px !important;
}

.menu-separador {
    height: 1px;
    background: rgba(128, 128, 128, 0.25);
    margin: 5px 10px;
}

/* =====================================================
   CLIENTES - NUEVA DISTRIBUCIÓN DE COLUMNAS
===================================================== */

#tablaClientes {
    min-width: 1850px;
    width: 100%;
    table-layout: fixed;
}

#tab-cli-empresa .table-box {
    overflow-x: auto !important;
    overflow-y: auto;
}

#tablaClientes th,
#tablaClientes td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* RUC */
#tablaClientes th:nth-child(1),
#tablaClientes td:nth-child(1) {
    width: 110px;
}

/* Razón Social */
#tablaClientes th:nth-child(2),
#tablaClientes td:nth-child(2) {
    width: 240px;
}

/* Razón Comercial */
#tablaClientes th:nth-child(3),
#tablaClientes td:nth-child(3) {
    width: 180px;
}

/* Dirección */
#tablaClientes th:nth-child(4),
#tablaClientes td:nth-child(4) {
    width: 260px;
}

/* Distrito */
#tablaClientes th:nth-child(5),
#tablaClientes td:nth-child(5) {
    width: 140px;
}

/* Rubro */
#tablaClientes th:nth-child(6),
#tablaClientes td:nth-child(6) {
    width: 140px;
}

/* Asesor */
#tablaClientes th:nth-child(7),
#tablaClientes td:nth-child(7) {
    width: 140px;
}

/* Pago */
#tablaClientes th:nth-child(8),
#tablaClientes td:nth-child(8) {
    width: 130px;
}

/* N° Contactos */
#tablaClientes th:nth-child(9),
#tablaClientes td:nth-child(9) {
    width: 95px;
    text-align: center;
}

/* Estado */
#tablaClientes th:nth-child(10),
#tablaClientes td:nth-child(10) {
    width: 95px;
    text-align: center;
}

/* Acciones */
#tablaClientes th:nth-child(11),
#tablaClientes td:nth-child(11) {
    width: 170px;
    text-align: center;
    white-space: nowrap;
}

#tablaClientes td:nth-child(11) .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 9px !important;
    margin-right: 4px;
    font-size: 12px !important;
}

/* =====================================================
   CONTACTOS - CLIENTE SELECCIONADO Y NUEVAS COLUMNAS
===================================================== */

.cli-contacto-titulo {
    color: #111827;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

body.dark .cli-contacto-titulo {
    color: #ffffff;
}

/* Tabla de contactos */
#tablaContactos {
    min-width: 1550px;
    width: 100%;
    table-layout: fixed;
}

#tab-cli-contactos .table-box,
[data-module="contactos"] .table-box {
    overflow-x: auto !important;
    overflow-y: auto;
}

#tablaContactos th,
#tablaContactos td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Contacto */
#tablaContactos th:nth-child(1),
#tablaContactos td:nth-child(1) {
    width: 210px;
}

/* Cargo */
#tablaContactos th:nth-child(2),
#tablaContactos td:nth-child(2) {
    width: 190px;
}

/* Área */
#tablaContactos th:nth-child(3),
#tablaContactos td:nth-child(3) {
    width: 170px;
}

/* Correo */
#tablaContactos th:nth-child(4),
#tablaContactos td:nth-child(4) {
    width: 220px;
}

/* Teléfono */
#tablaContactos th:nth-child(5),
#tablaContactos td:nth-child(5) {
    width: 130px;
}

/* Móvil */
#tablaContactos th:nth-child(6),
#tablaContactos td:nth-child(6) {
    width: 130px;
}

/* Observaciones */
#tablaContactos th:nth-child(7),
#tablaContactos td:nth-child(7) {
    width: 320px;
}

/* Permitir varias líneas en observaciones */
#tablaContactos td:nth-child(7) {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;

    line-height: 1.4;
    vertical-align: top;

    overflow-wrap: anywhere;
    word-break: normal;
}

/* Estado */
#tablaContactos th:nth-child(8),
#tablaContactos td:nth-child(8) {
    width: 95px;
    text-align: center;
}

/* Acciones */
#tablaContactos th:nth-child(9),
#tablaContactos td:nth-child(9) {
    width: 100px;
    text-align: center;
}

#tablaContactos td:nth-child(9) .btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
}

/* =========================================================
   BOTONERA COTIZACIÓN
   ========================================================= */

.botonera-cotizacion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.botonera-cotizacion-principal {
    display: flex;
    align-items: center;
    gap: 10px;
}

.botonera-cotizacion-eliminar {
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* =========================================================
   BUSCADOR COTIZACIONES - BOTÓN LIMPIAR
   ========================================================= */

.buscar-cotizacion-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.buscar-cotizacion-box #buscarCotizacion {
    padding-right: 34px;
}

.btn-limpiar-cotizacion {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);

    width: 24px;
    height: 24px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    background: transparent;

    font-size: 20px;
    line-height: 1;
    font-weight: bold;

    cursor: pointer;
    opacity: 0.55;
}

.btn-limpiar-cotizacion:hover {
    opacity: 1;
}

#buscarCotizacion:placeholder-shown+.btn-limpiar-cotizacion {
    display: none;
}

#btnGuardarBorrador:disabled,
#btnEmitirCotizacion:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(35%);
    box-shadow: none;
    pointer-events: none;
}

/* =====================================================
   OLCOT - BLOQUEO DE VENTANAS DETRÁS DE MODALES
===================================================== */

/*
 * Las ventanas principales permanecen debajo del fondo modal.
 */
#window-layer>.overlay-window-instance {
    z-index: 100;
}

/*
 * Fondo que bloquea las ventanas principales.
 */
#window-layer.active::before {
    z-index: 200;
    pointer-events: auto;
}

/*
 * Formularios Nuevo / Editar.
 */
#window-layer>.overlay-window-instance-2 {
    z-index: 300;
}

/*
 * Ventanas auxiliares.
 */
#window-layer>.overlay-window-instance-3 {
    z-index: 400;
}

/*
 * Ventana amplia de cotizaciones.
 */
#window-layer>.overlay-window-instance-4 {
    z-index: 250;
}

/* =====================================================
   CLIENTES - CENTRAR RUC Y RAZÓN SOCIAL EN CONTACTOS
===================================================== */

#tab-cli-contactos .cli-contactos-toolbar {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    align-items: center;
    column-gap: 12px;
    width: 100%;
}

/* Botón a la izquierda */
#tab-cli-contactos .cli-contactos-toolbar .olcot-toolbar-left {
    justify-self: start;
}

/* Datos del cliente realmente centrados */
#tab-cli-contactos .cli-contactos-centro {
    justify-self: center;
    text-align: center;
    min-width: 0;
    width: 100%;
}

/* Buscador a la derecha */
#tab-cli-contactos .cli-contactos-toolbar .olcot-toolbar-right {
    justify-self: end;
}

/* Texto del cliente */
#tab-cli-contactos .cli-contacto-titulo {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ajuste para resolución 1366 */
@media (max-width: 1366px) {
    #tab-cli-contactos .cli-contactos-toolbar {
        grid-template-columns: 170px minmax(0, 1fr) 285px;
        column-gap: 8px;
    }

    #tab-cli-contactos .cli-contacto-titulo {
        font-size: 12px;
    }
}

/* =====================================================
   CONTACTOS - CLIENTE Y ASESOR EN UNA MISMA FILA
===================================================== */

.contacto-asesor-readonly {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #cbd5e1 !important;
    cursor: default !important;
    font-weight: 600;
}

/* El cliente y el asesor ocupan una columna cada uno */
[data-module="contacto-form"] .form-modern .field-row select[name="cl0codigo"],
[data-module="contacto-form"] .form-modern .contacto-asesor-readonly {
    width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
}

/* Tema oscuro */
body.dark .contacto-asesor-readonly {
    background-color: #2b2b2b !important;
    color: #e5e7eb !important;
    border-color: #4b5563 !important;
}

/* =====================================================
   CONTACTOS - FECHA PERUANA
===================================================== */

input.fecha-peru {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

.flatpickr-calendar {
    z-index: 1000005 !important;
}

/* Año visible y fácil de modificar */
.flatpickr-current-month .numInputWrapper {
    width: 82px;
}

.flatpickr-current-month input.cur-year {
    font-weight: 600;
    text-align: center;
}

/* =====================================================
   FLATPICKR - AJUSTES PARA FECHA PERUANA
===================================================== */

.flatpickr-calendar {
    width: 340px !important;
}

.flatpickr-months {
    padding: 6px 8px;
}

.flatpickr-current-month {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 8px;
    box-sizing: border-box;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

.flatpickr-current-month .numInputWrapper {
    width: 70px !important;
    min-width: 70px;
}

.flatpickr-current-month input.cur-year {
    width: 64px !important;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* =====================================================
   FLATPICKR - SELECTOR PROFESIONAL DE AÑOS
===================================================== */

.flatpickr-current-month {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fp-boton-anio {
    height: 28px;
    min-width: 68px;

    padding: 2px 8px;

    border: 1px solid #cbd5e1;
    border-radius: 5px;

    background: #ffffff;
    color: #1f2937;

    font-family: "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.fp-boton-anio:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

/* Panel flotante */

.fp-selector-anios {
    position: absolute;

    top: 35px;
    left: 0;
    right: 0;
    bottom: 0;

    z-index: 20;

    padding: 12px;

    background: #ffffff;
    border-radius: 0 0 10px 10px;

    box-sizing: border-box;
}

.fp-selector-anios[hidden] {
    display: none !important;
}

/* Cabecera del bloque */

.fp-anios-cabecera {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;

    margin-bottom: 12px;
}

.fp-anios-cabecera strong {
    text-align: center;
    font-size: 14px;
}

.fp-anios-cabecera button {
    width: 32px;
    height: 32px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;

    font-size: 24px;
    line-height: 1;

    cursor: pointer;
}

.fp-anios-cabecera button:hover {
    background: #e5e7eb;
}

/* Cuadrícula de años */

.fp-anios-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.fp-anio-opcion {
    height: 42px;

    border: 0;
    border-radius: 21px;

    background: transparent;
    color: #1f2937;

    font-family: "Segoe UI", sans-serif;
    font-size: 13px;

    cursor: pointer;
}

.fp-anio-opcion:hover {
    background: #dbeafe;
}

.fp-anio-opcion.seleccionado {
    background: #2563eb;
    color: #ffffff;
    font-weight: 700;
}

.fp-anio-opcion.fuera-bloque {
    color: #9ca3af;
}

.fp-anio-opcion.deshabilitado {
    color: #d1d5db;
    cursor: not-allowed;
}

/* Tema oscuro */

body.dark .fp-boton-anio {
    background: #333333;
    color: #ffffff;
    border-color: #555555;
}

body.dark .fp-boton-anio:hover {
    background: #404040;
    border-color: #60a5fa;
}

body.dark .fp-selector-anios {
    background: #2b2b2b;
    color: #ffffff;
}

body.dark .fp-anios-cabecera button {
    color: #ffffff;
}

body.dark .fp-anios-cabecera button:hover {
    background: #444444;
}

body.dark .fp-anio-opcion {
    color: #e5e7eb;
}

body.dark .fp-anio-opcion:hover {
    background: #404f66;
}

body.dark .fp-anio-opcion.seleccionado {
    background: #38bdf8;
    color: #082f49;
}

body.dark .fp-anio-opcion.fuera-bloque {
    color: #737373;
}

/* El selector de años debe recibir clics */
.fp-selector-anios {
    pointer-events: auto !important;
}

/* Las flechas deben quedar por encima del panel */
.fp-anios-cabecera button {
    position: relative;
    z-index: 3;
    pointer-events: auto !important;
    cursor: pointer;
}

/* Evitar que elementos del calendario intercepten los clics */
.fp-anios-grid,
.fp-anios-cabecera {
    position: relative;
    z-index: 2;
}

/* =====================================================
   MONEDAS - TABLA NUEVO / EDITAR AJUSTADA
===================================================== */

/* Todos los elementos de la ventana respetan su contenedor */
#winMonedas *,
#winMonedas *::before,
#winMonedas *::after {
    box-sizing: border-box;
}

/* Cuerpo interno de la ventana */
#winMonedas .overlay-body.dsi-layout {
    width: 100%;
    min-width: 0;
    padding: 12px 18px;
    gap: 12px;
}

/* Zona que contiene la tabla */
#winMonedas .dsi-browser {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Marco de la tabla: no debe salir de la ventana */
#winMonedas .table-box-2 {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    margin: 0;

    overflow-y: auto;
    overflow-x: hidden;
}

/* Tabla estable */
#tablaMonedas {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

/* Celdas */
#tablaMonedas th,
#tablaMonedas td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* N° */
#tablaMonedas th:nth-child(1),
#tablaMonedas td:nth-child(1) {
    width: 52px;
    text-align: center;
}

/* Código */
#tablaMonedas th:nth-child(2),
#tablaMonedas td:nth-child(2) {
    width: 92px;
}

/* Moneda */
#tablaMonedas th:nth-child(3),
#tablaMonedas td:nth-child(3) {
    width: 200px;
}

/* Símbolo */
#tablaMonedas th:nth-child(4),
#tablaMonedas td:nth-child(4) {
    width: 100px;
}

/* Opciones */
#tablaMonedas th:nth-child(5),
#tablaMonedas td:nth-child(5) {
    width: 190px;
}

/* Los inputs ocupan únicamente el ancho de su celda */
#tablaMonedas input[type="text"] {
    display: block;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    height: 32px;

    padding: 5px 8px;

    border: 1px solid #aaa;
    border-radius: 4px;

    font-family: "Segoe UI", sans-serif;
    font-size: 11px;

    box-sizing: border-box;
}

/* Resaltar la fila en edición */
#tablaMonedas tr.editing td {
    background: #eef4ff;
}

/* La columna Opciones conserva ambos botones en una línea */
#tablaMonedas td:last-child {
    white-space: nowrap;
    overflow: visible;
}

/* Botones compactos dentro de Monedas */
#tablaMonedas td:last-child .btn,
#tablaMonedas td:last-child .btn-table-chica {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    width: auto !important;
    min-width: 0 !important;

    padding: 5px 10px !important;
    margin: 0 4px 0 0 !important;

    font-size: 11px !important;
    line-height: 1.1;
    white-space: nowrap;
}

/* Pie de la ventana */
#winMonedas .dsi-footer {
    flex: 0 0 auto;
    padding: 12px 4px 4px;
    gap: 12px;
}

/* Botones inferiores conservan su tamaño normal */
#winMonedas .dsi-footer .btn {
    width: 120px;
    min-width: 120px;
}

/* Tema oscuro */
body.dark #tablaMonedas tr.editing td {
    background: #263040 !important;
}

body.dark #tablaMonedas input[type="text"] {
    background: #2a2a2a;
    color: #ffffff;
    border-color: #555;
}

/* Ajuste para resoluciones menores */
@media (max-width: 700px) {

    #winMonedas .overlay-body.dsi-layout {
        padding: 10px;
    }

    #tablaMonedas th:nth-child(1),
    #tablaMonedas td:nth-child(1) {
        width: 42px;
    }

    #tablaMonedas th:nth-child(2),
    #tablaMonedas td:nth-child(2) {
        width: 72px;
    }

    #tablaMonedas th:nth-child(4),
    #tablaMonedas td:nth-child(4) {
        width: 75px;
    }

    #tablaMonedas th:nth-child(5),
    #tablaMonedas td:nth-child(5) {
        width: 165px;
    }

    #tablaMonedas td:last-child .btn,
    #tablaMonedas td:last-child .btn-table-chica {
        padding: 4px 7px !important;
        font-size: 10px !important;
    }
}

/* =====================================================
   COLORES - VENTANA COMPACTA OLCOT
===================================================== */

#winColores *,
#winColores *::before,
#winColores *::after {
    box-sizing: border-box;
}

/* Cuerpo de la ventana */
#winColores .overlay-body.dsi-layout {
    width: 100%;
    min-width: 0;
    padding: 12px 18px;
    gap: 12px;
}

/* Área de listado */
#winColores .dsi-browser {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Marco de la tabla */
#winColores .table-box-2 {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;

    overflow-y: auto;
    overflow-x: hidden;
}

/* Tabla estable */
#tablaColores {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

/* Celdas */
#tablaColores th,
#tablaColores td {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* N° */
#tablaColores th:nth-child(1),
#tablaColores td:nth-child(1) {
    width: 60px;
    text-align: center;
}

/* Color */
#tablaColores th:nth-child(2),
#tablaColores td:nth-child(2) {
    width: auto;
}

/* Opciones */
#tablaColores th:nth-child(3),
#tablaColores td:nth-child(3) {
    width: 190px;
    white-space: nowrap;
}

/* Inputs al crear o editar */
#tablaColores input[type="text"] {
    display: block;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    height: 32px;
    padding: 5px 8px;

    border: 1px solid #aaa;
    border-radius: 4px;

    font-family: "Segoe UI", sans-serif;
    font-size: 11px;

    box-sizing: border-box;
}

/* Fila activa */
#tablaColores tr.editing td {
    background: #eef4ff;
}

/* Botones compactos */
#tablaColores td:last-child .btn,
#tablaColores td:last-child .btn-table-chica {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    width: auto !important;
    min-width: 0 !important;

    padding: 5px 10px !important;
    margin: 0 4px 0 0 !important;

    font-size: 11px !important;
    line-height: 1.1;
    white-space: nowrap;
}

/* Footer */
#winColores .dsi-footer {
    flex: 0 0 auto;
    padding: 12px 4px 4px;
    gap: 12px;
}

#winColores .dsi-footer .btn {
    width: 120px;
    min-width: 120px;
}

/* Tema oscuro */
body.dark #tablaColores tr.editing td {
    background: #263040 !important;
}

body.dark #tablaColores input[type="text"] {
    background: #2a2a2a;
    color: #ffffff;
    border-color: #555555;
}

/*=========================================
BOTONES VISTA ARTICULOS
=========================================*/

.btn-vista{
    width:48px;
    height:48px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid #cfd6dd;
    border-radius:8px;
    background:#ffffff;
    cursor:pointer;
    transition:.20s;
}

.btn-vista svg{
    fill:#5d6772;
}

.btn-vista:hover{
    transform:scale(1.08);
    background:#f3f7fb;
    box-shadow:0 3px 10px rgba(0,0,0,.18);
}

.btn-vista.activo{
    background:#2f66e8;
    border-color:#2f66e8;
}

.btn-vista.activo svg{
    fill:#ffffff;
}
/* Nuevo artículo con el mismo estilo de los botones de vista */
.btn-nuevo-articulo {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-nuevo-articulo svg {
    fill: #ffffff;
}

.btn-nuevo-articulo:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: scale(1.08);
}

.buscar-wrapper{
    position:relative;
    display:flex;
    align-items:center;
}

.buscar-input{
    padding-right:34px;
}

.btn-limpiar-busqueda{
    position:absolute;
    right:8px;
    width:22px;
    height:22px;
    border:none;
    border-radius:50%;
    background:#d9dde4;
    color:#555;
    cursor:pointer;
    display:none;
    font-size:15px;
    line-height:20px;
    transition:.15s;
}

.btn-limpiar-busqueda:hover{
    background:#c7ccd4;
}

/* =========================================================
   COTIZACIÓN - FILA INDEPENDIENTE DE CONDICIONES
   Solo afecta:
   Fecha / Moneda / IGV / Forma de pago / Validez
   ========================================================= */

/*
 * La fila ocupa el ancho de la zona izquierda de Datos generales.
 * No modifica Cliente, Contacto, Correo, Asesor ni Observación.
 */

#winCotizacionForm .cot-fila-condiciones {
    grid-column: 1 / -2;
    grid-row: 3;

    display: grid;

    grid-template-columns:
        230px
        230px
        165px
        minmax(380px, 1fr)
        145px;

    column-gap: 10px;
    align-items: center;

    width: 100%;
    min-width: 0;
}


/* =========================================================
   FECHA
   ========================================================= */

#winCotizacionForm .cot-fila-condiciones .cot-campo-fecha {
    display: grid;
    grid-template-columns: 58px 150px;
    align-items: center;
    gap: 6px;

    width: 230px;
    min-width: 0;
}

#winCotizacionForm .cot-fila-condiciones #cot_fecha {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    box-sizing: border-box;
}


/* =========================================================
   MONEDA
   ========================================================= */

#winCotizacionForm .cot-fila-condiciones .cot-campo-moneda {
    display: grid;
    grid-template-columns: 62px 155px;
    align-items: center;
    gap: 6px;

    width: 230px;
    min-width: 0;
}

#winCotizacionForm .cot-fila-condiciones #idmoneda {
    width: 155px !important;
    min-width: 155px !important;
    max-width: 155px !important;
    box-sizing: border-box;
}


/* =========================================================
   IGV
   ========================================================= */

#winCotizacionForm .cot-fila-condiciones .cot-campo-igv {
    display: grid;
    grid-template-columns: 34px 120px;
    align-items: center;
    gap: 6px;

    width: 165px;
    min-width: 0;
}

#winCotizacionForm .cot-fila-condiciones #cot_incluye_igv {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    box-sizing: border-box;
}


/* =========================================================
   FORMA DE PAGO
   ========================================================= */

#winCotizacionForm .cot-fila-condiciones .cot-campo-forma-pago {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 7px;

    min-width: 0;
}

#winCotizacionForm .cot-fila-condiciones .cot-forma-pago-select {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 65px;
    align-items: center;
    gap: 8px;

    width: 100%;
    min-width: 0;
}

#winCotizacionForm .cot-fila-condiciones #id_pago {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box;
}

#winCotizacionForm .cot-fila-condiciones .btn-nueva-forma-pago {
    width: 65px !important;
    min-width: 65px !important;
    max-width: 65px !important;
    height: 34px;

    padding: 0 !important;
    font-size: 12px;
}


/* =========================================================
   VALIDEZ
   ========================================================= */

#winCotizacionForm .cot-fila-condiciones .cot-campo-validez {
    display: grid;
    grid-template-columns: 55px 80px;
    align-items: center;
    gap: 6px;

    width: 145px;
    min-width: 0;
}

#winCotizacionForm .cot-fila-condiciones #cot_validez_dias {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    box-sizing: border-box;
}


/* =========================================================
   LAPTOPS 1366 PX
   ========================================================= */

@media (max-width: 1366px) {

    #winCotizacionForm .cot-fila-condiciones {
        grid-template-columns:
            205px
            205px
            145px
            minmax(300px, 1fr)
            135px;

        column-gap: 7px;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-fecha {
        grid-template-columns: 50px 140px;
        width: 205px;
    }

    #winCotizacionForm .cot-fila-condiciones #cot_fecha {
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-moneda {
        grid-template-columns: 55px 140px;
        width: 205px;
    }

    #winCotizacionForm .cot-fila-condiciones #idmoneda {
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-igv {
        grid-template-columns: 30px 105px;
        width: 145px;
    }

    #winCotizacionForm .cot-fila-condiciones #cot_incluye_igv {
        width: 105px !important;
        min-width: 105px !important;
        max-width: 105px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-forma-pago {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    #winCotizacionForm .cot-fila-condiciones .cot-forma-pago-select {
        grid-template-columns: minmax(180px, 1fr) 60px;
        gap: 6px;
    }

    #winCotizacionForm .cot-fila-condiciones .btn-nueva-forma-pago {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-validez {
        grid-template-columns: 48px 78px;
        width: 135px;
    }

    #winCotizacionForm .cot-fila-condiciones #cot_validez_dias {
        width: 78px !important;
        min-width: 78px !important;
        max-width: 78px !important;
    }
}
/* =========================================================
   COTIZACIÓN - ANULAR POSICIONES ANTIGUAS SOLO EN LA
   FILA DE FECHA / MONEDA / IGV / FORMA PAGO / VALIDEZ
   ========================================================= */

#winCotizacionForm
.cot-fila-condiciones > .field-row {
    grid-column: auto !important;
    grid-row: auto !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* =====================================================
   OLCOT - BLOQUEO REAL DE VENTANAS DETRÁS DE UN MODAL
===================================================== */

/*
|--------------------------------------------------------------------------
| Cuando existe una ventana overlay-2 abierta:
| - bloquear ventanas principales
| - bloquear cotizaciones
| - bloquear auxiliares inferiores
|--------------------------------------------------------------------------
*/

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance,

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance-3,

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance-4 {
    pointer-events: none !important;
    user-select: none !important;
}

/*
|--------------------------------------------------------------------------
| La ventana modal abierta conserva todos sus controles
|--------------------------------------------------------------------------
*/

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance-2 {
    pointer-events: auto !important;
    user-select: auto !important;
}

/*
|--------------------------------------------------------------------------
| Fondo modal que captura cualquier clic fuera de la ventana
|--------------------------------------------------------------------------
*/

#window-layer.active::before {
    content: "";
    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.35);

    pointer-events: auto !important;
    cursor: default;

    z-index: 290 !important;
}

/*
|--------------------------------------------------------------------------
| La ventana overlay-2 debe estar encima del fondo
|--------------------------------------------------------------------------
*/

#window-layer > .overlay-window-instance-2 {
    z-index: 300 !important;
}

/* =========================================================
   OLCOT - BLOQUEO DEFINITIVO DE VENTANAS DETRÁS DE OVERLAY-2
   Formas de pago / mantenimientos abiertos desde cotización
========================================================= */

/*
|--------------------------------------------------------------------------
| El fondo modal debe quedar encima de Nueva/Editar cotización
|--------------------------------------------------------------------------
*/

#window-layer.active::before {
    content: "";
    position: fixed !important;
    inset: 0 !important;

    background: rgba(0, 0, 0, 0.35);

    z-index: 899999 !important;
    pointer-events: auto !important;

    cursor: default;
}

/*
|--------------------------------------------------------------------------
| Formas de pago queda siempre delante del fondo
|--------------------------------------------------------------------------
*/

#window-layer > .overlay-window-instance-2 {
    z-index: 900000 !important;
    pointer-events: auto !important;
}

/*
|--------------------------------------------------------------------------
| Cuando existe overlay-2, bloquear totalmente las ventanas inferiores
|--------------------------------------------------------------------------
*/

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance,

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance-3,

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance-4 {
    pointer-events: none !important;
    user-select: none !important;
}

/*
|--------------------------------------------------------------------------
| Reactivar únicamente el modal Formas de pago
|--------------------------------------------------------------------------
*/

#window-layer:has(> .overlay-window-instance-2)
> .overlay-window-instance-2 {
    pointer-events: auto !important;
    user-select: auto !important;
}

/* =====================================================
   CLIENTES - ASPA PARA LIMPIAR EL FILTRO
===================================================== */

#tab-cli-empresa .buscar-cliente-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#tab-cli-empresa .buscar-cliente-wrapper #cliBuscar {
    padding-right: 36px !important;
    box-sizing: border-box;
}

#tab-cli-empresa .buscar-cliente-wrapper
#btnLimpiarCliente {
    position: absolute;

    right: 7px;
    top: 50%;
    transform: translateY(-50%);

    width: 22px;
    min-width: 22px;
    height: 22px;

    padding: 0;
    margin: 0;

    display: none;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;

    background: #d9dde4;
    color: #4b5563;

    font-size: 17px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
}

#tab-cli-empresa .buscar-cliente-wrapper
#btnLimpiarCliente:hover {
    background: #c7ccd4;
    color: #111827;
}

body.dark #tab-cli-empresa .buscar-cliente-wrapper
#btnLimpiarCliente {
    background: #4b5563;
    color: #ffffff;
}

body.dark #tab-cli-empresa .buscar-cliente-wrapper
#btnLimpiarCliente:hover {
    background: #6b7280;
}

/* =========================================================
   OLCOT - CORRECCIÓN OVERLAY-3
   Familias / Marcas / Colores / Unidades / Monedas
========================================================= */

/*
 * El fondo modal permanece debajo.
 */
#window-layer.active::before {
    z-index: 899999 !important;
}

/*
 * Las ventanas abiertas con abrirVentana3()
 * deben quedar encima del fondo modal.
 */
#window-layer > .overlay-window-instance-3 {
    z-index: 900100 !important;
    pointer-events: auto !important;
    user-select: auto !important;
}

/* =========================================================
   OVERLAY-2 - LISTADOS MAESTROS
   Áreas / Cargos / Rubros / Formas de pago
   Evita que las tablas salgan por el lado derecho
========================================================= */

/*
|--------------------------------------------------------------------------
| Toda la ventana y sus elementos respetan el ancho disponible
|--------------------------------------------------------------------------
*/

#winAreas,
#winCargos,
#winRubros,
#winFormasPago,
#winAreas *,
#winCargos *,
#winRubros *,
#winFormasPago * {
    box-sizing: border-box;
}

/*
|--------------------------------------------------------------------------
| El cuerpo ocupa el ancho interior real de la ventana
|--------------------------------------------------------------------------
*/

#winAreas .overlay-body.dsi-layout,
#winCargos .overlay-body.dsi-layout,
#winRubros .overlay-body.dsi-layout,
#winFormasPago .overlay-body.dsi-layout {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    padding: 16px 22px !important;
    margin: 0;

    overflow: hidden;
}

/*
|--------------------------------------------------------------------------
| El contenedor de la tabla puede reducirse correctamente
|--------------------------------------------------------------------------
*/

#winAreas .dsi-browser,
#winCargos .dsi-browser,
#winRubros .dsi-browser,
#winFormasPago .dsi-browser {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    overflow: hidden;
}

/*
|--------------------------------------------------------------------------
| Caja de tabla contenida dentro de la ventana
|--------------------------------------------------------------------------
*/

#winAreas .table-box-2,
#winCargos .table-box-2,
#winRubros .table-box-2,
#winFormasPago .table-box-2 {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    margin: 0 !important;

    overflow-y: auto;
    overflow-x: hidden;

    box-sizing: border-box;
}

/*
|--------------------------------------------------------------------------
| Tablas estables
|--------------------------------------------------------------------------
*/

#tablaAreas,
#tablaCargos,
#tablaRubros,
#tablaFormasPago {
    width: 100%;
    max-width: 100%;

    table-layout: fixed;
    border-collapse: collapse;
}

/*
|--------------------------------------------------------------------------
| Evitar que textos o botones expandan las columnas
|--------------------------------------------------------------------------
*/

#tablaAreas th,
#tablaAreas td,
#tablaCargos th,
#tablaCargos td,
#tablaRubros th,
#tablaRubros td,
#tablaFormasPago th,
#tablaFormasPago td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/*
|--------------------------------------------------------------------------
| Botones compactos en la columna Opciones
|--------------------------------------------------------------------------
*/

#tablaAreas td:last-child .btn,
#tablaCargos td:last-child .btn,
#tablaRubros td:last-child .btn,
#tablaFormasPago td:last-child .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;

    width: auto !important;
    min-width: 0 !important;

    padding: 5px 10px !important;
    margin: 0 4px 0 0 !important;

    font-size: 11px !important;
    line-height: 1.1;
    white-space: nowrap;
}

/*
|--------------------------------------------------------------------------
| Pie alineado con la tabla
|--------------------------------------------------------------------------
*/

#winAreas .dsi-footer,
#winCargos .dsi-footer,
#winRubros .dsi-footer,
#winFormasPago .dsi-footer {
    flex: 0 0 auto;

    width: 100%;
    padding: 12px 16px 4px !important;
    margin: 0;

    box-sizing: border-box;
}

/* ÁREAS */

#tablaAreas th:nth-child(1),
#tablaAreas td:nth-child(1) {
    width: 70px;
}

#tablaAreas th:nth-child(3),
#tablaAreas td:nth-child(3) {
    width: 120px;
}

#tablaAreas th:nth-child(4),
#tablaAreas td:nth-child(4) {
    width: 190px;
}


/* CARGOS */

#tablaCargos th:nth-child(1),
#tablaCargos td:nth-child(1) {
    width: 70px;
}

#tablaCargos th:nth-child(3),
#tablaCargos td:nth-child(3) {
    width: 210px;
}


/* RUBROS */

#tablaRubros th:nth-child(1),
#tablaRubros td:nth-child(1) {
    width: 70px;
}

#tablaRubros th:nth-child(3),
#tablaRubros td:nth-child(3) {
    width: 120px;
}

#tablaRubros th:nth-child(4),
#tablaRubros td:nth-child(4) {
    width: 190px;
}


/* FORMAS DE PAGO */

#tablaFormasPago th:nth-child(1),
#tablaFormasPago td:nth-child(1) {
    width: 70px;
}

#tablaFormasPago th:nth-child(3),
#tablaFormasPago td:nth-child(3) {
    width: 110px;
}

#tablaFormasPago th:nth-child(4),
#tablaFormasPago td:nth-child(4) {
    width: 120px;
}

#tablaFormasPago th:nth-child(5),
#tablaFormasPago td:nth-child(5) {
    width: 190px;
}
/* =========================================================
   PROVEEDORES - OVERLAY-4 / TABLA ESTABLE
   Corrección aislada: no afecta cotizaciones ni otros módulos
========================================================= */

/* Todos los cálculos de ancho incluyen padding y bordes */
#winProveedores,
#winProveedores *,
#winProveedores *::before,
#winProveedores *::after {
    box-sizing: border-box !important;
}

/* El cuerpo no debe sumar width:100% + padding */
#winProveedores .overlay-body.dsi-layout {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 !important;
    padding: 14px 18px !important;

    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;

    overflow: hidden !important;
}

/* Zona interna reducible */
#winProveedores .dsi-browser {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* El marco siempre queda dentro del overlay */
#winProveedores .table-box-2 {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;

    margin: 0 !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
}

/* Tabla fija: editar o crear no recalcula columnas */
#tablaProveedores {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    table-layout: fixed !important;
    border-collapse: collapse !important;
}

/* Celdas contenidas */
#tablaProveedores th,
#tablaProveedores td {
    min-width: 0 !important;
    max-width: none !important;

    padding: 6px 7px !important;

    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
}

/* Anchos estables de las nueve columnas */
#tablaProveedores th:nth-child(1),
#tablaProveedores td:nth-child(1) {
    width: 50px !important;
    text-align: center !important;
}

#tablaProveedores th:nth-child(2),
#tablaProveedores td:nth-child(2) {
    width: 125px !important;
}

#tablaProveedores th:nth-child(3),
#tablaProveedores td:nth-child(3) {
    width: 175px !important;
}

#tablaProveedores th:nth-child(4),
#tablaProveedores td:nth-child(4) {
    width: 175px !important;
}

/* Motor toma únicamente el espacio restante */
#tablaProveedores th:nth-child(5),
#tablaProveedores td:nth-child(5) {
    width: auto !important;
}

#tablaProveedores th:nth-child(6),
#tablaProveedores td:nth-child(6) {
    width: 85px !important;
    text-align: center !important;
}

#tablaProveedores th:nth-child(7),
#tablaProveedores td:nth-child(7) {
    width: 75px !important;
    text-align: center !important;
}

#tablaProveedores th:nth-child(8),
#tablaProveedores td:nth-child(8) {
    width: 110px !important;
    text-align: center !important;
}

#tablaProveedores th:nth-child(9),
#tablaProveedores td:nth-child(9) {
    width: 170px !important;
    text-align: center !important;
}

/* Neutraliza el ancho global de 300 px de input/select */
#tablaProveedores input:not([type="checkbox"]):not([type="radio"]),
#tablaProveedores select {
    display: block !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    height: 32px !important;
    margin: 0 !important;
    padding: 5px 7px !important;

    font-family: "Segoe UI", sans-serif !important;
    font-size: 11px !important;

    box-sizing: border-box !important;
}

/* Alturas estables */
#tablaProveedores tbody tr:not(.editing) {
    height: 40px !important;
}

#tablaProveedores tbody tr.editing {
    height: 46px !important;
}

#tablaProveedores tbody tr.editing td {
    height: 46px !important;
    background: #eef4ff !important;
}

/* La columna Opciones nunca fuerza el ancho de la tabla */
#tablaProveedores td:last-child {
    overflow: hidden !important;
    white-space: nowrap !important;
    text-align: center !important;
}

#tablaProveedores td:last-child .btn,
#tablaProveedores td:last-child .btn-table-chica {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    height: 28px !important;
    padding: 4px 9px !important;
    margin: 0 3px 0 0 !important;

    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

/* Footer alineado con la tabla */
#winProveedores .dsi-footer {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;

    margin: 0 !important;
    padding: 10px 14px 2px !important;

    box-sizing: border-box !important;
}

/* Tema oscuro */
body.dark #tablaProveedores tbody tr.editing td {
    background: #263040 !important;
}

/* Ajuste fino para 1366 x 768 */
@media (max-width: 1366px) {
    #winProveedores .overlay-body.dsi-layout {
        padding: 10px 12px !important;
    }

    #tablaProveedores th,
    #tablaProveedores td {
        padding: 5px !important;
        font-size: 11px !important;
    }

    #tablaProveedores th:nth-child(2),
    #tablaProveedores td:nth-child(2) {
        width: 110px !important;
    }

    #tablaProveedores th:nth-child(3),
    #tablaProveedores td:nth-child(3),
    #tablaProveedores th:nth-child(4),
    #tablaProveedores td:nth-child(4) {
        width: 155px !important;
    }

    #tablaProveedores th:nth-child(9),
    #tablaProveedores td:nth-child(9) {
        width: 155px !important;
    }

    #tablaProveedores td:last-child .btn,
    #tablaProveedores td:last-child .btn-table-chica {
        padding: 4px 7px !important;
        margin-right: 2px !important;
        font-size: 10px !important;
    }
}

/* =========================================================
   ARTÍCULOS - DISTRIBUCIÓN FINAL DE COLUMNAS Y ZOOM
   Corrección aislada para #tablaArticulos
   Orden actual:
   Código / Cód. Interno / Imagen / Descripción / Color /
   Familia / Línea / Marca / Proveedor / Estado / Acciones
========================================================= */

/*
 * La tabla usa distribución fija para que cada columna conserve
 * su ancho y Descripción reciba el espacio principal.
 */
#winArticulos #tablaArticulos {
    width: 100% !important;
    min-width: 1480px !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
}

/* Contención general y alineación vertical */
#winArticulos #tablaArticulos th,
#winArticulos #tablaArticulos td {
    box-sizing: border-box !important;
    vertical-align: middle !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 1. Código: compacto y centrado */
#winArticulos #tablaArticulos th:nth-child(1),
#winArticulos #tablaArticulos td:nth-child(1) {
    width: 58px !important;
    text-align: center !important;
    font-variant-numeric: tabular-nums;
}

/* 2. Código interno */
#winArticulos #tablaArticulos th:nth-child(2),
#winArticulos #tablaArticulos td:nth-child(2) {
    width: 112px !important;
    text-align: left !important;
    font-variant-numeric: tabular-nums;
}

/* 3. Imagen */
#winArticulos #tablaArticulos th:nth-child(3),
#winArticulos #tablaArticulos td:nth-child(3) {
    width: 76px !important;
    text-align: center !important;
    overflow: visible !important;
    position: relative;
}

/* 4. Descripción: columna principal */
#winArticulos #tablaArticulos th:nth-child(4),
#winArticulos #tablaArticulos td:nth-child(4) {
    width: 360px !important;
    text-align: left !important;
}

/* 5. Color */
#winArticulos #tablaArticulos th:nth-child(5),
#winArticulos #tablaArticulos td:nth-child(5) {
    width: 125px !important;
    text-align: left !important;
}

/* 6. Familia */
#winArticulos #tablaArticulos th:nth-child(6),
#winArticulos #tablaArticulos td:nth-child(6) {
    width: 145px !important;
    text-align: left !important;
}

/* 7. Línea */
#winArticulos #tablaArticulos th:nth-child(7),
#winArticulos #tablaArticulos td:nth-child(7) {
    width: 145px !important;
    text-align: left !important;
}

/* 8. Marca */
#winArticulos #tablaArticulos th:nth-child(8),
#winArticulos #tablaArticulos td:nth-child(8) {
    width: 125px !important;
    text-align: center !important;
}

/* 9. Proveedor */
#winArticulos #tablaArticulos th:nth-child(9),
#winArticulos #tablaArticulos td:nth-child(9) {
    width: 155px !important;
    text-align: center !important;
}

/* 10. Estado */
#winArticulos #tablaArticulos th:nth-child(10),
#winArticulos #tablaArticulos td:nth-child(10) {
    width: 95px !important;
    text-align: center !important;
}

/* 11. Acciones */
#winArticulos #tablaArticulos th:nth-child(11),
#winArticulos #tablaArticulos td:nth-child(11) {
    width: 84px !important;
    text-align: center !important;
}

/* Miniatura estable */
#winArticulos #tablaArticulos td:nth-child(3) img {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;

    display: block;
    margin: 0 auto;

    object-fit: contain;
    cursor: zoom-in;

    position: relative;
    z-index: 1;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

/*
 * Corrección del zoom:
 * antes apuntaba a nth-child(8), pero Imagen ahora es la columna 3.
 */
#winArticulos #tablaArticulos td:nth-child(3):hover img {
    transform: scale(5);
    transform-origin: center center;
    z-index: 1000;

    background: #ffffff;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/*
 * Permite que el zoom salga de la celda.
 * El scroll continúa siendo manejado por .table-box.
 */
#winArticulos #tablaArticulos tbody tr,
#winArticulos #tablaArticulos tbody {
    overflow: visible !important;
}

/* Altura uniforme de las filas */
#winArticulos #tablaArticulos tbody tr {
    height: 52px;
}

/* Encabezados centrados; datos textuales alineados a la izquierda */
#winArticulos #tablaArticulos thead th {
    text-align: center !important;
}

/* Ajuste específico para 1366 x 768 */
@media (max-width: 1366px) {
    #winArticulos #tablaArticulos {
        min-width: 1320px !important;
    }

    #winArticulos #tablaArticulos th:nth-child(1),
    #winArticulos #tablaArticulos td:nth-child(1) {
        width: 52px !important;
    }

    #winArticulos #tablaArticulos th:nth-child(2),
    #winArticulos #tablaArticulos td:nth-child(2) {
        width: 105px !important;
    }

    #winArticulos #tablaArticulos th:nth-child(3),
    #winArticulos #tablaArticulos td:nth-child(3) {
        width: 68px !important;
    }

    #winArticulos #tablaArticulos th:nth-child(4),
    #winArticulos #tablaArticulos td:nth-child(4) {
        width: 300px !important;
    }

    #winArticulos #tablaArticulos th,
    #winArticulos #tablaArticulos td {
        padding-left: 6px !important;
        padding-right: 6px !important;
        font-size: 12px !important;
    }
}

/* Tema oscuro para la ampliación */
body.dark #winArticulos #tablaArticulos td:nth-child(3):hover img {
    background: #111827;
}

/* =========================================================
   ARTÍCULOS - ZOOM FLOTANTE SIN RECORTES
   Evita cortes en la primera fila, última fila y bordes.
========================================================= */

/*
 * Se desactiva la ampliación mediante transform dentro de la celda.
 * La miniatura permanece estable y la ampliación se muestra en
 * #artZoomPreview, cuya posición es calculada por JavaScript.
 */
#winArticulos #tablaArticulos td:nth-child(3):hover img {
    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Contenedor flotante */
#winArticulos #artZoomPreview {
    position: fixed !important;

    width: 290px !important;
    height: 290px !important;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 10px;
    box-sizing: border-box;

    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;

    box-shadow: 0 18px 45px rgba(0, 0, 0, .35);

    z-index: 10000000 !important;
    pointer-events: none !important;
}

/* Imagen completa, sin deformarse ni cortarse */
#winArticulos #artZoomPreview img {
    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height: 100% !important;

    object-fit: contain !important;
    display: block;
}

/* Tema oscuro */
body.dark #winArticulos #artZoomPreview {
    background: #111827;
    border-color: #475569;
}

/* En 1366×768, un poco más compacto */
@media (max-width: 1366px) {
    #winArticulos #artZoomPreview {
        width: 250px !important;
        height: 250px !important;
    }
}

/* =========================================================
   ARTÍCULOS - ZOOM FLOTANTE DEFINITIVO
   Controlado exclusivamente desde articulos/art10.js
========================================================= */

/* Evita el zoom antiguo por transform dentro de las celdas y Cards */
#winArticulos #tablaArticulos td:nth-child(3):hover img,
#winArticulos .art-card-img:hover img {
    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Miniaturas del listado */
#winArticulos #tablaArticulos td:nth-child(3) .art-img-zoom {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;

    display: block !important;
    margin: 0 auto !important;

    object-fit: contain !important;
    cursor: zoom-in !important;
}

/* Imágenes de Cards */
#winArticulos .art-card-img .art-img-zoom {
    max-width: 100% !important;
    max-height: 150px !important;
    object-fit: contain !important;
    cursor: zoom-in !important;
}

/*
 * El visor se agrega directamente al body para que ninguna tabla,
 * ventana o contenedor con overflow pueda recortarlo.
 */
body > #artZoomPreview {
    position: fixed !important;

    width: 320px !important;
    height: 320px !important;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 12px !important;
    box-sizing: border-box !important;

    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;

    box-shadow: 0 18px 45px rgba(0, 0, 0, .35) !important;

    z-index: 20000000 !important;
    pointer-events: none !important;

    opacity: 1;
}

body > #artZoomPreview img {
    display: block !important;

    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height: 100% !important;

    object-fit: contain !important;
}

/* Tema oscuro */
body.dark > #artZoomPreview {
    background: #111827 !important;
    border-color: #475569 !important;
}

/* Ajuste para 1366 × 768 */
@media (max-width: 1366px) {
    body > #artZoomPreview {
        width: 260px !important;
        height: 260px !important;
    }
}

/* =========================================================
   ARTÍCULOS - VISTAS Y ZOOM DEFINITIVO v1.4
   Listado: visor flotante.
   Cards: ampliación sobre la imagen del mismo card.
========================================================= */

/* ---------------------------------------------------------
   CABECERA DEL LISTADO SIEMPRE POR ENCIMA DE LAS FILAS
--------------------------------------------------------- */

#winArticulos .table-box {
    position: relative !important;
    isolation: isolate;
}

#winArticulos #tablaArticulos thead {
    position: relative;
    z-index: 5000 !important;
}

#winArticulos #tablaArticulos thead th {
    position: sticky !important;
    top: 0 !important;

    z-index: 5001 !important;

    background: var(--win-header-bg) !important;
    color: var(--win-header-text) !important;

    box-shadow:
        inset 0 -1px 0 var(--win-border),
        0 2px 4px rgba(0, 0, 0, .08);
}

/* Las filas y miniaturas quedan debajo de la cabecera */
#winArticulos #tablaArticulos tbody,
#winArticulos #tablaArticulos tbody tr,
#winArticulos #tablaArticulos tbody td,
#winArticulos #tablaArticulos tbody img {
    z-index: auto !important;
}

/* ---------------------------------------------------------
   LISTADO: MINIATURA ESTABLE + VISOR FLOTANTE
--------------------------------------------------------- */

#winArticulos #tablaArticulos .art-img-zoom-lista {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;

    display: block !important;
    margin: 0 auto !important;

    object-fit: contain !important;
    cursor: zoom-in !important;

    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* ---------------------------------------------------------
   CARDS: EL VISOR FLOTANTE NO SE UTILIZA
--------------------------------------------------------- */

#winArticulos #articulosCards {
    isolation: isolate;
    overflow-x: hidden;
    padding-top: 14px;
    padding-bottom: 24px;
}

#winArticulos #articulosCards .art-card {
    position: relative;
    z-index: 1;

    overflow: visible !important;

    transition:
        transform .20s ease,
        box-shadow .20s ease,
        border-color .20s ease;
}

/*
 * La zona de imagen constituye el escenario del zoom.
 * La ampliación crece centrada sobre el propio card.
 */
#winArticulos #articulosCards .art-card-img {
    position: relative;
    z-index: 2;

    overflow: visible !important;

    transform: translateZ(0);
}

#winArticulos #articulosCards .art-img-zoom-card {
    display: block;

    max-width: 100% !important;
    max-height: 150px !important;

    object-fit: contain !important;
    cursor: zoom-in !important;

    position: relative;
    z-index: 2;

    transform-origin: center center;

    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-radius .22s ease,
        background-color .22s ease;
}

/* Card elevado y delante de los demás */
#winArticulos #articulosCards .art-card:hover {
    z-index: 1000;

    transform: translateY(-4px);

    border-color: #93c5fd;

    box-shadow:
        0 18px 40px rgba(15, 23, 42, .22);
}

/* Zoom visual sobre la propia imagen del card */
#winArticulos #articulosCards .art-card-img:hover {
    z-index: 1001;
}

#winArticulos #articulosCards .art-card-img:hover .art-img-zoom-card {
    transform: scale(1.72) !important;

    z-index: 1002;

    background: #ffffff !important;
    border-radius: 10px;

    box-shadow:
        0 16px 38px rgba(0, 0, 0, .30) !important;
}

/* Tema oscuro del zoom en Cards */
body.dark #winArticulos #articulosCards .art-card:hover {
    border-color: #60a5fa;
    box-shadow:
        0 18px 42px rgba(0, 0, 0, .58);
}

body.dark #winArticulos #articulosCards .art-card-img:hover .art-img-zoom-card {
    background: #111827 !important;
}

/* Pantallas de 1366: ampliación un poco menor */
@media (max-width: 1366px) {
    #winArticulos #articulosCards .art-card-img:hover .art-img-zoom-card {
        transform: scale(1.55) !important;
    }
}

/* =========================================================
   ARTÍCULOS PREMIUM v2.0
   Animaciones, zoom adaptativo, precarga y lightbox.
========================================================= */

/* ---------------------------------------------------------
   TRANSICIONES GENERALES
--------------------------------------------------------- */

#winArticulos .acciones-superior,
#winArticulos .table-box,
#winArticulos #articulosCards {
    animation: artVistaEntrada .18s ease-out;
}

@keyframes artVistaEntrada {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

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

/* Hover elegante de filas */
#winArticulos #tablaArticulos tbody tr {
    transition:
        background-color .16s ease,
        box-shadow .16s ease;
}

#winArticulos #tablaArticulos tbody tr:hover td {
    background-color: rgba(37, 99, 235, .055);
}

/* La miniatura responde suavemente sin crecer dentro de la tabla */
#winArticulos #tablaArticulos .art-img-zoom-lista {
    transition:
        opacity .16s ease,
        filter .16s ease !important;
}

#winArticulos #tablaArticulos .art-img-zoom-lista:hover {
    opacity: .92;
    filter: saturate(1.08) contrast(1.03);
}

/* ---------------------------------------------------------
   VISOR FLOTANTE ADAPTATIVO DEL LISTADO
--------------------------------------------------------- */

body > #artZoomPreview {
    width: 320px !important;
    height: 320px !important;

    opacity: 0;
    transform: scale(.97);

    animation: artZoomEntrada .16s ease-out forwards;
}

body > #artZoomPreview.orientacion-vertical {
    width: 285px !important;
    height: 360px !important;
}

body > #artZoomPreview.orientacion-horizontal {
    width: 380px !important;
    height: 275px !important;
}

body > #artZoomPreview.orientacion-cuadrada {
    width: 320px !important;
    height: 320px !important;
}

@keyframes artZoomEntrada {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---------------------------------------------------------
   CARDS PREMIUM
--------------------------------------------------------- */

#winArticulos #articulosCards .art-card {
    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-color .22s ease,
        background-color .22s ease;
}

#winArticulos #articulosCards .art-card:hover {
    transform: translateY(-5px);

    border-color: #60a5fa;

    box-shadow:
        0 20px 44px rgba(15, 23, 42, .24);
}

#winArticulos #articulosCards .art-card-img {
    transition:
        background-color .22s ease,
        border-color .22s ease;
}

#winArticulos #articulosCards .art-card:hover .art-card-img {
    border-color: #bfdbfe;
    background: #ffffff;
}

#winArticulos #articulosCards .art-img-zoom-card {
    will-change: transform;

    transition:
        transform .24s cubic-bezier(.2, .75, .25, 1),
        box-shadow .24s ease,
        border-radius .24s ease,
        background-color .24s ease !important;
}

#winArticulos #articulosCards .art-card-img:hover .art-img-zoom-card {
    transform: scale(1.72) !important;

    border-radius: 12px;

    box-shadow:
        0 18px 42px rgba(15, 23, 42, .34) !important;
}

/* Indicación discreta de doble clic */
#winArticulos #articulosCards .art-card-img::after {
    content: "Doble clic para ampliar";

    position: absolute;
    left: 50%;
    bottom: 7px;

    transform: translateX(-50%) translateY(4px);

    padding: 3px 8px;

    border-radius: 999px;

    background: rgba(15, 23, 42, .76);
    color: #ffffff;

    font-size: 10px;
    white-space: nowrap;

    opacity: 0;
    pointer-events: none;

    transition:
        opacity .18s ease,
        transform .18s ease;
}

#winArticulos #articulosCards .art-card-img:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------
   LIGHTBOX DE IMAGEN COMPLETA
--------------------------------------------------------- */

#artLightbox {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;
    box-sizing: border-box;

    background: rgba(2, 6, 23, .76);
    backdrop-filter: blur(3px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    z-index: 30000000;

    transition:
        opacity .18s ease,
        visibility .18s ease;
}

#artLightbox.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.art-lightbox-contenido {
    position: relative;

    width: min(920px, 92vw);
    height: min(720px, 84vh);

    padding: 20px 20px 46px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 16px;

    box-shadow:
        0 28px 70px rgba(0, 0, 0, .48);

    transform: scale(.96) translateY(8px);

    transition:
        transform .20s cubic-bezier(.2, .75, .25, 1);
}

#artLightbox.visible .art-lightbox-contenido {
    transform: scale(1) translateY(0);
}

.art-lightbox-contenido > img {
    display: block;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;
}

.art-lightbox-cerrar {
    position: absolute;
    top: 10px;
    right: 12px;

    width: 34px;
    min-width: 34px;
    height: 34px;

    padding: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background: rgba(15, 23, 42, .82);
    color: #ffffff;

    font-size: 23px;
    line-height: 1;

    cursor: pointer;

    z-index: 2;

    transition:
        transform .16s ease,
        background-color .16s ease;
}

.art-lightbox-cerrar:hover {
    transform: scale(1.08);
    background: #dc2626;
}

.art-lightbox-pie {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 13px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

/* Tema oscuro */
body.dark .art-lightbox-contenido {
    background: #111827;
    border-color: #475569;
}

body.dark .art-lightbox-pie {
    color: #e5e7eb;
}

body.dark #winArticulos #articulosCards .art-card:hover .art-card-img {
    background: #111827;
    border-color: #475569;
}

/* 1366 x 768 */
@media (max-width: 1366px) {
    body > #artZoomPreview.orientacion-vertical {
        width: 245px !important;
        height: 310px !important;
    }

    body > #artZoomPreview.orientacion-horizontal {
        width: 325px !important;
        height: 235px !important;
    }

    body > #artZoomPreview.orientacion-cuadrada {
        width: 270px !important;
        height: 270px !important;
    }

    .art-lightbox-contenido {
        width: min(790px, 92vw);
        height: min(590px, 82vh);
    }

    #winArticulos #articulosCards .art-card-img:hover .art-img-zoom-card {
        transform: scale(1.55) !important;
    }
}


/* =========================================================
   COTIZACIÓN - PRECIOS CON P/LOGO Y ALINEACIÓN NUMÉRICA
   ========================================================= */

.cot-precios-box {
    width: 680px !important;
    max-width: 680px !important;
}

.cot-art-layout {
    grid-template-columns:
        250px minmax(0, 1fr) 680px !important;
}

.cot-precios th:nth-child(1),
.cot-precios td:nth-child(1) {
    width: 125px !important;
}

.cot-precios th:nth-child(2),
.cot-precios td:nth-child(2) {
    width: 110px !important;
}

.cot-precios th:nth-child(3),
.cot-precios td:nth-child(3) {
    width: 130px !important;
}

.cot-precios th:nth-child(4),
.cot-precios td:nth-child(4) {
    width: 145px !important;
}

.cot-precios th:nth-child(5),
.cot-precios td:nth-child(5) {
    width: 46px !important;
}

.cot-precios .cantidad,
.cot-precios .precio-logo,
.cot-precios .precio,
.cot-precios .total {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.cot-precios .precio-logo,
.cot-precios .precio,
.cot-precios .total {
    padding-right: 10px !important;
}

.cot-precios input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.cot-precios input[type="number"]::-webkit-outer-spin-button,
.cot-precios input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media (max-width: 1500px) {
    .cot-precios-box {
        width: 620px !important;
        max-width: 620px !important;
    }

    .cot-art-layout {
        grid-template-columns:
            220px minmax(0, 1fr) 620px !important;
    }

    .cot-precios th:nth-child(1),
    .cot-precios td:nth-child(1) {
        width: 112px !important;
    }

    .cot-precios th:nth-child(2),
    .cot-precios td:nth-child(2) {
        width: 98px !important;
    }

    .cot-precios th:nth-child(3),
    .cot-precios td:nth-child(3) {
        width: 118px !important;
    }

    .cot-precios th:nth-child(4),
    .cot-precios td:nth-child(4) {
        width: 130px !important;
    }
}


/* =========================================================
   COTIZACIÓN - CONTROL DE EDICIÓN Y NAVEGACIÓN DE PRECIOS
   ========================================================= */

/* Cabeceras centradas */
.cot-precios thead th {
    text-align: center !important;
    vertical-align: middle !important;
}

/* Precio automático y Total: solo lectura, gris claro */
.cot-precios .precio[readonly],
.cot-precios .total[readonly] {
    background: #eef1f4 !important;
    color: #4b5563 !important;
    border-color: #cbd5e1 !important;
}

/* Precio Unitario libre: editable únicamente si no hay precio de catálogo */
.cot-precios .precio.cot-precio-libre:not([readonly]) {
    background: #ffffff !important;
    color: #111827 !important;
}

/* Total no recibe cursor/foco del mouse */
.cot-precios .total {
    pointer-events: none !important;
    cursor: default !important;
}

/* Mantener todos los importes alineados como números */
.cot-precios .cantidad,
.cot-precios .precio-logo,
.cot-precios .precio,
.cot-precios .total {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

/* Al quitar el botón Actualizar descripción, el textarea ocupa el ancho útil */
.cot-desc-larga-wrap {
    display: block !important;
}

.cot-desc-larga-wrap .cot_descripcion_larga {
    width: 100% !important;
}

/* Tema oscuro: conservar diferencia visual de campos calculados */
body.dark .cot-precios .precio[readonly],
body.dark .cot-precios .total[readonly] {
    background: #374151 !important;
    color: #e5e7eb !important;
    border-color: #4b5563 !important;
}

body.dark .cot-precios .precio.cot-precio-libre:not([readonly]) {
    background: #111827 !important;
    color: #f9fafb !important;
}


/* Cantidad en cotización: siempre entera, sin decimales */
.cot-precios .cantidad {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}


/* =========================================================
   PAGINACIÓN DE LISTADOS CRÍTICOS
   ========================================================= */
.olcot-paginacion{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
    flex-wrap:wrap;
    margin-left:auto;
    font-size:12px;
}
.olcot-paginacion .btn{
    min-width:auto;
    padding:5px 9px;
}
.olcot-paginacion button:disabled{
    opacity:.45;
    cursor:not-allowed;
}
.table-footer{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}


/* ============================================================
   OLCOT 3.10.88 - RESPONSIVE SEGURO COTIZACIONES
   SOLO CSS - NO CAMBIA PHP NI JAVASCRIPT
   Pegar AL FINAL de css/estilos.css
   ============================================================ */

/* ---------- Pantalla principal de cotizaciones ---------- */

#winCotizaciones .table-box {
    overflow-x: auto !important;
    overflow-y: auto !important;
    min-width: 0 !important;
}

#winCotizaciones #tablaCotizaciones th,
#winCotizaciones #tablaCotizaciones td {
    box-sizing: border-box;
}

#winCotizaciones #tablaCotizaciones th:last-child,
#winCotizaciones #tablaCotizaciones td:last-child {
    white-space: nowrap !important;
}

/* 1366 / notebooks */
@media (max-width: 1450px) {

    #winCotizaciones .overlay-body {
        padding: 8px 10px !important;
    }

    #winCotizaciones .acciones-superior {
        margin-bottom: 8px !important;
        gap: 8px !important;
    }

    #winCotizaciones .acciones-superior .btn {
        min-width: 0 !important;
        width: auto !important;
        padding: 5px 10px !important;
        font-size: 11px !important;
    }

    #winCotizaciones .buscar-input {
        width: 245px !important;
        max-width: 32vw !important;
        padding: 5px 8px !important;
        font-size: 11px !important;
    }

    /* Anula los min-width 1500/1380 del CSS histórico */
    #winCotizaciones #tablaCotizaciones {
        min-width: 1110px !important;
        width: 100% !important;
        table-layout: fixed !important;
        font-size: 10.5px !important;
    }

    #winCotizaciones #tablaCotizaciones th,
    #winCotizaciones #tablaCotizaciones td {
        padding: 5px 6px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Sacrificio acordado SOLO en responsive:
       8 = IGV, 10 = Validez */
    #winCotizaciones #tablaCotizaciones th:nth-child(8),
    #winCotizaciones #tablaCotizaciones td:nth-child(8),
    #winCotizaciones #tablaCotizaciones th:nth-child(10),
    #winCotizaciones #tablaCotizaciones td:nth-child(10) {
        display: none !important;
    }

    /* Columnas visibles */
    #winCotizaciones #tablaCotizaciones th:nth-child(1),
    #winCotizaciones #tablaCotizaciones td:nth-child(1) {
        width: 115px !important;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(2),
    #winCotizaciones #tablaCotizaciones td:nth-child(2) {
        width: 72px !important;
        text-align: center;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(3),
    #winCotizaciones #tablaCotizaciones td:nth-child(3) {
        width: 145px !important;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(4),
    #winCotizaciones #tablaCotizaciones td:nth-child(4) {
        width: 125px !important;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(5),
    #winCotizaciones #tablaCotizaciones td:nth-child(5) {
        width: 155px !important;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(6),
    #winCotizaciones #tablaCotizaciones td:nth-child(6) {
        width: 112px !important;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(7),
    #winCotizaciones #tablaCotizaciones td:nth-child(7) {
        width: 58px !important;
        text-align: center;
    }

    #winCotizaciones #tablaCotizaciones th:nth-child(9),
    #winCotizaciones #tablaCotizaciones td:nth-child(9) {
        width: 135px !important;
    }

    /* Estado: siempre visible */
    #winCotizaciones #tablaCotizaciones th:nth-child(11),
    #winCotizaciones #tablaCotizaciones td:nth-child(11) {
        width: 88px !important;
        text-align: center;
    }

    /* Opciones: Abrir + Duplicar + PDF SIEMPRE visibles */
    #winCotizaciones #tablaCotizaciones th:nth-child(12),
    #winCotizaciones #tablaCotizaciones td:nth-child(12) {
        width: 178px !important;
        min-width: 178px !important;
        text-align: center !important;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: nowrap !important;
    }

    #winCotizaciones #tablaCotizaciones td:nth-child(12) .btn {
        display: inline-block !important;
        min-width: 0 !important;
        width: auto !important;
        padding: 4px 6px !important;
        margin: 1px !important;
        font-size: 10px !important;
        line-height: 1.15 !important;
    }

    #winCotizaciones .cot-badge {
        padding: 2px 6px !important;
        font-size: 9.5px !important;
    }
}

/* Si la pantalla es todavía más estrecha, se conserva el respaldo
   de scroll horizontal. No se oculta Estado ni Opciones. */
@media (max-width: 1180px) {
    #winCotizaciones #tablaCotizaciones {
        min-width: 1040px !important;
    }

    /* Correo puede ocultarse solo aquí, si hiciera falta */
    #winCotizaciones #tablaCotizaciones th:nth-child(5),
    #winCotizaciones #tablaCotizaciones td:nth-child(5) {
        display: none !important;
    }
}


/* ---------- Nueva / Editar Cotización ---------- */

@media (max-width: 1450px) {

    /* Aprovecha mejor la pantalla sin tocar el DOM */
    #winCotizacionForm.overlay-window-instance-4 {
        left: 1.2vw !important;
        right: 1.2vw !important;
        top: calc(var(--header-h) + 4px) !important;
        bottom: calc(var(--footer-h) + 4px) !important;
    }

    #winCotizacionForm .overlay-body {
        padding: 8px 12px !important;
    }

    #winCotizacionForm h3 {
        margin: 6px 0 7px !important;
        font-size: 13px !important;
    }

    #winCotizacionForm label {
        font-size: 11px !important;
    }

    #winCotizacionForm input:not([type="checkbox"]):not([type="radio"]),
    #winCotizacionForm select {
        min-height: 29px !important;
        height: 29px !important;
        padding: 4px 6px !important;
        font-size: 11px !important;
    }

    #winCotizacionForm textarea {
        padding: 5px 6px !important;
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    #winCotizacionForm .btn,
    #winCotizacionForm .btn-save,
    #winCotizacionForm .btn-cerrar,
    #winCotizacionForm .btn-delete {
        min-width: 0 !important;
        width: auto !important;
        min-height: 28px !important;
        height: auto !important;
        padding: 5px 8px !important;
        font-size: 10.5px !important;
    }

    /* Cabecera Datos generales */
    #winCotizacionForm .cot-datos-grid {
        gap: 6px 9px !important;
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr)
            minmax(0, 1fr)
            215px !important;
    }

    #winCotizacionForm .cot-datos-grid .field-row {
        grid-template-columns: 68px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    #winCotizacionForm .cot-observacion {
        gap: 4px !important;
    }

    #winCotizacionForm .cot-observacion textarea {
        height: 91px !important;
        min-height: 91px !important;
    }

    /* Items: compactar sin deformar imagen */
    #winCotizacionForm .cot-item {
        padding: 9px 10px !important;
        margin-bottom: 9px !important;
    }

    #winCotizacionForm .cot-item-header {
        margin-bottom: 6px !important;
    }

    #winCotizacionForm .cot-item-header strong {
        font-size: 11.5px !important;
    }

    #winCotizacionForm .cot-art-layout {
        grid-template-columns:
            125px
            minmax(410px, 1fr)
            minmax(450px, 1.08fr) !important;
        gap: 10px !important;
    }

    #winCotizacionForm .cot-art-img {
        width: 125px !important;
        min-width: 125px !important;
        height: 125px !important;
        min-height: 125px !important;
        overflow: hidden !important;
    }

    #winCotizacionForm .cot-art-img img {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    #winCotizacionForm .cot-art-grid {
        gap: 5px 6px !important;
    }

    #winCotizacionForm .cot-presentacion-row textarea {
        height: 42px !important;
        min-height: 42px !important;
    }

    #winCotizacionForm .cot-desc-larga-wrap {
        grid-template-columns: minmax(0, 1fr) 82px !important;
        gap: 6px !important;
    }

    #winCotizacionForm .cot-desc-larga-wrap textarea,
    #winCotizacionForm .cot-desc-larga-row textarea {
        height: 58px !important;
        min-height: 58px !important;
    }

    #winCotizacionForm .btn-actualizar-maestro {
        width: 82px !important;
        height: 48px !important;
        padding: 4px 5px !important;
        font-size: 9.5px !important;
    }

    #winCotizacionForm .cot-precios-box {
        min-width: 0 !important;
    }

    #winCotizacionForm .cot-precios {
        width: 100% !important;
        table-layout: fixed !important;
        font-size: 10px !important;
        margin-top: 4px !important;
        margin-bottom: 5px !important;
    }

    #winCotizacionForm .cot-precios th,
    #winCotizacionForm .cot-precios td {
        padding: 3px !important;
    }

    #winCotizacionForm .cot-precios input {
        width: 100% !important;
        min-width: 0 !important;
        height: 26px !important;
        padding: 2px 4px !important;
        font-size: 10px !important;
    }

    #winCotizacionForm .cot-totales {
        gap: 10px !important;
        padding: 6px 3px !important;
        font-size: 11px !important;
    }

    #winCotizacionForm .botonera-form,
    #winCotizacionForm .botonera-acciones {
        margin-top: 6px !important;
        gap: 6px !important;
    }

    #winCotizacionForm .cot-autosave {
        margin-top: 4px !important;
        font-size: 10px !important;
    }
}

/* En equipos más estrechos mantenemos scroll interno en lugar de
   romper la composición de precios o imágenes. */
@media (max-width: 1180px) {
    #winCotizacionForm .form-scroll {
        overflow: auto !important;
    }

    #winCotizacionForm .cot-art-layout {
        min-width: 950px !important;
    }
}


/* ============================================================
   OLCOT 3.10.89 - COTIZACIONES
   Corrección: footer / total registros / paginación visibles
   PEGAR AL FINAL de css/estilos.css
   Requiere mantener el parche responsive 3.10.88 anterior.
   ============================================================ */

@media (max-width: 1450px) {

    /* La ventana usa el alto disponible, pero el footer no puede quedar debajo */
    #winCotizaciones .overlay-body {
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
    }

    #winCotizaciones #cotizaciones-lista {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* Barra superior: no debe comprimirse */
    #winCotizaciones .acciones-superior {
        flex: 0 0 auto !important;
    }

    /* Solo la zona de la tabla hace scroll vertical/horizontal */
    #winCotizaciones .table-box {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        margin-bottom: 0 !important;
    }

    /* El pie queda siempre visible */
    #winCotizaciones .table-footer {
        flex: 0 0 auto !important;
        position: relative !important;
        z-index: 3 !important;
        min-height: 38px !important;
        height: 38px !important;
        padding: 6px 4px 4px !important;
        margin: 0 !important;
        background: #fff !important;
        border-top: 1px solid #cfd8e3 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        font-size: 10.5px !important;
    }

    /* Si total y paginación son hijos distintos, los mantenemos alineados */
    #winCotizaciones .table-footer {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        white-space: nowrap !important;
    }

    #winCotizaciones .table-footer > * {
        flex: 0 0 auto !important;
    }

    /* Controles de paginación habituales del módulo */
    #winCotizaciones .paginacion,
    #winCotizaciones .pagination,
    #winCotizaciones .table-pagination,
    #winCotizaciones .paginador {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 5px !important;
        position: static !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    #winCotizaciones .paginacion button,
    #winCotizaciones .pagination button,
    #winCotizaciones .table-pagination button,
    #winCotizaciones .paginador button {
        min-width: 0 !important;
        width: auto !important;
        height: 26px !important;
        min-height: 26px !important;
        padding: 3px 7px !important;
        font-size: 10px !important;
        line-height: 1 !important;
    }

    #winCotizaciones #totalCotizaciones {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 10.5px !important;
    }
}

/* En 1366x768 reservamos explícitamente unos píxeles para el pie */
@media (max-width: 1450px) and (max-height: 820px) {
    #winCotizaciones .table-box {
        padding-bottom: 0 !important;
    }

    #winCotizaciones .table-footer {
        min-height: 36px !important;
        height: 36px !important;
        padding-top: 5px !important;
        padding-bottom: 3px !important;
    }
}


/* ============================================================
   OLCOT 3.10.90 - NUEVA / EDITAR COTIZACION
   Corrección responsive de la cabecera "Datos generales"
   PEGAR AL FINAL de css/estilos.css
   Requiere mantener los parches 3.10.88 y 3.10.89.
   NO modifica PHP ni JavaScript.
   ============================================================ */

@media (max-width: 1450px) {

    /*
      Reorganización explícita de la cabecera para 1366x768.
      Evita que Moneda / IGV / Forma Pago / Validez se peguen
      o se superpongan con el campo anterior.
    */
    #winCotizacionForm .cot-datos-grid {
        display: grid !important;
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
        grid-auto-rows: auto !important;
        column-gap: 10px !important;
        row-gap: 7px !important;
        align-items: start !important;
    }

    /* Cada field-row conserva su etiqueta + control */
    #winCotizacionForm .cot-datos-grid > .field-row {
        min-width: 0 !important;
        width: auto !important;
        margin: 0 !important;
        display: grid !important;
        grid-template-columns: max-content minmax(0, 1fr) !important;
        column-gap: 6px !important;
        align-items: center !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row > label {
        white-space: nowrap !important;
        margin: 0 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row input,
    #winCotizacionForm .cot-datos-grid > .field-row select,
    #winCotizacionForm .cot-datos-grid > .field-row textarea {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* FILA 1: Cliente + Observación */
    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(1) {
        grid-column: 1 / 11 !important;
        grid-row: 1 !important;
    }

    #winCotizacionForm .cot-observacion {
        grid-column: 11 / 13 !important;
        grid-row: 1 / 4 !important;
        min-width: 0 !important;
        width: auto !important;
        align-self: stretch !important;
    }

    /* FILA 2: Contacto | Correo | Asesor */
    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(2) {
        grid-column: 1 / 4 !important;
        grid-row: 2 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(3) {
        grid-column: 4 / 8 !important;
        grid-row: 2 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(4) {
        grid-column: 8 / 11 !important;
        grid-row: 2 !important;
    }

    /* FILA 3: Fecha | Moneda | IGV | Forma Pago | Validez */
    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(5) {
        grid-column: 1 / 3 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(6) {
        grid-column: 3 / 5 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(7) {
        grid-column: 5 / 7 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(8) {
        grid-column: 7 / 10 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(9) {
        grid-column: 10 / 11 !important;
        grid-row: 3 !important;
    }

    /*
      Controles internos con botón:
      evita que Buscar / Nuevo empujen o monten el siguiente campo.
    */
    #winCotizacionForm .cot-cliente-select,
    #winCotizacionForm .cot-contacto-select {
        display: flex !important;
        align-items: center !important;
        gap: 7px !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    #winCotizacionForm .cot-cliente-select input,
    #winCotizacionForm .cot-contacto-select select {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
    }

    #winCotizacionForm .cot-cliente-select .btn,
    #winCotizacionForm .cot-contacto-select .btn {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    /*
      Por seguridad, ningún control de la tercera fila
      puede invadir la columna vecina.
    */
    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(n+5):nth-child(-n+9) {
        overflow: visible !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(n+5):nth-child(-n+9) select,
    #winCotizacionForm .cot-datos-grid > .field-row:nth-child(n+5):nth-child(-n+9) input {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* En resoluciones algo más estrechas conservamos legibilidad.
   No cambia la lógica; únicamente se permite scroll interno. */
@media (max-width: 1180px) {
    #winCotizacionForm .cot-datos-grid {
        min-width: 1040px !important;
    }

    #winCotizacionForm .form-scroll {
        overflow-x: auto !important;
    }
}

/* ============================================================
   OLCOT 3.10.91 - FIX DEFINITIVO FILA 3 DATOS GENERALES
   Nueva / Editar Cotización - solo responsive
   PEGAR AL FINAL de css/estilos.css
   ============================================================ */

@media (max-width: 1450px) {

    /*
      IMPORTANTE:
      Este bloque anula los ajustes históricos que tenían
      anchos fijos y márgenes negativos en Moneda / IGV /
      Forma Pago. Se usan IDs reales de cada control para
      evitar depender de nth-child.
    */

    #winCotizacionForm .cot-datos-grid {
        display: grid !important;

        /* 5 campos + Observación */
        grid-template-columns:
            200px       /* Fecha */
            205px       /* Moneda */
            155px       /* IGV */
            minmax(300px, 1fr) /* Forma Pago */
            150px       /* Validez */
            205px !important;  /* Observación */

        column-gap: 10px !important;
        row-gap: 7px !important;
        align-items: start !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* ---------- FILA 1 ---------- */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl0razonsoci) {
        grid-column: 1 / 6 !important;
        grid-row: 1 !important;
    }

    /* ---------- FILA 2 ---------- */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) {
        grid-column: 1 / 3 !important;
        grid-row: 2 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        grid-column: 3 / 5 !important;
        grid-row: 2 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-column: 5 / 6 !important;
        grid-row: 2 !important;
    }

    /* ---------- FILA 3 ---------- */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_fecha) {
        grid-column: 1 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#idmoneda) {
        grid-column: 2 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_incluye_igv) {
        grid-column: 3 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#id_pago) {
        grid-column: 4 !important;
        grid-row: 3 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_validez_dias) {
        grid-column: 5 !important;
        grid-row: 3 !important;
    }

    /* Observación ocupa su propia columna */
    #winCotizacionForm .cot-observacion {
        grid-column: 6 !important;
        grid-row: 1 / 4 !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    /* ----------------------------------------------------------
       TODOS LOS CAMPOS DE FILA 3 EN FLEX
       Esto impide que label/select/botón se monten entre sí.
       ---------------------------------------------------------- */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_fecha),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#idmoneda),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_incluye_igv),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#id_pago),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_validez_dias) {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;

        min-width: 0 !important;
        width: 100% !important;

        /* anula reglas antiguas */
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        grid-template-columns: none !important;
    }

    /* Etiquetas de fila 3 */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_fecha) > label,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#idmoneda) > label,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_incluye_igv) > label,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#id_pago) > label,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_validez_dias) > label {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* Selects / Fecha: nunca pueden invadir el siguiente campo */
    #winCotizacionForm #cot_fecha,
    #winCotizacionForm #idmoneda,
    #winCotizacionForm #cot_incluye_igv,
    #winCotizacionForm #id_pago,
    #winCotizacionForm #cot_validez_dias {
        flex: 1 1 auto !important;
        width: 1px !important;
        min-width: 0 !important;
        max-width: 100% !important;

        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* Anulación ESPECÍFICA de los estilos históricos conflictivos */
    #winCotizacionForm .cot-datos-grid .field-row:nth-child(6),
    #winCotizacionForm .cot-datos-grid .field-row:nth-child(7),
    #winCotizacionForm .cot-datos-grid .field-row:nth-child(8),
    #winCotizacionForm .cot-datos-grid .field-row:nth-child(9) {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    #winCotizacionForm .cot-datos-grid .field-row:nth-child(6) select,
    #winCotizacionForm .cot-datos-grid .field-row:nth-child(7) select {
        width: 1px !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /*
      Si existe un botón "Nuevo" junto a Forma Pago en la versión
      actual, queda dentro de su propio campo sin empujar Validez.
    */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#id_pago) > .btn,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#id_pago) > button {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 58px !important;
        max-width: 64px !important;
        margin: 0 !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
        white-space: nowrap !important;
    }

    /* Cliente / Contacto: conservarlos estables */
    #winCotizacionForm .cot-cliente-select,
    #winCotizacionForm .cot-contacto-select {
        min-width: 0 !important;
    }
}

/*
   En anchos menores a 1260 no forzamos a comprimir más.
   Preferimos scroll horizontal interno antes de superponer campos.
*/
@media (max-width: 1260px) {
    #winCotizacionForm .cot-datos-grid {
        min-width: 1210px !important;
    }

    #winCotizacionForm .form-scroll {
        overflow-x: auto !important;
    }
}


/* ============================================================
   OLCOT 3.10.92
   FIX REAL - FILA 3 RESPONSIVE NUEVA / EDITAR COTIZACIÓN
   Pegar AL FINAL de css/estilos.css

   CAUSA:
   Fecha / Moneda / IGV / Forma Pago / Validez YA NO son hijos
   directos de .cot-datos-grid. Están dentro de
   .cot-fila-condiciones, por eso los parches anteriores no
   alcanzaban correctamente esta fila.
   ============================================================ */

@media (max-width: 1450px) {

    /* ---------------------------------------------------------
       1. DATOS GENERALES
       Mantener observación a la derecha.
       --------------------------------------------------------- */
    #winCotizacionForm .cot-datos-grid {
        display: grid !important;
        grid-template-columns:
            minmax(0, 1fr)
            205px !important;
        column-gap: 10px !important;
        row-gap: 7px !important;
        align-items: start !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Cliente */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl0razonsoci) {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    /* Fila contacto / correo / asesor */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-row: 2 !important;
        min-width: 0 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) {
        grid-column: 1 !important;
        width: 32% !important;
        justify-self: start !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        grid-column: 1 !important;
        width: 42% !important;
        justify-self: center !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-column: 1 !important;
        width: 24% !important;
        justify-self: end !important;
    }

    /* Observación */
    #winCotizacionForm .cot-observacion {
        grid-column: 2 !important;
        grid-row: 1 / 4 !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    /* ---------------------------------------------------------
       2. FILA 3 REAL
       Esta es la estructura que actualmente contiene los
       cinco campos.
       --------------------------------------------------------- */
    #winCotizacionForm .cot-fila-condiciones {
        grid-column: 1 !important;
        grid-row: 3 !important;

        display: grid !important;
        grid-template-columns:
            190px       /* Fecha */
            190px       /* Moneda */
            135px       /* IGV */
            minmax(300px, 1fr) /* Forma Pago */
            125px !important;  /* Validez */

        column-gap: 9px !important;
        row-gap: 0 !important;

        align-items: center !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* Cada bloque ocupa solo SU columna */
    #winCotizacionForm .cot-fila-condiciones > .field-row,
    #winCotizacionForm .cot-fila-condiciones > [class*="cot-campo-"] {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        margin: 0 !important;
        padding: 0 !important;

        box-sizing: border-box !important;
        overflow: visible !important;
    }

    /* Estructura interna uniforme */
    #winCotizacionForm .cot-fila-condiciones .cot-campo-fecha {
        display: grid !important;
        grid-template-columns: 46px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-moneda {
        display: grid !important;
        grid-template-columns: 52px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-igv {
        display: grid !important;
        grid-template-columns: 28px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-forma-pago {
        display: grid !important;
        grid-template-columns: 68px minmax(0, 1fr) !important;
        gap: 6px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-validez {
        display: grid !important;
        grid-template-columns: 45px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    /* Labels no empujan al campo vecino */
    #winCotizacionForm .cot-fila-condiciones label {
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        white-space: nowrap !important;
        font-size: 11px !important;
    }

    /* Eliminar TODOS los anchos fijos históricos */
    #winCotizacionForm .cot-fila-condiciones #cot_fecha,
    #winCotizacionForm .cot-fila-condiciones #idmoneda,
    #winCotizacionForm .cot-fila-condiciones #cot_incluye_igv,
    #winCotizacionForm .cot-fila-condiciones #id_pago,
    #winCotizacionForm .cot-fila-condiciones #cot_validez_dias {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        margin: 0 !important;
        box-sizing: border-box !important;
    }

    /* Forma de pago: select + Nuevo */
    #winCotizacionForm .cot-fila-condiciones .cot-forma-pago-select {
        display: grid !important;
        grid-template-columns:
            minmax(0, 1fr)
            58px !important;
        gap: 6px !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    #winCotizacionForm .cot-fila-condiciones .btn-nueva-forma-pago {
        width: 58px !important;
        min-width: 58px !important;
        max-width: 58px !important;
        height: 29px !important;
        padding: 0 5px !important;
        margin: 0 !important;
        font-size: 10.5px !important;
        white-space: nowrap !important;
    }
}


/* ============================================================
   1366 x 768
   Más aire entre etiquetas y controles sin superponer.
   ============================================================ */
@media (max-width: 1366px) {

    #winCotizacionForm .cot-datos-grid {
        grid-template-columns:
            minmax(0, 1fr)
            205px !important;
        column-gap: 9px !important;
    }

    #winCotizacionForm .cot-fila-condiciones {
        grid-template-columns:
            182px
            185px
            130px
            minmax(285px, 1fr)
            118px !important;

        column-gap: 8px !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-fecha {
        grid-template-columns: 44px minmax(0, 1fr) !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-moneda {
        grid-template-columns: 50px minmax(0, 1fr) !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-igv {
        grid-template-columns: 26px minmax(0, 1fr) !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-forma-pago {
        grid-template-columns: 66px minmax(0, 1fr) !important;
    }

    #winCotizacionForm .cot-fila-condiciones .cot-campo-validez {
        grid-template-columns: 43px minmax(0, 1fr) !important;
    }
}


/* ============================================================
   Si la ventana real queda menor a ~1180px:
   NO se comprime más la fila. Se usa scroll horizontal interno.
   ============================================================ */
@media (max-width: 1180px) {

    #winCotizacionForm .form-scroll {
        overflow-x: auto !important;
    }

    #winCotizacionForm .cot-datos-grid {
        min-width: 1110px !important;
    }
}


/* ============================================================
   OLCOT 3.10.93
   FIX RESPONSIVE FILA 2 - CONTACTO / NUEVO / CORREO / ASESOR
   Pegar AL FINAL de css/estilos.css
   ============================================================ */

@media (max-width: 1450px) {

    /* ---------------------------------------------------------
       La segunda fila se organiza en una mini-grid independiente
       dentro de la primera columna de .cot-datos-grid.
       --------------------------------------------------------- */

    #winCotizacionForm .cot-datos-grid {
        position: relative !important;
    }

    /* CONTACTO */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) {
        grid-column: 1 !important;
        grid-row: 2 !important;

        width: 31% !important;
        min-width: 0 !important;
        justify-self: start !important;

        margin: 0 !important;
    }

    /* El contenido interno Contacto + Nuevo no debe desbordarse */
    #winCotizacionForm .cot-contacto-select {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 58px !important;
        gap: 6px !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #winCotizacionForm .cot-contacto-select select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #winCotizacionForm .cot-contacto-select .btn {
        width: 58px !important;
        min-width: 58px !important;
        max-width: 58px !important;
        padding: 0 5px !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    /* CORREO */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        grid-column: 1 !important;
        grid-row: 2 !important;

        width: 39% !important;
        min-width: 0 !important;
        justify-self: center !important;

        margin: 0 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* ASESOR */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-column: 1 !important;
        grid-row: 2 !important;

        width: 27% !important;
        min-width: 0 !important;
        justify-self: end !important;

        margin: 0 !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* Labels compactos y sin invadir el campo vecino */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-template-columns: 44px minmax(0, 1fr) !important;
        column-gap: 5px !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) label,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) label,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) label {
        margin: 0 !important;
        width: auto !important;
        white-space: nowrap !important;
        font-size: 11px !important;
    }
}


/* ============================================================
   Ajuste fino específico para 1366 x 768
   ============================================================ */
@media (max-width: 1366px) {

    /* Más espacio a Contacto porque contiene el botón Nuevo */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) {
        width: 32.5% !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        width: 38.5% !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        width: 26% !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-template-columns: 43px minmax(0, 1fr) !important;
        column-gap: 4px !important;
    }

    #winCotizacionForm .cot-contacto-select {
        grid-template-columns: minmax(0, 1fr) 56px !important;
        gap: 5px !important;
    }

    #winCotizacionForm .cot-contacto-select .btn {
        width: 56px !important;
        min-width: 56px !important;
        max-width: 56px !important;
        font-size: 10px !important;
    }
}


/* ============================================================
   OLCOT 3.10.94
   FIX FINO RESPONSIVE - MOVER CORREO A LA DERECHA
   Pegar AL FINAL de css/estilos.css
   ============================================================ */

@media (max-width: 1450px) {

    /* Damos un poco más de espacio real al bloque Contacto + Nuevo */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) {
        width: 34% !important;
        justify-self: start !important;
    }

    /* Correo se desplaza claramente a la derecha del botón Nuevo */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        width: 36.5% !important;
        justify-self: center !important;

        /* desplazamiento fino para sacar la etiqueta Correo
           del área del botón Nuevo */
        transform: translateX(22px) !important;
    }

    /* Asesor conserva espacio suficiente a la derecha */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        width: 25.5% !important;
        justify-self: end !important;
    }

    /* Más espacio entre la palabra Correo y su input */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        grid-template-columns: 50px minmax(0, 1fr) !important;
        column-gap: 6px !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) > label {
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) #cot_correo {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
}

/* Ajuste específico para 1366 */
@media (max-width: 1366px) {

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto) {
        width: 34.5% !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        width: 35.5% !important;
        transform: translateX(24px) !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        width: 25% !important;
    }
}

/* ============================================================
   OLCOT 3.10.95
   AJUSTE FINO - MARGEN ENTRE BOTÓN NUEVO Y CORREO
   Pegar AL FINAL de css/estilos.css
   ============================================================ */

@media (max-width: 1450px) {

    /* Desplaza TODO el bloque Correo (label + input) un poco más
       a la derecha para dejar aire visual después del botón Nuevo */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        transform: translateX(38px) !important;
        width: 34.5% !important;
    }

    /* Mantiene separación interna correcta entre "Correo" y su campo */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        grid-template-columns: 50px minmax(0, 1fr) !important;
        column-gap: 7px !important;
    }

    /* Ajuste leve del Asesor para conservar el equilibrio */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        width: 24.5% !important;
    }
}

@media (max-width: 1366px) {

    /* Ajuste específico para 1366x768 */
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo) {
        transform: translateX(42px) !important;
        width: 34% !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        width: 24% !important;
    }
}

/* ============================================================
   BUSCAR ARTÍCULO PARA COTIZACIÓN - RESPONSIVE FINAL 2026-08-31
   Scope estricto: no modifica otros módulos.
   ============================================================ */

/* ---------- Toolbar compacta y corporativa ---------- */
#winBuscarArticuloCot .cot-articulo-toolbar-fija {
    min-height: 56px !important;
    padding: 9px 16px !important;
    gap: 12px !important;
    background: var(--win-bg) !important;
}

#winBuscarArticuloCot .cot-articulo-toolbar-fija .acciones-izquierda,
#winBuscarArticuloCot .cot-articulo-toolbar-fija .acciones-derecha {
    gap: 8px !important;
}

#winBuscarArticuloCot .cot-articulo-toolbar-fija .btn {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    border-radius: 5px !important;
}

#winBuscarArticuloCot .cot-articulo-toolbar-fija .ico-cot {
    font-size: 13px !important;
}

#winBuscarArticuloCot #btnAgregarSeleccionadosArtCot {
    min-width: 145px !important;
}

#winBuscarArticuloCot #btnFiltrosArtCot {
    min-width: 92px !important;
}

#winBuscarArticuloCot #buscarArticuloCot {
    width: 260px !important;
    height: 32px !important;
    padding: 5px 9px !important;
    font-size: 12px !important;
}

/* ---------- Zona de tabla ---------- */
#winBuscarArticuloCot .overlay-body {
    padding: 12px 14px !important;
}

#winBuscarArticuloCot .table-box {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    border-color: #cbd5e1 !important;
}

#winBuscarArticuloCot #tablaArticulosCot {
    width: 100% !important;
    min-width: 1120px !important;
    table-layout: fixed !important;
    font-size: 12px !important;
}

/* Cabecera clara: sustituye la franja negra anterior. */
#winBuscarArticuloCot #tablaArticulosCot thead,
#winBuscarArticuloCot #tablaArticulosCot thead tr,
#winBuscarArticuloCot #tablaArticulosCot thead th {
    background: #e8edf3 !important;
    color: #1f2937 !important;
}

#winBuscarArticuloCot #tablaArticulosCot thead th {
    height: 34px !important;
    padding: 6px 7px !important;
    border-color: #c9d2dc !important;
    box-shadow: inset 0 -1px 0 #b8c4d1 !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    text-align: left !important;
}

#winBuscarArticuloCot #tablaArticulosCot tbody td {
    padding: 5px 7px !important;
    font-size: 11.5px !important;
    line-height: 1.25 !important;
    vertical-align: middle !important;
}

#winBuscarArticuloCot #tablaArticulosCot tbody tr {
    height: 46px !important;
}

/* ---------- Orden/ancho de columnas ----------
   1 Sel. | 2 Imagen | 3 Código proveedor | 4 Cód. interno (oculto)
   5 Artículo | 6 Color | 7 Proveedor | 8 Categoría | 9 Stock | 10+ Precios
   ------------------------------------------------------------- */
#winBuscarArticuloCot #tablaArticulosCot th:nth-child(1),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(1) {
    width: 42px !important;
    text-align: center !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(2),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(2) {
    width: 62px !important;
    text-align: center !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(3),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(3) {
    width: 92px !important;
}

/* Cód. interno: se conserva en DOM para no romper el render JS,
   pero no ocupa espacio visual. */
#winBuscarArticuloCot #tablaArticulosCot th:nth-child(4),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(4),
#winBuscarArticuloCot #tablaArticulosCot .col-codigo-interno-cot {
    display: none !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(5),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(5) {
    width: 320px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(6),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(6) {
    width: 88px !important;
    white-space: nowrap !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(7),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(7) {
    width: 145px !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(8),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(8) {
    width: 155px !important;
}

#winBuscarArticuloCot #tablaArticulosCot th:nth-child(9),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(9) {
    width: 78px !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

/* Rangos/precios dinámicos. */
#winBuscarArticuloCot #tablaArticulosCot th:nth-child(n+10),
#winBuscarArticuloCot #tablaArticulosCot td:nth-child(n+10) {
    width: 108px !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap !important;
}

/* Miniatura estable. */
#winBuscarArticuloCot #tablaArticulosCot .cot-art-thumb {
    width: 38px !important;
    height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    background: #fff !important;
    border: 1px solid #dbe2ea !important;
    border-radius: 5px !important;
    cursor: zoom-in !important;
    transition: transform .16s ease, opacity .16s ease !important;
}

#winBuscarArticuloCot #tablaArticulosCot .cot-art-thumb:hover {
    transform: scale(1.06) !important;
}

/* ---------- Zoom flotante del Listado ---------- */
#winBuscarArticuloCot #cotArtZoomPreview {
    position: fixed !important;
    width: 260px !important;
    height: 260px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: 1px solid #b9c7d8 !important;
    border-radius: 10px !important;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .24) !important;
    z-index: 2147483000 !important;
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(4px) scale(.985) !important;
    transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s !important;
}

#winBuscarArticuloCot #cotArtZoomPreview.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    transition-delay: 0s !important;
}

#winBuscarArticuloCot #cotArtZoomPreview img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

/* ---------- Footer ---------- */
#winBuscarArticuloCot .cot-articulo-footer-fijo {
    min-height: 38px !important;
    padding: 5px 14px !important;
    font-size: 11.5px !important;
}

/* ---------- Panel de filtros ---------- */
#winBuscarArticuloCot .cot-articulo-filtros {
    padding: 8px 16px 9px !important;
    gap: 14px !important;
    min-height: 62px !important;
}

#winBuscarArticuloCot .cot-filtro-titulo {
    font-size: 11px !important;
}

#winBuscarArticuloCot .cot-filtro-campo label {
    font-size: 10.5px !important;
}

#winBuscarArticuloCot .cot-filtro-num,
#winBuscarArticuloCot .cot-moneda-btn,
#winBuscarArticuloCot .cot-filtro-acciones .btn {
    height: 30px !important;
    font-size: 11.5px !important;
}

/* ---------- Tema oscuro ---------- */
body.dark #winBuscarArticuloCot #tablaArticulosCot thead,
body.dark #winBuscarArticuloCot #tablaArticulosCot thead tr,
body.dark #winBuscarArticuloCot #tablaArticulosCot thead th {
    background: #24415f !important;
    color: #f8fafc !important;
    border-color: #365879 !important;
    box-shadow: inset 0 -1px 0 #456b90 !important;
}

body.dark #winBuscarArticuloCot #cotArtZoomPreview {
    background: #111827 !important;
    border-color: #475569 !important;
}

/* ============================================================
   1366 x 768: más densidad sin perder legibilidad
   ============================================================ */
@media (max-width: 1366px), (max-height: 800px) {
    #winBuscarArticuloCot .cot-articulo-toolbar-fija {
        min-height: 48px !important;
        padding: 6px 12px !important;
        gap: 8px !important;
    }

    #winBuscarArticuloCot .cot-articulo-toolbar-fija .acciones-izquierda,
    #winBuscarArticuloCot .cot-articulo-toolbar-fija .acciones-derecha {
        gap: 6px !important;
    }

    #winBuscarArticuloCot .cot-articulo-toolbar-fija .btn {
        height: 29px !important;
        min-height: 29px !important;
        padding: 0 9px !important;
        font-size: 11px !important;
    }

    #winBuscarArticuloCot .cot-articulo-toolbar-fija .ico-cot {
        font-size: 12px !important;
    }

    #winBuscarArticuloCot #btnAgregarSeleccionadosArtCot {
        min-width: 132px !important;
    }

    #winBuscarArticuloCot #btnFiltrosArtCot {
        min-width: 84px !important;
    }

    #winBuscarArticuloCot #buscarArticuloCot {
        width: 225px !important;
        height: 29px !important;
        font-size: 11px !important;
    }

    #winBuscarArticuloCot .overlay-body {
        padding: 8px 10px !important;
    }

    #winBuscarArticuloCot #tablaArticulosCot {
        min-width: 1040px !important;
        font-size: 11px !important;
    }

    #winBuscarArticuloCot #tablaArticulosCot thead th {
        height: 30px !important;
        padding: 4px 5px !important;
        font-size: 10.5px !important;
    }

    #winBuscarArticuloCot #tablaArticulosCot tbody td {
        padding: 4px 5px !important;
        font-size: 10.5px !important;
    }

    #winBuscarArticuloCot #tablaArticulosCot tbody tr {
        height: 42px !important;
    }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(1),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(1) { width: 38px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(2),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(2) { width: 54px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(3),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(3) { width: 84px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(5),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(5) { width: 270px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(6),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(6) { width: 74px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(7),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(7) { width: 125px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(8),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(8) { width: 132px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(9),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(9) { width: 68px !important; }

    #winBuscarArticuloCot #tablaArticulosCot th:nth-child(n+10),
    #winBuscarArticuloCot #tablaArticulosCot td:nth-child(n+10) { width: 96px !important; }

    #winBuscarArticuloCot #tablaArticulosCot .cot-art-thumb {
        width: 34px !important;
        height: 34px !important;
        max-width: 34px !important;
        max-height: 34px !important;
    }

    #winBuscarArticuloCot #cotArtZoomPreview {
        width: 225px !important;
        height: 225px !important;
    }

    #winBuscarArticuloCot .cot-articulo-footer-fijo {
        min-height: 34px !important;
        padding: 4px 10px !important;
        font-size: 10.5px !important;
    }
}

/* ============================================================
   OLCOT 3.10.95 - COTIZACIÓN RESPONSIVE MÓVIL / TABLET
   La vista de escritorio se conserva sin cambios.
   En pantallas estrechas los bloques se apilan y ningún dato
   de artículo, imagen o precio queda fuera del área visible.
   ============================================================ */

@media (max-width: 900px) {
    #winCotizacionForm.overlay-window-instance-4 {
        left: 6px !important;
        right: 6px !important;
        top: calc(var(--header-h) + 4px) !important;
        bottom: calc(var(--footer-h) + 4px) !important;
        width: auto !important;
        max-width: none !important;
    }

    #winCotizacionForm .overlay-body,
    #winCotizacionForm .form-scroll {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .overlay-body {
        padding: 8px !important;
    }

    #winCotizacionForm form,
    #winCotizacionForm #cotItems,
    #winCotizacionForm .cot-item {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Datos generales: eliminar mínimos históricos y apilar. */
    #winCotizacionForm .cot-datos-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 7px !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-column: 1 !important;
        grid-row: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        justify-self: stretch !important;
        transform: none !important;
        display: grid !important;
        grid-template-columns: 78px minmax(0, 1fr) !important;
        gap: 6px !important;
    }

    #winCotizacionForm .cot-cliente-select,
    #winCotizacionForm .cot-contacto-select,
    #winCotizacionForm .cot-forma-pago-select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    #winCotizacionForm .cot-fila-condiciones {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 7px !important;
    }

    #winCotizacionForm .cot-fila-condiciones > .field-row,
    #winCotizacionForm .cot-fila-condiciones > [class*="cot-campo-"] {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        grid-column: auto !important;
        display: grid !important;
        grid-template-columns: 68px minmax(0, 1fr) !important;
        gap: 5px !important;
    }

    #winCotizacionForm .cot-observacion {
        grid-column: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    #winCotizacionForm .cot-observacion textarea {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Artículo: imagen -> datos -> precios, uno debajo del otro. */
    #winCotizacionForm .cot-art-layout {
        display: grid !important;
        grid-template-columns: 1fr !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 10px !important;
    }

    #winCotizacionForm .cot-art-img {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: clamp(160px, 42vw, 260px) !important;
        min-height: 160px !important;
        margin: 0 !important;
        padding: 8px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    #winCotizacionForm .cot-art-img img {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        margin: auto !important;
    }

    #winCotizacionForm .cot-art-grid {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 7px !important;
    }

    #winCotizacionForm .cot-articulo-row,
    #winCotizacionForm .cot-codigo-row,
    #winCotizacionForm .cot-presentacion-row,
    #winCotizacionForm .cot-desc-larga-row,
    #winCotizacionForm .cot-entrega-row,
    #winCotizacionForm .cot-desc-color-row {
        grid-column: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 4px !important;
    }

    #winCotizacionForm .cot-articulo-row {
        grid-template-columns: minmax(0, 1fr) auto !important;
    }

    #winCotizacionForm .cot-articulo-row label {
        grid-column: 1 / -1 !important;
    }

    #winCotizacionForm .cot-articulo-row input {
        grid-column: 1 !important;
    }

    #winCotizacionForm .cot-articulo-row .btn {
        grid-column: 2 !important;
        grid-row: 2 !important;
        min-width: 58px !important;
    }

    #winCotizacionForm .cot-codigo-row input,
    #winCotizacionForm .cot-presentacion-row textarea,
    #winCotizacionForm .cot-desc-larga-row textarea,
    #winCotizacionForm .cot-entrega-row input,
    #winCotizacionForm .cot-desc-larga-wrap {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .cot-desc-larga-wrap {
        display: block !important;
    }

    #winCotizacionForm .cot-presentacion-row textarea {
        min-height: 60px !important;
        height: 60px !important;
    }

    #winCotizacionForm .cot-desc-larga-row textarea {
        min-height: 92px !important;
        height: 92px !important;
    }

    /* Precios permanecen completos dentro del ancho disponible. */
    #winCotizacionForm .cot-precios-box {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border-left: 0 !important;
        border-top: 1px solid var(--border-color) !important;
        padding: 9px 0 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .cot-precios {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .cot-precios th,
    #winCotizacionForm .cot-precios td {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 3px !important;
        overflow: visible !important;
    }

    #winCotizacionForm .cot-precios th:nth-child(1),
    #winCotizacionForm .cot-precios td:nth-child(1) { width: 23% !important; }
    #winCotizacionForm .cot-precios th:nth-child(2),
    #winCotizacionForm .cot-precios td:nth-child(2) { width: 21% !important; }
    #winCotizacionForm .cot-precios th:nth-child(3),
    #winCotizacionForm .cot-precios td:nth-child(3) { width: 25% !important; }
    #winCotizacionForm .cot-precios th:nth-child(4),
    #winCotizacionForm .cot-precios td:nth-child(4) { width: 23% !important; }
    #winCotizacionForm .cot-precios th:nth-child(5),
    #winCotizacionForm .cot-precios td:nth-child(5) { width: 8% !important; }

    #winCotizacionForm .cot-precios input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 2px 3px !important;
        font-size: 10px !important;
    }

    #winCotizacionForm .cot-precios th {
        white-space: normal !important;
        line-height: 1.1 !important;
        font-size: 9.5px !important;
    }

    #winCotizacionForm .cot-precios .btn-delete {
        width: 100% !important;
        min-width: 24px !important;
        max-width: 34px !important;
        padding: 0 !important;
    }

    #winCotizacionForm .botonera-cotizacion,
    #winCotizacionForm .botonera-cotizacion-principal,
    #winCotizacionForm .botonera-cotizacion-eliminar {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .botonera-cotizacion-principal {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 7px !important;
    }

    #winCotizacionForm .botonera-cotizacion-principal .btn-cerrar {
        grid-column: 1 / -1 !important;
        width: 100% !important;
    }
}

@media (max-width: 560px) {
    #winCotizacionForm .overlay-topbar {
        min-height: 46px !important;
        padding: 7px 9px !important;
    }

    #winCotizacionForm .overlay-topbar span {
        font-size: 12px !important;
        padding-right: 8px !important;
    }

    #winCotizacionForm .cot-datos-grid > .field-row,
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cl1idcontacto),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#cot_correo),
    #winCotizacionForm .cot-datos-grid > .field-row:has(#em2codig2) {
        grid-template-columns: 1fr !important;
        gap: 3px !important;
    }

    #winCotizacionForm .cot-fila-condiciones {
        grid-template-columns: 1fr !important;
    }

    #winCotizacionForm .cot-fila-condiciones > .field-row,
    #winCotizacionForm .cot-fila-condiciones > [class*="cot-campo-"] {
        grid-template-columns: 78px minmax(0, 1fr) !important;
    }

    #winCotizacionForm .cot-art-img {
        height: min(250px, 58vw) !important;
        min-height: 185px !important;
    }

    #winCotizacionForm .cot-item {
        padding: 8px !important;
    }

    #winCotizacionForm .cot-precios th {
        font-size: 8.5px !important;
    }

    #winCotizacionForm .cot-precios input {
        font-size: 9px !important;
        padding: 2px !important;
    }

    #winCotizacionForm .botonera-cotizacion-principal {
        grid-template-columns: 1fr !important;
    }

    #winCotizacionForm .botonera-cotizacion-principal .btn-save,
    #winCotizacionForm .botonera-cotizacion-principal .btn-cerrar,
    #winCotizacionForm .botonera-cotizacion-eliminar .btn-delete {
        width: 100% !important;
    }
}

/* =========================================================
   OLCOT 2026-09-08 - PRECIOS: Suma P.U. + distribución final
   ========================================================= */
@media (min-width: 1101px) {
    #winCotizacionForm .cot-art-layout {
        grid-template-columns: 185px minmax(430px, 1fr) 590px !important;
        gap: 10px !important;
    }
    #winCotizacionForm .cot-art-img {
        width: 185px !important;
        max-width: 185px !important;
    }
    #winCotizacionForm .cot-precios-box {
        width: 590px !important;
        min-width: 590px !important;
        max-width: 590px !important;
        padding-left: 10px !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    #winCotizacionForm .cot-precios {
        width: 100% !important;
        table-layout: fixed !important;
    }
    #winCotizacionForm .cot-precios th,
    #winCotizacionForm .cot-precios td {
        padding: 3px 4px !important;
        min-width: 0 !important;
    }
    #winCotizacionForm .cot-precios th:nth-child(1),
    #winCotizacionForm .cot-precios td:nth-child(1) { width: 15% !important; }
    #winCotizacionForm .cot-precios th:nth-child(2),
    #winCotizacionForm .cot-precios td:nth-child(2) { width: 15% !important; }
    #winCotizacionForm .cot-precios th:nth-child(3),
    #winCotizacionForm .cot-precios td:nth-child(3) { width: 18% !important; }
    #winCotizacionForm .cot-precios th:nth-child(4),
    #winCotizacionForm .cot-precios td:nth-child(4) { width: 16% !important; }
    #winCotizacionForm .cot-precios th:nth-child(5),
    #winCotizacionForm .cot-precios td:nth-child(5) { width: 14% !important; }
    #winCotizacionForm .cot-precios th:nth-child(6),
    #winCotizacionForm .cot-precios td:nth-child(6) { width: 17% !important; }
    #winCotizacionForm .cot-precios th:nth-child(7),
    #winCotizacionForm .cot-precios td:nth-child(7) { width: 5% !important; }
    #winCotizacionForm .cot-precios input {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    #winCotizacionForm .cot-precios .suma-pu {
        background: rgba(255,255,255,.035) !important;
    }
}

@media (max-width: 1100px) {
    #winCotizacionForm .cot-precios th:nth-child(1),
    #winCotizacionForm .cot-precios td:nth-child(1) { width: 15% !important; }
    #winCotizacionForm .cot-precios th:nth-child(2),
    #winCotizacionForm .cot-precios td:nth-child(2) { width: 15% !important; }
    #winCotizacionForm .cot-precios th:nth-child(3),
    #winCotizacionForm .cot-precios td:nth-child(3) { width: 18% !important; }
    #winCotizacionForm .cot-precios th:nth-child(4),
    #winCotizacionForm .cot-precios td:nth-child(4) { width: 16% !important; }
    #winCotizacionForm .cot-precios th:nth-child(5),
    #winCotizacionForm .cot-precios td:nth-child(5) { width: 14% !important; }
    #winCotizacionForm .cot-precios th:nth-child(6),
    #winCotizacionForm .cot-precios td:nth-child(6) { width: 17% !important; }
    #winCotizacionForm .cot-precios th:nth-child(7),
    #winCotizacionForm .cot-precios td:nth-child(7) { width: 5% !important; }
}

/* =========================================================
   OLCOT 2026-09-08 - AJUSTE FINAL DE ANCHOS ITEM / PRECIOS
   Objetivo: recortar datos del artículo y dar más espacio a
   PRECIOS, especialmente TOTAL, reduciendo % Dscto.
   ========================================================= */
@media (min-width: 1101px) {
    /* PRECIOS gana ancho hacia la izquierda; el bloque central se recorta. */
    #winCotizacionForm .cot-art-layout {
        grid-template-columns: 175px minmax(350px, 1fr) 660px !important;
        gap: 8px !important;
    }

    #winCotizacionForm .cot-art-img {
        width: 175px !important;
        max-width: 175px !important;
    }

    /* Etiquetas más compactas para recuperar ancho útil en Artículo/Código/etc. */
    #winCotizacionForm .cot-articulo-row {
        grid-template-columns: 82px minmax(0, 1fr) 58px !important;
        gap: 7px !important;
    }

    #winCotizacionForm .cot-codigo-row,
    #winCotizacionForm .cot-presentacion-row,
    #winCotizacionForm .cot-desc-larga-row,
    #winCotizacionForm .cot-entrega-row,
    #winCotizacionForm .cot-desc-color-row {
        grid-template-columns: 82px minmax(0, 1fr) !important;
        gap: 7px !important;
    }

    #winCotizacionForm .cot-precios-box {
        width: 660px !important;
        min-width: 660px !important;
        max-width: 660px !important;
        padding-left: 8px !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    #winCotizacionForm .cot-precios {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }

    #winCotizacionForm .cot-precios th,
    #winCotizacionForm .cot-precios td {
        min-width: 0 !important;
        max-width: none !important;
        padding: 3px !important;
        box-sizing: border-box !important;
    }

    /* Distribución real de las 7 columnas. */
    #winCotizacionForm .cot-precios th:nth-child(1),
    #winCotizacionForm .cot-precios td:nth-child(1) { width: 14% !important; } /* Cantidad */

    #winCotizacionForm .cot-precios th:nth-child(2),
    #winCotizacionForm .cot-precios td:nth-child(2) { width: 13% !important; } /* P/LOGO */

    #winCotizacionForm .cot-precios th:nth-child(3),
    #winCotizacionForm .cot-precios td:nth-child(3) { width: 16% !important; } /* Precio Unit. */

    #winCotizacionForm .cot-precios th:nth-child(4),
    #winCotizacionForm .cot-precios td:nth-child(4) { width: 14% !important; } /* Suma P.U. */

    #winCotizacionForm .cot-precios th:nth-child(5),
    #winCotizacionForm .cot-precios td:nth-child(5) { width: 11% !important; } /* % Dscto. */

    #winCotizacionForm .cot-precios th:nth-child(6),
    #winCotizacionForm .cot-precios td:nth-child(6) { width: 25% !important; } /* Total */

    #winCotizacionForm .cot-precios th:nth-child(7),
    #winCotizacionForm .cot-precios td:nth-child(7) { width: 7% !important; }  /* X */

    #winCotizacionForm .cot-precios input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    /* Total necesita verse completo, incluso con miles. */
    #winCotizacionForm .cot-precios .total {
        text-align: right !important;
        padding-right: 8px !important;
        font-variant-numeric: tabular-nums;
    }

    #winCotizacionForm .cot-precios .descuento {
        padding-left: 3px !important;
        padding-right: 3px !important;
    }

    #winCotizacionForm .cot-precios .btn-delete {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;
        padding: 0 !important;
    }
}

/* ============================================================
   OLCOT - COTIZACIONES EN CELULAR: TARJETAS TÁCTILES
   2026-09-20
   La vista de escritorio no cambia. En móvil se muestran únicamente
   los filtros aprobados: Todas / Borrador / Emitidas.
   ============================================================ */

/* Elementos exclusivos de móvil: ocultos en escritorio/tablet ancha. */
#winCotizaciones .cot-mobile-filtros,
#winCotizaciones .cot-mobile-cards,
#winCotizaciones .cot-mobile-total {
    display: none;
}

@media (max-width: 768px) {
    #winCotizaciones .overlay-body {
        padding: 8px 9px !important;
        overflow: hidden !important;
    }

    #winCotizaciones #cotizaciones-lista {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 1px 10px !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Buscador -> filtros -> nueva cotización + total */
    #winCotizaciones .acciones-superior {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 9px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
    }

    #winCotizaciones .acciones-derecha {
        order: 1 !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    #winCotizaciones .cot-mobile-filtros {
        order: 2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 7px !important;
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 1px 0 2px !important;
        scrollbar-width: none;
    }

    #winCotizaciones .cot-mobile-filtros::-webkit-scrollbar {
        display: none;
    }

    #winCotizaciones .acciones-izquierda {
        order: 3 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    #winCotizaciones .buscar-cotizacion-box {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        position: relative !important;
    }

    #winCotizaciones .buscar-cotizacion-box::before {
        content: "⌕";
        position: absolute;
        left: 13px;
        top: 50%;
        transform: translateY(-52%);
        z-index: 2;
        font-size: 21px;
        color: #64748b;
        pointer-events: none;
    }

    #winCotizaciones .buscar-cotizacion-box #buscarCotizacion {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 48px !important;
        padding: 0 42px 0 42px !important;
        border: 1px solid #d7e0ea !important;
        border-radius: 12px !important;
        background: #f8fafc !important;
        color: #172033 !important;
        font-size: 14px !important;
        line-height: 48px !important;
        box-sizing: border-box !important;
        outline: none !important;
        box-shadow: 0 2px 7px rgba(15,23,42,.05) !important;
    }

    #winCotizaciones .buscar-cotizacion-box #buscarCotizacion:focus {
        border-color: #18a2a0 !important;
        box-shadow: 0 0 0 3px rgba(24,162,160,.12) !important;
    }

    #winCotizaciones .btn-limpiar-cotizacion {
        right: 9px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        font-size: 20px !important;
    }

    #winCotizaciones .cot-filtro-estado {
        flex: 0 0 auto !important;
        min-width: 82px !important;
        height: 39px !important;
        padding: 0 16px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        background: #f1f5f9 !important;
        color: #27354b !important;
        font: 600 13px/1 "Segoe UI", Arial, sans-serif !important;
        cursor: pointer !important;
        box-shadow: none !important;
        -webkit-tap-highlight-color: transparent;
    }

    #winCotizaciones .cot-filtro-estado.activo {
        border-color: #159c9b !important;
        background: #159c9b !important;
        color: #fff !important;
        box-shadow: 0 4px 10px rgba(21,156,155,.20) !important;
    }

    #winCotizaciones .cot-btn-nueva {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 225px !important;
        height: 48px !important;
        min-height: 48px !important;
        padding: 0 16px !important;
        border-radius: 11px !important;
        background: #159c9b !important;
        border-color: #159c9b !important;
        color: #fff !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        line-height: 48px !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-indent: 0 !important;
    }

    #winCotizaciones .cot-btn-nueva::before {
        content: "+";
        display: inline-block;
        margin-right: 8px;
        font-size: 24px;
        font-weight: 400;
        line-height: 1;
        vertical-align: -2px;
    }

    #winCotizaciones .cot-mobile-total {
        display: inline-block !important;
        flex: 0 0 auto !important;
        color: #172033 !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
    }

    /* En celular ya no se usa la tabla horizontal. */
    #winCotizaciones .table-box {
        display: none !important;
    }

    #winCotizaciones .cot-mobile-cards {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        padding: 0 0 2px !important;
        box-sizing: border-box !important;
    }

    #winCotizaciones .cot-mobile-card {
        position: relative !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 15px 14px 13px !important;
        border: 1px solid #e5eaf0 !important;
        border-radius: 14px !important;
        background: #fff !important;
        color: #182338 !important;
        box-shadow: 0 4px 14px rgba(15,23,42,.07) !important;
        box-sizing: border-box !important;
        -webkit-tap-highlight-color: transparent;
    }

    #winCotizaciones .cot-mobile-card-head {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 9px !important;
        min-width: 0 !important;
        margin-bottom: 6px !important;
    }

    #winCotizaciones .cot-mobile-numero {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        color: #0f1b3d !important;
        font-size: 17px !important;
        line-height: 1.2 !important;
        font-weight: 800 !important;
        letter-spacing: .01em !important;
        overflow-wrap: anywhere !important;
    }

    #winCotizaciones .cot-mobile-badge {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 82px !important;
        min-height: 32px !important;
        padding: 5px 10px !important;
        border-radius: 10px !important;
        font-size: 12px !important;
        line-height: 1 !important;
        font-weight: 700 !important;
        box-sizing: border-box !important;
    }

    #winCotizaciones .cot-mobile-badge-borrador {
        background: #dff0ff !important;
        color: #087fc4 !important;
    }

    #winCotizaciones .cot-mobile-badge-emitida {
        background: #dcf7e5 !important;
        color: #15803d !important;
    }

    #winCotizaciones .cot-mobile-cliente {
        width: 100% !important;
        margin-bottom: 9px !important;
        color: #334155 !important;
        font-size: 14px !important;
        line-height: 1.35 !important;
        font-weight: 500 !important;
        overflow-wrap: anywhere !important;
    }

    #winCotizaciones .cot-mobile-meta {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        min-width: 0 !important;
        padding-right: 116px !important;
    }

    #winCotizaciones .cot-mobile-meta > div {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        min-width: 0 !important;
        color: #4b5d75 !important;
        font-size: 13px !important;
        line-height: 1.25 !important;
    }

    #winCotizaciones .cot-mobile-meta > div > span:last-child {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #winCotizaciones .cot-mobile-ico {
        flex: 0 0 17px !important;
        width: 17px !important;
        text-align: center !important;
        color: #61738b !important;
        font-size: 13px !important;
    }

    #winCotizaciones .cot-mobile-acciones {
        position: absolute !important;
        right: 12px !important;
        bottom: 12px !important;
        display: flex !important;
        align-items: center !important;
        gap: 7px !important;
    }

    #winCotizaciones .cot-mobile-btn-principal {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        min-width: 82px !important;
        height: 42px !important;
        padding: 0 13px !important;
        border: 0 !important;
        border-radius: 10px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent;
    }

    #winCotizaciones .cot-mobile-btn-principal.es-editar {
        background: #159c9b !important;
        color: #fff !important;
    }

    #winCotizaciones .cot-mobile-btn-principal.es-ver {
        background: #e0f2fe !important;
        color: #087fc4 !important;
    }

    #winCotizaciones .cot-mobile-menu {
        position: relative !important;
        width: 42px !important;
        height: 42px !important;
    }

    #winCotizaciones .cot-mobile-menu > summary {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 42px !important;
        height: 42px !important;
        border: 1px solid #e6ebf1 !important;
        border-radius: 10px !important;
        background: #f1f5f9 !important;
        color: #25324a !important;
        font-size: 24px !important;
        line-height: 1 !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        list-style: none !important;
        box-sizing: border-box !important;
        -webkit-tap-highlight-color: transparent;
    }

    #winCotizaciones .cot-mobile-menu > summary::-webkit-details-marker {
        display: none !important;
    }

    #winCotizaciones .cot-mobile-menu-panel {
        position: absolute !important;
        right: 0 !important;
        bottom: 48px !important;
        z-index: 30 !important;
        display: grid !important;
        gap: 4px !important;
        width: 132px !important;
        padding: 6px !important;
        border: 1px solid #dfe6ee !important;
        border-radius: 10px !important;
        background: #fff !important;
        box-shadow: 0 12px 30px rgba(15,23,42,.18) !important;
        box-sizing: border-box !important;
    }

    #winCotizaciones .cot-mobile-menu-panel button {
        width: 100% !important;
        min-height: 38px !important;
        padding: 0 10px !important;
        border: 0 !important;
        border-radius: 7px !important;
        background: transparent !important;
        color: #26364e !important;
        text-align: left !important;
        font-size: 13px !important;
        cursor: pointer !important;
    }

    #winCotizaciones .cot-mobile-menu-panel button:active {
        background: #eef4f8 !important;
    }

    #winCotizaciones .cot-mobile-vacio {
        width: 100% !important;
        padding: 24px 12px !important;
        border: 1px dashed #d7e0ea !important;
        border-radius: 12px !important;
        background: #fff !important;
        color: #64748b !important;
        text-align: center !important;
        font-size: 13px !important;
        box-sizing: border-box !important;
    }

    /* En móvil el total ya está junto a Nueva cotización; el pie queda para paginar. */
    #winCotizaciones .table-footer {
        display: flex !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 7px 0 2px !important;
        margin: 0 !important;
        border: 0 !important;
        background: transparent !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    #winCotizaciones .table-footer #totalCotizaciones {
        display: none !important;
    }

    #winCotizaciones .olcot-paginacion {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 7px !important;
        margin: 0 !important;
        font-size: 10px !important;
    }

    #winCotizaciones .olcot-paginacion .btn {
        min-height: 38px !important;
        padding: 0 10px !important;
        border-radius: 9px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 430px) {
    #winCotizaciones .cot-filtro-estado {
        min-width: 0 !important;
        flex: 1 1 0 !important;
        padding: 0 10px !important;
    }

    #winCotizaciones .cot-btn-nueva {
        max-width: 205px !important;
        padding: 0 12px !important;
        font-size: 13px !important;
    }

    #winCotizaciones .cot-mobile-numero {
        font-size: 16px !important;
    }

    #winCotizaciones .cot-mobile-meta {
        padding-right: 104px !important;
    }

    #winCotizaciones .cot-mobile-btn-principal {
        min-width: 74px !important;
        padding: 0 10px !important;
    }
}

/* Tema oscuro de la vista móvil */
@media (max-width: 768px) {
    body.dark #winCotizaciones .buscar-cotizacion-box #buscarCotizacion,
    body.dark #winCotizaciones .cot-mobile-card,
    body.dark #winCotizaciones .cot-mobile-vacio,
    body.dark #winCotizaciones .cot-mobile-menu-panel {
        background: #111827 !important;
        border-color: #334155 !important;
        color: #f8fafc !important;
    }

    body.dark #winCotizaciones .buscar-cotizacion-box #buscarCotizacion::placeholder,
    body.dark #winCotizaciones .cot-mobile-cliente,
    body.dark #winCotizaciones .cot-mobile-meta > div,
    body.dark #winCotizaciones .cot-mobile-vacio {
        color: #cbd5e1 !important;
    }

    body.dark #winCotizaciones .cot-mobile-numero,
    body.dark #winCotizaciones .cot-mobile-total {
        color: #f8fafc !important;
    }

    body.dark #winCotizaciones .cot-filtro-estado,
    body.dark #winCotizaciones .cot-mobile-menu > summary {
        background: #1e293b !important;
        border-color: #334155 !important;
        color: #e2e8f0 !important;
    }

    body.dark #winCotizaciones .cot-filtro-estado.activo {
        background: #159c9b !important;
        border-color: #159c9b !important;
        color: #fff !important;
    }

    body.dark #winCotizaciones .cot-mobile-menu-panel button {
        color: #e2e8f0 !important;
    }
}

/* OLCOT V3.0.285 — Scrollbars globales adaptados al tema oscuro */
html[data-theme="dark"],
html[data-theme="dark"] *,
body.dark,
body.dark *{
    scrollbar-color:#53667d #111a26;
}
html[data-theme="dark"] ::-webkit-scrollbar,
body.dark ::-webkit-scrollbar{
    width:11px;
    height:11px;
}
html[data-theme="dark"] ::-webkit-scrollbar-track,
body.dark ::-webkit-scrollbar-track{
    background:#111a26;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb,
body.dark ::-webkit-scrollbar-thumb{
    background:#53667d;
    border:2px solid #111a26;
    border-radius:10px;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
body.dark ::-webkit-scrollbar-thumb:hover{
    background:#6b819a;
}
html[data-theme="dark"] ::-webkit-scrollbar-corner,
body.dark ::-webkit-scrollbar-corner{
    background:#111a26;
}
