/* ============================================================
   Modo IA — Chat profesional minimalista B&W
   Input centrado → anima al bottom al enviar (estilo Claude)
   ============================================================ */

:root {
    --bg: #050507;
    --bg-soft: #0c0c10;
    --bg-elev: #14141a;
    --bg-hover: #1c1c22;
    --bg-bubble: #1a1a20;
    --border: rgba(255, 255, 255, 0.07);
    --border-mid: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.24);
    --text: #f4f4f6;
    --text-soft: #a3a3ac;
    --text-mute: #62626c;
    --text-dim: #3a3a42;
    --danger: #ff5e5e;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-bubble: 18px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    --shadow: 0 20px 60px rgba(0,0,0,0.7);
    --ease: cubic-bezier(.16, 1, .3, 1);
    --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body.ia-body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    position: relative;
}

/* Math/grid backdrop — más visible */
body.ia-body::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.038) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.038) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(90vw 90vh at 50% 50%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(90vw 90vh at 50% 50%, black 30%, transparent 80%);
    animation: grid-fade-in 1.8s var(--ease) both;
}
@keyframes grid-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
body.ia-body::after {
    content: '';
    position: fixed;
    top: -50vh; left: 50%;
    transform: translateX(-50%);
    width: 90vw; height: 90vh;
    background: radial-gradient(closest-side, rgba(255,255,255,0.045), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   Antigravity-style grid waves
   Cuadrícula coloreada que respira y se desplaza en ondas suaves
   (mismo concepto que los puntos animados del IDE Antigravity,
    pero aplicado a la cuadrícula del fondo)
   ============================================================ */
@property --wx {
    syntax: '<percentage>';
    initial-value: 50%;
    inherits: false;
}
@property --wy {
    syntax: '<percentage>';
    initial-value: 50%;
    inherits: false;
}

.ia-grid-wave {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(currentColor 1px, transparent 1px),
        linear-gradient(90deg, currentColor 1px, transparent 1px);
    background-size: 48px 48px;
    mix-blend-mode: screen;
    opacity: 0;
    will-change: --wx, --wy;
    -webkit-mask-image: radial-gradient(ellipse 28vw 26vh at var(--wx) var(--wy),
                          rgba(0,0,0,0.80) 0%,
                          rgba(0,0,0,0.40) 38%,
                          transparent 72%);
            mask-image: radial-gradient(ellipse 28vw 26vh at var(--wx) var(--wy),
                          rgba(0,0,0,0.80) 0%,
                          rgba(0,0,0,0.40) 38%,
                          transparent 72%);
}
@keyframes wave-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.ia-grid-wave--blue {
    color: rgba(109, 163, 255, 0.30);
    animation: wave-fade-in 5s cubic-bezier(.35,0,.65,1) 1s both,
               wave-flow-blue 38s ease-in-out 5s infinite;
}
.ia-grid-wave--purple {
    color: rgba(180, 120, 255, 0.22);
    animation: wave-fade-in 5s cubic-bezier(.35,0,.65,1) 1.6s both,
               wave-flow-purple 46s ease-in-out 5.8s infinite;
}
.ia-grid-wave--cyan {
    color: rgba(94, 220, 255, 0.18);
    animation: wave-fade-in 5s cubic-bezier(.35,0,.65,1) 2.2s both,
               wave-flow-cyan 54s ease-in-out 6.6s infinite;
}
/* Las olas empiezan y terminan en el centro (50/50, igual que el initial-value
   de @property), así no hay "salto" cuando arranca la animación. */
@keyframes wave-flow-blue {
    0%, 100% { --wx: 50%; --wy: 50%; }
    20%      { --wx: 22%; --wy: 32%; }
    40%      { --wx: 76%; --wy: 38%; }
    60%      { --wx: 84%; --wy: 72%; }
    80%      { --wx: 30%; --wy: 80%; }
}
@keyframes wave-flow-purple {
    0%, 100% { --wx: 50%; --wy: 50%; }
    20%      { --wx: 78%; --wy: 68%; }
    40%      { --wx: 24%; --wy: 60%; }
    60%      { --wx: 46%; --wy: 22%; }
    80%      { --wx: 74%; --wy: 30%; }
}
@keyframes wave-flow-cyan {
    0%, 100% { --wx: 50%; --wy: 50%; }
    33%      { --wx: 28%; --wy: 78%; }
    66%      { --wx: 76%; --wy: 28%; }
}
@media (prefers-reduced-motion: reduce) {
    .ia-grid-wave--blue,
    .ia-grid-wave--purple,
    .ia-grid-wave--cyan {
        animation: wave-fade-in 5s cubic-bezier(.35,0,.65,1) 1s both;
    }
}

kbd {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-soft);
}

/* ============================================================
   Mode toggle (top-right) — texto + flechas que giran al hover
   ============================================================ */
.mode-toggle {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 0;
    color: var(--text-soft);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -.1px;
    text-decoration: none;
    border-radius: 999px;
    cursor: pointer;
    transition: color .25s var(--ease), background .25s var(--ease);
    animation: fade-down-y .7s var(--ease) .1s both;
}
.mode-toggle i {
    font-size: 12px;
    color: var(--text-mute);
    transition: transform .55s cubic-bezier(.34, 1.3, .64, 1), color .25s var(--ease);
}
.mode-toggle:hover {
    color: var(--text);
    background: var(--bg-hover);
}
.mode-toggle:hover i {
    color: var(--text);
    transform: rotate(360deg);
}
@keyframes fade-down-y {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Mantengo el viejo keyframe por compat */
@keyframes fade-down {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 600px) {
    .mode-toggle { top: 10px; right: 10px; padding: 7px 12px; font-size: 12px; }
    .mode-toggle span { display: none; }
    .mode-toggle i { font-size: 14px; }
}

/* ============================================================
   App / layout
   ============================================================ */
.ia-app {
    display: flex;
    height: 100dvh;
    width: 100%;
    position: relative;
    z-index: 1;
}
.ia-main {
    flex: 1;
    position: relative;
    min-width: 0; min-height: 0;
}

/* ============================================================
   Sidebar drawer
   ============================================================ */
.ia-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 290px;
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .4s var(--ease);
    display: flex; flex-direction: column;
    padding: 18px 12px;
    gap: 12px;
}
.is-sidebar-open .ia-sidebar { transform: translateX(0); }

/* Top del sidebar: wordmark + acciones (estilo Claude) */
.ia-sidebar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 6px 4px 8px;
    min-height: 32px;
}
.ia-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}
.ia-sidebar__avatar {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.ia-sidebar__brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.ia-sidebar__wordmark {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ia-sidebar__subtitle {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-mute);
    letter-spacing: -.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ia-sidebar__top-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* Section header (ej. "Recientes" arriba del historial) */
.ia-sidebar__section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 6px 6px;
    gap: 6px;
}
.ia-sidebar__section-title {
    font-family: var(--font);
    font-size: 11.5px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-mute);
    font-weight: 500;
}
.ia-iconbtn {
    background: transparent; border: 0;
    color: var(--text-soft); cursor: pointer;
    padding: 6px; border-radius: 6px;
    transition: color .2s var(--ease), background .2s var(--ease);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.ia-iconbtn:hover { color: var(--text); background: var(--bg-hover); }

/* Quick action buttons (Proyectos / Stack / Hackathones / Contacto) */
.ia-quickbtns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.ia-quickbtn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 9px 11px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 12px; font-weight: 500;
    cursor: pointer;
    transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), transform .12s;
    text-align: left;
    overflow: hidden;
}
.ia-quickbtn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ia-quickbtn:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--border-mid);
}
.ia-quickbtn:active { transform: translateY(1px); }
.ia-quickbtn i { font-size: 10.5px; color: var(--text-mute); transition: color .2s; }
.ia-quickbtn:hover i { color: var(--text); }

