/* ============================================================================
                 XY INC
    Autor:       Marco Antonio Acuña Rosas
    Nombre:      xy-os.css
    Creación:    2026.04.15
    Ult Mod:     2026.04.15
    Descripción: Estilos del Web OS XY — revisión limpia y minimalista.
                 Wallpaper, top bar, dock izquierdo, control strip derecho,
                 ventanas flotantes (drag / min / max / close), menú Inicio,
                 login y fallback mobile. Restraint Stripe/Linear: menos
                 gradientes, menos glow, más tipografía y espaciado.
   ============================================================================ */

:root {
    /* Wallpapers estilo Visual Studio 2026: grises neutros, sin tintes.
       Variante 1 = default (escala media), 2 = más oscura, 3 = contrastada. */
    --xy-wp-1: linear-gradient(160deg, #1f1f1f 0%, #252525 55%, #2b2b2b 100%);
    --xy-wp-2: linear-gradient(160deg, #141414 0%, #1c1c1c 55%, #232323 100%);
    --xy-wp-3: linear-gradient(160deg, #181818 0%, #262626 55%, #323232 100%);

    /* Wallpapers claros (tema light): grises muy claros. */
    --xy-wp-light-1: linear-gradient(160deg, #f3f4f6 0%, #eceef1 55%, #e6e8ec 100%);
    --xy-wp-light-2: linear-gradient(160deg, #fafafa 0%, #f2f3f5 55%, #eaecef 100%);
    --xy-wp-light-3: linear-gradient(160deg, #eef0f3 0%, #e4e7eb 55%, #dadee3 100%);

    --xy-topbar-h: 44px;       /* legacy — topbar eliminado del shell */
    --xy-dock-w: 72px;          /* legacy — dock lateral eliminado */
    --xy-strip-w: 48px;         /* legacy — control strip eliminado */
    --xy-strip-w-open: 280px;   /* legacy */
    --xy-taskbar-h: 52px;

    /* Superficies base estilo VS 2026 */
    --xy-bg-darkest:  #181818;
    --xy-bg-dark:     #1f1f1f;
    --xy-bg-panel:    #252526;
    --xy-bg-elevated: #2d2d30;
    --xy-text-dark:      #e1e1e1;
    --xy-text-dark-muted:#969696;
    --xy-border-dark:    #3f3f46;

    /* Light — blanco puro + grises claros */
    --xy-bg-light-0:  #ffffff;
    --xy-bg-light-1:  #f5f5f5;
    --xy-bg-light-2:  #ececec;
    --xy-text-light:      #1f1f1f;
    --xy-text-light-muted:#6b6b6b;
    --xy-border-light:    #e0e0e0;

    /* Glass — menos saturación, más gris que azul */
    --xy-glass-bg-dark:  rgba(31, 31, 31, 0.85);
    --xy-glass-bg-light: rgba(255, 255, 255, 0.88);
    --xy-glass-border:       rgba(255, 255, 255, 0.08);
    --xy-glass-border-light: rgba(0, 0, 0, 0.08);
    --xy-glass-blur: 16px;

    /* Acento VS blue + tint extra indigo para estados hover */
    --xy-primary: #2563eb;
    --xy-accent:  #3b82f6;

    --xy-radius-w: 10px;
    --xy-shadow-w:       0 8px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    --xy-shadow-w-focus: 0 14px 40px rgba(0, 0, 0, 0.50), 0 4px 10px rgba(0, 0, 0, 0.30);
}

/* ───────────────────────── BOOT SPINNER ──────────────────────────────────── */
.xy-boot {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--xy-wp-2);
    z-index: 99999;
}
.xy-boot-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,.18);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xy-spin 1s linear infinite;
}
@keyframes xy-spin { to { transform: rotate(360deg); } }

/* ───────────────────────── DESKTOP ROOT ──────────────────────────────────── */
.xy-desktop {
    position: fixed; inset: 0;
    overflow: hidden;
    color: #e5e7eb;
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.xy-desktop[data-xy-theme="light"] { color: #0f172a; }

.xy-wallpaper {
    position: absolute; inset: 0;
    background: var(--xy-wp-1);
    z-index: 0;
}
.xy-desktop[data-xy-wp="2"] .xy-wallpaper { background-image: var(--xy-wp-2); }
.xy-desktop[data-xy-wp="3"] .xy-wallpaper { background-image: var(--xy-wp-3); }

/* Tema claro: el fondo del escritorio también es claro. */
.xy-desktop[data-xy-theme="light"] .xy-wallpaper { background: var(--xy-wp-light-1); }
.xy-desktop[data-xy-theme="light"][data-xy-wp="2"] .xy-wallpaper { background-image: var(--xy-wp-light-2); }
.xy-desktop[data-xy-theme="light"][data-xy-wp="3"] .xy-wallpaper { background-image: var(--xy-wp-light-3); }
/* Viñeta clara: en tema light, sombra suave en vez de brillo blanco. */
.xy-desktop[data-xy-theme="light"] .xy-wallpaper::after {
    background: radial-gradient(circle at 25% 15%, rgba(0, 0, 0, 0.03), transparent 60%);
}

/* Highlight sutil y neutro — ligera viñeta clara arriba-izquierda, sin tinte azul. */
.xy-wallpaper::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.04), transparent 60%);
    pointer-events: none;
}


.xy-desktop-surface {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--xy-taskbar-h);
    z-index: 1;
}

/* Body sink: we don't render @Body visually */
.xy-body-sink { display: none; }

/* ───────────────────────── TOP BAR ───────────────────────────────────────── */
.xy-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--xy-topbar-h);
    display: flex; align-items: center;
    padding: 0 .75rem;
    gap: 1rem;
    background: var(--xy-glass-bg-dark);
    backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.15);
    -webkit-backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.15);
    border-bottom: 1px solid var(--xy-glass-border);
    z-index: 1000;
    color: #e5e7eb;
}
.xy-desktop[data-xy-theme="light"] .xy-topbar {
    background: var(--xy-glass-bg-light);
    border-bottom-color: var(--xy-glass-border-light);
    color: #0f172a;
}

.xy-topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.xy-topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.xy-topbar-right { display: flex; align-items: center; gap: .25rem; }

.xy-mark-link { display: inline-flex; align-items: center; }
.xy-mark { height: 24px; width: 24px; }

.xy-tenant-chip {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .25rem .625rem;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: inherit;
    font-size: .8125rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.xy-tenant-chip:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.18); }
.xy-desktop[data-xy-theme="light"] .xy-tenant-chip { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.08); }
.xy-desktop[data-xy-theme="light"] .xy-tenant-chip:hover { background: rgba(0,0,0,.08); }

.xy-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.xy-tenant-name { font-weight: 500; }
.xy-chev { font-size: .625rem; opacity: .7; }

.xy-search {
    display: flex; align-items: center; gap: .5rem;
    width: 100%; max-width: 460px;
    padding: .25rem .625rem;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    color: inherit;
}
.xy-search i { opacity: .55; font-size: .8125rem; }
.xy-search input {
    flex: 1;
    background: transparent; border: none; outline: none;
    color: inherit;
    font-size: .8125rem;
}
.xy-search input::placeholder { color: rgba(255,255,255,.4); }
.xy-desktop[data-xy-theme="light"] .xy-search { background: rgba(0,0,0,.03); border-color: rgba(0,0,0,.08); }
.xy-desktop[data-xy-theme="light"] .xy-search input::placeholder { color: rgba(0,0,0,.4); }

.xy-kbd {
    padding: 1px 6px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 4px;
    font-size: .625rem;
    font-family: 'Geist Mono', monospace;
    opacity: .7;
}
.xy-desktop[data-xy-theme="light"] .xy-kbd { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.1); }

.xy-icon-btn {
    position: relative;
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    border-radius: 8px;
    color: inherit; opacity: .8;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}
.xy-icon-btn:hover { background: rgba(255,255,255,.08); opacity: 1; }
.xy-desktop[data-xy-theme="light"] .xy-icon-btn:hover { background: rgba(0,0,0,.05); }

.xy-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 15px; height: 15px; padding: 0 4px;
    background: #dc2626;
    color: #fff;
    font-size: .625rem; font-weight: 700;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
}

.xy-clock {
    display: flex; flex-direction: column; align-items: flex-end;
    line-height: 1; padding: 0 .5rem;
    font-variant-numeric: tabular-nums;
}
.xy-clock-time { font-size: .8125rem; font-weight: 600; }
.xy-clock-date { font-size: .625rem; opacity: .6; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.xy-profile-btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .25rem .375rem .25rem .25rem;
    background: transparent; border: none;
    border-radius: 999px;
    color: inherit;
    cursor: pointer;
}
.xy-profile-btn:hover { background: rgba(255,255,255,.08); }
.xy-desktop[data-xy-theme="light"] .xy-profile-btn:hover { background: rgba(0,0,0,.05); }

.xy-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, var(--xy-primary), var(--xy-accent));
    color: #fff;
    font-size: .75rem; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
}
.xy-profile-info { display: flex; flex-direction: column; line-height: 1; text-align: left; }
.xy-profile-name { font-size: .75rem; font-weight: 600; }
.xy-profile-role { font-size: .625rem; opacity: .6; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* ───────────────────────── DOCK IZQUIERDO ────────────────────────────────── */
.xy-dock {
    position: fixed;
    top: var(--xy-topbar-h);
    left: 0; bottom: 0;
    width: var(--xy-dock-w);
    background: var(--xy-glass-bg-dark);
    backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.15);
    -webkit-backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.15);
    border-right: 1px solid var(--xy-glass-border);
    display: flex; flex-direction: column; align-items: center;
    padding: .5rem 0;
    gap: .375rem;
    z-index: 900;
}
.xy-desktop[data-xy-theme="light"] .xy-dock {
    background: var(--xy-glass-bg-light);
    border-right-color: var(--xy-glass-border-light);
}

.xy-dock-head { padding: .25rem 0 .5rem; }
.xy-dock-nav { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem; overflow-y: auto; width: 100%; padding: 0 .375rem; }
.xy-dock-nav::-webkit-scrollbar { width: 0; }
.xy-dock-foot { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding-top: .25rem; width: 100%; }
.xy-dock-sep {
    width: 36px; height: 1px;
    background: rgba(255,255,255,.1);
    margin: .25rem 0;
}
.xy-desktop[data-xy-theme="light"] .xy-dock-sep { background: rgba(0,0,0,.08); }

