/* ===================================================================
   MayoristaWeb - Rediseño visual, tema "B" (verde azulado, denso)
   Solo presentación. Se carga al final del _Layout, después de los
   temas de Kendo/Bootstrap, y se activa con <body class="skin-b">.
   Para desactivarlo: sacar la clase "skin-b" del body.
   Etapa 1: tokens + shell (header, menú lateral, home).
   =================================================================== */

:root {
    --ms-font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;

    --ms-bg: #F7F8F8;
    --ms-surface: #FFFFFF;
    --ms-surface-2: #F2F6F5;
    --ms-border: #DCE4E1;
    --ms-border-soft: #E9EFED;

    --ms-text: #14231F;
    --ms-text-2: #3C4F4A;
    --ms-muted: #51655F;

    --ms-primary: #0E7C7B;
    --ms-primary-hover: #0A6362;
    --ms-primary-soft: #DFF3F0;
    --ms-primary-ink: #0A5F5E;
    --ms-focus: #A9E0DA;

    --ms-ok: #1E9E5A;
    --ms-warn: #D98A00;
    --ms-danger: #D64545;
    --ms-info: #2F6FDE;

    --ms-radius: 10px;
    --ms-radius-lg: 12px;
    --ms-shadow: 0 8px 22px rgba(20, 35, 31, .09);

    --ms-sidebar-w: 264px;
    --ms-header-h: 46px;
}

/* ---------- Base ---------- */

body.skin-b {
    font-family: var(--ms-font);
    color: var(--ms-text);
    background: var(--ms-bg) !important;
    background-image: none !important;
}

/* ---------- Barras de desplazamiento finas ---------- */

/* Chrome/Edge ignoran ::-webkit-scrollbar si hay scrollbar-width/color,
   así que las propiedades estándar solo van donde no existe el pseudo. */
@supports not selector(::-webkit-scrollbar) {
    html:has(body.skin-b),
    body.skin-b * {
        scrollbar-width: thin;
        scrollbar-color: #C3CFCB transparent;
    }
}

html:has(body.skin-b) ::-webkit-scrollbar,
body.skin-b ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

html:has(body.skin-b) ::-webkit-scrollbar-track,
body.skin-b ::-webkit-scrollbar-track {
    background: transparent;
}

html:has(body.skin-b) ::-webkit-scrollbar-thumb,
body.skin-b ::-webkit-scrollbar-thumb {
    background: #C3CFCB;
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

html:has(body.skin-b) ::-webkit-scrollbar-thumb:hover,
body.skin-b ::-webkit-scrollbar-thumb:hover {
    background: #9FB3AE;
    background-clip: padding-box;
}

html:has(body.skin-b) ::-webkit-scrollbar-button,
body.skin-b ::-webkit-scrollbar-button {
    display: none;
}

/* ---------- Header ---------- */

body.skin-b #navheader {
    background-color: var(--ms-surface) !important;
    border-bottom: 1px solid var(--ms-border);
    box-shadow: none;
}

body.skin-b #normalheader {
    box-shadow: none !important;
    background: transparent;
    backdrop-filter: none;
}

body.skin-b #navheader .flatbutton,
body.skin-b #navheader .flatbutton i,
body.skin-b #navheader .flatbutton span.fas,
body.skin-b #navheader .flatbutton span.fa {
    color: var(--ms-text-2) !important;
}

body.skin-b #navheader .flatbutton:hover {
    background-color: var(--ms-surface-2) !important;
    border-radius: 8px;
}

body.skin-b #navheader .circulo,
body.skin-b #mobileheader .circulo {
    background: var(--ms-primary-soft) !important;
    color: var(--ms-primary-ink) !important;
    border: none !important;
    font-weight: 700;
}

body.skin-b #headersearch,
body.skin-b #navheader .k-autocomplete,
body.skin-b #navheader .k-textbox {
    border-radius: 8px;
}

/* ---------- Menú lateral permanente (pantallas anchas) ---------- */

/* En login / pantallas públicas no hay menú. */
body.skin-b:not(.is-auth) #sidebar,
body.skin-b:not(.is-auth) .overlay {
    display: none !important;
}

