/* ═══════════════════════════════════════════════════════════════════
   MARSHA THEME CORE F10  —  PALANTIR GRADE
   Build : 2026.03.17_THEME_MARSHA_DEEP_SPACE
   Fuente única de verdad para variables y estilos base.
   index.html NO debe redefinir ninguna de estas variables.
═══════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Orbitron';
    src: url('/fonts/Orbitron.ttf') format('truetype');
    font-weight: 400 800;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/fonts/Inter.woff2') format('woff2');
    font-weight: 300 600;
    font-display: swap;
}

/* ── TOKENS — MARSHA SYSTEM · DEEP SPACE SOVEREIGN ─────────────── */
:root {
    /* Fondos — iceberg profundo */
    --bg:               #080c10;
    --bg-panel:         #0a0e14;
    --bg-surface:       #0d1117;
    --bg-glass:         rgba(8,12,16,0.92);

    /* Bordes — casi invisibles, estructura sutil */
    --border:           rgba(255,255,255,0.06);
    --border-active:    rgba(0,128,255,0.5);
    --border-glow:      rgba(0,128,255,0.15);

    /* Gradientes MARSHA — austeridad cromática */
    --marsha-gradient:  linear-gradient(135deg, #0080FF 0%, #0055CC 100%);
    --nexus-gradient:   linear-gradient(135deg, #0080FF 0%, #0055CC 100%);
    --vault-gradient:   linear-gradient(135deg, #0080FF 0%, #0055CC 100%);
    --herald-gradient:  linear-gradient(135deg, #0080FF 0%, #0055CC 100%);
    --neural-gradient:  radial-gradient(ellipse at center, rgba(0,128,255,0.08) 0%, transparent 70%);

    /* Colores principales — un solo acento azul steel */
    --mia-blue:         #0080FF;   /* azul steel — acento único MARSHA */
    --mia-magenta:      #0066DD;   /* gris slate — elementos secundarios */
    --mia-deep:         #0055CC;   /* azul profundo — hover states */

    /* Texto — jerarquía clara */
    --text-main:        #d4d8e0;   /* gris perla — texto principal */
    --text-muted:       #3a3d4a;   /* gris oscuro — texto silenciado */
    --text-secondary:   #6b7280;   /* gris medio — texto secundario */
    --text-data:        #4DA6FF;   /* azul steel — datos activos */

    /* Estados — colores solo para alertas reales */
    --green:            #3FB950;   /* verde real — presencia online */
    --red:              #e5534b;   /* rojo apagado — emergencia */
    --amber:            #d97706;   /* ámbar — advertencia */

    /* Glow — mínimo, solo en elementos críticos */
    --glow-cyan:        0 0 12px rgba(0,128,255,0.2);
    --glow-magenta:     0 0 12px rgba(0,128,255,0.15);
    --glow-green:       0 0 8px rgba(63,185,80,0.2);

    /* Layout */
    --panel-w:          240px;
    --header-h:         64px;
    --radius:           2px;
    --radius-lg:        4px;
    --transition:       0.3s cubic-bezier(0.4,0,0.2,1);
}

/* Modos por módulo — mismo acento, consistencia total */
body.p2p-active   { --mia-blue: #0080FF; }
body.vault-active { --mia-blue: #0080FF; }
body.mail-active  { --mia-blue: #0080FF; }

/* ── RESET ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    /* Atmósfera espacial MARSHA — nebulosa de fondo */
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,128,255,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(0,128,255,0.04) 0%, transparent 60%),
        radial-gradient(ellipse 40% 30% at 20% 80%, rgba(0,128,255,0.03) 0%, transparent 50%);
}

:focus-visible {
    outline: 1px solid var(--mia-blue);
    outline-offset: 2px;
    border-radius: var(--radius);
}

/* ── BIOMETRIC SHIELD ────────────────────────────────────────────── */
#auth-shield {
    position: fixed; inset: 0;
    background: #010103;
    z-index: 999999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: 1.5s cubic-bezier(0.7,0,0.3,1);
}
#auth-shield.unlocked {
    opacity: 0; pointer-events: none;
    transform: scale(1.06); filter: blur(16px);
}
.wolf-container {
    position: relative; width: 300px; height: 300px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.23,1,0.32,1);
}
.wolf-container:hover  { transform: scale(1.03); }
.wolf-container:active { transform: scale(0.97); }
.cam-circle {
    position: absolute; width: 200px; height: 200px;
    border-radius: 50%; overflow: hidden;
    opacity: 0.1; filter: grayscale(1); z-index: -1;
}
#auth-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.auth-status {
    opacity: 0; pointer-events: none;
    font-family: 'Orbitron'; font-size: 0.55rem;
    letter-spacing: 8px; color: var(--mia-blue);
    text-transform: uppercase; transition: 0.3s;
    margin-top: 24px;
}
.wolf-svg {
    pointer-events: none; width: 100%; height: 100%;
    filter: drop-shadow(0 0 12px rgba(79,172,254,0.35));
    transition: all 0.5s ease;
}
.wolf-path {
    stroke: var(--mia-blue); stroke-width: 0.9;
    fill: rgba(79,172,254,0.015);
    stroke-linejoin: round;
    stroke-dasharray: 2500; stroke-dashoffset: 2500;
    animation: draw 3s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.wolf-eyes {
    fill: var(--mia-blue); stroke: none; opacity: 0.75;
    filter: drop-shadow(0 0 8px var(--mia-blue));
    transform-box: fill-box; transform-origin: center;
    animation: eyePulse 1.4s infinite alternate ease-in-out;
}
@keyframes eyePulse {
    0%   { transform: scale(0.94); opacity: 0.55; }
    100% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 16px var(--mia-blue)); }
}
.scan-node {
    fill: #fff; filter: blur(1px) drop-shadow(0 0 8px #fff);
    offset-path: path("M100,15 L130,30 L170,20 L140,60 L160,70 L180,90 L165,130 L145,150 L125,165 L115,195 L100,200 L85,195 L75,165 L55,150 L35,130 L20,90 L40,70 L60,60 L30,20 L70,30 Z");
    animation: nodeTravel 3s infinite linear; opacity: 0;
}
.scanning .scan-node { opacity: 1; }
@keyframes nodeTravel { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } }
.authorized .wolf-svg  { filter: drop-shadow(0 0 32px var(--green)); transform: scale(1.04); }
.authorized .wolf-path { stroke: var(--green) !important; fill: rgba(74,222,128,0.08) !important; }
.authorized .wolf-eyes { fill: var(--green) !important; filter: drop-shadow(0 0 16px var(--green)); }