/* App icon — plano, limpio, sin bounce */
.xy-app-icon {
    position: relative;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: inherit;
    font-size: .95rem;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    opacity: .82;
}
.xy-app-icon:hover {
    background: rgba(255,255,255,.08);
    color: inherit;
    opacity: 1;
}
.xy-desktop[data-xy-theme="light"] .xy-app-icon { color: #0f172a; }
.xy-desktop[data-xy-theme="light"] .xy-app-icon:hover { background: rgba(0,0,0,.05); }

/* Estado activo (abierta): fino accent bar a la izquierda, sin glow */
.xy-app-icon.is-open {
    background: rgba(99,102,241,.12);
    opacity: 1;
}
.xy-app-icon.is-open::before {
    content: "";
    position: absolute;
    left: -6px; top: 12px; bottom: 12px;
    width: 2px; border-radius: 2px;
    background: var(--xy-accent);
}

/* Indicador pequeño abajo */
.xy-app-dot {
    position: absolute;
    left: 50%; bottom: 4px;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--xy-accent);
}
.xy-app-icon.is-min .xy-app-dot { background: #94a3b8; }

.xy-app-logout { color: #fda4af; }
.xy-app-logout:hover { background: rgba(220,38,38,.15); color: #fecaca; }

/* Tooltip a la derecha */
.xy-tip {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%; transform: translate(-4px, -50%);
    white-space: nowrap;
    background: rgba(15,23,42,.96);
    color: #fff;
    padding: .25rem .5rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    border: 1px solid rgba(255,255,255,.1);
    z-index: 1001;
}
.xy-app-icon:hover .xy-tip { opacity: 1; transform: translate(0, -50%); }

/* ───────────────────────── MENÚ INICIO ───────────────────────────────────── */
.xy-start-toggle {
    background: linear-gradient(135deg, rgba(37,99,235,.25), rgba(99,102,241,.25));
    opacity: 1;
}
.xy-start-toggle:hover,
.xy-start-toggle.is-open {
    background: linear-gradient(135deg, rgba(37,99,235,.4), rgba(99,102,241,.4));
}

.xy-start-backdrop {
    position: fixed; inset: 0;
    background: transparent;
    z-index: 1500;
}

.xy-start-menu {
    position: fixed;
    bottom: calc(var(--xy-taskbar-h) + 8px);
    left: 12px;
    top: auto;
    width: 380px;
    max-height: calc(100vh - var(--xy-taskbar-h) - 24px);
    background: rgba(31, 31, 31, 0.96);
    backdrop-filter: blur(20px) saturate(1.1);
    -webkit-backdrop-filter: blur(20px) saturate(1.1);
    border: 1px solid var(--xy-border-dark);
    border-radius: 12px;
    box-shadow: 0 -12px 40px rgba(0,0,0,.55);
    padding: 1rem;
    color: var(--xy-text-dark);
    z-index: 1501;
    overflow-y: auto;
    animation: xy-start-in .16s ease-out both;
}
.xy-desktop[data-xy-theme="light"] .xy-start-menu {
    background: rgba(255,255,255,.98);
    border-color: var(--xy-border-light);
    color: var(--xy-text-light);
}
@keyframes xy-start-in {
    /* Surge desde abajo (emerge sobre el taskbar) */
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.xy-start-head {
    display: flex; align-items: center; justify-content: center;
    padding: .5rem .25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: .875rem;
}
.xy-desktop[data-xy-theme="light"] .xy-start-head { border-bottom-color: rgba(0,0,0,.06); }
.xy-start-logo {
    width: auto;
    height: 38px;
    max-width: 220px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}
.xy-start-toggle-icon { width: 24px; height: 24px; display: block; }

.xy-start-section { margin-bottom: .875rem; }
.xy-start-section:last-child { margin-bottom: 0; }
.xy-start-section-title {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .55;
    margin: 0 .25rem .375rem;
    font-weight: 600;
}
.xy-start-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .25rem;
}
.xy-start-item {
    display: flex; flex-direction: column; align-items: center;
    gap: .5rem;
    padding: .75rem .25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    color: inherit;
    font-size: .75rem;
    text-align: center;
    cursor: pointer;
    transform-origin: center bottom;
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1),
                background .15s ease,
                border-color .15s ease;
}
.xy-start-item:hover {
    background: rgba(99,102,241,.1);
    border-color: rgba(99,102,241,.22);
    transform: translateY(-4px) scale(1.08);
}
.xy-start-item:active { transform: translateY(-1px) scale(1.02); }

.xy-start-item-ico {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(99,102,241,.15);
    color: #a5b4fc;
    font-size: .95rem;
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1),
                background .15s ease,
                box-shadow .2s ease;
}
.xy-start-item:hover .xy-start-item-ico {
    transform: scale(1.12);
    background: rgba(99,102,241,.28);
    box-shadow: 0 6px 18px rgba(99,102,241,.35);
}
.xy-desktop[data-xy-theme="light"] .xy-start-item-ico { background: rgba(99,102,241,.12); color: #4f46e5; }
.xy-desktop[data-xy-theme="light"] .xy-start-item:hover .xy-start-item-ico {
    background: rgba(99,102,241,.22);
    box-shadow: 0 6px 16px rgba(99,102,241,.28);
}
.xy-start-item-label { font-weight: 500; line-height: 1.2; }

/* ───────────────────────── CONTROL STRIP ─────────────────────────────────── */
.xy-strip {
    position: fixed;
    top: var(--xy-topbar-h);
    right: 0; bottom: 0;
    width: var(--xy-strip-w);
    background: var(--xy-glass-bg-dark);
    backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.15);
    -webkit-backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.15);
    border-left: 1px solid var(--xy-glass-border);
    display: flex;
    z-index: 900;
    transition: width .22s ease;
}
.xy-strip.is-open { width: var(--xy-strip-w-open); }
.xy-desktop[data-xy-theme="light"] .xy-strip {
    background: var(--xy-glass-bg-light);
    border-left-color: var(--xy-glass-border-light);
}

.xy-strip-rail {
    width: var(--xy-strip-w);
    flex-shrink: 0;
    padding: .5rem 0;
    display: flex; flex-direction: column; align-items: center;
    gap: .25rem;
    border-right: 1px solid transparent;
}
.xy-strip.is-open .xy-strip-rail { border-right-color: rgba(255,255,255,.06); }
.xy-desktop[data-xy-theme="light"] .xy-strip.is-open .xy-strip-rail { border-right-color: rgba(0,0,0,.05); }

.xy-strip-toggle,
.xy-strip-btn {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    border-radius: 8px;
    color: inherit; opacity: .8;
    cursor: pointer;
    font-size: .9rem;
    transition: background .15s ease, opacity .15s ease;
}
.xy-strip-toggle:hover,
.xy-strip-btn:hover { background: rgba(255,255,255,.08); opacity: 1; }
.xy-desktop[data-xy-theme="light"] .xy-strip-toggle:hover,
.xy-desktop[data-xy-theme="light"] .xy-strip-btn:hover { background: rgba(0,0,0,.05); }

.xy-strip-panel {
    flex: 1; min-width: 0;
    padding: 1rem;
    overflow-y: auto;
    color: inherit;
}
.xy-strip-section { margin-bottom: 1.25rem; }
.xy-strip-section h6 {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .6;
    margin: 0 0 .5rem 0;
    font-weight: 600;
}

.xy-theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .375rem; }
.xy-theme-card {
    display: flex; flex-direction: column; align-items: center;
    gap: .375rem;
    padding: .5rem .25rem;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    color: inherit;
    cursor: pointer;
    font-size: .7rem;
    transition: all .15s ease;
}
.xy-theme-card:hover { background: rgba(255,255,255,.08); }
.xy-theme-card.is-sel { border-color: var(--xy-accent); background: rgba(99,102,241,.12); }
.xy-theme-chip {
    width: 28px; height: 28px; border-radius: 6px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,.1);
}
.xy-theme-chip[data-t="light"] { background: #f8fafc; border-color: rgba(0,0,0,.1); }
.xy-theme-chip[data-t="glassy"] {
    background: linear-gradient(135deg, rgba(37,99,235,.5), rgba(99,102,241,.3));
}

.xy-wp-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .375rem; }
.xy-wp-card {
    height: 48px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.08);
    cursor: pointer;
    color: #fff; font-weight: 600; font-size: .7rem;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s ease, border-color .15s ease;
}
.xy-wp-card[data-wp="1"] { background: var(--xy-wp-1); }
.xy-wp-card[data-wp="2"] { background: var(--xy-wp-2); }
.xy-wp-card[data-wp="3"] { background: var(--xy-wp-3); }
.xy-wp-card:hover { border-color: rgba(255,255,255,.3); }
.xy-wp-card.is-sel { border-color: var(--xy-accent); box-shadow: 0 0 0 1px var(--xy-accent); }

.xy-zoom-row { display: flex; gap: .25rem; flex-wrap: wrap; }
.xy-zoom-pill {
    padding: .25rem .625rem;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 999px;
    color: inherit; font-size: .7rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.xy-zoom-pill:hover { background: rgba(255,255,255,.08); }
.xy-zoom-pill.is-sel { background: var(--xy-accent); border-color: var(--xy-accent); color: #fff; }

.xy-switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; }
.xy-switch input { display: none; }
.xy-switch-slider {
    width: 30px; height: 16px;
    background: rgba(255,255,255,.18);
    border-radius: 999px;
    position: relative;
    transition: background .15s ease;
}
.xy-switch-slider::after {
    content: "";
    position: absolute;
    width: 12px; height: 12px;
    background: #fff;
    border-radius: 50%;
    top: 2px; left: 2px;
    transition: left .15s ease;
}
.xy-switch input:checked + .xy-switch-slider { background: var(--xy-accent); }
.xy-switch input:checked + .xy-switch-slider::after { left: 16px; }
.xy-switch-label { font-size: .75rem; opacity: .8; }

.xy-kbd-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .375rem; font-size: .75rem; opacity: .85; }
.xy-kbd-list li { display: flex; align-items: center; gap: .5rem; }

/* ───────────────────────── VENTANA FLOTANTE ──────────────────────────────── */
/* Host no-posicionado — cada ventana es position:fixed para que sus coordenadas
   sean viewport-relative y coincidan con la matemática clientX/Y del drag JS. */
.xy-window-host { position: static; }

.xy-window {
    position: fixed;
    background: var(--xy-bg-dark);
    border: 1px solid var(--xy-border-dark);
    border-radius: var(--xy-radius-w);
    box-shadow: var(--xy-shadow-w);
    display: flex; flex-direction: column;
    overflow: hidden;
    resize: both;
    min-width: 420px;
    min-height: 280px;
    color: var(--xy-text-dark);
    /* Transición estilo macOS para minimizar/restaurar: escala + opacidad +
       desplazamiento al taskbar, con pivote en borde inferior. */
    transform-origin: 50% 100%;
    transition: transform .32s cubic-bezier(.4, 0, .2, 1),
                opacity   .28s ease-out,
                box-shadow .15s ease,
                filter    .22s ease;
    /* La animación de entrada SOLO toca opacidad. Si animamos transform con
       fill-mode both, el valor queda "bloqueado" y el transform de
       .is-minimized no aplica → la animación de minimizar no se ve. */
    animation: xy-window-in .2s ease-out;
}
@keyframes xy-window-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.xy-window.is-dragging { transition: none; user-select: none; box-shadow: var(--xy-shadow-w-focus); }
.xy-window:focus-within { box-shadow: var(--xy-shadow-w-focus); }

/* ── Minimizar estilo macOS: encoge y se "absorbe" hacia el taskbar ────── */
.xy-window.is-minimized {
    transform: translateY(60vh) scale(.06);
    opacity: 0;
    pointer-events: none;
    /* Sube un poco por encima del tranform-origin para el efecto genie-lite */
    filter: blur(2px);
    animation: none; /* evita conflicto con xy-window-in */
}

/* Maximizada: llena la superficie del desktop (arriba y a los lados hasta el
   taskbar inferior). */
.xy-window.is-max {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: var(--xy-taskbar-h) !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0;
    border: none;
    resize: none;
    animation: none;
}

.xy-desktop[data-xy-theme="light"] .xy-window {
    background: var(--xy-bg-light-0);
    border-color: var(--xy-border-light);
    color: var(--xy-text-light);
}
.xy-desktop[data-xy-theme="glassy"] .xy-window {
    background: rgba(31, 31, 31, 0.70);
    backdrop-filter: blur(24px) saturate(1.1);
    -webkit-backdrop-filter: blur(24px) saturate(1.1);
    border-color: rgba(255,255,255,.10);
}

.xy-window-head {
    height: 36px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 .375rem 0 .75rem;
    background: var(--xy-bg-panel);
    border-bottom: 1px solid var(--xy-border-dark);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}