@media (min-width: 992px) {
    body.skin-b.is-auth #sidebar {
        left: 0 !important;
        width: var(--ms-sidebar-w);
        background: var(--ms-surface);
        border-right: 1px solid var(--ms-border);
        box-shadow: none;
        top: var(--ms-header-h);
        z-index: 900;
    }

    body.skin-b.is-auth .overlay {
        display: none !important;
    }

    /* Header: el buscador arranca donde arranca el contenido */
    body.skin-b.is-auth .leftheader {
        width: calc(var(--ms-sidebar-w) + 32px);
    }

    body.skin-b.is-auth .middleheader {
        min-width: 0;
        width: min(520px, 45vw);
    }

    body.skin-b.is-auth .divheadersearch {
        margin: 0;
        padding: 7px 0;
    }

    /* El borde lo da el contenedor Kendo; el input va sin borde. */
    body.skin-b.is-auth .divheadersearch .k-autocomplete {
        box-sizing: border-box;
        height: 32px;
        min-height: 32px;
        width: 100%;
        border: 1px solid var(--ms-border);
        background: var(--ms-bg);
    }

    body.skin-b.is-auth #headersearch,
    body.skin-b.is-auth .divheadersearch .k-autocomplete input {
        box-sizing: border-box;
        height: 30px;
        margin: 0;
        padding: 0 12px;
        font-size: 13.5px;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    body.skin-b.is-auth #abrirmenu,
    body.skin-b.is-auth #dismiss {
        display: none !important;
    }

    body.skin-b.is-auth #content {
        width: calc(100% - var(--ms-sidebar-w));
        padding-left: 32px;
        padding-right: 32px;
        padding-top: calc(var(--ms-header-h) + 24px);
    }
}

body.skin-b #sidebar {
    color: var(--ms-text);
}

body.skin-b #sidebar .sidebar-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ms-muted);
}

body.skin-b #searchopc {
    width: calc(100% - 28px);
    margin: 0 14px 10px;
    height: 38px;
    border: 1px solid var(--ms-border);
    border-radius: 8px;
    background: var(--ms-bg);
    font-size: 13.5px;
    padding: 0 10px;
}

body.skin-b #searchopc:focus {
    outline: 3px solid var(--ms-focus);
    border-color: var(--ms-primary);
}

body.skin-b #menutreecontainer {
    height: calc(100vh - var(--ms-header-h) - 130px) !important;
    overflow-y: auto;
    padding: 0 8px;
}

body.skin-b #menutreeview {
    font-size: 14px;
    color: var(--ms-text-2);
    background: transparent;
    border: none;
}

body.skin-b #menutreeview .k-in {
    border-radius: 8px;
    padding: 7px 10px;
    border: none;
}

body.skin-b #menutreeview .k-in:hover {
    background: var(--ms-surface-2);
}

body.skin-b #menutreeview .k-in.k-state-selected,
body.skin-b #menutreeview .k-in.k-state-selected:hover {
    background: var(--ms-primary-soft);
    color: var(--ms-primary-ink);
    font-weight: 600;
}

body.skin-b #expandnodes,
body.skin-b #colapsenodes {
    color: var(--ms-muted);
}

/* ---------- Home: tarjetas de módulos ---------- */

body.skin-b #homepage .tilesTitle {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    text-align: left;
    color: var(--ms-text);
    margin-bottom: 8px;
}

body.skin-b .tiles-container {
    text-align: left;
}

body.skin-b .tileBlock {
    margin-bottom: 22px;
    margin-right: 14px;
    max-width: 172px;
}

body.skin-b #homepage .tileButton button {
    width: 160px !important;
    height: 128px !important;
    background: var(--ms-surface);
    border: 1px solid var(--ms-border);
    border-radius: var(--ms-radius-lg);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--ms-primary);
    transition: box-shadow .15s, border-color .15s, transform .15s;
}

body.skin-b #homepage .tileButton button:hover {
    border-color: #9FD6D1;
    box-shadow: var(--ms-shadow);
    transform: translateY(-2px);
    background: var(--ms-surface);
}

body.skin-b #homepage .tileButton button:focus-visible {
    outline: 3px solid var(--ms-primary);
    outline-offset: 2px;
}

body.skin-b .tileButton > button > span > i {
    font-size: 2.2em;
    color: var(--ms-primary);
}

body.skin-b .tileLink {
    color: var(--ms-text);
    font-size: 14px;
    font-weight: 600;
    width: 150px;
    text-align: center;
}

/* ---------- Tarjeta de contenido (títulos de pantalla) ---------- */

body.skin-b #content h1,
body.skin-b #content h2 {
    font-family: var(--ms-font);
    font-weight: 700;
    letter-spacing: -.015em;
    color: var(--ms-text);
}

/* Home.js pinta títulos, íconos y links en blanco (inline) para el fondo
   oscuro anterior; con fondo claro hay que forzar los colores. */
body.skin-b #homepage .tilesTitle,
body.skin-b #homepage .tilesTitle * {
    color: var(--ms-text) !important;
}

body.skin-b #homepage .tileButton button i,
body.skin-b #homepage .link-tile-color i {
    color: var(--ms-primary) !important;
}

body.skin-b #homepage .tileLink a,
body.skin-b #homepage .tileLink .link-tile-color {
    color: var(--ms-text) !important;
}

/* Los botones del header reciben fondo y color inline desde JS (color de
   encabezado configurable); el tema B los unifica. */
body.skin-b #navheader .flatbutton,
body.skin-b #mobileheader .flatbutton {
    background: transparent !important;
    color: var(--ms-text-2) !important;
    border-radius: 8px;
}

body.skin-b #navheader .flatbutton:hover,
body.skin-b #mobileheader .flatbutton:hover {
    background: var(--ms-surface-2) !important;
}

