/* ==========================================================
   VARIABLES
========================================================== */

:root {

    --page-max-width:1180px;

    /*
    2026-08-21: --primary estaba en #0b4f71, pero el resto de la app
    (botones de confirmación de SweetAlert, foco de los buscadores de
    cada tabla, etc.) siempre usó #0c5878 — dos azules casi iguales
    pero no idénticos. Se alinea --primary al tono que YA es el
    "color de acción" de facto en toda la app, en vez de al revés.
    */
    --primary: #0c5878;
    --primary2: #08384f;

    --bg: #f5f7fb;
    --card: #ffffff;

    --text: #223;
    --muted: #758195;

    --border: #e8edf3;

    /* Enlaces (2026-10-15): ver la sección LINKS al final de este archivo */
    --link: #0c5878;
    --link-hover: #08384f;

}

/* ==========================================================
   RESET
========================================================== */

*{
    box-sizing:border-box;
}

body{

    margin:0;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        Segoe UI,
        Arial,
        sans-serif;

    background:var(--bg);
    color:var(--text);
    font-size:14px;

}

/* ==========================================================
   LAYOUT
========================================================== */

.layout{

    display:flex;
    min-height:100vh;

}

.main{

    margin-left:92px;
    width:calc(100% - 92px);

}

.content{

    padding:26px 28px;

    /*
    Ancho ÚNICO de todos los módulos del ERP (2026-10-13): el contenido se
    centra y se limita a --page-max-width. Las páginas NO deben poner su
    propio max-width de página: usar el 100% de este contenedor.
    */
    width:100%;
    max-width:calc(var(--page-max-width) + 56px);
    margin:0 auto;

}

/* ==========================================================
   SIDEBAR
========================================================== */

.sidebar{

    width:92px;

    background:#08384f;

    color:#fff;

    position:fixed;

    left:0;
    top:0;
    bottom:0;

    padding:16px 6px;

    display:flex;
    flex-direction:column;
    align-items:center;

    gap:16px;

}

.brand{

    width:42px;
    height:42px;

    border-radius:14px;

    background:linear-gradient(
        135deg,
        #ffab2e,
        #ff6b00
    );

    display:grid;
    place-items:center;

    font-weight:800;

}

/* ==========================================================
   MENU
========================================================== */

.nav{

    display:flex;
    flex-direction:column;

    gap:10px;

    width:100%;

    align-items:center;

}

.nav a{

    width:44px;
    height:44px;

    border-radius:14px;

    display:grid;
    place-items:center;

    color:#491528;

    text-decoration:none;

    font-size:18px;

}

.nav a.active,
.nav a:hover{

    /*background:rgba(255,255,255,.14);*/
    background: #db8ca0 !important;
    color:#ffffff;

}

/* ==========================================================
   TOPBAR
========================================================== */

.topbar{

    height:66px;

    background:#ffffff;

    border-bottom:1px solid var(--border);

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:0 28px;

    position:sticky;
    top:0;

    z-index:5;

}

.search{

    width:360px;
    max-width:45vw;

    border:1px solid var(--border);

    border-radius:12px;

    padding:11px 14px;

    color:var(--muted);

    outline:none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;

}

.search:focus{

    border-color:var(--primary);

    box-shadow:0 0 0 3px rgba(12, 88, 120, 0.10);

}

/* ==========================================================
   PAGE HEADER
========================================================== */

.page-head{

    display:flex;

    align-items:center;
    justify-content:space-between;

    margin-bottom:18px;

}

.page-head h1{

    margin:0;

    font-size:22px;

}

/* ==========================================================
   CARDS
========================================================== */

.card{

    background:var(--card);

    border:1px solid var(--border);

    border-radius:18px;

    box-shadow:0 12px 32px rgba(22,36,55,.05);

    padding:20px;

}

/* ==========================================================
   BUTTONS
========================================================== */

.btn{

    display:inline-flex;

    align-items:center;
    gap:8px;

    border:0;
    border-radius:12px;

    padding:11px 16px;

    text-decoration:none;

    font-weight:700;

    cursor:pointer;

    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;

}