/* ── ROOT LAYOUT ─────────────────────────────────────────────────── */
#root-layout {
    display: flex !important;
    width: 100vw; height: 100vh;
    opacity: 0; transition: opacity 1.2s ease;
    position: relative; z-index: 1;
}
#root-layout.visible { opacity: 1; }

#p2p-canvas {
    position: absolute; inset: 0;
    pointer-events: none; opacity: 0; transition: 1s; z-index: 0;
}
body.p2p-active #p2p-canvas,
body.vault-active #p2p-canvas { opacity: 0.3; }

/* ── LEFT PANEL ──────────────────────────────────────────────────── */
.left-panel {
    width: var(--panel-w);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    background: var(--bg-panel);
    z-index: 10; flex-shrink: 0;
    transition: margin var(--transition);
    /* Glow lateral sutil */
    box-shadow: inset -1px 0 0 rgba(0,128,255,0.05);
}
.left-panel.collapsed { margin-left: calc(-1 * var(--panel-w) + 12px); }

.collapse-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer;
    width: 20px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; z-index: 100;
    transition: color var(--transition), background var(--transition);
}
.collapse-btn:hover { color: var(--mia-blue); background: rgba(79,172,254,0.06); }
.collapse-btn-left  { right: -20px; border-radius: 0 3px 3px 0; border-left: none; }
.collapse-btn-right { left:  -20px; border-radius: 3px 0 0 3px; border-right: none; }