.ia-newchat {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px;
    width: 100%; padding: 8px 10px;
    background: transparent;
    border: 0;
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 13.5px; font-weight: 500;
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
    letter-spacing: -.1px;
    text-align: left;
}
.ia-newchat:hover { background: var(--bg-hover); }
.ia-newchat:active { background: var(--bg-elev); }
.ia-newchat__icon {
    font-size: 18px;
    line-height: 1;
    color: var(--text-soft);
    flex-shrink: 0;
    transition: color .2s var(--ease);
}
.ia-newchat:hover .ia-newchat__icon { color: var(--text); }
.ia-newchat span { line-height: 1.2; }

.ia-history {
    list-style: none; padding: 0; margin: 0;
    flex: 1; overflow-y: auto; min-height: 0;
    display: flex; flex-direction: column; gap: 1px;
}
.ia-history__empty { padding: 12px; color: var(--text-mute); font-size: 12px; font-style: italic; }
.ia-history__item {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 13px; color: var(--text-soft);
    transition: color .15s, background .15s;
}
.ia-history__item:hover { background: var(--bg-hover); color: var(--text); }
/* El chat activo no se resalta — solo el hover indica interacción */
.ia-history__item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ia-history__del {
    background: transparent; border: 0; color: var(--text-mute);
    cursor: pointer; padding: 4px; font-size: 11px;
    opacity: 0; transition: color .15s, opacity .15s;
}
.ia-history__item:hover .ia-history__del { opacity: 1; }
.ia-history__del:hover { color: var(--danger); }

/* Disclaimer debajo del input */
.ia-composer__disclaimer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 8px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-mute);
    text-align: center;
}
.ia-composer__disclaimer i {
    font-size: 10.5px;
    color: var(--text-mute);
    flex-shrink: 0;
}

.ia-scrim {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 85; opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease);
}
.is-sidebar-open .ia-scrim { opacity: 1; pointer-events: auto; }

/* Floating btn for sidebar */
.ia-floating-btn {
    position: fixed;
    z-index: 80;
    background: rgba(12,12,16,0.82);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    color: var(--text-soft);
    width: 38px; height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: color .25s var(--ease), border-color .25s var(--ease);
    animation: fade-down .7s var(--ease) .2s both;
}
.ia-floating-btn:hover { color: var(--text); border-color: var(--border-mid); }
.ia-floating-btn--history { top: 18px; left: 18px; }

/* Modificadores del icon button */
.ia-iconbtn--collapse { display: none; }

/* ============================================================
   Sidebar persistente en desktop (>= 901px) — colapsable estilo Claude
   ============================================================ */
@media (min-width: 901px) {
    .ia-sidebar {
        position: relative;
        transform: none !important;
        flex-shrink: 0;
        z-index: 5;
        overflow: hidden;
        transition: width .32s var(--ease),
                    padding .32s var(--ease),
                    opacity .25s var(--ease);
    }
    .ia-scrim { display: none !important; }
    .ia-floating-btn--history { display: none !important; }
    .ia-iconbtn--close { display: none !important; }
    .ia-iconbtn--collapse { display: inline-flex; }

    /* Colapsado: sidebar fuera de vista, aparece el botón flotante */
    .is-sidebar-collapsed .ia-sidebar {
        width: 0 !important;
        min-width: 0;
        padding-left: 0;
        padding-right: 0;
        opacity: 0;
        pointer-events: none;
    }
    .is-sidebar-collapsed .ia-sidebar > * {
        opacity: 0;
        transition: opacity .15s var(--ease);
    }
    .is-sidebar-collapsed .ia-floating-btn--history {
        display: inline-flex !important;
        animation: fade-down-y .3s var(--ease) .1s both;
    }
}

/* ============================================================
   Messages area (visible solo cuando is-chatting)
   ============================================================ */
.ia-messages {
    position: absolute;
    inset: 0;
    padding: 80px 20px 210px;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-gutter: stable both-edges;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s var(--ease) .15s;
    /* Desvanece los mensajes antes de llegar al composer, así no se ven detrás del input */
    -webkit-mask-image: linear-gradient(to bottom,
        #000 0,
        #000 calc(100% - 130px),
        transparent calc(100% - 60px));
            mask-image: linear-gradient(to bottom,
        #000 0,
        #000 calc(100% - 130px),
        transparent calc(100% - 60px));
}
.is-chatting .ia-messages {
    opacity: 1;
    pointer-events: auto;
}
.ia-messages::-webkit-scrollbar { width: 6px; }
.ia-messages::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
.ia-messages::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   Anchor (welcome + composer) — animates from center to bottom
   ============================================================ */
