/* =====================================================================
   ATER · Portal moderno — design system (tema claro)
   Se carga DESPUÉS de Site.css y sólo en las masters del flujo de menú
   (Site.Master y MenuContSite.Master). Reestructura el layout clásico
   de "cajas" en un layout full-width, limpio y con degradado completo.
   ===================================================================== */

:root {
    --ater-violeta: #422268;
    --ater-magenta: #9c027c;
    --ater-cyan: #00a9b7;
    --ater-oro: #f3c64a;
    --ater-grad: linear-gradient(135deg, #321b55 0%, #6d1a72 48%, #a50378 100%);
    --ater-bg: #fbfafc;
    --ater-card: #ffffff;
    --ater-text: #1f2937;
    --ater-muted: #6b7280;
    --ater-border: #e5e7eb;
    --ater-ring: rgba(156, 2, 124, 0.18);
    --ater-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .25);
}

/* ---- Reset del layout "caja" clásico --------------------------------- */
html, body {
    background: var(--ater-bg) !important;
    letter-spacing: normal !important;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    color: var(--ater-text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Mayor especificidad para vencer los `body { background: ... !important }`
   que algunas páginas legacy inyectan en su propio <style> (ej. el gris de
   las pantallas de Catastro). */
html body { background: var(--ater-bg) !important; }

/* Site.css fuerza la fuente serif 'Archivo' en todos los headings; la
   reemplazamos por una sans-serif moderna en las zonas del portal. */
.header h1, .header h4,
.portal-titles h1, .portal-user,
.lx-title, .lx-card, .lx-brand, .lx-footer {
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.page, .page100, .page2 {
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
    background: var(--ater-bg) !important;
    box-shadow: none !important;
}

.footer { display: none !important; }

/* ---- Header full-width con degradado completo ------------------------ */
.header,
.headerDefault {
    background: var(--ater-grad) !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: 0 6px 24px -8px rgba(66, 34, 104, .55);
    border-bottom: 3px solid rgba(255, 255, 255, .12);
    position: relative;
}

.portal-topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 1320px;
    margin: 0 auto;
    padding: 18px 32px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.portal-logo {
    height: 54px;
    width: auto;
    flex-shrink: 0;
    padding-right: 18px;
    border-right: 1px solid rgba(255, 255, 255, .25);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .3));
}

.portal-titles { min-width: 0; }

.portal-kicker {
    color: var(--ater-oro);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    margin-bottom: 2px;
}

.portal-titles h1 {
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    font-size: 1.45rem !important;
    font-weight: 750 !important;
    line-height: 1.25 !important;
    letter-spacing: .2px;
}

.portal-subtitle {
    color: rgba(255, 255, 255, .7);
    font-size: .86rem;
    margin-top: 2px;
}

.portal-user {
    margin-top: 8px;
    color: rgba(255, 255, 255, .82);
    font-size: .88rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 18px;
}

/* baseline, no center: "Nombre:"/"CUIT:" (.lbl-prefix, .78rem) son más chicos
   que el valor (.88rem) — centrados por caja quedan flotando arriba del dato
   en vez de compartir la línea de base con él. */
.portal-user > span { display: inline-flex; align-items: baseline; gap: 5px; }

.portal-user .portal-org {
    color: #ffd76a;
    font-weight: 600;
    text-transform: capitalize;
}

.portal-user .lbl-prefix {
    opacity: .65;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.portal-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-dfe {
    background: #fff;
    color: #b91c1c;
    font-size: .8rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 320px;
    line-height: 1.25;
}

/* ---- Botón salir / acciones del header ------------------------------- */
.portal-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .14);
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, .35);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease;
}

.portal-btn:hover { background: rgba(255, 255, 255, .26); transform: translateY(-1px); }

/* ---- Header responsive (celular): apila marca / datos / acciones -------
   Compartido por Site.Master y MenuContSite.Master (Menu, Roles, MenuCont). */
@media (max-width: 680px) {
    .portal-topbar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }
    .portal-brand { gap: 12px; flex: 1 1 100%; }
    .portal-logo {
        height: 42px;
        padding-right: 12px;
    }
    .portal-titles h1 { font-size: 1.15rem !important; }
    .portal-user {
        margin-top: 6px;
        font-size: .8rem;
        gap: 2px 12px;
    }
    .portal-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .portal-dfe { max-width: 100%; flex: 1 1 auto; }

    /* Area tactil: con el padding de escritorio el boton queda en ~35px de alto,
       por debajo del minimo de 44px que necesita un dedo (WCAG 2.5.5). El
       min-height sube la caja sin tocar el texto, asi que no reflota el header. */
    .portal-btn {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
    }
}

/* Cuando el area de acciones tiene un solo control (Site.Master: nada mas que
   "Salir"), ocupar un renglon entero para el desperdicia ~70px de alto y deja
   una franja vacia a su izquierda. Se lo lleva al hueco libre que queda arriba
   a la derecha, al lado del kicker "PORTAL ATER".

   Va con :has() a proposito: donde hay dos controles —MenuContSite suma el reloj
   de sesion al boton Volver— no entran en esa esquina sin chocar con el titulo,
   y ahi la regla no aplica y siguen en su renglon. En un navegador sin :has()
   tampoco aplica, o sea que el peor caso es el layout actual. */
   El :has(.portal-user) es la otra mitad de la condicion, y no estaba: la regla
   supone una cabecera alta —kicker, titulo y los datos del contribuyente— donde
   la esquina superior derecha esta libre. Error.Master no tiene datos de
   usuario: su cabecera es un solo renglon de ~52px, y ahi un boton de 44px
   anclado a 14px del techo se desbordaba por abajo del degradado. Sin
   .portal-user la regla no aplica y el boton se queda en el flujo, centrado
   contra el titulo, que es lo correcto para una cabecera corta. */
@media (max-width: 680px) {
    .portal-topbar:has(.portal-user):has(.portal-actions > :only-child) { position: relative; }
    .portal-topbar:has(.portal-user):has(.portal-actions > :only-child) .portal-brand {
        padding-right: 96px;
    }
    .portal-topbar:has(.portal-user):has(.portal-actions > :only-child) .portal-actions {
        position: absolute;
        top: 14px;
        right: 16px;
        width: auto;
    }

    /* Cabecera corta —sin datos de usuario, como Error.Master—: la marca y la
       accion conviven en un renglon. El bloque general de arriba las apila
       (.portal-brand a 100% y .portal-actions a 100% en su propia fila) porque
       da por sentado que la cabecera es alta; con un solo titulo eso agrega una
       fila entera para un boton que entra al lado. */
    .portal-topbar:not(:has(.portal-user)) {
        flex-wrap: nowrap;
        align-items: center;
    }
    .portal-topbar:not(:has(.portal-user)) .portal-brand {
        flex: 1 1 auto;
        min-width: 0;
    }
    .portal-topbar:not(:has(.portal-user)) .portal-actions {
        flex: 0 0 auto;
        width: auto;
        margin-left: auto;
    }
}