.logo-area {
    height: var(--header-h);
    display: flex; align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.logo-img { height: 52px; width: auto; }

.hist-container { flex: 1; padding: 20px; overflow-y: auto; }
.hist-container::-webkit-scrollbar { width: 3px; }
.hist-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-title {
    font-family: 'Orbitron'; font-size: 0.5rem;
    letter-spacing: 2px; color: var(--text-muted);
    margin-bottom: 16px; font-weight: 600;
    text-transform: uppercase;
    display: flex; justify-content: space-between; align-items: center;
}
.hist-item {
    font-size: 0.7rem; padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary); cursor: pointer;
    transition: color 0.2s, padding-left 0.2s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist-item:hover { color: var(--mia-blue); padding-left: 4px; }

.btn-purge {
    margin: 16px 20px; padding: 8px 12px;
    border: 1px solid rgba(248,113,113,0.15);
    color: rgba(248,113,113,0.5);
    font-family: 'Orbitron'; font-size: 0.4rem;
    letter-spacing: 1px;
    text-align: center; cursor: pointer;
    transition: all 0.2s; border-radius: var(--radius);
}
.btn-purge:hover {
    background: rgba(248,113,113,0.06);
    color: var(--red);
    border-color: rgba(248,113,113,0.4);
}

/* ── HEADER ──────────────────────────────────────────────────────── */
.main-view {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; z-index: 2; position: relative;
}
header {
    height: var(--header-h); flex-shrink: 0;
    padding: 0 32px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    position: relative; z-index: 5;
    /* Línea holográfica inferior */
    box-shadow: 0 1px 0 rgba(0,128,255,0.12), 0 4px 24px rgba(0,0,0,0.4);
}

/* Scanline sutil en header — efecto terminal espacial */
header::after {
    content: '';
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--mia-blue), transparent);
    opacity: 0.4;
    animation: scanHeader 4s ease-in-out infinite;
}
@keyframes scanHeader {
    0%, 100% { opacity: 0.2; transform: scaleX(0.3); }
    50%       { opacity: 0.6; transform: scaleX(1); }
}
.mia-title {
    font-family: 'Orbitron'; font-size: 0.85rem; letter-spacing: 5px;
    background: var(--marsha-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700; transition: background 0.5s;
    /* Glow holográfico en el título */
    filter: drop-shadow(0 0 12px rgba(0,128,255,0.3));
}
.header-controls { display: flex; gap: 20px; align-items: center; }

.lang-switch {
    font-family: 'Orbitron'; font-size: 0.45rem; color: var(--text-muted);
    cursor: pointer; display: flex; gap: 6px; align-items: center;
    border: 1px solid var(--border); padding: 4px 10px;
    border-radius: var(--radius); transition: border-color 0.2s;
}
.lang-switch:hover { border-color: var(--border-active); }
.lang-switch span.active { color: var(--mia-blue); }

.sys-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
#sys-txt {
    font-family: 'Orbitron'; font-size: 0.5rem;
    letter-spacing: 1px; font-weight: 600;
    color: var(--green); transition: color 0.3s;
}
.sw-track {
    width: 36px; height: 18px;
    background: rgba(255,255,255,0.04);
    border-radius: 9px; position: relative;
    border: 1px solid var(--border);
}
.sw-thumb {
    width: 12px; height: 12px; background: white;
    border-radius: 50%; position: absolute;
    top: 2px; left: 20px; transition: left 0.25s;
}


/* ── MI POST — selector destinatario solo mobile ─────── */
#mail-to-select { display: none; }