.ia-anchor {
    position: absolute;
    left: 50%;
    width: min(1100px, calc(100% - 32px));
    bottom: 50%;
    transform: translate(-50%, 50%);
    transition: bottom .65s var(--ease),
                transform .65s var(--ease),
                width .55s var(--ease);
    display: flex; flex-direction: column; gap: 24px;
    z-index: 5;
}
.is-chatting .ia-anchor {
    bottom: 18px;
    transform: translate(-50%, 0);
    width: min(760px, calc(100% - 32px));
}

/* Welcome */
.ia-welcome {
    text-align: center;
    padding: 0 16px;
    transition: opacity .5s var(--ease), transform .5s var(--ease), max-height .55s var(--ease), margin .5s var(--ease);
    max-height: 800px;
    opacity: 1;
    animation: welcome-in .7s var(--ease) both;
}
@keyframes welcome-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.is-chatting .ia-welcome {
    opacity: 0;
    transform: translateY(-24px);
    max-height: 0;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}
.ia-welcome__brand {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--mono); font-size: 11px;
    color: var(--text-soft);
    text-transform: uppercase; letter-spacing: 3px;
    margin-bottom: 26px;
    padding: 6px 14px;
    border: 1px solid var(--border-mid);
    border-radius: 999px;
    background: rgba(255,255,255,0.02);
}
.ia-welcome__brand-dot {
    width: 6px; height: 6px;
    background: var(--text);
    border-radius: 50%;
    animation: pulse-dot 2s var(--ease) infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
    50%      { opacity: .5; transform: scale(.7); box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}
.ia-welcome__title {
    font-size: 44px; font-weight: 600; letter-spacing: -1.2px;
    margin: 0 0 16px;
    line-height: 1.12;
    color: var(--text);
    white-space: nowrap;
}
@media (max-width: 900px) {
    .ia-welcome__title { white-space: normal; }
}
.ia-welcome__title .ia-name {
    font-family: var(--mono);
    font-style: normal;
    font-weight: 800;
    background: linear-gradient(180deg, #6da3ff 0%, #3b6fdc 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #5b9eff; /* fallback */
}

/* ============================================================
   Glitch tecnológico (chromatic aberration + font morphing)
   Aplica a cualquier .ia-glitch con atributo data-text
   ============================================================ */
.ia-glitch {
    position: relative;
    display: inline-block;
    color: inherit;
    will-change: transform, font-family;
    animation: glitch-main 7s steps(1) 2.4s infinite;
}
.ia-glitch::before,
.ia-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
    text-shadow: none;
    background: none;
    -webkit-text-fill-color: currentColor;
    opacity: 0;
    will-change: transform, clip-path, opacity, font-family;
}
.ia-glitch::before {
    color: #ff3366; /* canal rojo/magenta */
    mix-blend-mode: screen;
    animation: glitch-shift-a 5.2s steps(1) 3s infinite;
}
.ia-glitch::after {
    color: #00e0ff; /* canal cian */
    mix-blend-mode: screen;
    animation: glitch-shift-b 5.7s steps(1) 3.2s infinite;
}

/* Trama principal: micro-desplazamientos cada ~7s (sin cambio de fuente) */
@keyframes glitch-main {
    0%, 100%  { transform: translate(0, 0); }
    97.0%     { transform: translate(-1px, 0); }
    97.6%     { transform: translate(2px, -1px); }
    98.2%     { transform: translate(-2px, 1px); }
    98.8%     { transform: translate(1px, 0); }
    99.4%     { transform: translate(0, 1px); }
}

/* Canal A: rojo/magenta, salta y se corta horizontalmente */
@keyframes glitch-shift-a {
    0%, 100%  { opacity: 0; transform: translate(0, 0); clip-path: inset(0 0 0 0); }
    94%       { opacity: 0; }
    94.5%     { opacity: .9;  transform: translate(-3px, 0);  clip-path: inset(8%  0 64% 0); }
    95.5%     { opacity: .8;  transform: translate(2px, 1px); clip-path: inset(42% 0 28% 0); }
    96.5%     { opacity: .85; transform: translate(-2px, -1px); clip-path: inset(70% 0 6%  0); }
    97.5%     { opacity: .75; transform: translate(3px, 0);  clip-path: inset(22% 0 52% 0); }
    98.5%     { opacity: 0; }
}

/* Canal B: cian, salta en sentido opuesto */
@keyframes glitch-shift-b {
    0%, 100%  { opacity: 0; transform: translate(0, 0); clip-path: inset(0 0 0 0); }
    93.5%     { opacity: 0; }
    94.5%     { opacity: .9;  transform: translate(3px, 0);    clip-path: inset(28% 0 52% 0); }
    95.5%     { opacity: .8;  transform: translate(-2px, 1px); clip-path: inset(62% 0 14% 0); }
    96.5%     { opacity: .85; transform: translate(1px, -1px); clip-path: inset(4%  0 78% 0); }
    97.5%     { opacity: .75; transform: translate(-3px, 0);   clip-path: inset(48% 0 30% 0); }
    98.5%     { opacity: 0; }
}

/* Variante acento: timing ligeramente desfasado (legacy, sin uso actual) */
.ia-glitch--accent { animation-delay: 5.1s; }
.ia-glitch--accent::before { animation-delay: 5.7s; }
.ia-glitch--accent::after  { animation-delay: 5.9s; }

@media (prefers-reduced-motion: reduce) {
    .ia-glitch,
    .ia-glitch::before,
    .ia-glitch::after { animation: none; }
    .ia-glitch::before,
    .ia-glitch::after { display: none; }
}

/* ============================================================
   CRT / televisor antiguo
   Jitter sub-pixel constante + flicker + scanlines en movimiento
   Se aplica como wrapper sobre el .ia-glitch del nombre.
   Usa la propiedad individual `translate` para no chocar con el
   `transform: translate(...)` que usa el glitch.
   ============================================================ */
.ia-crt {
    position: relative;
    display: inline-block;
    isolation: isolate;
    animation: tv-jitter 0.85s steps(8, end) infinite,
               tv-flicker 5.5s ease-in-out infinite;
}
.ia-crt::after {
    content: '';
    position: absolute;
    inset: -2px -1px;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0,0,0,0)    0px,
        rgba(0,0,0,0)    2px,
        rgba(0,0,0,0.42) 2px,
        rgba(0,0,0,0.42) 3px
    );
    mix-blend-mode: multiply;
    opacity: 0.55;
    animation: tv-scan 3.8s linear infinite;
}
@keyframes tv-jitter {
    0%   { translate: 0 0; }
    14%  { translate: 0.4px -0.2px; }
    28%  { translate: -0.3px 0.3px; }
    42%  { translate: 0.5px 0.1px; }
    56%  { translate: -0.4px -0.3px; }
    70%  { translate: 0.3px 0.3px; }
    84%  { translate: -0.3px 0; }
    100% { translate: 0 0; }
}
@keyframes tv-flicker {
    0%, 100% { opacity: 1; }
    7%       { opacity: 0.84; }
    9%       { opacity: 1; }
    23%      { opacity: 0.95; }
    25%      { opacity: 1; }
    47%      { opacity: 0.90; }
    49%      { opacity: 1; }
    71%      { opacity: 0.96; }
    73%      { opacity: 1; }
    91%      { opacity: 0.88; }
    93%      { opacity: 1; }
}
@keyframes tv-scan {
    0%   { background-position: 0 0; }
    100% { background-position: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .ia-crt, .ia-crt::after { animation: none; }
}
.ia-welcome__sub {
    font-size: 14.5px; color: var(--text-soft);
    max-width: 500px; margin: 0 auto;
    line-height: 1.65;
}

/* Suggestions */
.ia-suggestions {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center;
    max-height: 200px;
    opacity: 1;
    transition: opacity .4s var(--ease), max-height .5s var(--ease), margin .4s var(--ease);
}
.is-chatting .ia-suggestions {
    opacity: 0;
    max-height: 0;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}
.ia-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: 999px;
    cursor: pointer; font-family: inherit;
    font-size: 12px; font-weight: 500;
    transition: color .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease), transform .15s;
    animation: chip-in .5s var(--ease) calc(var(--i, 0) * 60ms) both;
}
.ia-chip:nth-child(1) { --i: 0; }
.ia-chip:nth-child(2) { --i: 1; }
.ia-chip:nth-child(3) { --i: 2; }
.ia-chip:nth-child(4) { --i: 3; }
@keyframes chip-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ia-chip i { font-size: 10px; color: var(--text-mute); transition: color .2s; }
.ia-chip:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--border-mid);
    transform: translateY(-1px);
}
.ia-chip:hover i { color: var(--text); }