/* ---- Barra de identidad del pie (celular) ---------------------------
   La construye Scripts/barra-identidad-movil.js clonando el CUIT y el nombre
   que el master ya renderizo en .portal-user. Solo existe en las paginas que
   incluyen ese script (hoy Menu.aspx y Roles.aspx); en las demas el selector no
   encuentra nada y estas reglas quedan inertes.

   Se esconde por defecto y se enciende recien en telefono: el script corre
   siempre, asi que sin esto el bloque apareceria suelto en escritorio, donde el
   CUIT y el nombre ya estan en la cabecera. */
.mv-barra { display: none; }

@media (max-width: 640px) {
    .mv-barra {
        display: flex;
        align-items: center;
        gap: 12px;
        /* El "auto" de arriba es lo que la manda al fondo de .main, que las
           paginas dejan como columna flex estirada a todo el alto. Va adentro
           del shorthand a proposito: declarado aparte, cualquier `margin`
           posterior lo pisa y la barra queda pegada al contenido. */
        margin: auto 12px 0;
        padding: 12px 14px 12px 20px;
        border-radius: 22px;
        background: linear-gradient(105deg, #4b1c6d 0%, #7a1a78 100%);
        box-shadow: 0 16px 30px -18px rgba(30, 8, 48, .95);
        color: #fff;
    }

    .mv-barra-datos {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .mv-barra-nombre {
        font-size: .95rem;
        font-weight: 700;
        line-height: 1.2;
        text-transform: capitalize;
        overflow-wrap: anywhere;
    }

    .mv-barra-cuit {
        font-size: .78rem;
        font-variant-numeric: tabular-nums;
        letter-spacing: .3px;
        color: rgba(255, 255, 255, .66);
    }

    .mv-barra-salir {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
        padding: 11px 16px;
        border: 1.5px solid rgba(255, 255, 255, .55);
        border-radius: 13px;
        color: #fff !important;
        font-size: .9rem;
        font-weight: 700;
        text-decoration: none !important;
        -webkit-tap-highlight-color: transparent;
    }
    .mv-barra-salir:active { background: rgba(255, 255, 255, .16); }
    .mv-barra-salir svg { width: 17px; height: 17px; flex: 0 0 auto; }
}

/* ---- La cabecera como app bar ---------------------------------------
   En 360px la cabecera se llevaba un tercio de la pantalla con seis renglones
   —kicker, titulo, subtitulo, CUIT, nombre y el boton en una fila propia— para
   decir cosas que el usuario ya sabe. Una app resuelve esto con una barra:
   identidad arriba, quien sos en chico, y nada mas. */
@media (max-width: 480px) {
    /* El subtitulo repite lo que ya dice el kicker. Es el renglon mas
       prescindible y libera alto para el contenido. */
    .portal-subtitle { display: none; }
    .portal-topbar { padding-top: 12px; padding-bottom: 12px; }

    /* El logo se va en telefono. La marca ya la dice el kicker "PORTAL ATER" en
       dorado justo al lado, asi que el isotipo repetia el mismo dato gastando
       ~66px de ancho —imagen, padding y el borde separador— sobre los ~330
       utiles. Ese ancho es exactamente lo que le faltaba al titulo: en Menu y
       Roles, "Administradora Tributaria de Entre Rios" pasa a entrar sin partirse
       en dos renglones. */
    .portal-logo { display: none; }

    .portal-kicker { font-size: .64rem; letter-spacing: 1.4px; margin-bottom: 1px; }
    .portal-titles h1 { font-size: 1.06rem !important; }

    /* Los datos del usuario pasan a un renglon unico y chico. Los rotulos
       "CUIT:" y "NOMBRE:" se van: un CUIT se reconoce por su forma y el nombre
       viene atras: gastaban ~90px en decir lo que el dato ya dice. Se separan
       con un punto medio en vez de con palabras. */
    .portal-user {
        margin-top: 5px;
        font-size: .74rem;
        gap: 0 8px;
        opacity: .9;
    }
    .portal-user .lbl-prefix { display: none; }
    .portal-user > span + span::before {
        content: '·';
        margin-right: 8px;
        opacity: .5;
    }
}

/* ---- Textura de app en tactil ---------------------------------------
   Lo que separa una pagina web de una app en el celular no es tanto el layout
   como como responde al dedo. Cuatro cosas, en orden de cuanto se notan. */
@media (max-width: 680px) {
    /* 1. El recuadro gris que pinta el navegador al tocar es la senal mas fuerte
          de "esto es una pagina". Se apaga y se reemplaza por un estado
          presionado propio, que ademas responde en el touchstart y no al soltar. */
    .portal-btn {
        -webkit-tap-highlight-color: transparent;
        transition: background .2s ease, transform .08s ease;
    }
    .portal-btn:active {
        transform: scale(.96);
        background: rgba(255, 255, 255, .3);
    }

    /* 2. Safe areas: sin esto la cabecera se mete abajo del notch / isla dinamica
          y el borde inferior queda tapado por la barra de gestos. Depende del
          viewport-fit=cover que declaran las masters. */
    .portal-topbar {
        padding-top: calc(14px + env(safe-area-inset-top));
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
    }
    .main { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

    /* 3. En una app el chrome no se selecciona al mantener apretado. Los datos
          del usuario (CUIT, nombre) quedan afuera a proposito: esos se copian. */
    .portal-kicker,
    .portal-titles h1,
    .portal-subtitle,
    .portal-btn {
        -webkit-user-select: none;
        user-select: none;
    }

    /* 4. Corta el rebote elastico del final del scroll, que delata al navegador. */
    html, body { overscroll-behavior-y: contain; }
}

/* El :hover en tactil no existe: el navegador lo simula al tocar y despues lo
   deja pegado hasta que tocas otra cosa, asi que la card queda "levantada" sin
   motivo. Se limita a punteros que de verdad tienen hover. */
@media (hover: none) {
    .portal-btn:hover { background: rgba(255, 255, 255, .14); transform: none; }
}

@media (max-width: 400px) {
    .portal-logo {
        padding-right: 10px;
        margin-right: 2px;
    }
    .portal-titles h1 { font-size: 1.02rem !important; }
    /* Se achica el padding lateral, no el vertical: el min-height de arriba sigue
       valiendo y el boton no baja de los 44px. */
    .portal-btn { padding-left: 12px; padding-right: 12px; font-size: .84rem; }
}

/* ---- Oculta el menú clásico asp:Menu (lo reemplaza el portal Lit) ---- */
.hideSkiplink,
#NavigationMenu,
div.menu { display: none !important; }

/* Excepción: módulos con sub-menú propio (.submenu-shell: Catastro,
   Administración, etc.) conservan su nav, teñido en violeta para combinar
   con el header (el hover ya usa el degradado ATER). */
.submenu-shell .hideSkiplink,
.submenu-shell div.menu { display: block !important; }
.submenu-shell .hideSkiplink { background: #2d1850 !important; }
.submenu-shell div.menu { padding: 2px 16px; }
.submenu-shell div.menu ul li a,
.submenu-shell div.menu ul li a:visited {
    background-color: #2d1850 !important;
    border-color: #2d1850 !important;
    color: #fff !important;
    font-weight: 600;
}
.submenu-shell div.menu ul ul {
    box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .55);
}
/* Marcador oculto del tipo de usuario (lo lee el código, no debe verse). */
.lbl-tipo { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- Área de contenido ---------------------------------------------- */
.main {
    margin: 0 auto !important;
    padding: 0 !important;
    min-height: 60vh;
    background:
        radial-gradient(900px 380px at 50% -120px, rgba(156, 2, 124, .08), transparent 72%),
        var(--ater-bg);
}

/* Apps con la clase .app-shell (MenuContSite100.Master, Catastro, etc.):
   el contenido va en una tarjeta blanca centrada con aire, coherente con el
   portal, sin pegarse a los márgenes ni cortar los totales.
   MenuCont (portal) NO lleva .app-shell, así mantiene su full-width. */
.app-shell .main {
    max-width: 1500px;
    margin: 28px auto 56px !important;
    padding: 28px 24px !important;
    background: #fff !important;
    border: 1px solid var(--ater-border);
    border-radius: 14px;
    box-shadow: var(--ater-shadow);
    overflow-x: auto;
}

@media (max-width: 640px) {
    .app-shell .main {
        margin: 14px auto 32px !important;
        padding: 18px 14px !important;
        border-radius: 10px;
    }
}

/* Site.css pinta los headings claros (color #efefe5, pensados para fondos
   oscuros). En el contenido blanco del portal los volvemos oscuros y legibles. */
.app-shell .main h1,
.app-shell .main h2,
.app-shell .main h3,
.app-shell .main h4,
.app-shell .main h5,
.app-shell .main h6 {
    color: #172033 !important;
}
.app-shell .main .card-body h4 { font-weight: 700; margin-left: 0; }

/* =====================================================================
   Modernización global de tablas/botones/inputs legacy en apps internas.
   Scopeado a .app-shell .main para no afectar el login ni el portal moderno.
   :has(th) apunta solo a tablas de datos (no a tablas de maquetado).
   ===================================================================== */
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) {
    border-collapse: collapse !important;
    width: 100% !important;
    table-layout: auto;
    font-size: .82rem;
    color: #1f2937;
}
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) th {
    background: var(--ater-violeta) !important;
    color: #fff !important;
    font-weight: 700 !important;
    text-align: left !important;
    padding: 10px 9px !important;
    border: none !important;
    border-bottom: 2px solid var(--ater-magenta) !important;
    line-height: 1.2;
}
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) td {
    padding: 9px 9px !important;
    border: none !important;
    border-bottom: 1px solid #eef1f5 !important;
    background: #fff !important;
    color: #1f2937 !important;
    vertical-align: middle;
}
/* números/importes alineados a la derecha y sin cortar */
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) td { white-space: normal; }
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) tbody tr:nth-child(even) td { background: #faf8fc !important; }
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) tbody tr:hover td { background: #f4eef9 !important; }
/* fila seleccionada (DataTables agrega .selected al tr) */
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) tbody tr.selected td { background: #e6d9f2 !important; }
.app-shell .main table:has(> thead, > tbody > tr > th, > tr > th) tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--ater-magenta); }
/* DataTables con scrollY: el thead de medición dentro del cuerpo debe quedar con altura 0 */
.app-shell .main .dataTables_scrollBody table thead th {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border: none !important;
    height: 0 !important;
}