.btn:active{

    transform:translateY(0);

}

/*
2026-08-21: variante compacta, usada en las acciones de fila de las
tablas (ej. "Ver detalle", "Editar") como `btn btn-light btn-sm` —
la clase se usaba en varias páginas pero nunca estuvo definida, así
que no tenía ningún efecto (los botones "chicos" salían del mismo
tamaño que los normales).
*/
.btn-sm{

    padding:7px 12px;

    font-size:13px;

    border-radius:10px;

}

.btn-primary{

    background:var(--primary);
    color:#ffffff;

}

.btn-primary:hover{

    background:var(--primary2);

    transform:translateY(-1px);

    box-shadow:0 8px 20px rgba(12, 88, 120, 0.22);

}

.btn-light{

    background:#eef4f8;
    color:var(--primary);

}

.btn-light:hover{

    background:#dfeaf1;

    transform:translateY(-1px);

    box-shadow:0 6px 16px rgba(12, 88, 120, 0.12);

}

.btn-danger{

    background:#fff1f1;
    color:#d62828;

}

.btn-danger:hover{

    background:#ffe1e1;

    transform:translateY(-1px);

    box-shadow:0 6px 16px rgba(214, 40, 40, 0.14);

}

/* ==========================================================
   GRID
========================================================== */

.grid{

    display:grid;

    grid-template-columns:repeat(3,1fr);

    gap:18px;

}

/* ==========================================================
   PRODUCTOS
========================================================== */

.product{

    overflow:hidden;

    padding:0;

}

.product-img{

    height:180px;

    background:#eef2f6;

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

}

.product-img img{

    width:100%;
    height:100%;

    object-fit:cover;

}

.product-body{

    padding:16px;

}

.badge{

    display:inline-block;

    background:#eaf4ff;

    color:#0b4f71;

    border-radius:999px;

    padding:5px 10px;

    font-size:12px;
    font-weight:700;

}

/* ==========================================================
   FORMULARIOS
========================================================== */

.form-grid{

    display:grid;

    grid-template-columns:1fr 1fr;

    gap:16px;

}

.field{

    display:flex;
    flex-direction:column;

    gap:7px;

}

.field.full{

    grid-column:1/-1;

}

input,
select,
textarea{

    border:1px solid var(--border);

    border-radius:12px;

    padding:12px 13px;

    background:#ffffff;

    font:inherit;

}

textarea{

    min-height:110px;

    resize:vertical;

}

/* ==========================================================
   ALERTAS
========================================================== */

.alert{

    padding:12px 14px;

    border-radius:12px;

    margin-bottom:14px;

}

.alert-error{

    background:#fff1f1;

    color:#b42318;

}

.alert-ok{

    background:#ecfdf3;

    color:#027a48;

}

/* ==========================================================
   LOGIN
========================================================== */

.auth{

    min-height:100vh;

    display:grid;
    place-items:center;

    background:linear-gradient(
        135deg,
        #08384f,
        #0b4f71
    );

}

.auth-card{

    width:430px;
    max-width:92vw;

    background:#ffffff;

    border-radius:24px;

    padding:28px;

    box-shadow:0 22px 60px rgba(0,0,0,.22);

}

.auth-card h1{

    margin:0 0 8px;

}

/* ==========================================================
   TABLAS
========================================================== */

.table{

    width:100%;

    border-collapse:collapse;

}

.table th,
.table td{

    padding:13px;

    border-bottom:1px solid var(--border);

    text-align:left;

}

/* ==========================================================
   IMÁGENES
========================================================== */

.thumb{

    width:58px;
    height:46px;

    border-radius:10px;

    background:#eef2f6;

    object-fit:cover;

}

/* ==========================================================
   HELPERS
========================================================== */

.muted{

    color:var(--muted);

}

/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width:900px){

    .grid{

        grid-template-columns:1fr;

    }

    .form-grid{

        grid-template-columns:1fr;

    }

    .search{

        display:none;

    }

    .content{

        padding:18px;

    }

    .topbar{

        padding:0 18px;

    }

}