/* Composer */
.ia-composer {
    display: flex; flex-direction: column; gap: 8px;
}
.ia-input-wrap {
    position: relative;
    background: var(--bg-soft);
    border: 1px solid var(--border-mid);
    border-radius: 18px;
    transition: border-color .25s var(--ease), background .25s, box-shadow .25s;
    display: flex;
    flex-direction: column;
    min-height: 118px;
}
.ia-input-wrap:focus-within {
    border-color: #fff;
    background: var(--bg-elev);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}
.ia-input {
    width: 100%;
    background: transparent;
    border: 0; outline: 0; resize: none;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    padding: 14px 18px 4px;
    min-height: 70px;          /* ≈ 2.5 líneas de contenido */
    max-height: 220px;
    display: block;
    flex: 1 1 auto;
}
.ia-input::placeholder { color: var(--text-mute); }

/* Action row al fondo: [+] · · · [modelo] [mic] [send] */
.ia-input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px 8px;
    flex-shrink: 0;
}
.ia-input-actions__left,
.ia-input-actions__right {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative; /* contexto para el popover */
}

/* Botón + (attach) que abre el menú de acciones rápidas */
.ia-input-attach {
    width: 34px; height: 34px;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px;
    transition: background .15s, color .15s, transform .15s var(--ease);
}
.ia-input-attach:hover { background: var(--bg-hover); color: var(--text); }
.ia-input-attach[aria-expanded="true"] {
    background: var(--bg-hover);
    color: var(--text);
    transform: rotate(45deg);
}

/* Botón Descargar CV, junto al (+) */
.ia-input-cv {
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-mid);
    border-radius: 100px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.ia-input-cv:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-soft);
}
.ia-input-cv i { font-size: 13px; }

/* Popover */
.ia-attach-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--bg-soft);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    box-shadow: 0 14px 38px rgba(0,0,0,0.55);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 20;
    animation: attach-menu-in .18s var(--ease) both;
}
@keyframes attach-menu-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ia-attach-menu[hidden] { display: none; }
.ia-attach-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: transparent;
    border: 0;
    color: var(--text-soft);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.ia-attach-item:hover { background: var(--bg-hover); color: var(--text); }
.ia-attach-item i { font-size: 12px; color: var(--text-mute); width: 14px; text-align: center; transition: color .15s; }
.ia-attach-item:hover i { color: var(--text); }

/* Modelo */
.ia-input-model {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    background: transparent;
    padding: 6px 10px;
    border-radius: 8px;
    letter-spacing: -.2px;
    cursor: default;
    user-select: none;
    transition: background .15s, color .15s;
}
.ia-input-model i { font-size: 11.5px; color: var(--text-mute); }
.ia-input-model:hover { background: var(--bg-hover); color: var(--text); }
.ia-input-model:hover i { color: var(--text); }