.xy-window.is-dragging .xy-window-head { cursor: grabbing; }
.xy-desktop[data-xy-theme="light"] .xy-window-head {
    background: var(--xy-bg-light-1);
    border-bottom-color: var(--xy-border-light);
}
.xy-desktop[data-xy-theme="glassy"] .xy-window-head {
    background: rgba(45, 45, 48, 0.55);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
.xy-window-head-left { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 600; min-width: 0; }
.xy-window-ico { opacity: .7; font-size: .8125rem; }
.xy-window-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xy-window-ctrls { display: flex; align-items: center; gap: 1px; }

.xy-w-btn {
    width: 26px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    border-radius: 5px;
    color: inherit; opacity: .65;
    font-size: .7rem;
    cursor: pointer;
    transition: background .12s ease, opacity .12s ease, color .12s ease;
}
.xy-w-btn:hover { background: rgba(255,255,255,.08); opacity: 1; }
.xy-desktop[data-xy-theme="light"] .xy-w-btn:hover { background: rgba(0,0,0,.05); }
.xy-w-btn-close:hover { background: #dc2626; color: #fff; opacity: 1; }

.xy-window-body {
    flex: 1;
    overflow: auto;
    background: transparent;
    padding: 0;
    min-height: 0;
}

.xy-window-frame { width: 100%; height: 100%; border: 0; background: transparent; }

/* ───────────────────────── DESKTOP VACÍO ─────────────────────────────────── */
.xy-desktop-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .75rem;
    pointer-events: none;
    color: rgba(255,255,255,.65);
    text-align: center;
    padding: 2rem;
    z-index: 0;
    transition: opacity .35s ease;
}
/* Cuando hay ventanas abiertas el brand se mantiene pero baja a watermark */
.xy-desktop-empty.has-windows {
    opacity: .22;
}
.xy-desktop-empty.has-windows .xy-desktop-empty-logo {
    opacity: 1;
}
.xy-desktop[data-xy-theme="light"] .xy-desktop-empty { color: rgba(15,23,42,.55); }
/* Wordmark XY Ventures — PNG transparente sin recuadro, solo drop-shadow. */
.xy-desktop-empty-logo {
    width: auto;
    height: 72px;
    max-width: min(420px, 70vw);
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.35));
}
.xy-desktop-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -.01em;
    opacity: .8;
}
.xy-desktop-empty-hint {
    font-size: .8125rem;
    opacity: .6;
}

/* ───────────────────────── LOGIN ─────────────────────────────────────────── */
.xy-login-root {
    position: fixed; inset: 0;
    overflow: hidden;
    background: var(--xy-wp-2);
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #e5e7eb;
}
.xy-login-wp {
    position: absolute; inset: 0;
    background-image: var(--xy-wp-2);
}
.xy-login-blobs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* Blobs más sutiles: más pequeños, menos opacos, animación lenta */
.xy-blob {
    position: absolute;
    width: 380px; height: 380px;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .22;
    animation: xy-blob 30s ease-in-out infinite;
}
.xy-blob-a { top: -120px; left: -80px; background: #3b82f6; }
.xy-blob-b { bottom: -160px; right: -80px; background: #6366f1; animation-delay: -10s; }
.xy-blob-c { top: 45%; left: 55%; background: #818cf8; animation-delay: -20s; opacity: .15; }
@keyframes xy-blob {
    0%, 100% { transform: translate(0,0) scale(1); }
    33%      { transform: translate(30px, -20px) scale(1.05); }
    66%      { transform: translate(-20px, 30px) scale(.98); }
}

.xy-login-shell {
    position: relative;
    min-height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    z-index: 2;
}
.xy-login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem 2rem 1.5rem;
    background: rgba(255,255,255,.06);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,.3);
    color: #fff;
    animation: xy-card-in .4s ease both;
}
@keyframes xy-card-in { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.xy-login-brand { display: flex; flex-direction: column; align-items: center; gap: .375rem; margin-bottom: 1.5rem; }
.xy-login-logo {
    width: auto;
    height: 52px;
    max-width: 280px;
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}
.xy-login-sub {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .18em;
    opacity: .65;
}

.xy-login-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 .25rem 0; letter-spacing: -.01em; }
.xy-login-lead { font-size: .875rem; opacity: .7; margin: 0 0 1.5rem 0; }

.xy-login-form { display: flex; flex-direction: column; gap: 1rem; }

.xy-field { display: flex; flex-direction: column; gap: .375rem; }
.xy-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; font-weight: 600; }

.xy-input-wrap {
    position: relative;
    display: flex; align-items: center;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 9px;
    transition: border-color .15s ease, background .15s ease;
}
.xy-input-wrap:focus-within {
    border-color: var(--xy-accent);
    background: rgba(255,255,255,.08);
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.xy-input-icon { padding: 0 .75rem; opacity: .5; font-size: .875rem; }
.xy-input {
    flex: 1;
    background: transparent; border: none; outline: none;
    padding: .7rem .25rem .7rem 0;
    color: #fff;
    font-size: .9375rem;
}
.xy-input::placeholder { color: rgba(255,255,255,.38); }
.xy-input-eye {
    background: transparent; border: none;
    padding: 0 .75rem;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    font-size: .875rem;
}
.xy-input-eye:hover { color: #fff; }

.xy-row-between { display: flex; align-items: center; justify-content: space-between; }
.xy-check { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; opacity: .8; cursor: pointer; }
.xy-check input { accent-color: var(--xy-accent); }

.xy-alert {
    display: flex; align-items: center; gap: .5rem;
    padding: .625rem .75rem;
    background: rgba(220, 38, 38, .14);
    border: 1px solid rgba(220, 38, 38, .35);
    border-radius: 9px;
    font-size: .8125rem;
    color: #fecaca;
}

.xy-btn-primary {
    width: 100%;
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .7rem 1rem;
    background: linear-gradient(135deg, var(--xy-primary), var(--xy-accent));
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 9px;
    color: #fff;
    font-weight: 600; font-size: .9375rem;
    cursor: pointer;
    transition: filter .12s ease, transform .12s ease;
}
.xy-btn-primary:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.xy-btn-primary:disabled { opacity: .7; cursor: wait; }

.xy-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xy-spin .8s linear infinite;
}

.xy-login-foot {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    text-align: center;
    font-size: .75rem;
    opacity: .5;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.xy-login-foot-tiny {
    font-size: .625rem;
    opacity: .45;
    letter-spacing: .02em;
}
/* Prácticamente invisible — se funde con el fondo. Visible solo si seleccionas el texto. */
.xy-login-foot-hidden {
    font-size: .625rem;
    color: rgba(255, 255, 255, 0.02);
    letter-spacing: .02em;
    user-select: text;
}

/* ───────────────────────── MOBILE FALLBACK ───────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --xy-topbar-h: 52px;
        --xy-dock-w: 0px;
    }
    .xy-dock {
        top: auto; bottom: 0;
        left: 0; right: 0;
        width: 100%; height: 60px;
        flex-direction: row; justify-content: space-around;
        padding: .25rem .5rem;
        border-right: none;
        border-top: 1px solid var(--xy-glass-border);
    }
    .xy-dock-head, .xy-dock-foot { display: none; }
    .xy-dock-nav { flex-direction: row; overflow-x: auto; padding: 0; gap: .25rem; }
    .xy-app-icon { width: 44px; height: 44px; flex-shrink: 0; }
    .xy-app-icon.is-open::before { left: 10px; top: -6px; bottom: auto; width: auto; right: 10px; height: 2px; }
    .xy-tip { display: none; }

    .xy-strip { display: none; }
    .xy-topbar-center { display: none; }
    .xy-desktop-surface { left: 0; right: 0; bottom: 60px; }

    .xy-window {
        inset: 0 !important;
        width: 100% !important; height: 100% !important;
        border-radius: 0;
        resize: none;
    }
    .xy-window.is-max { left: 0 !important; right: 0 !important; top: 0 !important; bottom: var(--xy-taskbar-h) !important; }
    .xy-window-head { cursor: default; }

    .xy-start-menu { left: 8px; right: 8px; width: auto; bottom: calc(var(--xy-taskbar-h) + 8px); top: auto; }
    .xy-login-card { padding: 1.5rem; border-radius: 12px; }
}

/* ───────────────────────── UTILITARIOS ───────────────────────────────────── */
.xy-desktop .dropdown-menu {
    background: rgba(31, 31, 31, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid var(--xy-border-dark);
    color: var(--xy-text-dark);
}
.xy-desktop .dropdown-menu .dropdown-item { color: var(--xy-text-dark); }
.xy-desktop .dropdown-menu .dropdown-item:hover,
.xy-desktop .dropdown-menu .dropdown-item:focus { background: rgba(255,255,255,.06); color: #fff; }
.xy-desktop .dropdown-menu .dropdown-header { color: var(--xy-text-dark-muted); }
.xy-desktop[data-xy-theme="light"] .dropdown-menu {
    background: rgba(255,255,255,.98);
    border-color: var(--xy-border-light);
    color: var(--xy-text-light);
}
.xy-desktop[data-xy-theme="light"] .dropdown-menu .dropdown-item { color: var(--xy-text-light); }
.xy-desktop[data-xy-theme="light"] .dropdown-menu .dropdown-item:hover { background: rgba(0,0,0,.04); }

/* ============================================================================
   TASKBAR INFERIOR UNIFICADA
   Reemplaza topbar + dock + control strip antiguos.
   ============================================================================ */

/* Oculta los shells legacy por si siguieran renderizando en algún lugar. */
.xy-topbar, .xy-dock, .xy-strip { display: none !important; }

.xy-taskbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--xy-taskbar-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    background: var(--xy-glass-bg-dark);
    backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.1);
    -webkit-backdrop-filter: blur(var(--xy-glass-blur)) saturate(1.1);
    border-top: 1px solid var(--xy-glass-border);
    color: var(--xy-text-dark);
}
.xy-desktop[data-xy-theme="light"] .xy-taskbar {
    background: var(--xy-glass-bg-light);
    border-top-color: var(--xy-glass-border-light);
    color: var(--xy-text-light);
}
.xy-desktop[data-xy-theme="glassy"] .xy-taskbar {
    background: rgba(24, 24, 24, 0.55);
    border-top-color: rgba(255, 255, 255, 0.08);
}

.xy-tb-left, .xy-tb-center, .xy-tb-right {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.xy-tb-left  { flex: 0 1 auto; }
.xy-tb-center{ flex: 1 1 auto; justify-content: center; }
.xy-tb-right { flex: 0 0 auto; gap: 10px; }

.xy-tb-apps {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-left: 6px;
}
.xy-tb-sep {
    width: 1px;
    height: 26px;
    background: var(--xy-glass-border);
    margin: 0 6px;
}
.xy-desktop[data-xy-theme="light"] .xy-tb-sep { background: rgba(0,0,0,.08); }

/* ─── Dock estilo macOS: magnificación en onda (CSS puro via :has + hermanos)
   Se aplica SOLO a .xy-tb-apps > .xy-app-icon para excluir el botón Inicio.
   Curva: el ícono hovered escala al máximo, los vecinos a 1 posición escalan
   menos, y a 2 posiciones mínimo — ambas direcciones (derecha via "+", izquierda
   via ":has(+)"). La onda se propaga hasta 2 iconos a cada lado. */

.xy-taskbar .xy-tb-apps > .xy-app-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    transform-origin: bottom center;
    background: transparent;
    transition: transform .22s cubic-bezier(.34, 1.56, .64, 1),
                background .15s ease;
    animation: xy-dock-bounce-in .42s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes xy-dock-bounce-in {
    0%   { transform: translateY(22px) scale(.25); opacity: 0; }
    55%  { transform: translateY(-6px) scale(1.12); opacity: 1; }
    100% { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* ── Ícono con cursor encima — cresta de la onda ───────────────────────── */
.xy-taskbar .xy-tb-apps > .xy-app-icon:hover {
    transform: translateY(-22px) scale(1.7);
    background: rgba(255, 255, 255, 0.08);
}
.xy-desktop[data-xy-theme="light"] .xy-taskbar .xy-tb-apps > .xy-app-icon:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* ── Vecinos a 1 posición (a la derecha y a la izquierda) ──────────────── */
.xy-taskbar .xy-tb-apps > .xy-app-icon:hover + .xy-app-icon,
.xy-taskbar .xy-tb-apps > .xy-app-icon:has(+ .xy-app-icon:hover) {
    transform: translateY(-12px) scale(1.35);
}

/* ── Vecinos a 2 posiciones ────────────────────────────────────────────── */
.xy-taskbar .xy-tb-apps > .xy-app-icon:hover + .xy-app-icon + .xy-app-icon,
.xy-taskbar .xy-tb-apps > .xy-app-icon:has(+ .xy-app-icon + .xy-app-icon:hover) {
    transform: translateY(-5px) scale(1.15);
}

/* ── Vecinos a 3 posiciones (onda final que decae a casi 1) ────────────── */
.xy-taskbar .xy-tb-apps > .xy-app-icon:hover + .xy-app-icon + .xy-app-icon + .xy-app-icon,
.xy-taskbar .xy-tb-apps > .xy-app-icon:has(+ .xy-app-icon + .xy-app-icon + .xy-app-icon:hover) {
    transform: translateY(-2px) scale(1.06);
}

/* ── Pulse al hacer click: re-dispara el salto (agregado por xy-dock.js) ─ */
.xy-taskbar .xy-tb-apps > .xy-app-icon.is-pulse {
    animation: xy-dock-pulse .42s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes xy-dock-pulse {
    0%   { transform: translateY(0)   scale(1); }
    35%  { transform: translateY(-18px) scale(1.35); }
    65%  { transform: translateY(4px)  scale(.92); }
    100% { transform: translateY(0)   scale(1); }
}

/* Tooltip arriba (en lugar de a la derecha como en el dock vertical) */
.xy-taskbar .xy-app-icon .xy-tip {
    top: auto;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 4px);
}
.xy-taskbar .xy-app-icon:hover .xy-tip {
    transform: translate(-50%, 0);
}

/* Indicador de minimizado (dot pequeño abajo) */
.xy-taskbar .xy-app-icon .xy-app-dot {
    top: auto;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
}

/* Todas las apps del taskbar están abiertas por definición; no usamos el
   accent-bar is-active porque sería redundante. */
.xy-taskbar .xy-app-icon.is-active { background: transparent; }
.xy-taskbar .xy-app-icon.is-active::before { display: none; }

/* Start menu trigger dentro de la taskbar */
.xy-taskbar .xy-start-toggle {
    width: 40px; height: 40px;
    border-radius: 10px;
}

/* Search más compacto en taskbar */
.xy-taskbar .xy-search {
    max-width: 420px;
    width: 100%;
}

/* Dropdowns de la taskbar abren hacia arriba */
.xy-taskbar .dropdown-menu {
    margin-bottom: 8px;
}

/* ============================================================================
   PANEL DE CONTROL (XyConfigPanel — ventana "Configuración")
   ============================================================================ */

.xy-cfg {
    display: flex;
    height: 100%;
    min-height: 480px;
    color: inherit;
}
.xy-cfg-side {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8px;
    border-right: 1px solid var(--xy-glass-border);
    background: rgba(255,255,255,.02);
}
.xy-desktop[data-xy-theme="light"] .xy-cfg-side {
    background: rgba(0,0,0,.02);
    border-right-color: rgba(0,0,0,.06);
}
.xy-cfg-side-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: inherit;
    font-size: .875rem;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s ease;
}
.xy-cfg-side-btn i { width: 18px; text-align: center; opacity: .75; }
.xy-cfg-side-btn:hover { background: rgba(255,255,255,.05); }
.xy-desktop[data-xy-theme="light"] .xy-cfg-side-btn:hover { background: rgba(0,0,0,.04); }
.xy-cfg-side-btn.is-sel {
    background: rgba(99, 102, 241, 0.18);
    color: #fff;
}
.xy-desktop[data-xy-theme="light"] .xy-cfg-side-btn.is-sel {
    background: rgba(37, 99, 235, 0.12);
    color: #0f172a;
}
.xy-cfg-side-btn.is-sel i { opacity: 1; color: var(--xy-accent); }

.xy-cfg-main {
    flex: 1 1 auto;
    padding: 20px 28px;
    overflow: auto;
}
.xy-cfg-sec h3 {
    margin: 0 0 4px 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.xy-cfg-sub { margin: 0 0 20px 0; font-size: .8125rem; opacity: .65; }

.xy-cfg-group { margin-bottom: 20px; }
.xy-cfg-group > label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .65;
    margin-bottom: 8px;
}
.xy-cfg-readonly {
    font-family: 'Geist Mono', monospace;
    font-size: .8125rem;
    padding: 8px 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--xy-glass-border);
    border-radius: 6px;
}
.xy-desktop[data-xy-theme="light"] .xy-cfg-readonly {
    background: rgba(0,0,0,.03);
    border-color: rgba(0,0,0,.08);
}

/* ============================================================================
   Chat por sala (Ops) + Mini-oficina
   Layout split 2/3 chat · 1/3 oficina; apila en móvil.
   ============================================================================ */
.sala-chat-root {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: var(--ds-space-4);
    align-items: start;
}
/* Variante full: una sola columna que ocupa todo el ancho del tab */
.sala-chat-root.sala-chat-full {
    grid-template-columns: minmax(0, 1fr);
}

/* ═══════════════════════════ CHAT ESTILO BURBUJAS ═════════════════════════ */
.chat-stream {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 4px 16px;
}
.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}
/* Usuario: burbuja a la derecha sin avatar */
.chat-row-user { justify-content: flex-end; }

/* Assistant: avatar + burbuja a la izquierda */
.chat-row-assistant { justify-content: flex-start; }

.chat-avatar {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--xy-primary), var(--xy-accent));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8125rem;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    margin-bottom: 2px;
}