/* ── MODULE TABS ─────────────────────────────────────────────────── */
.selector-area {
    display: flex; gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    background: var(--bg-panel);
    flex-shrink: 0; z-index: 4;
}
.mode-btn {
    font-family: 'Orbitron'; font-size: 0.55rem; letter-spacing: 2px;
    color: var(--text-muted); font-weight: 600; cursor: pointer;
    padding: 14px 20px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    white-space: nowrap; position: relative;
    outline: none; border-radius: 0;
    -webkit-tap-highlight-color: transparent;
}
.mode-btn:focus { outline: none; }
.mode-btn:focus-visible { outline: none; }
.mode-btn:hover { color: var(--text-main); }
.mode-btn.active {
    color: var(--mia-blue);
    border-bottom-color: var(--mia-blue);
    text-shadow: 0 0 12px rgba(0,128,255,0.6);
}

/* ── WORK ZONES ──────────────────────────────────────────────────── */
#chat-wall, #teams-wall {
    flex: 1; overflow-y: auto;
    padding: 32px 20% 32px;
    scroll-behavior: smooth;
}
/* MOBILE: sin padding lateral desktop */
@media (max-width: 768px) {
    #chat-wall, #teams-wall {
        padding: 0 !important;
    }
}
#chat-wall::-webkit-scrollbar { width: 3px; }
#chat-wall::-webkit-scrollbar-thumb { background: var(--border); }

.msg { margin-bottom: 24px; font-size: 0.875rem; line-height: 1.7; word-wrap: break-word; }
.msg-label {
    font-family: 'Orbitron'; font-size: 0.42rem;
    color: var(--text-muted); margin-bottom: 6px;
    letter-spacing: 1.5px; text-transform: uppercase;
}
.row-user {
    border-left: 2px solid var(--mia-magenta);
    padding-left: 16px;
    box-shadow: -4px 0 12px rgba(0,128,255,0.08);
}
.row-mia  {
    border-left: 2px solid var(--mia-blue);
    padding-left: 16px;
    box-shadow: -4px 0 12px rgba(0,128,255,0.1);
}

#vault-wall {
    display: none; flex: 1; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px;
}
#mail-wall {
    display: none; flex: 1; flex-direction: column;
    overflow-y: auto; padding: 32px 20%;
}
.dept-tabs {
    display: flex; gap: 8px; margin-bottom: 24px;
    justify-content: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px; overflow-x: auto;
}
.dept-tab {
    font-family: 'Orbitron'; font-size: 0.45rem; letter-spacing: 1px;
    padding: 6px 14px; border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; border-radius: var(--radius);
    transition: all 0.2s; white-space: nowrap;
}
.dept-tab:hover  { border-color: var(--border-active); color: var(--mia-blue); }
.dept-tab.active { border-color: var(--mia-blue); color: var(--mia-blue); background: rgba(79,172,254,0.06); }

.drop-zone {
    width: 60%; max-width: 500px; height: 260px;
    border: 1px dashed rgba(245,158,11,0.25);
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    transition: all 0.2s; background: rgba(255,215,0,0.01);
    cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
    background: rgba(245,158,11,0.05);
    border-color: var(--amber);
}
.drop-zone.secure-state {
    border-color: var(--green);
    background: rgba(74,222,128,0.04);
    box-shadow: 0 0 16px rgba(74,222,128,0.08);
}
.vault-title {
    font-family: 'Orbitron'; font-size: 0.65rem;
    letter-spacing: 3px; color: var(--amber);
}

/* ── INPUT ZONE ──────────────────────────────────────────────────── */
.input-zone {
    padding: 16px 32px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    flex-shrink: 0;
}
body.vault-active .input-zone { display: none !important; }
body.mail-active  .input-zone { display: none !important; }

.bar-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 12px 20px; border-radius: var(--radius);
    display: flex; gap: 16px; align-items: center;
    transition: border-color 0.2s;
}
.bar-container:focus-within { border-color: var(--border-active); }

input[type="text"]:not(.auth-input):not(.guest-input), #user-input {
    flex: 1; background: transparent; border: none;
    color: var(--text-main); font-size: 0.875rem; outline: none;
    font-family: 'Inter', sans-serif;
    resize: none; line-height: 1.5;
    min-height: 24px; max-height: 120px;
    overflow-y: auto; width: 100%;
}
input[type="text"]::placeholder { color: var(--text-muted); }