body.skin-b #viewsesioninfocirculo,
body.skin-b #mobileviewsesioninfocirculo {
    background: var(--ms-primary-soft) !important;
    color: var(--ms-primary-ink) !important;
    border-color: transparent !important;
}

body.skin-b #mobileheader {
    background: var(--ms-surface);
}

/* Expandir / contraer árbol: botones chicos y discretos */
body.skin-b #expandnodes,
body.skin-b #colapsenodes {
    width: 28px;
    height: 28px;
    line-height: 26px;
    top: 10px; /* centrado en la fila del título (48px) */
    border-radius: 8px;
    background: var(--ms-surface-2);
    color: var(--ms-text-2);
    border: 1px solid var(--ms-border);
    font-size: 12px;
}

body.skin-b #expandnodes { right: 46px; }
body.skin-b #colapsenodes { right: 14px; }

body.skin-b #expandnodes:hover,
body.skin-b #colapsenodes:hover {
    background: var(--ms-primary-soft);
    color: var(--ms-primary-ink);
}

/* ---------- Ajustes de fidelidad con el mockup ---------- */

/* Menu2.js pinta fondo y color inline en sidebar y árbol */
body.skin-b #sidebar,
body.skin-b #menutreeview {
    background: #ffffff00 !important;
    color: var(--ms-text-2) !important;
}

body.skin-b #menutreeview .k-in,
body.skin-b #menutreeview .k-in:hover {
    color: var(--ms-text-2);
}

body.skin-b #menutreeview .k-sprite {
    color: var(--ms-primary);
    font-size: 16px;
    width: 22px;
    text-align: center;
    margin-right: 8px;
}

/* Marca arriba del menú */
body.skin-b .ms-brand {
    display: none;
}

@media (min-width: 992px) {
    body.skin-b.is-auth .ms-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        height: var(--ms-header-h);
        padding: 0 16px;
        float: left;
    }

    body.skin-b .ms-brand-logo {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        background: var(--ms-primary);
        color: #fff;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.skin-b .ms-brand strong {
        display: block;
        font-size: 15px;
        line-height: 1.2;
        color: var(--ms-text);
    }

    body.skin-b .ms-brand small {
        display: block;
        font-size: 12px;
        color: var(--ms-muted);
    }

    /* Barra de favoritos / ir al inicio: junto al menú, no debajo */
    /* Sin franja propia: el botón de inicio y los favoritos flotan en el
       margen del contenido, sobre el mismo fondo de la página. */
    body.skin-b.is-auth #toolbar {
        position: static;
        width: auto;
        height: auto !important;
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 18px;
        padding: 0;
        background: transparent !important;
        border: none;
        box-shadow: none !important;
    }

    body.skin-b.is-auth #toolbar #sortable {
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    body.skin-b.is-auth #toolbar #gohome {
        width: 40px;
        height: 40px;
        margin: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: var(--ms-surface) !important;
        border: 1px solid var(--ms-border);
        border-radius: 10px;
    }

    body.skin-b.is-auth #toolbar #gohome i {
        font-size: 16px;
    }

    body.skin-b.is-auth #toolbar #gohome:hover {
        background: var(--ms-primary-soft) !important;
        border-color: #9FD6D1;
    }

    body.skin-b.is-auth #content {
        padding-left: 32px;
    }
}

body.skin-b #toolbar .flathome,
body.skin-b #toolbar i,
body.skin-b #toolbar .flatbutton {
    color: var(--ms-text-2) !important;
}

/* Home: tarjetas horizontales con ícono en cuadro suave */
body.skin-b #homepage .tileBlock {
    max-width: none;
    margin: 0 14px 14px 0;
}

body.skin-b #homepage .tileButton,
body.skin-b #homepage .tileElem {
    width: 250px;
    padding: 0;
}

body.skin-b #homepage .tooltip-home {
    display: none;
}

body.skin-b #tilescontainer .col-md-12 {
    padding-left: 0;
    padding-right: 0;
}

body.skin-b #tilescontainer .row {
    margin-left: 0;
    margin-right: 0;
}

body.skin-b #homepage,
body.skin-b #tilescontainer {
    padding-left: 0;
    margin-left: 0;
}

body.skin-b #homepage .tilesTitle {
    margin-left: 0;
    padding-left: 0;
}

body.skin-b #sidebar .sidebar-header {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 16px;
}

body.skin-b #homepage .tilesTitle {
    margin-top: 0;
}

body.skin-b #homepage .tileButton button {
    width: 250px !important;
    height: 76px !important;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    text-align: left;
}

body.skin-b #homepage .tileButton button > span {
    padding: 0;
    display: flex;
}

body.skin-b #homepage .tileButton button i {
    font-size: 20px !important;
    width: 44px;
    height: 44px;
    line-height: 44px;
    border-radius: 10px;
    background: var(--ms-primary-soft);
    text-align: center;
    display: block;
}

body.skin-b #homepage .tileLink {
    flex: 1;
    width: auto;
    margin: 0;
    text-align: left;
    font-size: 14px;
}