/* ==========================================================
   MENÚ RESPONSIVE KOSK
   No modifica el diseño original de escritorio
========================================================== */

.kosk-mobile-menu-button {
    display: none;
}

.kosk-mobile-overlay {
    display: none;
}

/* ==========================================================
   MÓVIL Y TABLET
========================================================== */

@media (max-width: 900px) {

    body.kosk-mobile-menu-open {
        overflow: hidden;
    }

    /*
    ----------------------------------------------------------
    Contenido principal
    ----------------------------------------------------------
    */

    .main {
        width: 100%;
        margin-left: 0;
    }

    /*
    ----------------------------------------------------------
    Sidebar original
    ----------------------------------------------------------
    */

    #koskSidebar {
        width: 92px;

        z-index: 1001;

        transform: translateX(-100%);

        transition:
            transform 0.28s ease,
            box-shadow 0.28s ease;

        box-shadow: none;
    }

    #koskSidebar.kosk-sidebar-visible {
        transform: translateX(0);

        box-shadow:
            12px 0 32px rgba(38, 20, 28, 0.18);
    }

    /*
    ----------------------------------------------------------
    Overlay
    ----------------------------------------------------------
    */

    .kosk-mobile-overlay {
        display: block;

        position: fixed;
        inset: 0;

        z-index: 1000;

        background: rgba(30, 20, 25, 0.38);

        opacity: 0;
        visibility: hidden;

        transition:
            opacity 0.28s ease,
            visibility 0.28s ease;
    }

    .kosk-mobile-overlay.kosk-mobile-overlay-visible {
        opacity: 1;
        visibility: visible;
    }

    /*
    ----------------------------------------------------------
    Botón hamburguesa
    ----------------------------------------------------------
    */

    .kosk-mobile-menu-button {
        width: 42px;
        height: 42px;

        flex: 0 0 42px;

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

        border: 1px solid var(--border);
        border-radius: 12px;

        background: #ffffff;
        color: #491528;

        padding: 0;

        font-size: 22px;

        cursor: pointer;

        transition:
            background 0.2s ease,
            border-color 0.2s ease;
    }

    .kosk-mobile-menu-button:hover {
        background: #fff3f6;
        border-color: #f7becc;
    }

    /*
    ----------------------------------------------------------
    Topbar
    ----------------------------------------------------------
    */

    .topbar {
        min-height: 66px;
        height: auto;

        justify-content: flex-start;

        padding: 8px 18px;

        gap: 14px;
    }

    .topbar > img {
        width: auto !important;
        height: 42px !important;
        max-width: 120px !important;

        flex: 0 0 auto;

        object-fit: contain !important;
    }

    .topbar .search {
        display: none;
    }

    .kosk-topbar-user {
        margin-left: auto;

        max-width: 180px;

        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /*
    ----------------------------------------------------------
    Contenido
    ----------------------------------------------------------
    */

    .content {
        padding: 18px;
    }
}

/* ==========================================================
   TELÉFONOS PEQUEÑOS
========================================================== */

@media (max-width: 480px) {

    .topbar {
        padding: 8px 12px;
        gap: 10px;
    }

    .kosk-mobile-menu-button {
        width: 40px;
        height: 40px;

        flex-basis: 40px;

        font-size: 21px;
    }

    .topbar > img {
        width: auto !important;
        height: 36px !important;
        max-width: 95px !important;
    }

    .kosk-topbar-user {
        max-width: 105px;

        font-size: 12px;
    }

    .content {
        padding: 15px 12px;
    }
}

/* ==========================================================
   CONTROL DEFINITIVO DEL BOTÓN MÓVIL
========================================================== */

/* Escritorio: completamente oculto */
@media (min-width: 901px) {

    #koskMobileMenuButton {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

}