.btn-exec {
    background: transparent;
    border: 1px solid rgba(0,128,255,0.5);
    color: #4DA6FF; padding: 9px 24px;
    font-family: 'Orbitron'; font-size: 0.5rem;
    letter-spacing: 1px;
    cursor: pointer; font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.2s;
    white-space: nowrap; flex-shrink: 0;
}
.btn-exec:hover {
    background: rgba(0,128,255,0.08);
    border-color: #0080FF;
    color: #fff;
    transform: translateY(-1px);
}

.e2e-bar { display: none; }
.nodes-flow {
    margin-top: 10px; display: flex;
    justify-content: center; align-items: center;
}
.node-dot {
    width: 4px; height: 4px;
    background: rgba(0,128,255,0.15);
    border-radius: 50%; animation: led-sequence 2.8s infinite;
}
.node-line {
    width: 32px; height: 1px;
    background: rgba(255,255,255,0.04);
    position: relative; overflow: hidden;
}
.node-line::after {
    content: ""; position: absolute; top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74,222,128,0.4), transparent);
    animation: data-spark 2.8s infinite linear;
}
.nodes-flow .node-dot:nth-child(1)       { animation-delay: 0s; }
.nodes-flow .node-line:nth-child(2)::after { animation-delay: 0.4s; }
.nodes-flow .node-dot:nth-child(3)       { animation-delay: 0.8s; }
.nodes-flow .node-line:nth-child(4)::after { animation-delay: 1.2s; }
.nodes-flow .node-dot:nth-child(5)       { animation-delay: 1.6s; }
.nodes-flow .node-line:nth-child(6)::after { animation-delay: 2.0s; }
.nodes-flow .node-dot:nth-child(7)       { animation-delay: 2.4s; }
@keyframes data-spark   { 0% { left: -100%; } 100% { left: 200%; } }
@keyframes led-sequence {
    0%, 80%   { background: rgba(0,128,255,0.15); box-shadow: none; }
    90%, 100% { background: var(--mia-blue); box-shadow: 0 0 8px var(--mia-blue); }
}

/* ── RIGHT PANEL ─────────────────────────────────────────────────── */
.right-panel {
    width: var(--panel-w); background: var(--bg-panel);
    border-left: 1px solid var(--border);
    padding: 24px 20px;
    transition: margin var(--transition);
    position: relative; display: flex; flex-direction: column;
    flex-shrink: 0; z-index: 10;
    box-shadow: inset 1px 0 0 rgba(0,128,255,0.05);
}
.right-panel.collapsed { margin-right: calc(-1 * var(--panel-w) + 12px); }

.progress-bg   {
    height: 2px; background: rgba(0,128,255,0.06);
    margin-bottom: 20px; border-radius: 1px;
}
.progress-fill {
    height: 100%; background: var(--marsha-gradient);
    transition: width 1s; border-radius: 1px;
    box-shadow: 0 0 8px rgba(0,128,255,0.3);
}

.key-box {
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--border); display: none;
}
body.p2p-active .key-box { display: block; }

.key-display {
    font-family: monospace; font-size: 0.45rem; color: var(--mia-blue);
    background: rgba(0,0,0,0.3); padding: 10px; display: block;
    margin: 8px 0; border: 1px dashed rgba(79,172,254,0.2);
    word-break: break-all; border-radius: var(--radius);
}
.key-input-styled {
    width: 100%; background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main); font-family: 'Orbitron'; font-size: 0.45rem;
    padding: 10px; margin-bottom: 8px; outline: none;
    border-radius: var(--radius); transition: border-color 0.2s;
}
.key-input-styled:focus { border-color: var(--border-active); }

.key-btn {
    width: 100%; padding: 9px; font-family: 'Orbitron'; font-size: 0.42rem;
    letter-spacing: 1px;
    background: transparent; border: 1px solid var(--mia-blue);
    color: var(--mia-blue); cursor: pointer;
    transition: background 0.2s; border-radius: var(--radius);
    margin-bottom: 6px;
}
.key-btn:hover { background: rgba(79,172,254,0.08); }