.chat-bubble {
    max-width: min(72%, 720px);
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .9375rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    animation: chatBubbleIn .18s ease-out;
}
@keyframes chatBubbleIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Burbuja usuario — accent, esquina inferior-derecha redondeada menos */
.chat-bubble-user {
    background: linear-gradient(135deg, var(--xy-primary), var(--xy-accent));
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Burbuja assistant — superficie, esquina inferior-izquierda redondeada menos */
.chat-bubble-assistant {
    background: var(--xy-bg-panel);
    color: var(--xy-text-dark);
    border: 1px solid var(--xy-border-dark);
    border-bottom-left-radius: 4px;
}
.xy-desktop[data-xy-theme="light"] .chat-bubble-assistant {
    background: var(--xy-bg-light-0);
    color: var(--xy-text-light);
    border-color: var(--xy-border-light);
}

.chat-bubble-name {
    font-size: .75rem;
    font-weight: 600;
    color: var(--xy-text-dark-muted);
    margin-bottom: 3px;
    letter-spacing: .01em;
}
.xy-desktop[data-xy-theme="light"] .chat-bubble-name { color: var(--xy-text-light-muted); }

.chat-bubble-text {
    white-space: pre-wrap;
}
.chat-bubble-text strong { font-weight: 700; }
.chat-bubble-text code {
    background: rgba(0,0,0,.25);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .875em;
    font-family: 'Geist Mono', ui-monospace, monospace;
}
.chat-bubble-user .chat-bubble-text code { background: rgba(0,0,0,.25); color: #fff; }
.xy-desktop[data-xy-theme="light"] .chat-bubble-assistant .chat-bubble-text code { background: rgba(0,0,0,.06); }

.chat-bubble-meta {
    display: flex;
    gap: 4px;
    font-size: .6875rem;
    color: var(--xy-text-dark-muted);
    margin-top: 6px;
    opacity: .7;
}
.xy-desktop[data-xy-theme="light"] .chat-bubble-meta { color: var(--xy-text-light-muted); }

/* Thinking: three dots animation */
.chat-bubble-thinking { padding: 14px 18px; }
.chat-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 12px;
}
.chat-typing span {
    width: 6px; height: 6px;
    background: currentColor;
    border-radius: 50%;
    opacity: .4;
    animation: chatTyping 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatTyping {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30%           { opacity: 1;  transform: translateY(-3px); }
}

/* Sistema: banners centrados — info (neutro) y error (rojo) */
.chat-row-system { justify-content: center; }
.chat-system {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: .8125rem;
    max-width: 640px;
    display: flex;
    align-items: center;
}
.chat-system-error {
    background: rgba(220, 38, 38, .12);
    border: 1px solid rgba(220, 38, 38, .4);
    color: #fca5a5;
}
.xy-desktop[data-xy-theme="light"] .chat-system-error { color: #991b1b; background: rgba(220,38,38,.08); }
.chat-system-info {
    background: rgba(99, 102, 241, .10);
    border: 1px solid rgba(99, 102, 241, .25);
    color: #a5b4fc;
}
.xy-desktop[data-xy-theme="light"] .chat-system-info { color: #4338ca; background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.2); }

/* Indicador de conexión SignalR en el header del chat */
.chat-conn-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    vertical-align: middle;
}
.chat-conn-dot.on {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, .6);
    animation: chatDotPulse 2s ease-in-out infinite;
}
.chat-conn-dot.off {
    background: #6b7280;
    opacity: .5;
}
@keyframes chatDotPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .5; }
}

/* ═══════════════════════════ MARKDOWN dentro de burbujas ═════════════════ */
.chat-md { line-height: 1.55; }
.chat-md p { margin: 0 0 .5rem 0; }
.chat-md p:last-child { margin-bottom: 0; }
.chat-md h1, .chat-md h2, .chat-md h3, .chat-md h4, .chat-md h5, .chat-md h6 {
    margin: .875rem 0 .375rem 0;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.chat-md h1 { font-size: 1.25rem; }
.chat-md h2 { font-size: 1.125rem; }
.chat-md h3 { font-size: 1rem; }
.chat-md h4, .chat-md h5, .chat-md h6 { font-size: .9375rem; }
.chat-md ul, .chat-md ol { margin: .25rem 0 .5rem 0; padding-left: 1.5rem; }
.chat-md li { margin-bottom: .15rem; }
.chat-md li > p { margin: 0; }
.chat-md strong { font-weight: 700; }
.chat-md em { font-style: italic; }
.chat-md a { color: var(--xy-accent); text-decoration: underline; }
.chat-md hr { border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: .75rem 0; }
.chat-md blockquote {
    margin: .5rem 0;
    padding: .25rem .75rem;
    border-left: 3px solid var(--xy-accent);
    background: rgba(99,102,241,.06);
    opacity: .9;
}
.chat-md code {
    background: rgba(0,0,0,.30);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .875em;
    font-family: 'Geist Mono', ui-monospace, monospace;
}
.chat-md pre {
    background: rgba(0,0,0,.35);
    border: 1px solid rgba(255,255,255,.08);
    padding: .625rem .875rem;
    border-radius: 8px;
    margin: .5rem 0;
    overflow-x: auto;
    font-size: .8125rem;
    line-height: 1.5;
}
.chat-md pre code { background: transparent; padding: 0; font-size: inherit; }
.chat-md table {
    border-collapse: collapse;
    margin: .5rem 0;
    font-size: .875rem;
    width: 100%;
    max-width: 100%;
}
.chat-md th, .chat-md td {
    border: 1px solid rgba(255,255,255,.12);
    padding: .375rem .625rem;
    text-align: left;
    vertical-align: top;
}
.chat-md th { background: rgba(255,255,255,.06); font-weight: 600; }
.chat-md tbody tr:nth-child(even) td { background: rgba(255,255,255,.02); }

.xy-desktop[data-xy-theme="light"] .chat-md code,
.xy-desktop[data-xy-theme="light"] .chat-md pre { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.08); }
.xy-desktop[data-xy-theme="light"] .chat-md th { background: rgba(0,0,0,.04); }
.xy-desktop[data-xy-theme="light"] .chat-md th,
.xy-desktop[data-xy-theme="light"] .chat-md td,
.xy-desktop[data-xy-theme="light"] .chat-md hr { border-color: rgba(0,0,0,.1); }

/* Historial descendente — separador visual entre turnos cuando el composer va arriba */
.chat-stream.chat-stream-desc { margin-top: 0; }

/* ═══════════════════════════ TABS CHAT / ACTIVIDAD ═════════════════════════ */
.sala-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--xy-border-dark);
    margin-top: var(--ds-space-2);
}
.xy-desktop[data-xy-theme="light"] .sala-tabs { border-color: var(--xy-border-light); }