/* Móvil y tablet: visible */
@media (max-width: 900px) {

    #koskMobileMenuButton {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;

        width: 42px !important;
        height: 42px !important;

        flex: 0 0 42px;

        align-items: center;
        justify-content: center;

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

        border: 1px solid var(--border);
        border-radius: 12px;

        background: #ffffff;
        color: #491528;

        font-size: 22px;
        cursor: pointer;
        overflow: visible !important;
    }

}

/* ============================================================
   DATATABLES -- TEMA GLOBAL DEL SISTEMA (2026-10-02)
   ------------------------------------------------------------
   Antes cada módulo (clientes, pedidos, usuarios, productos)
   traía su propia copia casi idéntica de estas reglas, scoped
   por "#miTablaId" -- eso fue lo que causó que la pestaña
   "Clientes App" se viera distinta a "Clientes" (una tabla nueva
   se quedaba sin ninguna de estas reglas hasta que alguien se
   acordaba de copiarlas).

   Ahora cualquier tabla inicializada con DataTables hereda esto
   automáticamente, porque apunta a las clases que el plugin
   agrega solo (.dataTables_wrapper, table.dataTable), sin
   depender del id de cada tabla. Los módulos ya NO deben traer
   su propia copia de este bloque -- solo deben agregar estilos
   que sean realmente específicos de esa página (nombre de
   cliente, badges de estado, etc.).

   Para una tabla secundaria/incrustada que necesite verse más
   compacta (ej. historial de inventario dentro de la ficha de
   producto), envolver la tabla en un contenedor con la clase
   "datatable-compact" -- ver esa sección más abajo.
============================================================ */

.dataTables_wrapper {
    width: 100%;
}

table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

table.dataTable.no-footer {
    border-bottom: 0 !important;
}

table.dataTable thead th {
    padding: 16px 14px !important;
    border-bottom: 1px solid #dbe4ec !important;
    background: transparent !important;
    color: #202131;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

table.dataTable tbody td {
    padding: 16px 14px !important;
    border-bottom: 1px solid #edf1f5 !important;
    background: transparent !important;
    color: #202131;
    font-size: 14px;
    vertical-align: middle;
}

table.dataTable tbody tr:last-child td {
    border-bottom: 0 !important;
}

table.dataTable tbody tr:hover td {
    background: #f8fafc !important;
}

table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd,
table.dataTable.display tbody tr.even,
table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover {
    background: transparent !important;
    box-shadow: none !important;
}

/* Controles: buscador + "Mostrar N" */

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 20px;
    color: inherit;
}

.dataTables_wrapper .dataTables_length {
    float: left;
}

.dataTables_wrapper .dataTables_filter {
    float: right;
    text-align: right;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #202131;
    font-size: 14px;
}

/* 2026-10-02: el propio CSS de DataTables (cdn.datatables.net) trae sus
   reglas ".dataTables_wrapper .dataTables_length select" y
   ".dataTables_wrapper .dataTables_filter input" con bordes grises
   cuadrados (#aaa / 3px) -- EXACTAMENTE los mismos selectores que usamos
   aquí. Con la misma especificidad, quién gana depende del orden/caché
   de carga de los <link> -- por eso a veces se veía bien y a veces se
   veía con el estilo "crudo" de DataTables, de forma intermitente y
   difícil de reproducir. Igual que ya se hacía abajo con
   .paginate_button, forzamos con !important las propiedades que
   DataTables también define, para que nuestro estilo gane siempre, sin
   depender del orden de carga. */

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    min-height: 42px;
    border: 1px solid #dbe4ec !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: #202131 !important;
    padding: 8px 12px !important;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.dataTables_wrapper .dataTables_length select {
    min-width: 75px;
}

.dataTables_wrapper .dataTables_filter input {
    min-width: 230px;
    margin-left: 0 !important;
    padding-left: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230c5878' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 16px 16px;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #0c5878 !important;
    box-shadow: 0 0 0 3px rgba(12, 88, 120, 0.10);
}

/* Información + paginación */

.dataTables_wrapper .dataTables_info {
    float: left;
    padding-top: 22px;
    color: #748198;
    font-size: 14px;
}