/* Botones */
.app-shell .main input[type="submit"],
.app-shell .main input[type="button"],
.app-shell .main button:not(.portal-btn),
.app-shell .main a.btn {
    display: inline-block;
    background: var(--ater-grad) !important;
    color: #fff !important;
    border: none !important;
    padding: 9px 18px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 8px 18px -10px var(--ater-magenta);
    transition: transform .15s ease, filter .2s ease;
}
.app-shell .main input[type="submit"]:hover,
.app-shell .main input[type="button"]:hover,
.app-shell .main button:not(.portal-btn):hover,
.app-shell .main a.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }

/* Estado deshabilitado (ASP.NET agrega disabled="disabled" + class="aspNetDisabled") */
.app-shell .main input[type="submit"]:disabled,
.app-shell .main input[type="button"]:disabled,
.app-shell .main button:not(.portal-btn):disabled,
.app-shell .main a.btn.aspNetDisabled,
.app-shell .main .aspNetDisabled {
    background: #d4d8e0 !important;
    color: #8b919c !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}
.app-shell .main input[type="submit"]:disabled:hover,
.app-shell .main input[type="button"]:disabled:hover,
.app-shell .main button:not(.portal-btn):disabled:hover,
.app-shell .main a.btn.aspNetDisabled:hover { transform: none !important; filter: none !important; }

/* Inputs / selects / textareas */
.app-shell .main input[type="text"],
.app-shell .main input[type="date"],
.app-shell .main input[type="number"],
.app-shell .main input[type="email"],
.app-shell .main select,
.app-shell .main textarea {
    padding: 8px 12px !important;
    border: 1.5px solid var(--ater-border) !important;
    border-radius: 8px !important;
    font-size: .92rem !important;
    background: #fff !important;
    color: #1f2937 !important;
}
.app-shell .main input[type="text"]:focus,
.app-shell .main input[type="date"]:focus,
.app-shell .main input[type="number"]:focus,
.app-shell .main input[type="email"]:focus,
.app-shell .main select:focus,
.app-shell .main textarea:focus {
    outline: none !important;
    border-color: var(--ater-magenta) !important;
    box-shadow: 0 0 0 3px var(--ater-ring) !important;
}

/* Links de acción (Todo / Nada, etc.) */
.app-shell .main a:not(.btn):not(.portal-btn) { color: var(--ater-magenta); font-weight: 600; }

/* Transicion entre Menu.aspx y Roles.aspx */
html.portal-flow-page .main {
    animation: portalFlowIn .34s cubic-bezier(.2, .78, .25, 1) both;
    transform-origin: 50% 42%;
    will-change: opacity, transform, filter;
}

html.portal-flow-page.portal-flow-leaving .main {
    animation: portalFlowOut .26s cubic-bezier(.55, .06, .68, .19) both;
}

html.portal-flow-page.portal-flow-leaving .portal-topbar {
    filter: saturate(1.04) brightness(.98);
    transition: filter .26s ease;
}

@keyframes portalFlowIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(.992);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes portalFlowOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateX(-22px) scale(.988);
        filter: blur(5px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html.portal-flow-page .main,
    html.portal-flow-page.portal-flow-leaving .main {
        animation: none;
        transform: none;
        filter: none;
    }
}

/* Placeholder de la banda del portal mientras carga service-portal-app.
   El alto tiene que seguir al del .topband (padding + iconrow + searchzone). */
service-portal-app:not(:defined) {
    display: block;
    min-height: 240px;
    background: linear-gradient(90deg, #24113f 0%, #56206f 42%, #86106f 72%, #bd007f 100%);
}

/* Salida del login (Default.aspx) hacia Menu.aspx.
   Se va la tarjeta y no el .main entero: el overlay "Ingresando..." vive
   arriba de todo y si desvaneciéramos el contenedor se iría con él.
   Reusa portalFlowOut para que la salida se sienta igual que la del portal.
   El .lx-stage ya trae lxLoginEntra, así que esta regla se la pisa al salir. */
html.login-page.portal-flow-leaving .lx-stage {
    animation: portalFlowOut .3s cubic-bezier(.55, .06, .68, .19) both;
}

/* El overlay lo muestra el login con display:none -> flex; el fade evita que
   aparezca de golpe justo cuando la tarjeta se está yendo. */
.lx-overlay {
    animation: lxOverlayEntra .26s ease both;
}

@keyframes lxOverlayEntra {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    html.login-page.portal-flow-leaving .lx-stage,
    .lx-overlay {
        animation: none;
    }
}

/* ---- Modales legacy (AjaxControlToolkit ModalPopupExtender) ----------
   Se conserva el markup y el comportamiento WebForms; esta capa unifica su
   apariencia en todas las masters modernas que usan .app-shell. */
.app-shell .modalBackground {
    background: rgba(20, 12, 36, .64) !important;
    filter: none !important;
    opacity: 1 !important;
    backdrop-filter: blur(3px);
}

.app-shell .modalPopup {
    box-sizing: border-box;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 32px) !important;
    overflow: auto;
    padding: 22px !important;
    color: #fff !important;
    background:
        radial-gradient(520px 220px at 100% 0, rgba(156, 2, 124, .32), transparent 68%),
        linear-gradient(145deg, #2d184d 0%, #422268 58%, #5d1c65 100%) !important;
    border: 1px solid rgba(255, 255, 255, .28) !important;
    border-radius: 16px !important;
    box-shadow: 0 28px 70px -24px rgba(17, 8, 31, .8),
                0 12px 28px -18px rgba(0, 0, 0, .72) !important;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.app-shell .modalPopup h1,
.app-shell .modalPopup h2,
.app-shell .modalPopup h3 {
    margin: 0 !important;
    padding: 0 0 12px !important;
    color: #fff !important;
    font-size: 1.3rem !important;
    line-height: 1.3 !important;
    text-align: left !important;
}

.app-shell .modalPopup > div:first-child {
    margin: -4px 0 14px !important;
    border-bottom: 1px solid rgba(255, 255, 255, .24) !important;
}

/* La barra de titulo trae fondo blanco inline (el DragPanel la usa de manija) y
   .TituloPanel (Styles/Site.css) fuerza fondo blanco + texto azul. Sobre el
   degrade violeta del modal eso deja un rectangulo blanco pegado arriba con el
   titulo en azul, que no combina con nada. Mismo patron que .app-exenciones en
   master-modern.css. */
.app-shell .modalPopup > div[style*="background-color:white"] {
    background: transparent !important;
}

.app-shell .modalPopup .TituloPanel {
    background: transparent !important;
    color: #fff !important;
}

.app-shell .modalPopup input[type="file"] {
    color: #fff;
    background: transparent;
}

.app-shell .modalPopup input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
}

.app-shell .modalPopup input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, .22);
}