.dep-link-header  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.dep-link-title   { font-family: 'Orbitron'; font-size: 0.5rem; font-weight: 700; color: var(--mia-blue); letter-spacing: 1.5px; text-transform: uppercase; }
.dep-link-status  { color: var(--text-muted); font-size: 0.42rem; white-space: nowrap; }
.status-online    { color: var(--green) !important; font-weight: 700; }

.footer-right {
    margin-top: auto; padding-top: 16px; text-align: center;
    border-top: 1px solid var(--border);
}
.web-link  { font-family: 'Orbitron'; font-size: 0.52rem; color: #6b7280; text-decoration: none; letter-spacing: 1px; transition: color 0.2s; }
.web-link:hover { color: var(--mia-blue); }
.copy-txt  { font-family: 'Orbitron'; font-size: 0.44rem; color: rgba(255,255,255,0.15); margin-top: 6px; }

/* ── SYSTEM INDICATOR ────────────────────────────────────────────── */
#top1-indicator {
    position: fixed; bottom: 16px; right: 16px;
    font-family: 'Orbitron'; font-size: 0.5rem; letter-spacing: 1px;
    padding: 6px 14px; border-radius: var(--radius);
    border: 1px solid rgba(0,128,255,0.2);
    background: rgba(2,5,9,0.92);
    color: var(--green); z-index: 9999;
    pointer-events: none;
    backdrop-filter: blur(12px);
    box-shadow: var(--glow-cyan), inset 0 0 20px rgba(0,128,255,0.03);
}
.status-critical { color: var(--red)   !important; border-color: rgba(248,113,113,0.3) !important; animation: pulse-red 1.5s infinite; }
.status-degraded { color: var(--amber) !important; border-color: rgba(245,158,11,0.3) !important; }
.status-top1     { color: var(--green) !important; border-color: rgba(74,222,128,0.3) !important; }
@keyframes pulse-red { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── ANALYSIS ZONE ───────────────────────────────────────────────── */
#analysis-zone {
    display: none; position: fixed; inset: 0;
    flex-direction: column; align-items: center; justify-content: center;
    padding: 40px; z-index: 100000;
    background: rgba(5,5,8,0.96);
    backdrop-filter: blur(12px);
}
#viewer-container {
    width: 80%; height: 78%; background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}

/* ── VIDEO GRID (TEAMS) ──────────────────────────────────────────── */
#video-grid {
    display: none; flex-wrap: wrap;
    gap: 12px; padding: 20px;
    justify-content: center; align-items: center;
    flex: 1;
}
#video-grid video {
    width: 320px; border-radius: var(--radius);
    border: 1px solid var(--border-active);
    background: #000;
}

/* ── INACTIVE STATE ──────────────────────────────────────────────── */
body.inactive-sys { filter: grayscale(0.15) contrast(0.92); }
body.inactive-sys .btn-exec     { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
body.inactive-sys .sw-thumb     { left: 3px !important; background: var(--red); }
body.inactive-sys #sys-txt      { color: var(--red); }
body.inactive-sys input         { pointer-events: none; opacity: 0.3; }
body.inactive-sys .node-dot,
body.inactive-sys .node-line::after { animation-play-state: paused !important; opacity: 0.1; }

/* ── HUB — INDICADOR DE MENSAJE NUEVO ──────────────────────── */
.hub-dept-item.has-new {
    position: relative;
}
.hub-dept-item.has-new::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0080FF;
    box-shadow: 0 0 6px #0080FF;
    animation: pulse-new 1.5s infinite;
}
@keyframes pulse-new {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50%       { opacity: 0.4; transform: translateY(-50%) scale(0.7); }
}
.hub-dept-item .unread-count {
    display: none;
    font-family: "Share Tech Mono", monospace;
    font-size: 0.4rem;
    background: #0080FF;
    color: #000;
    border-radius: 8px;
    padding: 1px 5px;
    margin-left: 6px;
    font-weight: 700;
}
.hub-dept-item.has-new .unread-count { display: inline; }