/* Micrófono */
.ia-input-mic {
    width: 34px; height: 34px;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14.5px;
    transition: background .15s, color .15s, transform .12s;
}
.ia-input-mic:hover { background: var(--bg-hover); color: var(--text); }
.ia-input-mic:active { transform: scale(.94); }
.ia-input-mic.is-recording {
    background: var(--danger);
    color: #fff;
    animation: mic-pulse 1.4s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 94, 94, 0.55); }
    50%      { box-shadow: 0 0 0 8px rgba(255, 94, 94, 0); }
}

/* Send: cuadrado-redondeado, opaco por defecto, blanco si hay texto */
.ia-send {
    position: relative;
    right: auto; top: auto; bottom: auto;
    width: 34px; height: 34px;
    border: 0; border-radius: 9px;
    background: var(--bg-elev);
    color: var(--text-mute);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    transform: none;
    transition: transform .18s var(--ease-bounce),
                background .22s var(--ease),
                color .22s var(--ease),
                box-shadow .25s;
    box-shadow: inset 0 0 0 1px var(--border);
}
.ia-send.is-ready {
    background: #fff;
    color: #000;
    box-shadow: none;
}
.ia-send.is-ready:hover:not(:disabled) {
    background: #e5e5e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255,255,255,0.18);
}
.ia-send.is-ready:active:not(:disabled) { transform: translateY(0); }
.ia-send:disabled { cursor: not-allowed; }

/* ============================================================
   Messages
   ============================================================ */
.m {
    max-width: 760px;
    margin: 0 auto 24px;
    display: flex;
    gap: 14px;
    animation: msg-in .45s var(--ease) both;
}
@keyframes msg-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.m__avatar {
    flex-shrink: 0;
    width: 30px; height: 30px;
    background: #fff;
    color: #000;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--mono);
    font-size: 14px; font-weight: 700;
    margin-top: 18px;
    letter-spacing: -1px;
}
.m__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.m__content { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.m__role {
    font-family: var(--font);
    font-size: 12px; font-weight: 600;
    text-transform: none; letter-spacing: -.1px;
    color: var(--text-mute);
}
.m__body {
    font-size: 15px;
    line-height: 1.68;
    color: var(--text);
    word-wrap: break-word;
}
.m__body > *:first-child { margin-top: 0; }
.m__body > *:last-child { margin-bottom: 0; }

/* USER: right-aligned bubble, no avatar */
.m--user { justify-content: flex-end; }
.m--user .m__avatar { display: none; }
.m--user .m__content { align-items: flex-end; max-width: 78%; }
.m--user .m__body {
    background: var(--bg-bubble);
    border: 1px solid var(--border);
    border-radius: var(--radius-bubble);
    border-bottom-right-radius: 6px;
    padding: 10px 16px;
    font-size: 14.5px;
}
.m--user .m__body p { margin: 0; }

/* BOT: left, avatar L visible */
.m--bot .m__content { flex: 1; min-width: 0; }
.m--bot .m__role { color: var(--text); }

/* Acciones bajo cada mensaje del bot (Copiar, etc.) */
.m__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity .2s var(--ease);
}
.m:hover .m__actions { opacity: 1; }
.m__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 0;
    color: var(--text-mute);
    cursor: pointer;
    padding: 5px 9px;
    border-radius: 7px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.m__action:hover { background: var(--bg-hover); color: var(--text); }
.m__action i { font-size: 10.5px; }

/* Markdown */
.m__body h1, .m__body h2, .m__body h3, .m__body h4 {
    font-weight: 700; line-height: 1.3; margin: 18px 0 8px;
    letter-spacing: -.3px;
}
.m__body h1 { font-size: 22px; }
.m__body h2 { font-size: 19px; }
.m__body h3 { font-size: 16px; }
.m__body h4 {
    font-family: var(--mono);
    font-size: 12px; color: var(--text-soft);
    text-transform: uppercase; letter-spacing: 1.5px;
    font-weight: 600;
}
.m__body p { margin: 0 0 10px; }
.m__body p:last-child { margin-bottom: 0; }

/* Espaciado entre cualquier bloque GenUI y un párrafo de texto siguiente */
.gu-mini + p,
.gu-card + p,
.gu-tool + p,
.gu-code + p,
.gu-stack + p,
.gu-form + p,
.gu-form--sent + p,
.gu-table-wrap + p,
.gu-actions + p {
    margin-top: 22px;
}