.sala-tab {
    padding: 8px 16px;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--xy-text-dark-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sala-tab:hover { color: var(--xy-text-dark); }
.sala-tab.active {
    color: var(--xy-accent);
    border-bottom-color: var(--xy-accent);
}
.xy-desktop[data-xy-theme="light"] .sala-tab { color: var(--xy-text-light-muted); }
.xy-desktop[data-xy-theme="light"] .sala-tab:hover { color: var(--xy-text-light); }
.xy-desktop[data-xy-theme="light"] .sala-tab.active { color: var(--xy-primary); border-bottom-color: var(--xy-primary); }

.sala-tab-count {
    font-size: .6875rem;
    background: rgba(255,255,255,.08);
    color: var(--xy-text-dark-muted);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}
.sala-tab.active .sala-tab-count { background: rgba(59,130,246,.15); color: var(--xy-accent); }
.xy-desktop[data-xy-theme="light"] .sala-tab-count { background: rgba(0,0,0,.06); color: var(--xy-text-light-muted); }
.xy-desktop[data-xy-theme="light"] .sala-tab.active .sala-tab-count { background: rgba(37,99,235,.1); color: var(--xy-primary); }

/* ═══════════════════════════ TIMELINE DE ACTIVIDAD ═════════════════════════ */
.act-timeline {
    display: flex;
    flex-direction: column;
    padding: 12px 0 16px;
}

.act-event {
    display: grid;
    grid-template-columns: 32px 2px 1fr;
    gap: 0 10px;
    min-height: 48px;
    animation: chatBubbleIn .18s ease-out;
}
.act-icon {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: .875rem;
    flex-shrink: 0;
    z-index: 1;
}
.act-line {
    width: 2px;
    background: var(--xy-border-dark);
    justify-self: center;
    min-height: 100%;
}
.act-event:last-child .act-line { background: transparent; }
.xy-desktop[data-xy-theme="light"] .act-line { background: var(--xy-border-light); }

.act-body {
    padding: 4px 0 16px;
    min-width: 0;
}
.act-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.act-title {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--xy-text-dark);
}
.xy-desktop[data-xy-theme="light"] .act-title { color: var(--xy-text-light); }

.act-actor {
    font-size: .75rem;
    font-weight: 500;
    color: var(--xy-accent);
    background: rgba(59,130,246,.1);
    padding: 1px 8px;
    border-radius: 4px;
}
.act-time {
    font-size: .6875rem;
    color: var(--xy-text-dark-muted);
    font-family: 'Geist Mono', monospace;
}
.xy-desktop[data-xy-theme="light"] .act-time { color: var(--xy-text-light-muted); }

.act-content {
    font-size: .8125rem;
    color: var(--xy-text-dark-muted);
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 96px;
    overflow: hidden;
}
.xy-desktop[data-xy-theme="light"] .act-content { color: var(--xy-text-light-muted); }

.act-meta {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.act-chip {
    font-size: .6875rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,.06);
    color: var(--xy-text-dark-muted);
    font-family: 'Geist Mono', monospace;
}
.xy-desktop[data-xy-theme="light"] .act-chip { background: rgba(0,0,0,.05); color: var(--xy-text-light-muted); }

/* Empty state */
.act-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--xy-text-dark-muted);
    font-size: .875rem;
}
.act-empty i { font-size: 1.25rem; opacity: .5; }
.xy-desktop[data-xy-theme="light"] .act-empty { color: var(--xy-text-light-muted); }