.app-shell .modalPopup table {
    width: 100% !important;
    margin-top: 12px !important;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.app-shell .modalPopup table td {
    padding: 3px 6px !important;
    color: #fff !important;
    vertical-align: middle;
}

.app-shell .modalPopup table td:first-child {
    width: 126px;
    padding-left: 0 !important;
    color: rgba(255, 255, 255, .82) !important;
    font-weight: 600;
}

.app-shell .modalPopup input[type="text"],
.app-shell .modalPopup input[type="date"],
.app-shell .modalPopup input[type="number"],
.app-shell .modalPopup input[type="email"],
.app-shell .modalPopup select,
.app-shell .modalPopup textarea {
    box-sizing: border-box;
    min-height: 39px;
    background: rgba(255, 255, 255, .98) !important;
}

.app-shell .modalPopup input[type="submit"],
.app-shell .modalPopup input[type="button"],
.app-shell .modalPopup button {
    min-width: 96px;
    margin-left: 6px;
    border: 1px solid rgba(255, 255, 255, .28) !important;
    box-shadow: 0 10px 22px -13px rgba(0, 0, 0, .8) !important;
}

@media (max-width: 560px) {
    .app-shell .modalPopup { padding: 18px 16px !important; }
    .app-shell .modalPopup table,
    .app-shell .modalPopup tbody,
    .app-shell .modalPopup tr,
    .app-shell .modalPopup td { display: block; width: 100% !important; }
    .app-shell .modalPopup table td { padding: 3px 0 !important; }
    .app-shell .modalPopup table td:first-child { padding-top: 8px !important; }
    .app-shell .modalPopup input[type="submit"],
    .app-shell .modalPopup input[type="button"],
    .app-shell .modalPopup button { margin: 8px 6px 0 0; }
}

/* =====================================================================
   Páginas de error (Error.Master) — card centrada coherente con el portal
   ===================================================================== */
.err-wrap { display: flex; justify-content: center; padding: 64px 20px; }
.err-card {
    max-width: 580px; width: 100%;
    background: #fff; border: 1px solid var(--ater-border); border-radius: 18px;
    box-shadow: var(--ater-shadow); padding: 46px 42px; text-align: center;
    position: relative; overflow: hidden;
}
.err-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--ater-grad); }
.err-icon {
    width: 74px; height: 74px; margin: 0 auto 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(156, 2, 124, .12), rgba(66, 34, 104, .12));
    color: var(--ater-magenta);
}
.err-card span:first-of-type {
    display: block; font-size: 1.4rem !important; font-weight: 800 !important;
    color: #1f2937 !important; margin-bottom: 6px; line-height: 1.3;
}
.err-card span { color: var(--ater-muted); font-size: 1rem; line-height: 1.6; }
.err-card input[type="submit"],
.err-card .err-btn {
    display: inline-block; margin-top: 10px;
    background: var(--ater-grad) !important; color: #fff !important; border: none !important;
    padding: 12px 28px !important; border-radius: 10px !important; font-weight: 700 !important;
    text-decoration: none !important; cursor: pointer;
    box-shadow: 0 10px 22px -10px var(--ater-magenta);
    transition: transform .15s ease, filter .2s ease;
}
.err-card input[type="submit"]:hover,
.err-card .err-btn:hover { transform: translateY(-1px); filter: brightness(1.07); }

/* "Ver más" con el detalle técnico (plegable) */
.err-detail { margin-top: 22px; text-align: left; }
.err-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: pointer;
    color: var(--ater-magenta); font: inherit; font-weight: 700; font-size: .85rem;
    padding: 6px 0;
}
.err-toggle::before { content: "▸"; font-size: .8rem; transition: transform .15s ease; }
.err-toggle.open::before { transform: rotate(90deg); }
.err-toggle:hover { color: var(--ater-violeta); }
.err-detail-body {
    display: none;
    margin: 8px 0 0;
    background: #1b1030; color: #e7e1f0;
    border-radius: 10px; padding: 14px 16px;
    font-family: Consolas, "Courier New", monospace; font-size: .76rem; line-height: 1.5;
    white-space: pre-wrap; word-break: break-word;
    max-height: 320px; overflow: auto;
}

/* =====================================================================
   Landing de opciones en cards (Administración, etc.) — light DOM
   ===================================================================== */