/* Espaciado entre un párrafo y un bloque GenUI siguiente */
.m__body p + .gu-mini,
.m__body p + .gu-card,
.m__body p + .gu-tool,
.m__body p + .gu-code,
.m__body p + .gu-form,
.m__body p + .gu-table-wrap {
    margin-top: 16px;
}
.m__body strong { color: #fff; font-weight: 700; }
.m__body a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.m__body a:hover { text-decoration-color: #fff; }
.m__body ul, .m__body ol { margin: 6px 0 12px; padding-left: 22px; }
.m__body li { margin: 4px 0; }
.m__body hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.m__body code:not(pre code) {
    background: var(--bg-elev);
    padding: 2px 7px; border-radius: 4px;
    font-family: var(--mono); font-size: 12.5px;
    border: 1px solid var(--border);
    color: #e8e8e8;
}

/* Thinking state (estilo Claude) — icono azul morphing + texto rotativo italic con shimmer */
.ia-thinking {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 14.5px;
    font-style: italic;
    color: var(--text-soft);
}
.ia-thinking__icon {
    width: 18px; height: 18px;
    display: inline-flex;
    align-items: center; justify-content: center;
    color: #6da3ff; /* azul */
    font-size: 14px;
    animation: thinking-icon-spin 2.4s var(--ease) infinite;
    filter: drop-shadow(0 0 6px rgba(109, 163, 255, 0.45));
}
@keyframes thinking-icon-spin {
    0%   { transform: rotate(0deg)   scale(1);    }
    25%  { transform: rotate(90deg)  scale(0.7);  }
    50%  { transform: rotate(180deg) scale(1.05); }
    75%  { transform: rotate(270deg) scale(0.7);  }
    100% { transform: rotate(360deg) scale(1);    }
}
.ia-thinking__text {
    display: inline-block;
    background: linear-gradient(90deg, rgba(255,255,255,0.35) 0%, #fff 50%, rgba(255,255,255,0.35) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: thinking-shimmer 2.4s linear infinite;
    transition: opacity .25s var(--ease);
    min-height: 1.4em;
}
@keyframes thinking-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
.ia-thinking__text--fade-out {
    opacity: 0;
}

/* ============================================================
   GenUI
   ============================================================ */
.gu-btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent;
    border: 1px solid var(--border-mid);
    color: var(--text);
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 500; font-family: inherit;
    cursor: pointer; text-decoration: none;
    transition: background .2s var(--ease), border-color .2s var(--ease), transform .12s;
}
.gu-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.gu-btn:active { transform: translateY(1px); }
.gu-btn i { font-size: 11px; opacity: .8; }
.gu-btn--ghost { background: transparent; border-color: var(--border); color: var(--text-soft); }
.gu-btn--primary {
    background: #fff; color: #000; border-color: #fff;
    font-weight: 600;
}

/* Botón inline (dentro de celdas de tabla o texto) — más compacto */
.gu-btn--inline {
    padding: 3px 9px;
    font-size: 11.5px;
    border-radius: 6px;
    gap: 5px;
    background: var(--bg-elev);
    border-color: var(--border);
}
.gu-btn--inline i { font-size: 9.5px; }
.gu-btn--inline:hover {
    background: var(--bg-hover);
    border-color: var(--border-mid);
}
.gu-btn--primary:hover { background: #e5e5e5; color: #000; border-color: #e5e5e5; }
.gu-btn--primary i { opacity: 1; }

.gu-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }

.gu-stack { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.gu-stack__chip {
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 11px; padding: 3px 9px;
    border-radius: 999px; font-weight: 500;
    transition: border-color .2s, background .2s;
}
.gu-stack__chip:hover { border-color: var(--border-mid); background: var(--bg-hover); }

/* Card */
.gu-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 12px 0;
    transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.gu-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.gu-card__media { background: #000; min-height: 130px; overflow: hidden; position: relative; }
.gu-card__media::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
}
.gu-card__media img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    filter: grayscale(0.15);
    transition: filter .3s var(--ease), transform .35s var(--ease);
}
.gu-card:hover .gu-card__media img { filter: grayscale(0); transform: scale(1.04); }
.gu-card__body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gu-card__meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gu-card__year { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--text-mute); }
.gu-card__title { font-size: 15px; font-weight: 700; margin: 0; color: #fff; letter-spacing: -.2px; }
.gu-card__desc { font-size: 12.5px; color: var(--text-soft); margin: 0; line-height: 1.5; }
.gu-card__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.gu-card__chip {
    background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-soft);
    font-family: var(--mono); font-size: 10px; padding: 1.5px 7px;
    border-radius: 999px; letter-spacing: -.1px;
}
.gu-card__chip--more { color: var(--text); border-color: var(--border-mid); }
.gu-card__actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* ============================================================
   Hackathon card — hero image + award badge + thumbnail strip
   ============================================================ */
.gu-hack {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 12px 0;
    transition: border-color .25s var(--ease), transform .25s var(--ease);
    animation: tool-slide .45s var(--ease) both;
}
.gu-hack:hover { border-color: var(--border-mid); }

.gu-hack__hero {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.gu-hack__hero img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    filter: grayscale(.15);
    transition: filter .35s var(--ease), transform .35s var(--ease);
}
.gu-hack:hover .gu-hack__hero img { filter: grayscale(0); transform: scale(1.03); }
.gu-hack__hero::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
}
.gu-hack__badge {
    position: absolute;
    top: 12px; right: 12px;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid var(--border-mid);
    color: #fff;
    font-size: 11.5px; font-weight: 600;
    padding: 6px 11px;
    border-radius: 999px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 24px);
}
.gu-hack__badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gu-hack__body {
    padding: 14px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.gu-hack__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--text-mute);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}
.gu-hack__meta i { font-size: 9.5px; }
.gu-hack__sep { color: var(--border-strong); }
.gu-hack__year { color: var(--text-soft); }
.gu-hack__loc { display: inline-flex; align-items: center; gap: 4px; }

.gu-hack__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.3px;
    line-height: 1.25;
}
.gu-hack__sub {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 12.5px;
    color: var(--text-soft);
}
.gu-hack__sub strong {
    color: var(--text);
    font-weight: 600;
}
.gu-hack__desc {
    font-size: 13px;
    color: var(--text-soft);
    margin: 0;
    line-height: 1.55;
}

.gu-hack__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
    margin-top: 8px;
}
.gu-hack__thumb {
    aspect-ratio: 4 / 3;
    background: #000;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    cursor: zoom-in;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .2s, transform .2s var(--ease);
}
.gu-hack__thumb:hover {
    border-color: var(--border-mid);
    transform: translateY(-1px);
}
.gu-hack__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(.18);
    transition: filter .25s var(--ease), transform .35s var(--ease);
    pointer-events: none;
}
.gu-hack__thumb:hover img {
    filter: grayscale(0);
    transform: scale(1.06);
}

@media (max-width: 600px) {
    .gu-hack__hero { aspect-ratio: 16 / 10; }
    .gu-hack__badge {
        font-size: 10.5px;
        padding: 5px 9px;
        top: 10px; right: 10px;
    }
    .gu-hack__title { font-size: 15.5px; }
    .gu-hack__gallery { grid-template-columns: repeat(3, 1fr); }
}

/* Mini-card colapsable (overview compact) */
.gu-mini {
    margin: 6px 0;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color .2s var(--ease), background .2s var(--ease);
    animation: tool-slide .35s var(--ease) both;
}
.gu-mini:hover {
    border-color: var(--border-mid);
}
.gu-mini__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    outline: 0;
}
.gu-mini__head:focus-visible {
    box-shadow: inset 0 0 0 2px var(--border-mid);
}
.gu-mini__thumb {
    width: 44px; height: 44px;
    border-radius: 7px;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}