.dataTables_wrapper .dataTables_paginate {
    float: right;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 14px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 40px;
    height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 2px !important;
    border: 1px solid #dbe4ec !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #202131 !important;
    padding: 0 12px !important;
    box-shadow: none !important;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    border-color: #0c5878 !important;
    background: #edf6fa !important;
    color: #0c5878 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    border-color: #0c5878 !important;
    background: #0c5878 !important;
    color: #ffffff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #e4eaf0 !important;
    background: #ffffff !important;
    color: #748198 !important;
}

.dataTables_wrapper::after {
    content: "";
    display: block;
    clear: both;
}

@media (max-width: 768px) {

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        width: 100%;
        float: none;
        text-align: left;
    }

    .dataTables_wrapper .dataTables_filter {
        margin-top: 12px;
    }

    .dataTables_wrapper .dataTables_filter label {
        align-items: flex-start;
        flex-direction: column;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        min-width: 0;
    }

    .dataTables_wrapper .dataTables_info {
        padding-top: 18px;
    }

    .dataTables_wrapper .dataTables_paginate {
        justify-content: flex-start;
        flex-wrap: wrap;
        padding-top: 12px;
    }

}

/* ------------------------------------------------------------
   Variante compacta (opt-in) para tablas secundarias/incrustadas
   -- ej. el historial de movimientos de inventario dentro de la
   ficha de producto. Envolver la tabla en:
       <div class="datatable-compact"> <table ...>...</table> </div>
------------------------------------------------------------ */

.datatable-compact .dataTables_wrapper .dataTables_length,
.datatable-compact .dataTables_wrapper .dataTables_filter {
    margin-bottom: 16px;
}

.datatable-compact .dataTables_wrapper .dataTables_length label,
.datatable-compact .dataTables_wrapper .dataTables_filter label {
    font-size: 13px;
}

.datatable-compact .dataTables_wrapper .dataTables_length select,
.datatable-compact .dataTables_wrapper .dataTables_filter input {
    min-height: 40px;
    font-size: 13px;
}

.datatable-compact .dataTables_wrapper .dataTables_filter input {
    min-width: 190px;
    padding-left: 38px;
    background-position: 12px center;
    background-size: 14px 14px;
}

.datatable-compact table.dataTable thead th,
.datatable-compact table.dataTable tbody td {
    font-size: 13px;
}

.datatable-compact .dataTables_wrapper .dataTables_info {
    padding-top: 18px;
    font-size: 13px;
}

.datatable-compact .dataTables_wrapper .dataTables_paginate {
    padding-top: 12px;
}

.datatable-compact .dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px !important;
    font-size: 13px;
}


/* ==========================================================
   LINKS (2026-10-15) — solo ERP (este archivo no lo cargan /shop/ ni /scan/)
   ----------------------------------------------------------
   Antes los <a> sin estilo propio salían con el azul y el subrayado del
   navegador. Todas las reglas usan :where() (especificidad 0) a propósito:
   cualquier componente que ya defina su propio color/subrayado (botones,
   menú lateral, tarjetas, tablas...) sigue ganando y no cambia. Lo que
   cambia es todo enlace que no tenía estilo.
========================================================== */

:where(a) {
    color: var(--link);
    text-decoration: none;
    transition: color .15s ease, text-decoration-color .2s ease;
}

:where(a:hover) {
    color: var(--link-hover);
}

/* Enlaces de texto (sin clase): semibold + subrayado fino que aparece al pasar el mouse. */
:where(a:not([class]):not([role="button"])) {
    font-weight: 600;
    text-decoration-line: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

:where(a:not([class]):not([role="button"]):hover) {
    text-decoration-color: currentColor;
}

/* Teclado: anillo de foco visible y discreto. */
:where(a:focus-visible) {
    outline: 2px solid rgba(12, 88, 120, .45);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Enlaces dentro de avisos: heredan el color del aviso (rojo/verde/...) y se subrayan. */
:where(.alert a, .alert a:hover) {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: currentColor;
}