.opciones-head { margin: 2px 0 22px; }
.opciones-head h2 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 800; color: var(--ater-violeta); }
.opciones-head p { margin: 0; color: var(--ater-muted); font-size: .95rem; }
.opciones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.opcion-card {
    --cat-color: #9c027c;
    position: relative; overflow: hidden; min-height: 118px;
    display: grid; grid-template-columns: 44px 1fr 24px; align-items: start; gap: 14px;
    text-decoration: none; color: inherit;
    background: linear-gradient(90deg, #f8fbfd 0%, #fff 74%);
    border: 1px solid color-mix(in srgb, var(--cat-color) 18%, #e6eaef 82%);
    border-radius: 12px; padding: 18px 40px 18px 18px;
    box-shadow: 0 22px 34px -30px rgba(31, 41, 55, .7);
    transition: transform .14s ease, box-shadow .2s ease, border-color .2s ease;
}
.opcion-card:hover {
    transform: translateY(-4px); border-color: var(--cat-color);
    box-shadow: 0 28px 44px -30px color-mix(in srgb, var(--cat-color) 48%, #172033 52%);
}
.opcion-ico {
    width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--cat-color) 14%, white 86%); color: var(--cat-color);
}
.opcion-ico svg { width: 23px; height: 23px; }
.opcion-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.opcion-title { font-weight: 800; font-size: .98rem; color: #172033; text-transform: uppercase; line-height: 1.18; }
.opcion-desc { color: #7a8493; font-size: .79rem; line-height: 1.38; }
.opcion-band {
    position: absolute; top: 0; right: 0; bottom: 0; width: 28px;
    background: var(--cat-color); color: rgba(255, 255, 255, .95);
    display: flex; justify-content: center;
}
.opcion-band span { margin-top: 13px; font-weight: 800; font-size: .85rem; }
.opcion-arrow {
    align-self: end; justify-self: end; margin-right: -16px; margin-bottom: -2px;
    color: color-mix(in srgb, var(--cat-color) 72%, #d1d5db 28%); font-size: 1.5rem; line-height: 1;
    transition: transform .15s ease;
}
.opcion-card:hover .opcion-arrow { transform: translateX(3px); }

/* Compatibilidad: el viejo .borde-botones deja de ser una caja fea */
.borde-botones {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

/* =====================================================================
   LOGIN (Default.aspx) — overlay full-screen con fondo ATER elegante
   Se usa position:fixed para no depender de toggles en la master.
   ===================================================================== */
html.login-page .header,
html.login-page .footer { display: none !important; }

.lx {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 20px;
    isolation: isolate;
    /* Base tranquila: los glows bajaron de .34/.18 a .20/.12 para que la tarjeta
       sea lo que resalta y no el fondo. */
    background:
        radial-gradient(900px 580px at 84% 8%, rgba(156, 2, 124, .20), transparent 64%),
        radial-gradient(800px 540px at 7% 98%, rgba(0, 169, 183, .12), transparent 60%),
        linear-gradient(135deg, #2a1748 0%, #1d1136 54%, #150b26 100%);
}

/* ---- Particulas del fondo -------------------------------------------------
   Reemplazan a la "ola" en perspectiva y a las estelas diagonales que habia
   antes. Aquello sumaba once capas de gradiente con mask-image, blur,
   drop-shadow, mix-blend-mode y animaciones de background-position: cada frame
   repintaba el viewport entero.

   Ahora son dos capas de puntos y lo unico que se anima es transform, que el
   compositor resuelve en la GPU sin repintar. Los puntos se dibujan con
   radial-gradient en mosaico (background-size), asi que basta desplazar la capa
   exactamente la altura de un mosaico para que el ciclo cierre sin salto.

   Dos capas a distinta velocidad y tamano dan sensacion de profundidad: la de
   atras es mas chica, mas tenue y mas lenta. ---------------------------- */
.lx::before,
.lx::after {
    content: "";
    /* fixed y no absolute: .lx es el contenedor con scroll, y una capa absoluta
       que sobresale 420px por abajo le agrega alto scrolleable (barra fantasma).
       Fija tampoco se recorta -- .lx no tiene transform, asi que no es bloque
       contenedor -- y el campo de particulas queda quieto al scrollear. */
    position: fixed;
    left: 0;
    right: 0;
    top: -420px;
    bottom: -420px;
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}

/* Capa lejana: puntos chicos y tenues. */
.lx::before {
    background-image:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, .38) 0 1px, transparent 1.6px),
        radial-gradient(circle at 63% 28%, rgba(0, 169, 183, .34) 0 1.1px, transparent 1.7px),
        radial-gradient(circle at 37% 61%, rgba(255, 255, 255, .26) 0 .9px, transparent 1.5px),
        radial-gradient(circle at 84% 76%, rgba(196, 24, 151, .30) 0 1px, transparent 1.6px),
        radial-gradient(circle at 8% 89%, rgba(255, 255, 255, .22) 0 .8px, transparent 1.4px);
    background-size: 240px 240px;
    opacity: .7;
    animation: lxParticlesFar 44s linear infinite;
}

/* Capa cercana: puntos un poco mas grandes, mas brillantes y mas rapidos. */
.lx::after {
    background-image:
        radial-gradient(circle at 72% 18%, rgba(255, 255, 255, .5) 0 1.4px, transparent 2.1px),
        radial-gradient(circle at 26% 44%, rgba(0, 169, 183, .42) 0 1.3px, transparent 2px),
        radial-gradient(circle at 55% 83%, rgba(255, 255, 255, .34) 0 1.2px, transparent 1.9px);
    background-size: 370px 370px;
    opacity: .55;
    animation: lxParticlesNear 31s linear infinite;
}

/* El desplazamiento es exactamente un mosaico, por eso el loop es invisible. */
@keyframes lxParticlesFar {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(0, -240px, 0); }
}

@keyframes lxParticlesNear {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(0, -370px, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .lx::before,
    .lx::after {
        animation: none;
    }
    .lx-stage {
        animation: none;
    }
}

.lx-stage,
.lx-center,
.lx-footer { position: relative; z-index: 1; width: 100%; }

.lx-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lx-stage {
    width: 100%;
    max-width: 1060px;
    min-height: 600px;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 44px 110px -48px rgba(0, 0, 0, .92),
        -34px 0 90px -72px rgba(0, 169, 183, .76),
        34px 0 96px -72px rgba(196, 24, 151, .82);
    animation: lxLoginEntra .62s cubic-bezier(.2, .84, .26, 1) both;
}

/* ---- panel izquierdo: imagen + bienvenida ---- */
.lx-welcome {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 46px 44px;
    color: #fff;
    background:
        linear-gradient(160deg, rgba(66, 34, 104, .5) 0%, rgba(22, 11, 40, .55) 52%, rgba(12, 7, 24, .85) 100%),
        url("/images/login-ocean-ater.png") center / cover no-repeat;
}
.lx-brandtop {
    position: absolute;
    top: 46px;
    left: 44px;
    display: flex;
    align-items: center;
    z-index: 2;
}
.lx-brandtop .lx-ater-toplogo {
    width: 158px !important;
    max-width: 158px !important;
    height: auto !important;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .34));
}

.lx-welcome-text {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 150px;
}

.lx-welcome-text h1 {
    margin: 0;
    color: #fff;
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.05;
}
.lx-line { width: 54px; height: 3px; background: var(--ater-magenta); border-radius: 2px; margin: 20px 0; }
.lx-welcome-text p {
    max-width: 360px;
    margin: 0;
    color: rgba(255, 255, 255, .82);
    font-size: .98rem;
    line-height: 1.6;
}

/* ---- panel derecho: formulario ---- */
.lx-card {
    position: relative;
    overflow: hidden;
    background: #1b1030;
    padding: 56px 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, .05);
    perspective: 1200px;
}
.lx-flip {
    position: relative;
    width: 100%;
    min-height: 470px;
    transform-style: preserve-3d;
    transition: transform .55s cubic-bezier(.22, .9, .32, 1);
}
.lx-card.apps-open .lx-flip { transform: rotateY(180deg); }
.lx-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.lx-face-apps {
    transform: rotateY(180deg);
    justify-content: flex-start;
    padding-top: 8px;
}
/* Toggle a los accesos guardados.

   Antes era una pastilla con brillo animado y un chevron "<" junto a la palabra
   "Apps": el chevron se leia como "atras", el texto no decia a donde llevaba y en
   los dos estados se veia igual. Ahora es una pastilla de vidrio sobria (el CTA
   "Siguiente" es el unico que grita) con el icono de grilla y un contador; al
   abrirse cambia a flecha + "Volver al ingreso". */
.lx-apps-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .9);
    padding: 7px 14px 7px 7px;
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}