/* ── Colores por tipo de evento ── */
.act-event-user .act-icon { background: var(--xy-primary); color: #fff; }
.act-event-triaje .act-icon { background: #8b5cf6; color: #fff; }
.act-event-invoke .act-icon { background: #f59e0b; color: #fff; }
.act-event-reply .act-icon { background: #10b981; color: #fff; }
.act-event-tool .act-icon { background: #6366f1; color: #fff; }
.act-event-synth .act-icon { background: #06b6d4; color: #fff; }
.act-event-assist .act-icon { background: #3b82f6; color: #fff; }
.act-event-info .act-icon { background: rgba(99,102,241,.15); color: #a5b4fc; }
.act-event-error .act-icon { background: rgba(220,38,38,.15); color: #fca5a5; }
.act-event-internal .act-icon { background: rgba(139,92,246,.15); color: #c4b5fd; }
.act-event-valid .act-icon { background: rgba(16,185,129,.15); color: #6ee7b7; }
.act-event-other .act-icon { background: rgba(255,255,255,.08); color: var(--xy-text-dark-muted); }
.act-event-thinking .act-icon { background: rgba(251,191,36,.15); color: #fbbf24; }

.xy-desktop[data-xy-theme="light"] .act-event-info .act-icon { background: rgba(99,102,241,.1); color: #4338ca; }
.xy-desktop[data-xy-theme="light"] .act-event-error .act-icon { background: rgba(220,38,38,.1); color: #dc2626; }
.xy-desktop[data-xy-theme="light"] .act-event-internal .act-icon { background: rgba(139,92,246,.1); color: #7c3aed; }
.xy-desktop[data-xy-theme="light"] .act-event-valid .act-icon { background: rgba(16,185,129,.1); color: #059669; }
.xy-desktop[data-xy-theme="light"] .act-event-other .act-icon { background: rgba(0,0,0,.06); color: var(--xy-text-light-muted); }
.xy-desktop[data-xy-theme="light"] .act-event-thinking .act-icon { background: rgba(245,158,11,.1); color: #d97706; }

/* Línea de color para eventos importantes */
.act-event-invoke .act-line { background: rgba(245,158,11,.3); }
.act-event-error .act-line { background: rgba(220,38,38,.3); }
.act-event-tool .act-line { background: rgba(99,102,241,.2); }

.sala-chat-main {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
    min-width: 0;
}
.sala-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ds-space-3);
    padding: 4px 2px 0 2px;
}
.sala-chat-header h2 { font-size: 1.05rem; margin: 0; }
.sala-chat-header .meta {
    display: flex; gap: var(--ds-space-2); align-items: center; flex-wrap: wrap;
    font-size: var(--ds-text-sm);
}
.sala-chat-header .meta .tenant-dot {
    width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.sala-chat-composer { margin-top: var(--ds-space-2); }
.sala-chat-oficina {
    position: sticky;
    top: calc(var(--ds-space-4) + 8px);
}

/* Conversación — reutiliza del Ops original, con tamaño más discreto */
.ops-conversation { display: flex; flex-direction: column; gap: var(--ds-space-3); }
.ops-turn { display: flex; gap: var(--ds-space-3); padding: var(--ds-space-3) var(--ds-space-4);
            border-radius: var(--ds-radius-lg); background: var(--ds-surface); border: 1px solid var(--ds-border); }
.ops-turn.turn-user { background: var(--ds-surface-2); }
.ops-turn.turn-thinking { opacity: 0.7; font-style: italic; }
.ops-turn.turn-system {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.35);
    color: #fca5a5;
}
.ops-turn.turn-system .turn-avatar { background: #dc2626; color: #fff; }
.ops-turn.turn-system .turn-meta strong { color: #f87171; }
.ops-turn.turn-system .turn-text { color: inherit; font-weight: 500; }
.turn-avatar { width: 32px; height: 32px; border-radius: var(--ds-radius); background: var(--ds-brand-600);
               color: white; display: flex; align-items: center; justify-content: center; font-weight: 600;
               flex-shrink: 0; font-size: var(--ds-text-xs); }
.ops-turn.turn-user .turn-avatar { background: var(--ds-neutral-700); }
.turn-body { flex: 1; min-width: 0; }
.turn-meta { display: flex; gap: var(--ds-space-2); align-items: center; margin-bottom: 4px;
             font-size: var(--ds-text-xs); color: var(--ds-text-muted); }
.turn-meta strong { color: var(--ds-text); font-weight: 600; }
.turn-text { white-space: pre-wrap; line-height: 1.5; font-size: var(--ds-text-sm); }
.ops-debug { margin-top: var(--ds-space-2); background: var(--ds-neutral-950); color: var(--ds-neutral-100);
             padding: var(--ds-space-3); border-radius: var(--ds-radius); }
.ops-debug summary { cursor: pointer; font-family: var(--ds-font-mono); font-size: var(--ds-text-xs); }
.ops-debug pre { margin-top: var(--ds-space-2); font-size: var(--ds-text-2xs); max-height: 400px; overflow: auto; }

/* Mini-oficina */
.mini-oficina {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    padding: var(--ds-space-3);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
}
.mini-oficina-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ds-space-2);
    border-bottom: 1px solid var(--ds-border);
    padding-bottom: var(--ds-space-2);
}
.mini-oficina-title { font-weight: 600; font-size: var(--ds-text-sm); }
.mini-oficina-sub { font-size: var(--ds-text-2xs); color: var(--ds-text-muted); }
.mini-oficina-empty {
    text-align: center;
    color: var(--ds-text-muted);
    padding: var(--ds-space-4) var(--ds-space-2);
}
.mini-oficina-empty i { font-size: 1.6rem; display: block; margin-bottom: 4px; }
.mini-oficina-list {
    display: flex; flex-direction: column; gap: 6px;
    max-height: 62vh; overflow-y: auto;
}
.mini-agente {
    display: flex; align-items: center; gap: var(--ds-space-2);
    padding: 6px 8px;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface-2);
    transition: border-color 160ms ease, transform 160ms ease;
}
.mini-agente.is-active   { border-color: #22c55e; }
.mini-agente.is-warning  { border-color: #dc2626; animation: miniAgenteBounce 400ms ease; }
.mini-agente.is-active   { animation: miniAgenteBounce 400ms ease; }
.mini-agente-avatar {
    position: relative;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--ds-brand-600); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: var(--ds-text-xs);
    flex-shrink: 0;
}
.mini-agente-dot {
    position: absolute;
    right: -2px; bottom: -2px;
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--ds-surface);
    background: #94a3b8;
}
.mini-agente-dot.dot-activo  { background: #22c55e; animation: miniDotPulse 1.5s ease-in-out infinite; }
.mini-agente-dot.dot-warning { background: #dc2626; animation: miniDotPulse 1.2s ease-in-out infinite; }
.mini-agente-dot.dot-idle    { background: #94a3b8; }
.mini-agente-body { flex: 1; min-width: 0; }
.mini-agente-nombre {
    font-weight: 600; font-size: var(--ds-text-sm);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-agente-meta {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px;
}
.mini-agente-pill {
    font-size: var(--ds-text-2xs);
    padding: 1px 6px;
    border-radius: 999px;
    display: inline-flex; align-items: center; gap: 3px;
}
.mini-agente-pill.activo  { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.mini-agente-pill.warning { background: rgba(220, 38, 38, 0.18); color: #fca5a5; }
.mini-agente-pill.idle    { background: rgba(148, 163, 184, 0.15); color: var(--ds-text-muted); }

@keyframes miniDotPulse {
    0%,100% { transform: scale(1);   opacity: 1;   }
    50%     { transform: scale(1.35); opacity: .7; }
}
@keyframes miniAgenteBounce {
    0%   { transform: translateY(0); }
    30%  { transform: translateY(-2px); }
    60%  { transform: translateY(1px); }
    100% { transform: translateY(0); }
}

@media (max-width: 960px) {
    .sala-chat-root { grid-template-columns: 1fr; }
    .sala-chat-oficina { position: static; }
    .mini-oficina-list { max-height: 40vh; }
}

/* =============================================================================
   Oficina global (/oficina) — tarjetas por sala + panel lateral de actividad.
   Diseño grid HTML (sin SVG). Dot verde pulsante reusa chatDotPulse.
   ========================================================================== */
.oficina-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}

.oficina-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.oficina-sala-card {
    background: var(--ds-surface, #fff);
    border: 1px solid var(--ds-border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.oficina-sala-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px dashed var(--ds-border, #e2e8f0);
    padding-bottom: 8px;
}

.oficina-sala-nombre {
    font-weight: 700;
    font-size: var(--ds-text-sm, 14px);
    color: var(--ds-text, #0f172a);
}

.oficina-tenant-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.oficina-agentes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.oficina-agente {
    display: grid;
    grid-template-columns: 32px 1fr 12px auto;
    align-items: center;
    gap: 8px;
    padding: 4px 2px;
    font-size: var(--ds-text-xs, 12px);
}

.oficina-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    text-transform: uppercase;
    flex-shrink: 0;
}

.oficina-agente-nombre {
    color: var(--ds-text, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oficina-agente-act {
    color: var(--ds-text-muted, #64748b);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.oficina-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background: #94a3b8;
    box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.4);
}

.oficina-dot.on {
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    animation: chatDotPulse 1.6s ease-in-out infinite;
}

.oficina-dot.warn {
    background: #dc2626;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55);
    animation: chatDotPulse 1.2s ease-in-out infinite;
}

.oficina-dot.idle { background: #94a3b8; }

.oficina-contador-global {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ds-text, #0f172a);
}

/* Panel lateral de actividad reciente */
.oficina-panel-actividad {
    background: var(--ds-surface, #fff);
    border: 1px solid var(--ds-border, #e2e8f0);
    border-radius: 10px;
    padding: 10px 12px;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 160px);
    overflow: auto;
}

.oficina-panel-title {
    font-weight: 700;
    font-size: var(--ds-text-sm, 14px);
    margin-bottom: 8px;
    color: var(--ds-text, #0f172a);
    border-bottom: 1px dashed var(--ds-border, #e2e8f0);
    padding-bottom: 6px;
}

.oficina-actividad-empty {
    color: var(--ds-text-muted, #64748b);
    font-size: var(--ds-text-xs, 12px);
    padding: 20px 8px;
    text-align: center;
}

.oficina-actividad-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.oficina-actividad-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: var(--ds-text-xs, 12px);
    padding: 6px 4px;
    border-bottom: 1px solid var(--ds-border, #f1f5f9);
}

.oficina-actividad-row:last-child { border-bottom: none; }

.oficina-actividad-meta {
    display: flex;
    gap: 6px;
    align-items: baseline;
    flex-wrap: wrap;
    color: var(--ds-text-muted, #64748b);
    font-size: 10px;
    margin-bottom: 2px;
}

.oficina-actividad-sala {
    font-weight: 700;
    color: var(--ds-text, #0f172a);
}

.oficina-actividad-autor {
    font-style: italic;
}

.oficina-actividad-when {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.oficina-actividad-texto {
    color: var(--ds-text, #0f172a);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.3;
}

@media (max-width: 960px) {
    .oficina-layout { grid-template-columns: 1fr; }
    .oficina-panel-actividad { position: static; max-height: none; }
}

/* Sala card interactiva — hover cuando se puede hacer clic */
.oficina-sala-card[style*="cursor:pointer"]:hover {
    border-color: var(--xy-accent);
    box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.oficina-sala-card.has-activity {
    border-color: rgba(16,185,129,.3);
}
.oficina-sala-action {
    margin-top: 8px;
    font-size: .75rem;
    color: var(--xy-accent);
    opacity: 0;
    transition: opacity .15s;
}
.oficina-sala-card:hover .oficina-sala-action { opacity: 1; }
.oficina-sala-activas {
    font-size: .6875rem;
    color: #10b981;
    font-weight: 600;
}

/* Actividad panel — iconos enriquecidos por tipo */
.oficina-actividad-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.oficina-actividad-icon {
    width: 24px; height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: .6875rem;
}
.oficina-actividad-body { flex: 1; min-width: 0; }
.act-ico-user   .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-user   { background: rgba(37,99,235,.15); color: var(--xy-accent); }
.act-ico-invoke .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-invoke { background: rgba(245,158,11,.15); color: #f59e0b; }
.act-ico-reply  .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-reply  { background: rgba(16,185,129,.15); color: #10b981; }
.act-ico-tool   .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-tool   { background: rgba(99,102,241,.15); color: #6366f1; }
.act-ico-assist .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-assist { background: rgba(59,130,246,.15); color: #3b82f6; }
.act-ico-synth  .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-synth  { background: rgba(6,182,212,.15); color: #06b6d4; }
.act-ico-error  .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-error  { background: rgba(220,38,38,.15); color: #fca5a5; }
.act-ico-info   .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-info   { background: rgba(99,102,241,.1); color: #a5b4fc; }
.act-ico-other  .oficina-actividad-icon,
.oficina-actividad-icon.act-ico-other  { background: rgba(255,255,255,.06); color: var(--xy-text-dark-muted); }

/* ═══════════════════════════ OFICINA DETALLE ═══════════════════════════════ */
.ofdet-root {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
}
.ofdet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--ds-space-3);
    padding: 4px 2px 0 2px;
}
.ofdet-header h3 { font-size: 1.05rem; margin: 0; }

/* Layout 2 columnas: diagrama + panel lateral */
.ofdet-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 960px) {
    .ofdet-layout { grid-template-columns: 1fr; }
}

/* ── Títulos de sección ── */
.ofdet-section-title {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--xy-text-dark-muted);
    margin-bottom: 12px;
}
.xy-desktop[data-xy-theme="light"] .ofdet-section-title { color: var(--xy-text-light-muted); }

/* ── Diagrama de árbol (columna izquierda) ── */
.ofdet-diagram-area {
    background: var(--xy-bg-panel);
    border: 1px solid var(--xy-border-dark);
    border-radius: 12px;
    padding: 16px 20px;
    min-height: 300px;
}
.xy-desktop[data-xy-theme="light"] .ofdet-diagram-area {
    background: var(--xy-bg-light-0);
    border-color: var(--xy-border-light);
}
.ofdet-flow-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 16px;
    color: var(--xy-text-dark-muted);
    font-size: .875rem;
}
.ofdet-flow-empty i { font-size: 1.5rem; opacity: .5; }

/* Árbol vertical — cada nivel centrado horizontalmente */
.ofdet-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 8px 0 16px;
}

/* Nivel horizontal del árbol */
.tree-level {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Conectores entre niveles */
.tree-connectors {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 0;
}
.tree-connector-group {
    display: flex;
    justify-content: center;
    width: 90px;
}
.tree-arrow-svg {
    width: 8px;
    height: 28px;
    color: var(--xy-text-dark-muted);
}
.xy-desktop[data-xy-theme="light"] .tree-arrow-svg { color: var(--xy-text-light-muted); }

/* Nodo de agente */
.flow-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    min-width: 90px;
    border-radius: 12px;
    border: 2px solid var(--xy-border-dark);
    background: var(--xy-bg-elevated);
    transition: border-color .2s, box-shadow .2s;
}
.xy-desktop[data-xy-theme="light"] .flow-node {
    border-color: var(--xy-border-light);
    background: var(--xy-bg-light-1);
}
.flow-node-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9375rem;
    color: #fff;
    background: linear-gradient(135deg, var(--xy-primary), var(--xy-accent));
}
.flow-node-label {
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--xy-text-dark);
}
.xy-desktop[data-xy-theme="light"] .flow-node-label { color: var(--xy-text-light); }

.flow-node-model {
    font-size: .625rem;
    color: var(--xy-text-dark-muted);
    font-family: 'Geist Mono', monospace;
}
.flow-node-tokens {
    font-size: .625rem;
    color: var(--xy-text-dark-muted);
    font-family: 'Geist Mono', monospace;
}

.flow-node-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    position: absolute;
    top: 6px; right: 6px;
}

/* Estados del nodo */
.flow-node-active {
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16,185,129,.25);
}
.flow-node-active .flow-node-dot {
    background: #10b981;
    animation: chatDotPulse 1.6s ease-in-out infinite;
}
.flow-node-active .flow-node-avatar {
    background: linear-gradient(135deg, #059669, #10b981);
}
.flow-node-done { border-color: #3b82f6; }
.flow-node-done .flow-node-dot { background: #3b82f6; }
.flow-node-error {
    border-color: #dc2626;
    box-shadow: 0 0 12px rgba(220,38,38,.2);
}
.flow-node-error .flow-node-dot { background: #dc2626; }
.flow-node-error .flow-node-avatar {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
}
.flow-node-idle .flow-node-dot { background: #6b7280; opacity: .5; }

.flow-node-tool {
    font-size: .625rem;
    color: #6366f1;
    background: rgba(99,102,241,.1);
    padding: 2px 8px;
    border-radius: 4px;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-node-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 14px;
    border: 2px solid #10b981;
    opacity: 0;
    animation: flowPulse 2s ease-out infinite;
    pointer-events: none;
}
@keyframes flowPulse {
    0%   { opacity: .5; transform: scale(1); }
    100% { opacity: 0;  transform: scale(1.06); }
}

/* Leyenda */
.ofdet-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--xy-border-dark);
}
.xy-desktop[data-xy-theme="light"] .ofdet-legend { border-color: var(--xy-border-light); }
.ofdet-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .6875rem;
    color: var(--xy-text-dark-muted);
}
.ofdet-legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.ofdet-legend-dot.active { background: #10b981; }
.ofdet-legend-dot.done   { background: #3b82f6; }
.ofdet-legend-dot.error  { background: #dc2626; }
.ofdet-legend-dot.idle   { background: #6b7280; opacity: .5; }

/* ── Panel lateral (columna derecha) ── */
.ofdet-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 8px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.ofdet-panel-section {
    background: var(--xy-bg-panel);
    border: 1px solid var(--xy-border-dark);
    border-radius: 10px;
    padding: 12px 14px;
}
.xy-desktop[data-xy-theme="light"] .ofdet-panel-section {
    background: var(--xy-bg-light-0);
    border-color: var(--xy-border-light);
}
.ofdet-panel-empty {
    padding: 16px 8px;
    text-align: center;
    color: var(--xy-text-dark-muted);
    font-size: .8125rem;
}

/* Agentes en el panel */
.ofdet-agent-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ofdet-agent-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background .12s;
}
.ofdet-agent-row:hover { background: rgba(255,255,255,.04); }
.xy-desktop[data-xy-theme="light"] .ofdet-agent-row:hover { background: rgba(0,0,0,.03); }
.ofdet-agent-row.is-active { background: rgba(16,185,129,.06); }
.ofdet-agent-row.is-error  { background: rgba(220,38,38,.06); }

.ofdet-agent-avatar-sm {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .6875rem;
    color: #fff;
    background: linear-gradient(135deg, var(--xy-primary), var(--xy-accent));
    flex-shrink: 0;
}
.ofdet-agent-info { flex: 1; min-width: 0; }
.ofdet-agent-name {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--xy-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.xy-desktop[data-xy-theme="light"] .ofdet-agent-name { color: var(--xy-text-light); }
.ofdet-agent-meta-line {
    display: flex;
    gap: 6px;
    font-size: .625rem;
    color: var(--xy-text-dark-muted);
    font-family: 'Geist Mono', monospace;
}

.ofdet-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ofdet-status-dot.is-active {
    background: #10b981;
    animation: chatDotPulse 1.6s ease-in-out infinite;
}
.ofdet-status-dot.is-done   { background: #3b82f6; }
.ofdet-status-dot.is-error  { background: #dc2626; }
.ofdet-status-dot.is-idle   { background: #6b7280; opacity: .5; }

/* Timeline en el panel */
.ofdet-timeline-scroll {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
}
.ofdet-tl-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 5px 4px;
    border-radius: 6px;
    animation: chatBubbleIn .15s ease-out;
}
.ofdet-tl-icon {
    width: 22px; height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: .625rem;
    flex-shrink: 0;
}
/* Reusar colores de act-event-* para los iconos */
.ofdet-tl-row.act-event-user   .ofdet-tl-icon { background: rgba(37,99,235,.15); color: var(--xy-accent); }
.ofdet-tl-row.act-event-triaje .ofdet-tl-icon { background: rgba(139,92,246,.15); color: #8b5cf6; }
.ofdet-tl-row.act-event-invoke .ofdet-tl-icon { background: rgba(245,158,11,.15); color: #f59e0b; }
.ofdet-tl-row.act-event-reply  .ofdet-tl-icon { background: rgba(16,185,129,.15); color: #10b981; }
.ofdet-tl-row.act-event-tool   .ofdet-tl-icon { background: rgba(99,102,241,.15); color: #6366f1; }
.ofdet-tl-row.act-event-synth  .ofdet-tl-icon { background: rgba(6,182,212,.15); color: #06b6d4; }
.ofdet-tl-row.act-event-assist .ofdet-tl-icon { background: rgba(59,130,246,.15); color: #3b82f6; }
.ofdet-tl-row.act-event-info   .ofdet-tl-icon { background: rgba(99,102,241,.1); color: #a5b4fc; }
.ofdet-tl-row.act-event-error  .ofdet-tl-icon { background: rgba(220,38,38,.15); color: #fca5a5; }

.ofdet-tl-body { flex: 1; min-width: 0; }
.ofdet-tl-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}
.ofdet-tl-label {
    font-size: .6875rem;
    font-weight: 600;
    color: var(--xy-text-dark);
}
.xy-desktop[data-xy-theme="light"] .ofdet-tl-label { color: var(--xy-text-light); }
.ofdet-tl-time {
    font-size: .625rem;
    color: var(--xy-text-dark-muted);
    font-family: 'Geist Mono', monospace;
    flex-shrink: 0;
}
.ofdet-tl-actor {
    font-size: .625rem;
    color: var(--xy-accent);
    background: rgba(59,130,246,.08);
    padding: 0 6px;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 2px;
}
.ofdet-tl-text {
    font-size: .6875rem;
    color: var(--xy-text-dark-muted);
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 48px;
    overflow: hidden;
}
.xy-desktop[data-xy-theme="light"] .ofdet-tl-text { color: var(--xy-text-light-muted); }

/* Main area — ocupa todo el espacio */
.ofdet-main {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

/* Graph containers — theme light border */
.xy-desktop[data-xy-theme="light"] .ofdet-graph-container {
    background: var(--xy-bg-light-0) !important;
    border-color: var(--xy-border-light) !important;
}

/* Resumen panel */
.ofdet-summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ofdet-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .75rem;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.ofdet-summary-row:last-child { border-bottom: none; }
.ofdet-summary-row span:first-child { color: var(--xy-text-dark-muted); }
.ofdet-summary-row span:last-child { font-weight: 600; font-family: 'Geist Mono', monospace; color: var(--xy-text-dark); }
.xy-desktop[data-xy-theme="light"] .ofdet-summary-row { border-color: rgba(0,0,0,.05); }
.xy-desktop[data-xy-theme="light"] .ofdet-summary-row span:first-child { color: var(--xy-text-light-muted); }
.xy-desktop[data-xy-theme="light"] .ofdet-summary-row span:last-child { color: var(--xy-text-light); }

/* ===== TwinOfficers — marca del escritorio (override de branding XY) ===== */
.xy-desktop-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    user-select: none;
}
.sipen-desktop-brand {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: .12em;
    color: var(--xy-accent, #3b82f6);
    opacity: .35;
}
.sipen-desktop-sub {
    font-size: 1rem;
    color: var(--xy-text-dark-muted, #969696);
    opacity: .6;
    letter-spacing: .04em;
}
.sipen-start-brand {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: .12em;
    color: var(--xy-accent, #3b82f6);
}

/* logo en cabecera del menú inicio */
.sipen-start-logo { height: 34px; width: auto; display: block; }
/* mark grande en el escritorio vacío */
.sipen-desktop-logo { width: 104px; height: 104px; opacity: .5; margin-bottom: 10px; }

/* Logotipo ProjeX (X ventures) en la taskbar (junto al toggle de tema).
   Lee bien en tema claro y oscuro, sin chip. */
.sipen-issemym-logo {
    height: 24px;
    width: auto;
    display: block;
    opacity: .95;
}

/* ===== Ventana de Inicio — bienvenida institucional TwinOfficers ===== */
.sipen-home { display: flex; flex-direction: column; min-height: 100%; position: relative; }
.sipen-home-hero {
    display: flex; align-items: center; gap: 24px;
    padding: 28px 32px;
    background: linear-gradient(120deg, #0d47a1 0%, #0d47a1 55%, #1565c0 100%);
    color: #fff;
}
.sipen-home-logocard {
    flex: 0 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
}
.sipen-home-logocard img { height: 52px; width: auto; display: block; }
.sipen-home-kicker { font-size: .8rem; letter-spacing: .04em; color: #aed581; font-weight: 600; margin-bottom: 4px; }
.sipen-home-title { font-size: 1.9rem; font-weight: 800; margin: 0 0 6px; letter-spacing: .01em; }
.sipen-home-sub { margin: 0; font-size: .98rem; color: rgba(255,255,255,.88); max-width: 60ch; }
.sipen-home-sub strong { color: #aed581; }

.sipen-home-body { padding: 26px 32px 32px; }
.sipen-home-lead { font-size: 1rem; line-height: 1.6; max-width: 80ch; margin: 0 0 26px; opacity: .9; }
.sipen-home-h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 16px; }
.sipen-home-h2::after { content: ""; display: block; width: 46px; height: 3px; background: #1565c0; border-radius: 2px; margin-top: 8px; }

.sipen-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sipen-home-card {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--xy-border-dark);
    border-radius: 12px;
    background: rgba(255,255,255,.02);
}
.xy-desktop[data-xy-theme="light"] .sipen-home-card { border-color: var(--xy-border-light); background: rgba(0,0,0,.015); }
.sipen-home-card h3 { font-size: .95rem; font-weight: 700; margin: 2px 0 4px; }
.sipen-home-card p { font-size: .85rem; line-height: 1.45; margin: 0; opacity: .72; }
.sipen-home-ico {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #0d47a1, #0d47a1);
    color: #aed581;
    font-size: 1.05rem;
}
.sipen-home-foot {
    margin-top: 28px; padding-top: 16px;
    border-top: 1px solid var(--xy-border-dark);
    font-size: .8rem; opacity: .55;
}
.xy-desktop[data-xy-theme="light"] .sipen-home-foot { border-top-color: var(--xy-border-light); }

/* ===== Inicio — secciones adicionales ===== */
.sipen-home-muted { font-size: .85rem; opacity: .6; }
.sipen-home-live { margin-top: 8px; }
.sipen-home-live .fa-database { color: #1565c0; }

/* Cifras institucionales */
.sipen-home-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px; margin-bottom: 26px;
}
.sipen-home-stat {
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 18px; border-radius: 12px;
    border: 1px solid var(--xy-border-dark);
    background: linear-gradient(135deg, rgba(21,101,192,.12), rgba(91,15,36,.06));
}
.xy-desktop[data-xy-theme="light"] .sipen-home-stat { border-color: var(--xy-border-light); }
.sipen-home-stat-num { font-size: 1.7rem; font-weight: 800; color: #1565c0; line-height: 1; }
.xy-desktop[data-xy-theme="light"] .sipen-home-stat-num { color: #0d47a1; }
.sipen-home-stat-lbl { font-size: .82rem; opacity: .75; }

/* Accesos rápidos */
.sipen-home-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 30px; }
.sipen-home-action {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border-radius: 12px; cursor: pointer; text-align: left;
    border: 1px solid var(--xy-border-dark);
    background: rgba(255,255,255,.02); color: inherit;
    transition: border-color .15s, transform .15s, background .15s;
}
.xy-desktop[data-xy-theme="light"] .sipen-home-action { border-color: var(--xy-border-light); background: rgba(0,0,0,.015); }
.sipen-home-action:hover { border-color: #1565c0; transform: translateY(-2px); }
.sipen-home-action-ico {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0d47a1, #0d47a1); color: #aed581; font-size: 1rem;
}
.sipen-home-action-txt { display: flex; flex-direction: column; flex: 1; }
.sipen-home-action-txt strong { font-size: .92rem; }
.sipen-home-action-txt small { font-size: .78rem; opacity: .65; }
.sipen-home-action-arrow { opacity: .4; font-size: .85rem; }
.sipen-home-action:hover .sipen-home-action-arrow { opacity: .9; color: #1565c0; }

/* Modalidades (chips desde BD) */
.sipen-home-mods { display: flex; flex-wrap: wrap; gap: 10px; }
.sipen-home-mod {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 999px;
    border: 1px solid var(--xy-border-dark); background: rgba(255,255,255,.02);
}
.xy-desktop[data-xy-theme="light"] .sipen-home-mod { border-color: var(--xy-border-light); background: rgba(0,0,0,.015); }
.sipen-home-mod-clave {
    font-weight: 800; font-size: .72rem; letter-spacing: .04em;
    color: #aed581; background: linear-gradient(135deg, #0d47a1, #0d47a1);
    padding: 3px 8px; border-radius: 6px;
}
.sipen-home-mod-nom { font-size: .85rem; }
.sipen-home-mod-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }

/* Marco legal */
.sipen-home-legal {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px 18px; border-radius: 12px; line-height: 1.5; font-size: .88rem;
    border-left: 3px solid #1565c0;
    background: rgba(21,101,192,.06);
}
.sipen-home-legal i { color: #1565c0; font-size: 1.1rem; margin-top: 2px; }

/* ===== Inicio — lead embellecido ===== */
.sipen-lead {
    display: flex; gap: 16px; align-items: stretch;
    margin: 4px 0 30px;
    padding: 18px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(21,101,192,.10), rgba(91,15,36,.04));
}
.xy-desktop[data-xy-theme="light"] .sipen-lead { background: linear-gradient(135deg, rgba(21,101,192,.07), rgba(21,101,192,.02)); }
.sipen-lead-bar { flex: 0 0 4px; border-radius: 4px; background: linear-gradient(#1e88e5, #0d47a1); }
.sipen-lead p { margin: 0; font-size: 1.12rem; line-height: 1.72; }
.sipen-lead strong { color: #1e88e5; font-weight: 700; }
.xy-desktop[data-xy-theme="light"] .sipen-lead strong { color: #1565c0; }
.sipen-lead-tag {
    display: inline-block; margin-top: 8px;
    font-style: italic; font-size: .95rem; color: #689f38; font-weight: 600;
}

/* ===== Inicio — gráficas ===== */
.sipen-charts {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 30px;
}
.sipen-chart-wide { grid-column: 1 / -1; }
@media (min-width: 760px) {
    .sipen-charts { grid-template-columns: 1.6fr 1fr; }
    .sipen-chart-wide { grid-column: auto; }
    .sipen-charts > .sipen-chart-card:nth-child(3) { grid-column: 1 / -1; }
}
.sipen-chart-card {
    padding: 16px 18px; border-radius: 14px;
    border: 1px solid var(--xy-border-dark); background: rgba(255,255,255,.02);
}
.xy-desktop[data-xy-theme="light"] .sipen-chart-card { border-color: var(--xy-border-light); background: rgba(0,0,0,.015); }
.sipen-chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.sipen-chart-head > span:first-child { font-weight: 700; font-size: .95rem; }
.sipen-chart-year { font-size: .78rem; opacity: .6; }
.sipen-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.sipen-chart-grid { stroke: currentColor; opacity: .10; stroke-width: 1; stroke-dasharray: 3 4; }
.sipen-chart-axis { fill: currentColor; opacity: .55; font-size: 11px; }

/* dona */
.sipen-donut-wrap { display: flex; align-items: center; gap: 18px; }
.sipen-donut { width: 150px; height: 150px; flex: 0 0 auto; }
.sipen-donut-big { fill: currentColor; font-size: 19px; font-weight: 800; }
.sipen-donut-sub { fill: currentColor; opacity: .55; font-size: 10px; }
.sipen-donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.sipen-legend-row { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.sipen-legend-dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.sipen-legend-lbl { font-weight: 600; }
.sipen-legend-val { margin-left: auto; opacity: .7; }

/* Subtítulo del hero en una sola línea */
.sipen-home-sub { max-width: none; white-space: nowrap; font-size: .95rem; }

/* ===== Login (pantalla completa) ===== */
.sipen-login {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(37,99,235,.18), transparent 60%),
        radial-gradient(900px 500px at 10% 110%, rgba(29,78,216,.16), transparent 60%),
        linear-gradient(160deg, #14161b 0%, #1b1f27 60%, #20242d 100%);
    font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: #e7eaf0;
}
.sipen-login-card {
    width: 380px; max-width: calc(100vw - 32px);
    background: rgba(32,36,44,.72);
    backdrop-filter: blur(18px) saturate(1.1);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    padding: 30px 30px 22px;
    box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.sipen-login-brand { text-align: center; margin-bottom: 18px; }
.sipen-login-logo { width: 60px; height: 60px; }
.sipen-login-title { font-size: 1.7rem; font-weight: 800; letter-spacing: .14em; margin-top: 8px; }
.sipen-login-sub { font-size: .78rem; color: #9aa3b2; letter-spacing: .02em; }
.sipen-login-h { font-size: 1.15rem; font-weight: 700; margin: 6px 0 2px; }
.sipen-login-hint { font-size: .85rem; color: #9aa3b2; margin: 0 0 18px; }
.sipen-login-lbl { display: block; font-size: .78rem; color: #9aa3b2; margin: 12px 0 6px; letter-spacing: .03em; }
.sipen-login-field {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px; padding: 0 12px;
    transition: border-color .15s, background .15s;
}
.sipen-login-field:focus-within { border-color: #3b82f6; background: rgba(59,130,246,.08); }
.sipen-login-field > i { color: #8b93a3; font-size: .9rem; }
.sipen-login-field input {
    flex: 1; background: transparent; border: 0; outline: none;
    color: #e7eaf0; font-size: .95rem; padding: 12px 0;
}
.sipen-login-eye { background: transparent; border: 0; color: #8b93a3; cursor: pointer; padding: 4px; }
.sipen-login-remember { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: #c4cad4; margin: 14px 0 4px; cursor: pointer; }
.sipen-login-error {
    display: flex; align-items: center; gap: 8px;
    font-size: .82rem; color: #fecaca;
    background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.3);
    border-radius: 8px; padding: 9px 12px; margin: 12px 0 0;
}
.sipen-login-btn {
    width: 100%; margin-top: 18px; padding: 12px;
    border: 0; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff; font-size: .95rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: filter .15s, transform .1s;
}
.sipen-login-btn:hover:not(:disabled) { filter: brightness(1.07); }
.sipen-login-btn:active:not(:disabled) { transform: translateY(1px); }
.sipen-login-btn:disabled { opacity: .7; cursor: default; }
.sipen-login-foot { text-align: center; font-size: .72rem; color: #6b7180; margin-top: 18px; }

/* Spinner de arranque mientras se restaura la sesión */
.sipen-boot {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    background: #15171c; color: #3b82f6; font-size: 2rem;
}

/* Logo ProjeX en el login */
.sipen-login-issemym { height: 46px; width: auto; display: block; margin: 0 auto; }

/* ===== Login en TEMA CLARO (respeta el tema guardado) ===== */
html[data-xy-theme="light"] .sipen-login {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(37,99,235,.10), transparent 60%),
        radial-gradient(900px 500px at 10% 110%, rgba(29,78,216,.08), transparent 60%),
        linear-gradient(160deg, #f3f4f6 0%, #e9ebef 60%, #dfe2e7 100%);
    color: #1f2430;
}
html[data-xy-theme="light"] .sipen-login-card {
    background: rgba(255,255,255,.88);
    border-color: rgba(0,0,0,.08);
    box-shadow: 0 24px 70px rgba(0,0,0,.18);
}
html[data-xy-theme="light"] .sipen-login-title { color: #1f2430; }
html[data-xy-theme="light"] .sipen-login-sub,
html[data-xy-theme="light"] .sipen-login-hint,
html[data-xy-theme="light"] .sipen-login-lbl { color: #5b6470; }
html[data-xy-theme="light"] .sipen-login-field {
    background: rgba(0,0,0,.03);
    border-color: rgba(0,0,0,.12);
}
html[data-xy-theme="light"] .sipen-login-field:focus-within { background: rgba(37,99,235,.06); border-color: #2563eb; }
html[data-xy-theme="light"] .sipen-login-field input { color: #1f2430; }
html[data-xy-theme="light"] .sipen-login-field > i,
html[data-xy-theme="light"] .sipen-login-eye { color: #6b7280; }
html[data-xy-theme="light"] .sipen-login-remember { color: #3a414c; }
html[data-xy-theme="light"] .sipen-login-foot { color: #8b93a0; }

/* Boot spinner respeta tema claro */
html[data-xy-theme="light"] .sipen-boot { background: #f3f4f6; }

/* ===== Menú de usuario (taskbar) ===== */
.xy-profile-wrap { position: relative; display: flex; }
.xy-profile-chev { font-size: .7rem; opacity: .5; margin-left: 4px; transition: transform .15s; }
.xy-profile-btn.is-open .xy-profile-chev { transform: rotate(180deg); }

.xy-usermenu-backdrop { position: fixed; inset: 0; z-index: 1200; background: transparent; }
.xy-usermenu {
    position: fixed; right: 10px; bottom: calc(var(--xy-taskbar-h) + 8px);
    width: 250px; z-index: 1201;
    background: rgba(37,37,38,.98);
    border: 1px solid var(--xy-border-dark);
    border-radius: 12px;
    box-shadow: 0 -12px 40px rgba(0,0,0,.55);
    padding: 6px;
    backdrop-filter: blur(18px) saturate(1.1);
    animation: xy-usermenu-in .14s ease-out both;
}
@keyframes xy-usermenu-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.xy-usermenu-head {
    font-size: .8rem; color: var(--xy-text-dark-muted);
    padding: 10px 12px 9px; border-bottom: 1px solid var(--xy-border-dark);
    margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.xy-usermenu-item {
    display: flex; align-items: center; gap: 11px;
    width: 100%; text-align: left;
    background: transparent; border: 0; cursor: pointer;
    color: var(--xy-text-dark); font-size: .88rem;
    padding: 9px 12px; border-radius: 8px;
}
.xy-usermenu-item i { width: 16px; text-align: center; opacity: .8; }
.xy-usermenu-item:hover { background: rgba(255,255,255,.08); }
.xy-usermenu-sep { height: 1px; background: var(--xy-border-dark); margin: 5px 8px; }
.xy-usermenu-danger { color: #f87171; }
.xy-usermenu-danger:hover { background: rgba(220,38,38,.14); }

/* Tema claro */
.xy-desktop[data-xy-theme="light"] .xy-usermenu {
    background: rgba(255,255,255,.99); border-color: var(--xy-border-light);
    box-shadow: 0 -12px 40px rgba(0,0,0,.18);
}
.xy-desktop[data-xy-theme="light"] .xy-usermenu-head { color: var(--xy-text-light-muted); border-bottom-color: var(--xy-border-light); }
.xy-desktop[data-xy-theme="light"] .xy-usermenu-item { color: var(--xy-text-light); }
.xy-desktop[data-xy-theme="light"] .xy-usermenu-item:hover { background: rgba(0,0,0,.05); }
.xy-desktop[data-xy-theme="light"] .xy-usermenu-sep { background: var(--xy-border-light); }
.xy-desktop[data-xy-theme="light"] .xy-usermenu-danger { color: #dc2626; }

/* ===== Login — oscuro/claro neutro + acento institucional XY Ventures (verde #7cb342) ===== */
.sipen-login {
    background:
        radial-gradient(1100px 600px at 82% -12%, rgba(124,179,66,.12), transparent 60%),
        radial-gradient(900px 520px at 8% 112%, rgba(124,179,66,.06), transparent 60%),
        linear-gradient(160deg, #181818 0%, #1f1f1f 60%, #252526 100%);
}
.sipen-login-card { background: rgba(37,37,38,.82); border-color: rgba(255,255,255,.08); }
.sipen-login-field:focus-within { border-color: #7cb342; background: rgba(124,179,66,.08); }
.sipen-login-remember input { accent-color: #7cb342; }
.sipen-login-btn { background: linear-gradient(135deg, #8bc34a 0%, #558b2f 100%); }
.sipen-boot { color: #7cb342; }

/* Login tema claro — sin azules, mismo acento naranja */
html[data-xy-theme="light"] .sipen-login {
    background:
        radial-gradient(1100px 600px at 82% -12%, rgba(124,179,66,.10), transparent 60%),
        linear-gradient(160deg, #f3f4f6 0%, #e9ebef 60%, #dfe2e7 100%);
}
html[data-xy-theme="light"] .sipen-login-field:focus-within { border-color: #7cb342; background: rgba(124,179,66,.06); }

/* Login oscuro — más oscuro (evitar tono café): base casi negra, naranja mínimo */
.sipen-login {
    background:
        radial-gradient(900px 480px at 82% -12%, rgba(124,179,66,.05), transparent 55%),
        linear-gradient(160deg, #0d0d0e 0%, #141415 55%, #1a1a1b 100%);
}
.sipen-login-card { background: rgba(24,24,26,.88); border-color: rgba(255,255,255,.07); }

/* Login — botón oscuro (no naranja) */
.sipen-login-btn {
    background: linear-gradient(180deg, #2c2c31 0%, #212125 100%);
    border: 1px solid rgba(255,255,255,.14);
    color: #f1f1f3;
}
.sipen-login-btn:hover:not(:disabled) { background: linear-gradient(180deg, #34343a 0%, #28282d 100%); filter: none; }
html[data-xy-theme="light"] .sipen-login-btn {
    background: linear-gradient(180deg, #2c2c31 0%, #1f1f23 100%);
    border-color: rgba(0,0,0,.18); color: #fff;
}

/* ===== Logo del portal (imagen real a color: chevrons ProjeX verde/azul) ===== */
.sipen-portal-mask {
    display: inline-block;
    background: url('/img/brand/projex-mark.svg') center / contain no-repeat;
}

/* Tamaño del ícono en el botón de inicio */
.xy-start-toggle .xy-start-toggle-icon { width: 26px; height: 26px; }

/* Cabecera del menú de inicio */
.xy-start-head { display: flex; align-items: center; gap: 12px; }
.sipen-start-headlogo { width: 36px; height: 36px; flex: 0 0 auto; }
.sipen-start-headtxt { display: flex; flex-direction: column; line-height: 1.15; }
.sipen-start-headname { font-weight: 800; letter-spacing: .1em; font-size: 1.05rem; }
.sipen-start-headsub { font-size: .72rem; opacity: .6; }

/* Marca de agua del logo ProjeX (a color, tenue) en el fondo de pantalla */
.xy-wallpaper::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: url('/img/brand/projex-mark.svg') center / 360px no-repeat;
    opacity: .06;
}

/* Botón de inicio: sin azul, fondo neutro según tema */
.xy-start-toggle { background: transparent; }
.xy-start-toggle:hover,
.xy-start-toggle.is-open { background: rgba(255,255,255,.10); }
.xy-desktop[data-xy-theme="light"] .xy-start-toggle:hover,
.xy-desktop[data-xy-theme="light"] .xy-start-toggle.is-open { background: rgba(0,0,0,.06); }

/* Logo del portal en el login (chevrons ProjeX a color real) */
.sipen-login-logomask { width: 96px; height: 72px; margin: 0 auto 4px; }

/* Login tema claro: botón claro (no oscuro) */
html[data-xy-theme="light"] .sipen-login-btn {
    background: linear-gradient(180deg, #ffffff 0%, #eceef2 100%);
    border: 1px solid rgba(0,0,0,.16);
    color: #1f2430;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
html[data-xy-theme="light"] .sipen-login-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #f6f7f9 0%, #e2e5ea 100%);
    filter: none;
}

/* Marca de agua del logotipo ProjeX (wordmark) abajo-derecha del login */
.sipen-login::after {
    content: "";
    position: absolute;
    right: 34px;
    bottom: 26px;
    width: 260px;
    height: 68px;
    background: url('/img/brand/projex-logo.svg') right bottom / contain no-repeat;
    opacity: .10;
    pointer-events: none;
}
html[data-xy-theme="light"] .sipen-login::after { opacity: .12; }
