/* ==========================================================================
   WabotChat · Edición Navideña (CRM + inicio de sesión)
   Solo decoración: todo son fondos/pseudo-elementos sin eventos (no cambian
   estructura, formularios ni scripts). Archivos: static/xmas-crm.css +
   static/xmas/crm-* y static/xmas/login-*.
   Quitar la temporada: poner xmas_crm = false en base.html y login.html
   (o restaurar los .bak-2026-12-02f) y borrar estos archivos.
   ========================================================================== */

html.xmas-crm {
    --xc-bar: linear-gradient(90deg, #012f1d 0%, #004327 10%, #015530 20%, #014728 30%, #01321d 40%, #01301e 50%, #013721 60%, #013d27 70%, #02422d 80%, #002d20 90%, #02271a 100%);
    --xc-gw: clamp(440px, 54vw, 782px);
}

/* ---------- Barra superior: guirnalda, moño, luces, trineo y luna ---------- */
.xmas-crm .topbar {
    position: relative;
    background:
        url("xmas/crm-bar-sleigh.webp") right clamp(120px, 11.5vw, 181px) top 0 / auto 100% no-repeat,
        url("xmas/crm-bar-garland.webp") left calc(50% - var(--xc-gw) * .0886) top 0 / var(--xc-gw) auto no-repeat,
        var(--xc-bar);
    border-bottom: 1px solid #0a5a37;
}
.xmas-crm .brand { position: relative; z-index: 1; }
.xmas-crm .brand img { filter: drop-shadow(0 1px 2px #00180e66); }
.xmas-crm .topbar .logout, .xmas-crm .topbar [data-mobile-inbox-menu] { position: relative; z-index: 1; }
.xmas-crm .topbar .logout .button-quiet {
    gap: 9px; min-height: 40px; padding-inline: 16px; border-radius: 12px;
    color: #fff; font-weight: 700;
    background: linear-gradient(180deg, #0c4a30, #06331f);
    border: 1px solid #1fae5a;
    box-shadow: 0 0 0 1px #0a2d1d inset, 0 0 14px #19b95a40;
}
.xmas-crm .topbar .logout .button-quiet:hover { background: linear-gradient(180deg, #11603e, #08402a); }
.xmas-crm .topbar .logout .button-quiet::before {
    content: ""; width: 18px; height: 18px; background: currentColor;
    -webkit-mask: url("xmas/crm-icon-logout.svg") center / contain no-repeat;
    mask: url("xmas/crm-icon-logout.svg") center / contain no-repeat;
}
.xmas-crm .topbar [data-mobile-inbox-menu] { border-radius: 12px; border: 1px solid #1fae5a; background: linear-gradient(180deg, #0c4a30, #06331f); }

@media (max-width: 1239px) {
    .xmas-crm .topbar { background:
        url("xmas/crm-bar-garland.webp") left calc(50% - var(--xc-gw) * .0886) top 0 / var(--xc-gw) auto no-repeat,
        var(--xc-bar); }
}
@media (max-width: 991px) {
    .xmas-crm .topbar { background:
        url("xmas/crm-m-pine-left.webp") left top / auto 100% no-repeat,
        url("xmas/crm-m-pine-right.webp") right top / auto 100% no-repeat,
        url("xmas/crm-m-lights.webp") center 40% / min(220px, 56vw) auto no-repeat,
        url("xmas/crm-flake-white.svg") 68% 28% / 14px no-repeat,
        var(--xc-bar); }
}

/* ---------- Menú lateral verde con nieve, muñeco y regalos ---------- */
@media (min-width: 992px) {
    .xmas-crm .workspace-sidebar {
        position: sticky;
        border-color: #0b5a37;
        background:
            url("xmas/crm-flake-green.svg") 91% 17% / 20px no-repeat,
            url("xmas/crm-flake-green.svg") 90% 40% / 24px no-repeat,
            url("xmas/crm-flake-green.svg") 93% 66% / 18px no-repeat,
            url("xmas/crm-flake-green.svg") 7% 74% / 16px no-repeat,
            linear-gradient(205deg, #05703d 0%, #035a33 38%, #02462a 100%);
        box-shadow: 0 8px 25px #04301c33;
    }
    .xmas-crm .workspace-sidebar::after {
        content: ""; position: absolute; z-index: 0; pointer-events: none;
        left: 0; right: 0; bottom: 72px;
        height: min(clamp(0px, calc(100dvh - 861px), 200px), calc((clamp(245px, 22vw, 300px) - 16px) * .738));
        background:
            url("xmas/crm-side-snow.webp") left bottom / auto 100% no-repeat,
            url("xmas/crm-side-ground.webp") left bottom / auto 14.7% repeat-x;
    }
    /* El desplegable sube sobre la nav; si ambos quedan en z-index:1, la nav
       (posterior en el DOM, sidebar en column-reverse) se queda encima y se come los clics. */
    .xmas-crm .workspace-sidebar > .workspace-nav { position: relative; z-index: 1; }
    .xmas-crm .workspace-sidebar > .account-menu { position: relative; z-index: 2; }
    .xmas-crm .workspace-nav nav a { color: #f3fff7; }
    .xmas-crm .workspace-nav .nav-icon { color: #f3fff7; }
    .xmas-crm .workspace-nav nav a:hover { background: #ffffff1f; color: #fff; }
    .xmas-crm .workspace-nav nav a[aria-current] {
        color: #fff; background: linear-gradient(180deg, #3fd556, #1ea83c);
        box-shadow: 0 3px 10px #00000030, 0 1px 0 #ffffff55 inset;
    }
    .xmas-crm .workspace-nav input[type="search"] {
        color: #fff; background: #ffffff14; border-color: #ffffff59;
    }
    .xmas-crm .workspace-nav input[type="search"]::placeholder { color: #e6f7ec; opacity: .95; }
    .xmas-crm .workspace-nav-divider { border-top-color: #ffffff3d; }
    .xmas-crm .workspace-sidebar .account-menu { background: var(--white); border-radius: 12px; }
    .xmas-crm .workspace-sidebar .workspace-profile { border-top-color: transparent; margin-top: 0; padding-top: 11px; padding-bottom: 6px; }
}
@media (min-width: 992px) and (max-height: 945px) {
    .xmas-crm .workspace-sidebar::after { display: none; }
}

/* ---------- Conversación: copos, pinos y regalos (muy suaves) ---------- */
html.xmas-crm:not([data-mode="dark"]) .messages {
    background:
        url("xmas/crm-chat-art.webp") right bottom / min(300px, 62%) auto no-repeat,
        url("xmas/crm-flake-white.svg") 90% 9% / 34px no-repeat,
        url("xmas/crm-flake-white.svg") 76% 21% / 22px no-repeat,
        url("xmas/crm-flake-white.svg") 91% 33% / 40px no-repeat,
        url("xmas/crm-flake-white.svg") 64% 46% / 20px no-repeat,
        url("xmas/crm-flake-white.svg") 86% 54% / 26px no-repeat,
        url("xmas/crm-flake-white.svg") 70% 63% / 18px no-repeat,
        url("xmas/crm-flake-white.svg") 14% 38% / 32px no-repeat,
        linear-gradient(180deg, #e3f4ea 0%, #e9f6ef 55%, #eef8f3 100%);
}
@media (max-width: 991px) {
    html.xmas-crm:not([data-mode="dark"]) .messages {
        background:
            url("xmas/crm-m-chat-bow.webp") right top / min(96px, 28%) auto no-repeat,
            url("xmas/crm-m-chat-snow.webp") left bottom / 100% auto no-repeat,
            url("xmas/crm-flake-white.svg") 12% 18% / 22px no-repeat,
            url("xmas/crm-flake-white.svg") 28% 42% / 16px no-repeat,
            url("xmas/crm-flake-white.svg") 8% 58% / 28px no-repeat,
            url("xmas/crm-flake-white.svg") 42% 72% / 18px no-repeat,
            url("xmas/crm-flake-white.svg") 78% 36% / 20px no-repeat,
            linear-gradient(180deg, #e8f4ef 0%, #eef7f3 45%, #eaf6f1 100%);
    }
}

/* ---------- Datos del contacto: copos, gorro, guirnalda y regalos ---------- */
@media (min-width: 1120px) {
    html.xmas-crm:not([data-mode="dark"]) .contact-panel {
        background:
            url("xmas/crm-contact-gifts.webp") right bottom / min(236px, 100%) auto no-repeat,
            url("xmas/crm-flake-ice.svg") 94% 3% / 28px no-repeat,
            url("xmas/crm-flake-ice.svg") 8% 7% / 18px no-repeat,
            url("xmas/crm-flake-ice.svg") 82% 17% / 16px no-repeat,
            url("xmas/crm-flake-ice.svg") 12% 88% / 24px no-repeat;
    }
    .xmas-crm .contact-card { position: relative; }
    .xmas-crm .contact-card .avatar { position: relative; overflow: visible; }
    .xmas-crm .contact-card .avatar::after {
        content: ""; position: absolute; pointer-events: none;
        width: 50px; height: 48px; right: -14px; top: -19px;
        background: url("xmas/crm-hat.svg") center / contain no-repeat;
        transform: scaleX(-1);
    }
    .xmas-crm .contact-card::after {
        content: ""; position: absolute; pointer-events: none;
        left: 50%; bottom: -19px; width: min(214px, 100%); height: 37px; transform: translateX(-50%);
        background: url("xmas/crm-contact-divider.webp") center / contain no-repeat;
    }
}
@media (min-width: 1120px) and (max-height: 939px) {
    html.xmas-crm:not([data-mode="dark"]) .contact-panel {
        background-size: 0 0, 28px, 18px, 16px, 24px;
    }
}


/* ---------- Móvil (<992px): lista, gorros, acebo y nieve (el escritorio no cambia) ---------- */
@media (max-width: 991px) {
    .xmas-crm .account-menu .profile-avatar {
        position: relative;
        overflow: visible;
    }
    .xmas-crm .account-menu .profile-avatar::after {
        content: ""; position: absolute; pointer-events: none;
        width: 30px; height: 28px; left: -10px; top: -12px;
        background: url("xmas/crm-hat.svg") center / contain no-repeat;
    }
    .xmas-crm .thread-entry:has(.thread-selected) { position: relative; overflow: visible; }
    .xmas-crm .thread-entry:has(.thread-selected)::after {
        content: ""; position: absolute; pointer-events: none; z-index: 2;
        top: -4px; right: 2px; width: 44px; height: 38px;
        background: url("xmas/crm-m-holly.webp") center / contain no-repeat;
    }
    html.xmas-crm:not([data-mode="dark"]) .thread-selected {
        background-image:
            url("xmas/crm-flake-white.svg"),
            url("xmas/crm-flake-white.svg");
        background-repeat: no-repeat, no-repeat;
        background-size: 16px, 12px;
        background-position: 86% 72%, 72% 88%;
        background-color: light-dark(#e8f5eb, var(--surface-raised));
    }
    html.xmas-crm:not([data-mode="dark"]) .thread-panel {
        position: relative;
        isolation: isolate;
    }
    html.xmas-crm:not([data-mode="dark"]) .thread-panel::after {
        content: ""; position: absolute; pointer-events: none; z-index: 0;
        left: 0; right: 0; bottom: 0; height: min(176px, 46vw);
        background: url("xmas/crm-m-list-snow.webp") left bottom / 100% auto no-repeat;
    }
    .xmas-crm .thread-panel > * { position: relative; z-index: 1; }
    html.xmas-crm:not([data-mode="dark"]) .thread-list { padding-bottom: min(168px, 44vw); }

    .xmas-crm .chat-heading .avatar { position: relative; overflow: visible; }
    .xmas-crm .chat-heading .avatar::after {
        content: ""; position: absolute; pointer-events: none;
        width: 28px; height: 26px; left: -9px; top: -11px;
        background: url("xmas/crm-hat.svg") center / contain no-repeat;
    }
}

/* ==========================================================================
   Inicio de sesión (solo con body.xmas-login)
   ========================================================================== */
.xmas-login .access-entry {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        url("xmas/login-tl.webp") left top / clamp(170px, 58%, 440px) auto no-repeat,
        url("xmas/login-bottom.webp") left bottom -24px / 100% auto no-repeat,
        url("xmas/crm-flake-ice.svg") 12% 30% / 40px no-repeat,
        url("xmas/crm-flake-ice.svg") 92% 14% / 46px no-repeat,
        url("xmas/crm-flake-ice.svg") 88% 52% / 20px no-repeat,
        url("xmas/crm-flake-ice.svg") 6% 62% / 22px no-repeat,
        radial-gradient(ellipse 70% 45% at 55% 18%, #fffefd 0%, #fffefd00 70%),
        linear-gradient(180deg, #fbf3ee 0%, #faf5f1 45%, #f8f6f4 100%);
}
.xmas-login .access-inner { position: relative; z-index: 1; }
.xmas-login .access-inner .logo {
    width: min(100%, 440px); margin: 0 auto 2px; border-radius: 0; overflow: visible; background: none;
}
.xmas-tagline {
    margin: 0; text-align: center; font-weight: 700; text-transform: uppercase;
    font-size: clamp(.78rem, 1.08vw, 1rem); letter-spacing: .19em; color: #17533c;
}
.xmas-divider { display: flex; align-items: center; gap: 14px; margin: 14px 0 8px; }
.xmas-divider span { flex: 1; height: 1px; background: linear-gradient(90deg, #cdd6cd00 0%, #cdd6cd 45%); }
.xmas-divider span:last-child { background: linear-gradient(270deg, #cdd6cd00 0%, #cdd6cd 45%); }
.xmas-divider i { width: 28px; height: 28px; flex: none; background: url("xmas/login-whatsapp.svg") center / contain no-repeat; }
.xmas-login .access-inner h1 { margin: 6px 0 20px; font-size: clamp(1.75rem, 2.3vw, 2.1rem); color: #0c3d2c; }
.xmas-login .access-form { gap: 7px; }
.xmas-login .access-form label { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: .93rem; color: #1b2f27; }
.xmas-login .access-form label[for="email"]::before,
.xmas-login .access-form label[for="password"]::before {
    content: ""; width: 17px; height: 17px; background: #1b2f27;
    -webkit-mask: var(--xl-icon) center / contain no-repeat; mask: var(--xl-icon) center / contain no-repeat;
}
.xmas-login .access-form label[for="email"] { --xl-icon: url("xmas/login-icon-mail.svg"); }
.xmas-login .access-form label[for="password"] { --xl-icon: url("xmas/login-icon-lock.svg"); }
.xmas-login .access-form input:not([type="hidden"]) {
    min-height: 52px; padding-inline: 14px; border: 1px solid #cde1d2; border-radius: 12px;
    background: linear-gradient(180deg, #f8fcf7 0%, #ebf5ed 100%);
    box-shadow: inset 0 1px 2px #17402a14;
}
.xmas-login .access-form > .button {
    gap: 10px; min-height: 52px; font-size: 1.05rem; font-weight: 750; letter-spacing: .01em;
    background: linear-gradient(180deg, #17a042 0%, #0a7a2b 55%, #086a25 100%);
    box-shadow: 0 7px 18px #0a6d2a40, 0 1px 0 #ffffff55 inset;
}
.xmas-login .access-form > .button:hover { background: linear-gradient(180deg, #129238 0%, #086a25 60%, #065a1f 100%); }
.xmas-login .access-form > .button::before {
    content: ""; width: 20px; height: 20px; background: currentColor;
    -webkit-mask: url("xmas/login-icon-enter.svg") center / contain no-repeat; mask: url("xmas/login-icon-enter.svg") center / contain no-repeat;
}
.xmas-login .access-help { color: #3f5a4e; }
.xmas-login .access-help a { color: #0a6b2a; text-decoration: underline; text-underline-offset: 3px; }

/* Mitad derecha: portátil con gorro, luces, regalos y beneficios */
.xmas-login .access-visual {
    position: relative;
    isolation: isolate;
    background: #07301f url("xmas/login-visual.webp") center bottom / cover no-repeat;
}
.xmas-features {
    position: absolute; z-index: 1; left: 50%; bottom: clamp(26px, 7.5%, 80px); transform: translateX(-50%);
    display: flex; align-items: center; justify-content: center; margin: 0; padding: 0; list-style: none;
    width: max-content; max-width: calc(100% - 28px); color: #fff; pointer-events: none;
}
.xmas-features li { display: flex; align-items: center; gap: clamp(8px, .9vw, 14px); }
.xmas-features li + li::before {
    content: ""; width: 1px; height: clamp(40px, 4.2vw, 62px); margin-inline: clamp(12px, 1.7vw, 26px);
    background: linear-gradient(180deg, #ffffff00, #ffffff40 30%, #ffffff40 70%, #ffffff00);
}
.xf-tile {
    position: relative; flex: none; width: clamp(44px, 4.3vw, 62px); aspect-ratio: 1; border-radius: 28%;
    background: linear-gradient(160deg, #1f8a4d 0%, #0d5a32 55%, #07391f 100%);
    border: 1px solid #4fd88a66;
    box-shadow: 0 8px 18px #00180d80, 0 1px 0 #ffffff55 inset, 0 0 0 1px #052a17 inset, 0 -10px 16px #00000040 inset;
}
.xf-tile::before {
    content: ""; position: absolute; inset: 2px 2px 52% 2px; border-radius: 26% 26% 60% 60% / 30% 30% 40% 40%;
    background: linear-gradient(180deg, #ffffff40, #ffffff06);
}
.xf-tile::after {
    content: ""; position: absolute; inset: 24%; background: var(--xf-icon) center / contain no-repeat;
}
.xf-chat { --xf-icon: url("xmas/login-feat-chat.svg"); }
.xf-team { --xf-icon: url("xmas/login-feat-team.svg"); }
.xf-chart { --xf-icon: url("xmas/login-feat-chart.svg"); }
.xf-text { font-weight: 700; font-size: clamp(.78rem, 1.02vw, .98rem); line-height: 1.28; text-shadow: 0 1px 6px #00140a99; white-space: nowrap; }

/* Nieve cayendo (muy ligera; se detiene con «reducir movimiento») */
.xmas-login .access-entry::before, .xmas-login .access-visual::before {
    content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background-size: 220px 220px, 300px 300px, 380px 380px;
    background-position: 0 0, 0 0, 0 0;
}
.xmas-login .access-entry::before {
    background-image:
        radial-gradient(2.2px 2.2px at 30px 40px, #c9dde5, #c9dde500),
        radial-gradient(1.8px 1.8px at 180px 130px, #d3e4ea, #d3e4ea00),
        radial-gradient(2.6px 2.6px at 110px 210px, #c2d8e1, #c2d8e100);
}
.xmas-login .access-visual::before {
    background-image:
        radial-gradient(2.4px 2.4px at 30px 40px, #ffffffcc, #fff0),
        radial-gradient(1.8px 1.8px at 200px 150px, #ffffffaa, #fff0),
        radial-gradient(3px 3px at 120px 250px, #ffffffdd, #fff0);
}
@media (prefers-reduced-motion: no-preference) {
    .xmas-login .access-entry::before, .xmas-login .access-visual::before { animation: xmas-fall 24s linear infinite; }
}
@keyframes xmas-fall {
    to { background-position: 26px 220px, -34px 300px, 44px 380px; }
}

@media (max-width: 991px) {
    .xmas-features { display: none; }
    .xmas-login .access-visual { background-position: 16% bottom; }
}
@media (max-width: 740px) {
    .xmas-login .access-entry {
        background:
            url("xmas/login-tl.webp") left top / min(210px, 52%) auto no-repeat,
            url("xmas/login-bottom.webp") left bottom / min(100%, 560px) auto no-repeat,
            url("xmas/crm-flake-ice.svg") 90% 12% / 30px no-repeat,
            url("xmas/crm-flake-ice.svg") 92% 56% / 18px no-repeat,
            radial-gradient(ellipse 80% 40% at 55% 18%, #fffefd 0%, #fffefd00 70%),
            linear-gradient(180deg, #fbf3ee 0%, #faf5f1 45%, #f8f6f4 100%);
    }
    .xmas-login .access-inner .logo { width: min(100%, 360px); }
}