/* Placa del icono: mismo violeta que .lx-app-ico, para que se lea como "esto
   te lleva a esas tarjetas". */
.lx-apps-toggle-ico {
    position: relative;
    display: inline-flex;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(167, 139, 250, .18);
    color: #c4b5fd;
    transition: background .16s ease, color .16s ease;
}

.lx-apps-toggle-ico svg {
    width: 15px;
    height: 15px;
    transition: opacity .2s ease, transform .3s ease;
}

/* Las dos leyendas y los dos iconos viven en el DOM; el estado decide cual se ve. */
.lx-ico-back,
.lx-txt-volver { display: none; }

.lx-card.apps-open .lx-ico-grid,
.lx-card.apps-open .lx-txt-abrir { display: none; }

.lx-card.apps-open .lx-ico-back,
.lx-card.apps-open .lx-txt-volver { display: inline; }

.lx-apps-count {
    display: inline-flex;
    min-width: 19px;
    height: 19px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(0, 169, 183, .22);
    box-shadow: inset 0 0 0 1px rgba(0, 169, 183, .5);
    color: #7fe3ec;
    font-size: .7rem;
    font-weight: 800;
}

.lx-apps-count[hidden] { display: none; }

/* Al volver, el contador sobra: ya estas mirando la lista. */
.lx-card.apps-open .lx-apps-count { display: none; }

.lx-apps-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 169, 183, .55);
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.lx-apps-toggle:hover .lx-apps-toggle-ico {
    background: rgba(167, 139, 250, .28);
    color: #ddd6fe;
}

.lx-apps-toggle:active { transform: translateY(0); }

.lx-apps-toggle:focus-visible {
    outline: 2px solid #7fe3ec;
    outline-offset: 3px;
}

/* Sin accesos guardados todavia: sigue estando (es como se descubre la funcion)
   pero apagado, para no prometer una lista vacia. */
.lx-apps-toggle.sin-apps { opacity: .55; }
.lx-apps-toggle.sin-apps:hover { opacity: 1; }

.lx-card.apps-open .lx-apps-toggle {
    border-color: rgba(255, 255, 255, .26);
    background: rgba(255, 255, 255, .1);
}