/* ── FOCUS MODE — transparencia escritorio ──────────────────── */



/* ── IRIS CONTROLS — enterprise buttons ───────────────────────── */
.iris-ctrl-btn {
    background: rgba(0,128,255,0.06);
    border: 1px solid rgba(0,128,255,0.25);
    color: #4DA6FF;
    font-family: 'Orbitron', monospace;
    font-size: 0.4rem;
    letter-spacing: 2px;
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.iris-ctrl-btn:hover {
    background: rgba(0,128,255,0.12);
    border-color: rgba(0,128,255,0.6);
}
.iris-ctrl-btn.muted,
.iris-ctrl-btn.cam-off {
    background: rgba(229,83,75,0.1);
    border-color: rgba(229,83,75,0.5);
    color: #e5534b;
}

/* ── UI-CONTRAST — jerarquía visual títulos > texto ───────────── */
.right-panel-section-title,
.hub-section-label,
.vault-section-label,
.iris-section-label {
    color: #d4d8e0;
    font-family: 'Orbitron', monospace;
    letter-spacing: 3px;
    font-size: 0.42rem;
}


/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — MARSHA F10
   Breakpoints: 768px (tablet) · 480px (phone)
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* ══ MOBILE APP LAYOUT — Palantir style ══════════════════ */

    /* Ocultar left panel — nav ya está en selector-area tabs  */
    .left-panel  { display: none !important; }
    .right-panel { display: none !important; }

    #root-layout {
        flex-direction: column;
        overflow: hidden;
        height: 100dvh;
        height: 100svh;
    }

    /* Main view ocupa todo el viewport como app nativa */
    .main-view {
        width: 100% !important;
        min-width: 0 !important;
        height: 100dvh !important;
        height: 100svh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* ── HEADER compacto ─────────────────────────────────── */
    header {
        height: 52px !important;
        padding: 0 16px !important;
        flex-shrink: 0 !important;
        border-bottom: 1px solid rgba(0,128,255,0.12) !important;
        background: rgba(10,14,20,0.99) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
    }

    .mia-title {
        font-size: 0.48rem !important;
        letter-spacing: 2px !important;
    }

    /* ── NAV TABS — BOTTOM BAR enterprise mobile ─────────── */
    .selector-area {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        height: 56px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        justify-content: space-around !important;
        padding: 0 0 env(safe-area-inset-bottom) 0 !important;
        gap: 0 !important;
        border-top: 1px solid rgba(0,128,255,0.15) !important;
        border-bottom: none !important;
        background: rgba(8,12,18,0.98) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        z-index: 9999 !important;
        overflow: visible !important;
        flex-shrink: 0 !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
    }
    .selector-area::-webkit-scrollbar { display: none; }

    /* MI POST select — visible solo mobile */
    #mail-to-select {
        display: block !important;
    }

    .mode-btn {
        flex: 1 !important;
        font-size: 0.58rem !important;
        padding: 6px 2px 4px !important;
        letter-spacing: 1px !important;
        height: 56px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border-bottom: none !important;
        border-top: 2px solid transparent !important;
        min-width: 0 !important;
        white-space: nowrap !important;
    }
    .mode-btn.active {
        color: #0080FF !important;
        border-top-color: #0080FF !important;
        border-bottom: none !important;
        background: rgba(0,128,255,0.06) !important;
        text-shadow: 0 0 10px rgba(0,128,255,0.5) !important;
    }
        background: rgba(0,128,255,0.06) !important;
        text-shadow: 0 0 10px rgba(0,128,255,0.5) !important;
    }

    /* ── CONTENT PANELS — flex:1 sin tocar display (JS lo controla) ── */
    #chat-wall,
    #teams-wall,
    #mail-wall,
    #vault-wall,
    #iris-wall,
    #nexo-wall {
        flex: 1 !important;
        flex-direction: column !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding-bottom: 72px !important;
    }

    #teams-wall {
        flex-direction: column !important;
        flex: 1 !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    #hub-chat-wall {
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 10px 12px !important;
        min-height: 0 !important;
    }

    #mia-output {
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
    }

    /* ── INPUT ZONE — fijo al bottom con safe area iOS ──── */
    .input-zone {
        flex-shrink: 0 !important;
        padding: 10px 14px !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
        border-top: 1px solid rgba(0,128,255,0.12) !important;
        background: rgba(10,14,20,0.99) !important;
        backdrop-filter: blur(12px) !important;
        margin-bottom: 56px !important;
    }

    .bar-container {
        gap: 8px !important;
    }

    #user-input {
        font-size: 13px !important;
        min-height: 36px !important;
        max-height: 120px !important;
        padding: 8px 10px !important;
        line-height: 1.4 !important;
    }

    #btn-send {
        height: 36px !important;
        padding: 0 14px !important;
        font-size: 0.38rem !important;
        flex-shrink: 0 !important;
    }

    /* Ocultar e2e-bar y nodes-flow en móvil */
    .e2e-bar    { display: none !important; }
    .nodes-flow { display: none !important; }

    /* ── HUB BUBBLES ─────────────────────────────────────── */
    .hub-bubble {
        max-width: 80% !important;
        font-size: 0.7rem !important;
        padding: 10px 14px !important;
        line-height: 1.5 !important;
    }

    /* ── MI POST ─────────────────────────────────────────── */
    #email-inbox-container {
        flex: 1 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 8px !important;
        margin: 6px 0 4px !important;
    }

    #mail-body {
        font-size: 0.65rem !important;
    }

    /* ── VAULT ───────────────────────────────────────────── */
    #vault-file-list > div {
        grid-template-columns: 36px 1fr 50px !important;
        font-size: 0.48rem !important;
    }

    #vault-file-list > div > div:nth-child(4),
    #vault-file-list > div > div:nth-child(5) {
        display: none !important;
    }

    /* ── IRIS ────────────────────────────────────────────── */
    #iris-grid {
        flex: 1 !important;
        padding: 8px !important;
        gap: 6px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #iris-grid > div[data-peer] {
        flex: 0 1 100% !important;
        max-width: 100% !important;
        aspect-ratio: 16/9 !important;
    }

    .iris-ctrl-btn {
        padding: 8px 14px !important;
        font-size: 0.38rem !important;
    }

    /* ── FLOAT WINDOW ────────────────────────────────────── */
    #iris-float-win {
        width: 150px !important;
        bottom: 80px !important;
        right: 10px !important;
    }

    /* ── MODALES ─────────────────────────────────────────── */
    #vault-share-modal > div > div {
        min-width: 90vw !important;
        max-width: 96vw !important;
    }

    #iris-pre-invite-modal > div,
    #iris-invite-modal > div {
        width: 92vw !important;
        padding: 16px !important;
    }
}

@media (max-width: 480px) {

    /* ── TIPOGRAFÍA PHONE ────────────────────────────────── */
    body { font-size: 13px; }

    .mia-title { font-size: 0.42rem !important; }

    header { height: 48px !important; }

    .mode-btn {
        font-size: 0.58rem !important;
        padding: 4px 9px !important;
    }

    /* Badge IRIS compacto */
    #iris-call-badge        { padding: 3px 6px !important; }
    #iris-call-badge-label  { font-size: 0.34rem !important; }

    /* ── IRIS grid — stack vertical ──────────────────────── */
    #iris-grid {
        flex-direction: column !important;
        align-items: center !important;
    }

    #iris-grid > div[data-peer] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ── VAULT phone ─────────────────────────────────────── */
    #vault-file-list > div {
        grid-template-columns: 32px 1fr 48px !important;
    }

    /* ── INPUT phone — 16px mínimo para evitar autozoom iOS ── */
    #user-input,
    #mail-body,
    input,
    textarea {
        font-size: 16px !important;
    }
}