.gu-mini__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(.2);
    transition: filter .25s var(--ease);
}
.gu-mini:hover .gu-mini__thumb img { filter: grayscale(0); }
.gu-mini__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gu-mini__top {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.gu-mini__title {
    font-weight: 700;
    font-size: 13.5px;
    color: #fff;
    letter-spacing: -.2px;
}
.gu-mini__year {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-mute);
    letter-spacing: 1px;
}
.gu-mini__desc {
    font-size: 12px;
    color: var(--text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}
.gu-mini__chevron {
    color: var(--text-mute);
    font-size: 11px;
    transition: transform .3s var(--ease), color .2s;
    flex-shrink: 0;
}
.gu-mini:hover .gu-mini__chevron { color: var(--text); }
.gu-mini.is-open .gu-mini__chevron { transform: rotate(180deg); }

/* Detalles colapsables: usamos grid-template-rows trick para animar de 0 a auto */
.gu-mini__details {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .35s var(--ease);
}
.gu-mini.is-open .gu-mini__details {
    grid-template-rows: 1fr;
}
.gu-mini__details-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 12px;
}
.gu-mini.is-open .gu-mini__details-inner {
    padding: 4px 12px 12px;
    border-top: 1px solid var(--border);
}
.gu-mini__details-inner .gu-card__chips {
    margin-top: 10px;
}
.gu-mini__details-inner .gu-card__actions {
    margin-top: 10px;
}

/* Code block */
.gu-code {
    margin: 14px 0;
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.gu-code__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}
.gu-code__lang {
    font-family: var(--mono); text-transform: lowercase;
    font-weight: 600; letter-spacing: .3px;
    color: var(--text-soft);
}
.gu-code__copy {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-soft); cursor: pointer;
    padding: 3px 10px; border-radius: 5px;
    font-size: 10.5px; font-family: inherit;
    display: inline-flex; align-items: center; gap: 5px;
    transition: color .2s, border-color .2s;
}
.gu-code__copy:hover { color: var(--text); border-color: var(--border-mid); }
.gu-code pre {
    margin: 0; padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 12.5px; line-height: 1.6;
    color: #e8e8e8;
}