.lx-card.apps-open .lx-apps-toggle-ico {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

/* Espacio para que el titulo de la cara de apps no choque con el boton. */
.lx-apps-head { margin: 8px 0 18px; padding-right: 190px; }
.lx-apps-head span {
    color: rgba(255, 255, 255, .48);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .9px;
}
.lx-apps-head h2 {
    margin: 7px 0 0;
    color: #fff;
    font-size: 1.72rem;
    font-weight: 800;
}
.lx-apps-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow-y: auto;
    /* El hover levanta la tarjeta 2px y esta caja recorta por el overflow: sin
       colchon arriba, el borde superior de la primera fila quedaba cortado. El
       margen negativo devuelve la grilla a su lugar para no correr el layout.
       El padding derecho (4px) es la luz para la barra de scroll. */
    padding: 4px 4px 4px 0;
    margin-top: -4px;
    max-height: 386px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
}
.lx-app-card {
    min-width: 0;
    min-height: 112px;
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(255, 255, 255, .055);
    color: #fff;
    padding: 14px 30px 13px 12px;
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.lx-app-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(180deg, #7c3aed, #00a9b7);
}
.lx-app-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 169, 183, .62);
    background: rgba(255, 255, 255, .08);
}
.lx-app-ico {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    background: rgba(167, 139, 250, .15);
}
.lx-app-ico svg { width: 19px; height: 19px; }
.lx-app-copy {
    min-width: 0;
    display: grid;
    gap: 7px;
}
.lx-app-copy strong {
    color: #fff;
    font-size: .82rem;
    line-height: 1.16;
    text-transform: uppercase;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.lx-app-copy small {
    color: rgba(255, 255, 255, .56);
    font-size: .72rem;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.lx-app-x {
    position: absolute;
    top: 8px;
    right: 13px;
    z-index: 1;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .58);
    font-size: .6rem;
}
.lx-app-x:hover { background: var(--ater-magenta); color: #fff; }
.lx-apps-empty {
    grid-column: 1 / -1;
    border: 1px dashed rgba(255, 255, 255, .18);
    border-radius: 10px;
    padding: 28px 18px;
    color: rgba(255, 255, 255, .52);
    text-align: center;
    font-size: .9rem;
}
.lx-title { margin: 0; font-size: 1.95rem; font-weight: 800; color: #fff; }
/* 30px y no 18px: antes habia un bloque de entorno entre el subtitulo y el primer
   campo. Ese bloque ya no esta (el entorno se fue al margen superior derecho de la
   pantalla), y sin este aire el formulario queda pegado al encabezado. */
.lx-subtitle { margin: 6px 0 30px; color: rgba(255, 255, 255, .5); font-size: .9rem; }

/* ---- Indicador de entorno -------------------------------------------------
   Pastilla suelta arriba a la derecha de la pantalla. Es hija de .lx y no de la
   tarjeta: .lx-flip se rota con transform al abrir los accesos directos, y ahi
   adentro la pastilla giraria con la tarjeta.

   position: fixed y no absolute -- .lx tiene overflow-y: auto, asi que absolute
   se iria de pantalla al scrollear. .lx no tiene transform, o sea que no es
   bloque contenedor y fixed resuelve contra el viewport.

   El color sale de .lx-env-ctx-* en .lx: como las custom properties heredan, el
   mismo token pinta la pastilla, su luz y la linea de acento de .lx-card.  --- */
.lx-env {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    max-width: calc(100vw - 48px);
    gap: 9px;
    padding: 7px 15px 7px 12px;
    border: 1px solid var(--lx-env-line, rgba(255, 255, 255, .18));
    border-radius: 999px;
    background: var(--lx-env-bg, rgba(255, 255, 255, .06));
    color: var(--lx-env, rgba(255, 255, 255, .72));
    box-sizing: border-box;
    cursor: default;
    /* Vidrio esmerilado: la pastilla flota sobre el fondo con particulas, y sin
       esto los puntos que pasan por detras la ensucian. */
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .9);
}

.lx-env-dot {
    position: relative;
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    /* La "luz" sale de currentColor, que a su vez viene de --lx-env: cambiando
       el token del entorno cambian punto, halo y linea de acento a la vez. */
    box-shadow: 0 0 10px currentColor, 0 0 22px currentColor;
}

/* Latido suave: llama la atencion sin animar toda la pastilla. */
.lx-env-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: .55;
    animation: lx-env-pulse 2.6s ease-out infinite;
}

@keyframes lx-env-pulse {
    0%   { transform: scale(.65); opacity: .6; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

.lx-env-name {
    min-width: 0;
    overflow: hidden;
    color: currentColor;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Un token por entorno: lo usan la pastilla, su luz y la linea de acento de la
   tarjeta. Test va en verde: es el entorno del dia a dia y el ambar se leia como
   advertencia. El rojo queda reservado para produccion. */
.lx-env-ctx-desa { --lx-env: #7fdcff; --lx-env-line: rgba(112, 214, 255, .38); --lx-env-bg: rgba(21, 91, 128, .30); }
.lx-env-ctx-test { --lx-env: #5ee9a4; --lx-env-line: rgba(94, 233, 164, .42); --lx-env-bg: rgba(15, 88, 60, .32); }
.lx-env-ctx-prod { --lx-env: #ff8ba0; --lx-env-line: rgba(255, 122, 144, .42); --lx-env-bg: rgba(128, 33, 52, .30); }
.lx-env-ctx-desconocido { --lx-env: rgba(255, 255, 255, .7); --lx-env-line: rgba(255, 255, 255, .18); --lx-env-bg: rgba(255, 255, 255, .06); }

/* Linea de acento en el borde superior de la tarjeta: identifica el entorno de
   un vistazo, sin robarle protagonismo al formulario. */
.lx-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 4;
    /* Fallback plano primero: si el navegador no entiende color-mix descarta la
       segunda regla y la linea igual se ve. */
    background: var(--lx-env, rgba(255, 255, 255, .5));
    background: linear-gradient(90deg,
        var(--lx-env, rgba(255, 255, 255, .5)),
        color-mix(in srgb, var(--lx-env, #fff) 35%, transparent) 55%,
        transparent);
}

@media (prefers-reduced-motion: reduce) {
    .lx-env-dot::after { animation: none; }
}

.lx-field { margin-bottom: 28px; }
.lx-field label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, .55);
    margin-bottom: 6px;
}
.lx-input-wrap { position: relative; }
.lx-input-wrap::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ater-magenta), #00a9b7);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .22s ease;
    pointer-events: none;
}
.lx-input-wrap:focus-within::after { transform: scaleX(1); }
.lx-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 34px 12px 2px;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: #fff;
    font-size: 1.05rem;
    transition: border-color .2s ease, background .2s ease;
}
.lx-input::placeholder { color: rgba(255, 255, 255, .32); }
.lx-input:focus {
    outline: none;
    border-bottom-color: transparent;
    background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, .035) 100%);
}
.lx-input-wrap svg {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; color: rgba(255, 255, 255, .4); pointer-events: none;
    transition: color .2s ease, filter .2s ease;
}
.lx-input-wrap:focus-within svg { color: #fff; filter: drop-shadow(0 0 8px rgba(156, 2, 124, .62)); }

.lx-btn {
    width: 100%;
    margin-top: 14px;
    border: none;
    cursor: pointer;
    padding: 15px 18px;
    border-radius: 10px;
    background:
        linear-gradient(115deg, transparent 0%, transparent 36%, rgba(255, 255, 255, .26) 45%, transparent 55%, transparent 100%),
        var(--ater-grad);
    background-size: 250% 100%, 100% 100%;
    background-position: 135% 0, 0 0;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: 0 16px 34px -14px var(--ater-magenta), 0 0 0 1px rgba(255, 255, 255, .08) inset;
    transition: transform .16s ease, filter .2s ease, box-shadow .2s ease, background-position .52s ease;
}
.lx-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    background-position: -65% 0, 0 0;
    box-shadow: 0 22px 42px -15px var(--ater-magenta), 0 0 0 1px rgba(255, 255, 255, .18) inset;
}
.lx-btn:active { transform: translateY(0); }

.lx-note { margin-top: 22px; text-align: center; color: rgba(255, 255, 255, .45); font-size: .82rem; }

/* CUITs recientes cacheados (login) */
.lx-recents {
    width: 100%;
    margin-top: 22px; padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.lx-recents:empty { display: none; }
.lx-recents-lbl {
    display: block; margin-bottom: 8px;
    color: rgba(255, 255, 255, .5); font-size: .72rem;
    text-transform: uppercase; letter-spacing: .8px;
}
.lx-recents-list {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    max-height: 128px; overflow-y: auto;
    padding-right: 4px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
}
.lx-recents-list::-webkit-scrollbar { width: 8px; }
.lx-recents-list::-webkit-scrollbar-track { background: transparent; }
.lx-recents-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .2); border-radius: 8px; }
.lx-recents-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .32); }
.lx-chip {
    width: 100%;
    min-width: 0;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22px;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16);
    color: #fff; border-radius: 10px; padding: 0 9px 0 14px;
    font-size: .9rem; font-family: inherit; text-align: left;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.lx-chip:hover { background: rgba(156, 2, 124, .22); border-color: var(--ater-magenta); transform: translateY(-1px); }
.lx-chip-text {
    min-width: 0;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.lx-chip-x {
    width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .65);
    font-size: .68rem; line-height: 1;
}
.lx-chip-x:hover { background: var(--ater-magenta); color: #fff; }

/* Overlay de carga al ingresar (login) */
.lx-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(18, 10, 38, .74);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    color: #fff; cursor: progress;
}
.lx-spinner {
    width: 56px; height: 56px; border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, .22); border-top-color: var(--ater-magenta);
    animation: lxgirar .8s linear infinite;
}
@keyframes lxgirar { to { transform: rotate(360deg); } }
.lx-overlay-text { font-weight: 600; font-size: 1.05rem; letter-spacing: .3px; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }

@keyframes lxLoginEntra {
    from {
        opacity: 0;
        transform: translateY(22px) scale(.985);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* ---- responsive: apilar en pantallas chicas ---- */
@media (max-width: 820px) {
    .lx-stage { grid-template-columns: 1fr; max-width: 460px; min-height: 0; }
    .lx-welcome { min-height: 220px; padding: 28px 30px; }
    .lx-welcome-text { padding-top: 118px; }
    .lx-welcome-text h1 { font-size: 2.2rem; }
    .lx-card { padding: 40px 34px; }
    .lx-flip { min-height: 500px; }
    .lx-apps-grid { grid-template-columns: 1fr; max-height: 408px; }

    /* La pantalla achica sus margenes (.lx pasa a 18px 12px): la pastilla los
       acompana para no quedar despegada del borde. */
    .lx-env {
        top: 12px;
        right: 14px;
        padding: 6px 12px 6px 10px;
        gap: 8px;
    }
    .lx-env-name { font-size: .72rem; }
}

.lx-footer {
    background: rgba(0, 0, 0, .28);
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: 22px 28px;
}
.lx-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
    color: rgba(255, 255, 255, .8);
}
.lx-footer-brand {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #fff;
}
.lx-footer-text { font-size: .85rem; line-height: 1.5; }
.lx-footer-text span { color: rgba(255, 255, 255, .55); }

/* =====================================================================
   LOGIN EN MOVIL: una pantalla de ingreso, no dos paneles apilados.
   En escritorio el login es un escenario partido —foto y bienvenida a la
   izquierda, formulario a la derecha— y eso funciona. Apilado en un telefono
   se convierte en 220px de foto y texto de bienvenida antes de llegar al unico
   campo que hay que completar. Una app de ingreso hace lo contrario: marca
   arriba, campo enseguida, boton grande.
   ===================================================================== */
@media (max-width: 560px) {
    .lx { padding: 0; }

    /* Marca + formulario centrados como un bloque en el alto que queda libre
       arriba del footer.

       El centrado va por margin-block: auto en .lx-stage y no por
       align-items: center en el contenedor, que seria lo obvio. Con
       align-items, cuando el contenido es mas alto que el espacio disponible
       —11 CUITs guardados en una pantalla corta— el sobrante se reparte a los
       dos lados y la parte de arriba se va fuera del area scrolleable: queda
       cortada y no hay forma de llegar a ella. Los margenes auto, en cambio,
       colapsan a 0 cuando no sobra espacio, asi que el contenido nunca se
       vuelve inalcanzable.

       align-items: flex-start es para que la fila de la marca no se estire:
       estirada, el logo queda arriba y todo el hueco le cae debajo. */
    .lx-center {
        flex: 1 1 auto;
        align-items: flex-start;
    }
    .lx-stage { margin-block: auto; }

    /* El escenario deja de ser una caja: la pantalla ya es la caja. Sin radio,
       sin sombra y sin fondo propio, el degradado y las particulas de .lx pasan
       a ser el fondo del login en vez de quedar como un marco alrededor. */
    .lx-stage {
        grid-template-columns: 1fr;
        gap: 0;
        min-height: auto;
        max-width: none;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        /* Las filas se miden por su contenido. Sin esto la grilla las estira
           para llenar el alto y la marca se lleva el sobrante. */
        align-content: start;
    }

    /* Del panel de bienvenida sobrevive la marca. La foto y el parrafo se van:
       la atmosfera ya la pone el fondo, y el parrafo explica lo que el usuario
       esta a punto de hacer de todos modos. */
    .lx-welcome {
        min-height: 0;
        /* justify-content: space-between viene de escritorio, donde el panel es
           alto y separa logo de bienvenida. Acá sólo queda el logo y hay que
           anularlo o se reparte el aire que sobre. */
        justify-content: flex-start;
        padding: 22px 20px 2px;
        background: none;
        align-items: center;
    }
    .lx-welcome-text { display: none; }
    .lx-brandtop {
        position: static;
        justify-content: center;
    }
    .lx-brandtop .lx-ater-toplogo {
        width: 136px !important;
        max-width: 136px !important;
    }

    /* El formulario flota sobre el fondo como un panel de vidrio, en lugar de
       ser la mitad derecha de una tarjeta partida al medio. */
    .lx-card {
        margin: 16px 14px 0;
        padding: 26px 20px 22px;
        border-radius: 22px;
        background: rgba(255, 255, 255, .055);
        border: 1px solid rgba(255, 255, 255, .1);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .9);
    }

    /* Una sola declaracion de que es esta pantalla, centrada y con candado.
       En una lista centrar el titulo estorba —el ojo tiene que volver al margen
       para escanear las filas—, pero un login tiene un unico foco y ahi centrar
       es lo natural: es lo que hacen ARCA, los bancos y casi cualquier app.
       El candado va por mask y no como <img>: no toca el markup y hereda el
       color del titulo. */
    .lx-title {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        font-size: 1.5rem;
    }
    .lx-title::before {
        content: "";
        width: 21px;
        height: 21px;
        flex: 0 0 auto;
        background: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
    }
    .lx-subtitle { text-align: center; margin-bottom: 24px; }

    .lx-field { margin-bottom: 20px; }

    /* "Ingrese un CUIT/CUIL para continuar" repite lo que ya dice el placeholder
       y lo que el boton deja obvio. Ocupaba un renglon entre el CTA y los
       accesos guardados. */
    .lx-note { display: none; }

    /* Separador antes de lo secundario, como la linea que ARCA pone entre
       "Ingresar" y "Obtene tu Clave Fiscal": marca donde termina la accion
       principal y empieza el resto. */
    .lx-recents {
        margin-top: 22px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 255, 255, .1);
    }

    /* Las dos caras eran absolutas (inset: 0), asi que el alto lo tenia que
       reservar el contenedor con un numero fijo. Con 11 CUITs guardados el
       formulario pasaba ese numero y los ultimos chips quedaban cortados contra
       el borde de la tarjeta.

       Ahora la cara del formulario vuelve al flujo y es ella la que da el alto:
       crece con los accesos guardados y se encoge cuando no hay ninguno. La cara
       de accesos sigue absoluta y superpuesta, y el min-height queda solo como
       piso para el caso inverso —formulario corto, grilla de accesos larga—. */
    .lx-flip { min-height: 340px; }
    .lx-face { justify-content: flex-start; }
    .lx-face-login { position: relative; }
    .lx-apps-grid { max-height: 272px; }

    /* Multiplo exacto del alto del chip (44px + 9px de gap): asi el corte del
       scroll cae entre dos chips y no por la mitad de uno. */
    .lx-recents-list { max-height: 150px; }

    /* Footer centrado y apilado, como el de ARCA: la marca arriba y la bajada
       abajo. En fila, a 360px, "ATER" quedaba pegado a un bloque de texto de
       dos renglones y se leia como una sola linea apretada.

       margin-top: auto lo manda al fondo de la pantalla. Al sacarle el flex: 1
       a .lx-center —para que el formulario dejara de centrarse en el alto— el
       footer quedaba pegado abajo del contenido, flotando a media pantalla con
       el fondo vacio debajo. */
    .lx-footer {
        margin-top: auto;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    }
    .lx-footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 6px;
    }
    .lx-footer-brand { font-size: 1.3rem; letter-spacing: 3px; }
    .lx-footer-text { font-size: .74rem; }

    /* En pantalla angosta el boton queda solo con el icono (y el contador): el
       texto no entra sin comerse el titulo de la tarjeta. El title/aria-expanded
       siguen explicando que hace. */
    .lx-apps-toggle {
        top: 14px;
        right: 14px;
        gap: 6px;
        padding: 7px 9px 7px 7px;
        /* Queda solo con el icono, asi que sin esto cae a ~40px: por debajo del
           minimo tactil. */
        min-height: 44px;
    }

    .lx-apps-toggle-txt { display: none; }
    .lx-apps-head { padding-right: 66px; }

    /* Misma textura tactil que el resto del portal: sin el recuadro gris del
       navegador y con acuse de recibo propio. */
    .lx-btn,
    .lx-apps-toggle,
    .lx-chip,
    .lx-app-card {
        -webkit-tap-highlight-color: transparent;
    }
    .lx-btn:active,
    .lx-app-card:active { transform: scale(.98); transition: transform .08s ease; }

    /* La "x" de quitar un CUIT guardado convive con el chip: si queda chica se
       toca el chip por error y se ingresa con un CUIT que se queria borrar. */
    .lx-chip { min-height: 44px; }
    .lx-chip-x { min-width: 30px; min-height: 30px; }
}