/* Tool card */
.gu-tool {
    display: flex; align-items: center; gap: 11px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-left: 2px solid #fff;
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    margin: 8px 0;
    font-size: 12.5px;
    animation: tool-slide .45s var(--ease) both;
}
@keyframes tool-slide {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
.gu-tool__icon {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.gu-tool__body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gu-tool__name { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.gu-tool__desc { font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gu-tool__status { flex-shrink: 0; font-size: 13px; }
.gu-tool__icon-status--ok { color: var(--text); }
.gu-tool__icon-status--err { color: var(--danger); }
.gu-tool__spinner {
    width: 12px; height: 12px;
    border: 2px solid var(--border-strong);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gu-tool--running { border-left-color: var(--text-soft); }
.gu-tool--error { border-left-color: var(--danger); }
.gu-tool--error .gu-tool__icon { color: var(--danger); border-color: var(--danger); }

/* Table */
.gu-table-wrap {
    margin: 14px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-soft);
    animation: tool-slide .45s var(--ease) both;
}
.gu-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gu-table thead { background: var(--bg-elev); }
.gu-table th {
    text-align: left; padding: 9px 14px;
    font-family: var(--mono); font-size: 10.5px;
    font-weight: 600; color: var(--text-soft);
    text-transform: uppercase; letter-spacing: 1.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.gu-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
    line-height: 1.5;
}
.gu-table tr:last-child td { border-bottom: 0; }
.gu-table tbody tr { transition: background .15s; }
.gu-table tbody tr:hover { background: var(--bg-hover); }
.gu-table__dash { color: var(--text-mute); font-family: var(--mono); }

/* Iconos inline de marca (detectados automáticamente en el texto) */
.ia-brand-icon {
    display: inline-block;
    margin-right: 6px;
    font-size: 0.95em;
    color: var(--text);
    opacity: .9;
    vertical-align: -1px;
}

/* Inline form */
.gu-form {
    margin: 22px 0;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 12px;
    animation: form-in .45s var(--ease) both;
}
@keyframes form-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.gu-form__head {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--mono);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 2px;
    color: var(--text);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.gu-form__head i { font-size: 10px; }
.gu-field { display: flex; flex-direction: column; gap: 5px; }
.gu-field__label {
    font-family: var(--mono);
    font-size: 10.5px; font-weight: 600;
    color: var(--text-soft);
    text-transform: uppercase; letter-spacing: 1.2px;
}
.gu-field__input {
    background: var(--bg);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    outline: 0;
    transition: border-color .2s var(--ease), background .2s;
}
.gu-field__input:focus { border-color: #fff; background: var(--bg-soft); }
.gu-field__input--area { resize: vertical; min-height: 64px; font-family: inherit; }
.gu-field__input:disabled { opacity: .55; cursor: not-allowed; }

.gu-form__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gu-form__msg { font-size: 12px; color: var(--text-mute); font-family: var(--mono); }
.gu-form__msg--err { color: var(--danger); }
.gu-form__msg--ok { color: var(--text); }

/* Spinner dentro del botón Contactar */
.gu-btn__spinner {
    width: 12px; height: 12px;
    border: 2px solid rgba(0,0,0,0.18);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    display: inline-block;
}

/* Form en estado "enviado" */
.gu-form--sent {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-left: 2px solid #fff;
    border-radius: var(--radius);
    padding: 16px 18px;
    margin: 22px 0;
    display: flex; align-items: flex-start; gap: 14px;
    animation: form-in .4s var(--ease) both;
}
.gu-form__sent-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: #fff; color: #000;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.gu-form__sent-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gu-form__sent-title {
    font-family: var(--mono);
    font-size: 13px; font-weight: 700;
    color: var(--text);
}
.gu-form__sent-sub {
    font-size: 12.5px;
    color: var(--text-soft);
    line-height: 1.5;
}
.gu-form__sent-sub strong { color: var(--text); }

/* ============================================================
   Modal de arquitectura de proyecto (B&W, en Modo IA)
   ============================================================ */
.ia-modal {
    position: fixed; inset: 0;
    z-index: 200;
    display: none;
    align-items: center; justify-content: center;
    padding: 24px;
}
.ia-modal.is-open { display: flex; animation: modal-fade .25s var(--ease) both; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.ia-modal__scrim {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.ia-modal__panel {
    position: relative;
    width: 100%; max-width: 720px;
    max-height: 88vh;
    background: var(--bg-soft);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 30px 100px rgba(0,0,0,0.7);
    display: flex; flex-direction: column;
    animation: modal-rise .35s var(--ease) both;
}
@keyframes modal-rise {
    from { opacity: 0; transform: translateY(20px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ia-modal__head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.ia-modal__title-group { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ia-modal__year {
    font-family: var(--mono);
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-mute);
}
.ia-modal__title {
    margin: 0;
    font-size: 22px; font-weight: 700;
    letter-spacing: -.4px;
    color: #fff;
}
.ia-modal__close {
    width: 34px; height: 34px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-soft);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px;
    transition: color .2s, border-color .2s, background .2s;
    flex-shrink: 0;
}
.ia-modal__close:hover { color: var(--text); border-color: var(--border-mid); background: var(--bg-hover); }

.ia-modal__body {
    flex: 1;
    padding: 18px 20px 22px;
    overflow-y: auto;
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
    min-height: 0;
}
.ia-modal__foot {
    flex-shrink: 0;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    display: flex; justify-content: flex-end; gap: 8px;
}
.ia-modal__foot[hidden] { display: none; }
.ia-modal__body::-webkit-scrollbar { width: 6px; }
.ia-modal__body::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
.ia-modal__desc {
    font-size: 14px; color: var(--text-soft);
    margin: 0 0 16px;
    line-height: 1.6;
}
.ia-modal__stack { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 22px; }
.ia-modal__h {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text);
    margin: 18px 0 8px;
    font-family: var(--mono);
}
.ia-modal__h:first-of-type { margin-top: 0; }
.ia-modal__p {
    margin: 0 0 14px;
    color: var(--text);
    line-height: 1.7;
}
.ia-modal__p strong { color: #fff; font-weight: 700; }

.ia-modal__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    margin: 20px 0 8px;
}
.ia-modal__shot {
    aspect-ratio: 4/3;
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: zoom-in;
    transition: border-color .2s;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}
.ia-modal__shot:hover { border-color: var(--border-mid); }
.ia-modal__shot img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(.1);
    transition: filter .2s, transform .35s var(--ease);
    pointer-events: none; /* el button captura el click */
}
.ia-modal__shot:hover img { filter: grayscale(0); transform: scale(1.05); }

/* Lightbox real: overlay fullscreen separado del modal */
.ia-lightbox {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    cursor: zoom-out;
}
.ia-lightbox.is-open {
    display: flex;
    animation: modal-fade .2s var(--ease) both;
}
.ia-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
    animation: lightbox-pop .25s var(--ease) both;
}
@keyframes lightbox-pop {
    from { opacity: 0; transform: scale(.94); }
    to   { opacity: 1; transform: scale(1); }
}
.ia-lightbox__close {
    position: absolute;
    top: 18px; right: 18px;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: background .2s, border-color .2s;
}
.ia-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 600px) {
    .ia-modal { padding: 12px; align-items: flex-end; }
    .ia-modal__panel { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
    .ia-modal__title { font-size: 18px; }
    .ia-modal__gallery { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 760px) {
    .ia-messages {
        padding: 70px 14px 170px;
        -webkit-mask-image: linear-gradient(to bottom,
            #000 0,
            #000 calc(100% - 110px),
            transparent calc(100% - 50px));
                mask-image: linear-gradient(to bottom,
            #000 0,
            #000 calc(100% - 110px),
            transparent calc(100% - 50px));
    }
    .ia-welcome__title { font-size: 32px; }
    .ia-welcome__sub { font-size: 13.5px; }
    .gu-card { grid-template-columns: 1fr; }
    .gu-card__media { min-height: 160px; }
    .ia-chip { padding: 6px 11px; font-size: 11.5px; }
    .m--user .m__content { max-width: 86%; }
    .m__avatar { width: 26px; height: 26px; font-size: 12px; }
}

/* ============================================================
   Modal de confirmación (reemplazo del confirm() nativo)
   ============================================================ */
.ia-confirm {
    position: fixed; inset: 0;
    z-index: 250;
    display: none;
    align-items: center; justify-content: center;
    padding: 24px;
}
.ia-confirm.is-open {
    display: flex;
    animation: modal-fade .22s var(--ease) both;
}
.ia-confirm__scrim {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}
.ia-confirm__panel {
    position: relative;
    width: 100%; max-width: 380px;
    background: var(--bg-soft);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    padding: 22px 22px 18px;
    text-align: center;
    box-shadow: var(--shadow);
    animation: modal-rise .3s var(--ease) both;
}
.ia-confirm__icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--danger);
    margin: 0 auto 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.ia-confirm__title {
    margin: 0 0 6px;
    font-size: 17px; font-weight: 700;
    letter-spacing: -.3px;
    color: #fff;
    line-height: 1.3;
}
.ia-confirm__msg {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.55;
}
.ia-confirm__actions {
    display: flex;
    gap: 8px;
    justify-content: stretch;
}
.ia-confirm__btn {
    flex: 1;
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .12s;
}
.ia-confirm__btn:active { transform: translateY(1px); }
.ia-confirm__btn i { font-size: 11px; }
.ia-confirm__btn--ghost {
    background: transparent;
    border: 1px solid var(--border-mid);
    color: var(--text-soft);
}
.ia-confirm__btn--ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-strong);
}
.ia-confirm__btn--danger {
    background: var(--danger);
    border: 1px solid var(--danger);
    color: #fff;
}
.ia-confirm__btn--danger:hover {
    background: #ff7878;
    border-color: #ff7878;
}
.ia-confirm__btn--danger:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .ia-confirm { padding: 16px; align-items: flex-end; }
    .ia-confirm__panel { max-width: 100%; }
}
