@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&family=Newsreader:ital,wght@0,500;1,600&family=Inter:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

:root{--bg:#02080f;--panel:rgba(4,19,35,.78);--line:rgba(239,241,243,.1);--text:#eff1f3;--muted:#82909e;--blue:#176eb1;--cyan:#00a9d9;--sidebar-w:264px;--light-bg:#eff1f3;--light-panel:#ffffff;--light-border:rgba(4,19,35,.1);--light-text:#0c1b28;--light-muted:#5b6b78;--font-ui:"DM Sans",sans-serif}

/* ---------- design: bordes (Configuración → Diseño) ---------- */
body[data-radius="sharp"] .welcome,body[data-radius="sharp"] .composer,body[data-radius="sharp"] .code-block,body[data-radius="sharp"] .new-chat,body[data-radius="sharp"] .h-item,body[data-radius="sharp"] .attach-thumb,body[data-radius="sharp"] .account-card,body[data-radius="sharp"] .avatar,body[data-radius="sharp"] .composer button,body[data-radius="sharp"] .attach-btn,body[data-radius="sharp"] .modal,body[data-radius="sharp"] .project-item,body[data-radius="sharp"] textarea,body[data-radius="sharp"] input[type="text"]{border-radius:4px}
body[data-radius="round"] .welcome{border-radius:34px}
body[data-radius="round"] .composer{border-radius:26px}
body[data-radius="round"] .code-block{border-radius:16px}
body[data-radius="round"] .new-chat,body[data-radius="round"] .h-item,body[data-radius="round"] .project-item{border-radius:16px}
body[data-radius="round"] .attach-thumb{border-radius:13px}
body[data-radius="round"] .account-card{border-radius:15px}
body[data-radius="round"] .avatar{border-radius:12px}
body[data-radius="round"] .composer button,body[data-radius="round"] .attach-btn{border-radius:14px}
body[data-radius="round"] .modal{border-radius:26px}
body[data-radius="round"] textarea,body[data-radius="round"] input[type="text"]{border-radius:14px}

/* ---------- design: densidad ---------- */
body[data-density="compact"] .message{margin-bottom:14px}
body[data-density="compact"] .thread{padding-top:40px}
body[data-density="compact"] .content p{margin-bottom:8px}
body[data-density="compact"] .h-item{padding:6px 8px 6px 10px}
body[data-density="compact"] .new-chat{margin:10px 12px 4px;padding:8px 12px}
body[data-density="compact"] .side-top{padding:12px 16px 2px}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font-ui),sans-serif;overflow:hidden;overscroll-behavior:none}

/* ---------- scrollbars ----------
   Without this, browsers fall back to their native scrollbar — on Windows
   (especially inside an installed PWA window) that's a chunky grey classic
   scrollbar with up/down arrow buttons that clashes hard with the rest of
   the UI. This themes it everywhere scrolling happens: thin, rounded,
   barely-there until hovered. Firefox uses scrollbar-width/-color; Chromium
   / Safari / Edge use the ::-webkit-scrollbar-* pseudo-elements — both are
   included so every engine gets the same treatment. */
*{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.16) transparent}
*::-webkit-scrollbar{width:8px;height:8px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background:rgba(255,255,255,.14);border-radius:8px;border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.28);background-clip:padding-box}

.app{display:flex;height:100vh;height:100dvh;position:relative;max-width:100vw;overflow:hidden}

/* ---------- sidebar ---------- */
.sidebar{width:var(--sidebar-w);flex:0 0 var(--sidebar-w);background:rgba(2,10,19,.9);border-right:1px solid var(--line);display:flex;flex-direction:column;z-index:20;transition:transform .25s ease}
.side-top{padding:18px 16px 4px}
.brand{display:flex;align-items:center;gap:10px;font:800 14px "Manrope";letter-spacing:.13em;text-decoration:none;color:var(--text)}
.brand img{width:28px;height:28px;object-fit:contain}
.brand b{color:#72d9ff}
.new-chat{margin:16px 12px 6px;display:flex;align-items:center;gap:9px;background:rgba(0,169,217,.08);border:1px solid rgba(0,169,217,.3);color:#bfeeff;border-radius:10px;padding:10px 13px;font:600 13px var(--font-ui);cursor:pointer;transition:background .15s ease}
.new-chat:hover{background:rgba(0,169,217,.16)}
.nav-label{padding:16px 20px 6px;font:700 10.5px var(--font-ui);letter-spacing:.09em;text-transform:uppercase;color:#4f5d68}
.history{flex:1;overflow-y:auto;padding:0 10px 10px}
.history-empty{color:#4f5d68;font-size:12px;padding:14px 10px}
.h-item{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:8px 10px 8px 12px;border-radius:9px;font-size:13px;color:#9fadb9;cursor:pointer;margin-bottom:1px;position:relative;transition:background .12s ease,color .12s ease}
.h-item span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.h-item:hover{background:rgba(255,255,255,.06);color:#fff}
.h-item.active{background:rgba(23,110,177,.18);color:#fff}
.h-item.active::before{content:"";position:absolute;left:2px;top:8px;bottom:8px;width:2px;border-radius:2px;background:#00a9d9}
.h-item .del{all:unset;opacity:0;flex:0 0 auto;display:grid;place-items:center;width:18px;height:18px;color:#7a8894;border-radius:5px;cursor:pointer;box-sizing:border-box}
.h-item:hover .del,.h-item:focus-visible .del{opacity:1}
.h-item .del:hover{color:#fff;background:rgba(255,255,255,.08)}
.side-bottom{padding:12px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:2px}
.status{display:flex;align-items:center;gap:6px;color:#657482;font-size:10px}
.status i{width:6px;height:6px;border-radius:50%;background:#657482;flex:0 0 auto}
.status.ready i{background:#5fe0b2;box-shadow:0 0 10px rgba(95,224,178,.7)}
.status.error i{background:#ff7070}
.status-corner{position:fixed;top:10px;right:12px;z-index:40;padding:5px 9px 5px 8px;border-radius:20px;background:rgba(2,8,15,.6);border:1px solid var(--line);backdrop-filter:blur(10px);pointer-events:none}
.app-version{color:#455260;font-size:10px;letter-spacing:.06em;padding:0 6px 6px}

.menu-toggle{display:none;position:fixed;top:16px;left:16px;z-index:30;width:38px;height:38px;border-radius:10px;border:1px solid var(--line);background:rgba(2,8,15,.75);backdrop-filter:blur(10px);color:var(--text);cursor:pointer;align-items:center;justify-content:center}
.scrim{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:15}

/* ---------- main ---------- */
.main{flex:1;position:relative;display:flex;flex-direction:column;min-width:0}

/* Signature background: concentric chevron rings echoing the Azyvion
   mark — a signal radiating upward, not a stock radial-glow blob. Faint
   grid kept underneath purely as texture. */
.bg-grid{position:fixed;inset:0;opacity:.12;background-image:linear-gradient(rgba(255,255,255,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.05) 1px,transparent 1px);background-size:65px 65px;mask-image:radial-gradient(circle at 50% 30%,#000,transparent 70%);pointer-events:none;z-index:0}
.beacon{position:fixed;top:-6%;left:50%;transform:translateX(-50%);width:min(1100px,140vw);aspect-ratio:1/.62;pointer-events:none;z-index:0;opacity:.55;mask-image:linear-gradient(to bottom,#000 45%,transparent 92%)}
.beacon svg{width:100%;height:100%;display:block}
.beacon path{fill:none;stroke-linecap:round}
.beacon .r1{stroke:rgba(0,169,217,.5)}
.beacon .r2{stroke:rgba(23,110,177,.38)}
.beacon .r3{stroke:rgba(23,110,177,.22)}
.beacon .r4{stroke:rgba(255,255,255,.08)}
@media(prefers-reduced-motion:no-preference){
  .beacon .r1{animation:beam 5s ease-in-out infinite}
  .beacon .r2{animation:beam 5s ease-in-out .5s infinite}
  .beacon .r3{animation:beam 5s ease-in-out 1s infinite}
}
@keyframes beam{0%,100%{opacity:.5;transform:translateY(0)}50%{opacity:1;transform:translateY(-6px)}}

.thread{flex:1;overflow-y:auto;position:relative;z-index:1;padding:60px 0 20px}

/* welcome: light card (tema claro), estilo Claude.ai, sobre el fondo oscuro del resto de la app */
.welcome{text-align:center;max-width:660px;margin:20px auto 40px;padding:46px 40px 42px;background:var(--light-bg);border:1px solid var(--light-border);border-radius:26px;box-shadow:0 30px 90px rgba(4,19,35,.4);color:var(--light-text)}
.welcome-greet{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}
.welcome-mark{width:30px;height:30px;flex:0 0 auto;display:inline-flex}
.welcome-mark svg{width:100%;height:100%}
.welcome h1{font:500 clamp(28px,4.2vw,42px)/1.08 "Newsreader",serif;letter-spacing:-.01em;margin:0;color:var(--light-text)}
.welcome h1 em{font-style:italic;font-weight:600;color:var(--blue)}
.welcome>p{max-width:460px;margin:18px auto 0;color:var(--light-muted);font-size:14px;line-height:1.6}
.suggestions{display:flex;gap:9px;flex-wrap:wrap;justify-content:center;margin-top:28px}
.suggestions button{display:inline-flex;align-items:center;gap:7px;background:var(--light-panel);color:#33424c;border:1px solid var(--light-border);border-radius:999px;padding:10px 15px;font:600 12.5px var(--font-ui);cursor:pointer;box-shadow:0 1px 2px rgba(4,19,35,.05)}
.suggestions button svg{flex:0 0 auto;color:var(--blue)}
.suggestions button:hover{color:var(--light-text);border-color:rgba(23,110,177,.5);background:#fbfcfd}

.messages{max-width:820px;margin:0 auto;padding:0 24px}
.message{display:flex;gap:13px;margin-bottom:24px;animation:rise .3s ease both}
@keyframes rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.message{animation:none}}
.avatar{flex:0 0 32px;height:32px;border:1px solid rgba(0,169,217,.35);border-radius:9px;display:grid;place-items:center;font:800 11px "Manrope";color:#8fe0ff;background:rgba(0,169,217,.06)}
.bubble{max-width:680px;min-width:0}
.label{display:block;color:#657583;font-size:9px;font-weight:700;letter-spacing:.15em;margin-bottom:7px}
.content{color:#dbe1e6;font-size:14px;line-height:1.7;overflow-wrap:anywhere}
.content p{margin:0 0 12px;white-space:pre-wrap;word-wrap:break-word}
.content p:last-child{margin-bottom:0}
.content h4,.content h5,.content h6{margin:18px 0 8px;color:#fff;font:700 15px "Manrope";letter-spacing:-.01em}
.content h4:first-child,.content h5:first-child,.content h6:first-child{margin-top:0}
.content ul,.content ol{margin:0 0 12px;padding-left:20px}
.content li{margin-bottom:4px}
.content blockquote{margin:0 0 12px;padding:2px 14px;border-left:2px solid rgba(0,169,217,.4);color:#a9b5c0}
.content a{color:#76d9ff;text-decoration:underline;text-underline-offset:2px}
.content code{background:rgba(255,255,255,.08);border:1px solid var(--line);border-radius:5px;padding:1px 6px;font:12.5px "SFMono-Regular",Consolas,monospace;color:#8fe0ff}
.code-block{margin:4px 0 12px;border:1px solid var(--line);border-radius:11px;overflow:hidden;background:rgba(0,0,0,.28)}
.code-bar{display:flex;align-items:center;justify-content:space-between;padding:7px 12px;background:rgba(255,255,255,.04);border-bottom:1px solid var(--line);font:11px var(--font-ui);color:#7a8894;text-transform:lowercase;letter-spacing:.04em}
.code-block pre{margin:0;padding:13px 14px;overflow-x:auto}
.code-block code{background:none;border:0;padding:0;color:#d9e6ee;font:12.5px/1.6 "SFMono-Regular",Consolas,monospace}
.copy-code,.copy-msg{background:transparent;border:1px solid var(--line);color:#8fa0ac;border-radius:6px;padding:3px 9px;font:10px var(--font-ui);letter-spacing:.04em;cursor:pointer}
.copy-code:hover,.copy-msg:hover{color:#fff;border-color:rgba(0,169,217,.45)}
.copy-code.copied{color:#5fe0b2;border-color:rgba(95,224,178,.4)}
.msg-actions{margin-top:8px;display:flex;opacity:0;transition:opacity .15s}
.message.assistant:hover .msg-actions{opacity:1}
.message.user{justify-content:flex-end}
.message.user .avatar{order:2;border-color:rgba(239,241,243,.18);color:#fff;background:rgba(239,241,243,.05)}
.message.user .bubble{background:rgba(23,110,177,.18);border:1px solid rgba(23,110,177,.3);padding:12px 15px;border-radius:15px 4px 15px 15px}
.message.user .bubble .content p{margin-bottom:0}
.message.user .label{display:none}

.msg-images{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.msg-images img{max-width:180px;max-height:180px;border-radius:10px;border:1px solid var(--line);object-fit:cover}

/* ---------- generated images (Straks Imagen) ---------- */
.gen-image-wrap{margin-bottom:8px;max-width:320px}
.gen-image-wrap img{width:100%;max-height:320px;border-radius:12px;border:1px solid var(--line);object-fit:cover;background:rgba(255,255,255,.03);display:block}
.gen-image-wrap.loading img{filter:blur(6px);opacity:.55}
.gen-image-wrap .gen-image-status{display:flex;align-items:center;gap:6px;margin-top:6px;font:500 11px var(--font-ui);color:var(--muted)}
.gen-image-actions{display:flex;gap:6px;margin-top:6px}
.gen-image-actions a,.gen-image-actions button{font:600 11px var(--font-ui);color:#c9d5dd;background:rgba(255,255,255,.06);border:0;border-radius:7px;padding:5px 9px;cursor:pointer;text-decoration:none}
.gen-image-actions a:hover,.gen-image-actions button:hover{background:rgba(255,255,255,.12);color:#fff}
.gen-image-actions .gen-regenerate{margin-left:auto}

.typing{display:inline-flex;gap:4px}
.typing span{width:5px;height:5px;border-radius:50%;background:#6fdcff;animation:b 1s infinite}
.typing span:nth-child(2){animation-delay:.15s}
.typing span:nth-child(3){animation-delay:.3s}
@keyframes b{50%{opacity:.2;transform:translateY(-2px)}}

/* streaming "materialize" effect */
.stream-text{margin:0;color:#dbe1e6;font-size:14px;line-height:1.7;white-space:pre-wrap;word-wrap:break-word}
.mat-in{display:inline;filter:blur(2px);color:#7fe0ff;animation:mat .35s ease forwards}
@keyframes mat{to{filter:blur(0);color:#dbe1e6}}
@media(prefers-reduced-motion:reduce){.mat-in{filter:none;animation:none}}
.stream-cursor{display:inline-block;width:7px;height:15px;margin-left:2px;background:#6fdcff;vertical-align:-2px;animation:blink 1s step-end infinite}
@keyframes blink{50%{opacity:0}}
.message.assistant.streaming .avatar{box-shadow:0 0 16px rgba(0,169,217,.55)}

/* ---------- focus states (keyboard nav) ---------- */
a:focus-visible,button:focus-visible,textarea:focus-visible,.h-item:focus-visible{outline:2px solid #00a9d9;outline-offset:2px}

/* ---------- composer ---------- */
.composer-dock{position:relative;z-index:1;max-width:820px;width:100%;margin:0 auto;padding:0 24px 22px}
.attach-preview{display:flex;gap:8px;flex-wrap:wrap;padding:0 4px 8px}

/* ---------- model picker ---------- */
.model-bar{display:block;padding:0 4px 8px;position:relative}
.model-picker-btn{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--light-border);background:var(--light-panel);color:var(--light-text);font:600 12.5px var(--font-ui);padding:6px 12px 6px 8px;border-radius:999px;cursor:pointer;box-shadow:0 1px 2px rgba(4,19,35,.05)}
.model-picker-btn:hover{background:rgba(4,19,35,.05)}
.model-picker-icon{display:inline-flex;align-items:center;justify-content:center;width:19px;height:19px;border-radius:6px;background:linear-gradient(135deg,var(--blue),var(--cyan));color:#fff;font:700 10px var(--font-ui);flex:0 0 auto}
.model-picker-caret{color:var(--light-muted);flex:0 0 auto;transition:transform .15s ease}
.model-picker-btn[aria-expanded="true"] .model-picker-caret{transform:rotate(180deg)}
.model-popover{display:flex;flex-direction:column;gap:2px;position:absolute;left:4px;bottom:calc(100% + 8px);z-index:80;width:280px;padding:6px;border:1px solid var(--light-border);background:var(--light-panel);border-radius:16px;box-shadow:0 24px 60px rgba(4,19,35,.25)}
.model-popover[hidden]{display:none}
.model-option{width:100%;display:flex;align-items:center;gap:10px;border:0;background:transparent;text-align:left;padding:9px 10px;border-radius:11px;cursor:pointer;font:inherit}
.model-option:hover{background:rgba(4,19,35,.05)}
.model-option-icon{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;flex:0 0 auto;color:#fff}
.model-option-icon.straks{background:linear-gradient(135deg,var(--blue),var(--cyan));font:700 12px var(--font-ui)}
.model-option-icon.straks-image{background:linear-gradient(135deg,#7c4dff,#ff6fa5)}
.model-option-main{display:flex;flex-direction:column;gap:1px;flex:1 1 auto;min-width:0}
.model-option-name{font:600 13px var(--font-ui);color:var(--light-text)}
.model-option-desc{font:500 11px var(--font-ui);color:var(--light-muted)}
.model-check{color:var(--blue);flex:0 0 auto;opacity:0}
.model-option.active .model-check{opacity:1}
@media(max-width:860px){.model-popover{left:4px;right:auto;width:min(280px,calc(100vw - 48px))}}
.attach-thumb{position:relative;width:56px;height:56px;border-radius:9px;overflow:hidden;border:1px solid var(--line)}
.attach-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.attach-thumb .rm{position:absolute;top:2px;right:2px;width:16px;height:16px;border-radius:5px;background:rgba(0,0,0,.6);color:#fff;font-size:10px;display:grid;place-items:center;cursor:pointer}

.composer{display:flex;align-items:flex-end;gap:8px;padding:10px;border:1px solid var(--light-border);background:var(--light-panel);border-radius:18px;box-shadow:0 20px 60px rgba(4,19,35,.4)}
.attach-btn{flex:0 0 auto;width:38px;height:38px;border:0;border-radius:11px;background:transparent;color:var(--light-muted);cursor:pointer;display:grid;place-items:center}
.attach-btn:hover{background:rgba(4,19,35,.06);color:var(--light-text)}
textarea{resize:none;flex:1;border:0;outline:0;background:transparent;color:var(--light-text);font:14px var(--font-ui);padding:10px;max-height:150px}
textarea::placeholder{color:#8b98a3}
.composer button[type="submit"]{flex:0 0 auto;width:38px;height:38px;border:0;border-radius:11px;background:var(--blue);color:#fff;font-size:18px;cursor:pointer;display:grid;place-items:center}
.composer button[type="submit"]:hover{background:#1c7ec2}
.composer button:disabled{opacity:.45;cursor:default}
.voice-btn{flex:0 0 auto;width:38px;height:38px;border:0;border-radius:11px;background:transparent;color:var(--light-muted);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
.voice-btn:hover{background:rgba(4,19,35,.06);color:var(--light-text)}
.voice-btn.unavailable{opacity:.35;cursor:not-allowed}
.hint{text-align:center;color:#4f5d68;font-size:9px;letter-spacing:.08em;padding:10px 0 0}

/* ---------- voice conversation ----------
   Full-screen overlay for the "talk to Azyvion AI" feature (see voice.js).
   Same state machine end to end: activating -> listening -> processing ->
   thinking -> speaking, plus error/denied. The orb's glow color and the
   bar animation just reflect whichever `.state-*` class is on the root. */
.voice-overlay{position:fixed;inset:0;z-index:110;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:28px 20px calc(36px + env(safe-area-inset-bottom));background:radial-gradient(circle at 50% 30%,rgba(0,64,110,.55),rgba(0,4,10,.97) 70%);backdrop-filter:blur(22px)}
.voice-overlay[hidden]{display:none}
body.voice-locked{overflow:hidden}

.voice-close{position:absolute;top:18px;right:18px;width:36px;height:36px;border:1px solid var(--line);border-radius:50%;background:rgba(255,255,255,.06);color:var(--text);display:grid;place-items:center;cursor:pointer}
.voice-close:hover{background:rgba(255,255,255,.12)}

.voice-stage{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;text-align:center;max-width:520px}

.voice-orb{width:150px;height:150px;border-radius:50%;display:grid;place-items:center;background:radial-gradient(circle at 35% 30%,rgba(0,169,217,.5),rgba(23,110,177,.22) 55%,transparent 75%);border:1px solid rgba(0,169,217,.35);box-shadow:0 0 0 rgba(0,169,217,.35);transition:box-shadow .35s ease,border-color .35s ease;position:relative;cursor:default}
.voice-orb::after{content:"";position:absolute;inset:-14px;border-radius:50%;border:1px solid rgba(0,169,217,.16);animation:voice-pulse 2.6s ease-out infinite}
@keyframes voice-pulse{0%{transform:scale(.86);opacity:.7}100%{transform:scale(1.4);opacity:0}}

.voice-bars{display:flex;align-items:center;gap:4px;height:46px}
.voice-bars span{width:4px;height:44px;border-radius:3px;background:linear-gradient(180deg,#00d4ff,#176eb1);transform:scaleY(var(--bar-scale,.25));transition:transform .07s linear}

.voice-status{margin:0;font:600 15px "DM Sans";color:var(--text);letter-spacing:.01em}
.voice-caption{margin:0;min-height:44px;font:400 14px "DM Sans";color:var(--muted);max-width:460px;line-height:1.5}

.voice-controls{display:flex;align-items:center;gap:22px}
.voice-control{width:56px;height:56px;border-radius:50%;border:1px solid var(--line);background:rgba(255,255,255,.06);color:var(--text);display:grid;place-items:center;cursor:pointer;transition:background .15s,transform .1s}
.voice-control:active{transform:scale(.94)}
.voice-mute.muted{background:rgba(255,255,255,.2);color:#fff}
.voice-end{width:64px;height:64px;background:#e5484d;border-color:transparent;color:#fff}
.voice-end:hover{background:#d33438}

.voice-overlay.state-activating .voice-status{opacity:.85}
.voice-overlay.state-listening .voice-orb{box-shadow:0 0 46px rgba(0,169,217,.55)}
.voice-overlay.state-processing .voice-orb,.voice-overlay.state-thinking .voice-orb{animation:voice-think 1.1s ease-in-out infinite}
@keyframes voice-think{0%,100%{opacity:.65}50%{opacity:1}}
.voice-overlay.state-speaking .voice-orb{box-shadow:0 0 46px rgba(124,77,255,.55);border-color:rgba(124,77,255,.45)}
.voice-overlay.state-speaking .voice-bars span{background:linear-gradient(180deg,#c58bff,#7c4dff)}
.voice-overlay.state-error .voice-orb,.voice-overlay.state-denied .voice-orb{box-shadow:0 0 30px rgba(229,72,77,.5);border-color:rgba(229,72,77,.5);cursor:pointer}
.voice-overlay.state-error .voice-status,.voice-overlay.state-denied .voice-status{color:#ff8a8f}

@media (max-width:640px){
  .voice-orb{width:120px;height:120px}
  .voice-control{width:50px;height:50px}
  .voice-end{width:58px;height:58px}
}

/* ---------- PWA: banner de instalación + toast de actualización ---------- */
.install-banner{position:fixed;left:16px;right:16px;bottom:16px;z-index:50;display:flex;align-items:center;gap:12px;justify-content:space-between;padding:13px 16px;border:1px solid var(--line);background:rgba(4,19,35,.96);backdrop-filter:blur(20px);border-radius:14px;box-shadow:0 20px 60px rgba(0,0,0,.45);max-width:520px;margin:0 auto;animation:slideUp .3s ease}
@keyframes slideUp{from{transform:translateY(16px);opacity:0}to{transform:translateY(0);opacity:1}}
.install-banner-text{display:flex;flex-direction:column;gap:2px;min-width:0}
.install-banner-text strong{font:700 13px "Manrope";color:#fff}
.install-banner-text span{font-size:12px;color:#9fadb9;line-height:1.4}
.install-banner-text b{color:#bfeeff;font-weight:600}
.install-banner-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.install-btn{background:#00a9d9;border:0;color:#041323;font:700 12.5px var(--font-ui);padding:9px 16px;border-radius:9px;cursor:pointer;white-space:nowrap}
.install-btn:hover{background:#38c3ee}
.install-close{all:unset;flex:0 0 auto;width:24px;height:24px;display:grid;place-items:center;color:#7a8894;border-radius:6px;cursor:pointer;font-size:11px}
.install-close:hover{color:#fff;background:rgba(255,255,255,.08)}

.update-toast{position:fixed;top:16px;left:50%;transform:translateX(-50%);z-index:60;padding:10px 18px;border-radius:20px;background:rgba(0,169,217,.16);border:1px solid rgba(0,169,217,.4);color:#bfeeff;font:600 12.5px var(--font-ui);box-shadow:0 10px 30px rgba(0,0,0,.4);animation:slideDown .25s ease}
@keyframes slideDown{from{transform:translate(-50%,-12px);opacity:0}to{transform:translate(-50%,0);opacity:1}}

@media(max-width:860px){
  .install-banner{left:12px;right:12px;bottom:12px;flex-direction:column;align-items:stretch}
  .install-banner-actions{justify-content:flex-end}
}

/* ---------- responsive / mobile sidebar ---------- */
@media(max-width:860px){
  .menu-toggle{display:flex}
  .sidebar{position:fixed;top:0;left:0;bottom:0;width:min(var(--sidebar-w),86vw);flex-basis:min(var(--sidebar-w),86vw);transform:translateX(-100%)}
  .app.sidebar-open .sidebar{transform:translateX(0)}
  .app.sidebar-open .scrim{display:block}
  .thread{padding-top:76px}
  .welcome{margin:16px auto 28px;padding:32px 22px 30px}
  .welcome h1{font-size:32px}
  .messages{padding:0 16px}
  .composer-dock{padding:0 16px 16px}
}

/* Small phones (iPhone SE and similar ~360-390px wide, plus any narrow
   resized desktop/PWA window): tighten everything further so nothing
   crowds or clips, and give every fixed UI element room for the notch /
   home-indicator via safe-area insets. */
@media(max-width:480px){
  .menu-toggle{top:calc(12px + env(safe-area-inset-top));left:calc(12px + env(safe-area-inset-left))}
  .status-corner{top:calc(10px + env(safe-area-inset-top));right:calc(10px + env(safe-area-inset-right))}
  .thread{padding-top:68px}
  .welcome{margin:12px auto 20px;padding:26px 16px 24px;border-radius:20px}
  .welcome h1{font-size:26px}
  .welcome>p{font-size:13px}
  .suggestions button{padding:8px 12px;font-size:11.5px}
  .messages{padding:0 12px}
  .message{gap:9px;margin-bottom:18px}
  .avatar{flex-basis:26px;width:26px;height:26px;border-radius:8px}
  .bubble{max-width:calc(100vw - 70px)}
  .composer-dock{padding:0 10px calc(10px + env(safe-area-inset-bottom))}
  .composer{padding:8px;gap:6px}
  .attach-btn,.composer button[type="submit"]{width:36px;height:36px}
  textarea{padding:8px;font-size:15px} /* 15px+ keeps iOS Safari from auto-zooming on focus */
  .model-picker-btn{padding:5px 10px 5px 7px;font-size:12px}
  .model-popover{width:min(280px,calc(100vw - 24px))}
  .gen-image-wrap{max-width:100%}
}

/* Guards against genuinely tiny/oddly-resized windows (e.g. a desktop PWA
   dragged down to ~150px wide) where fixed-width children could otherwise
   force horizontal overflow and drag in a scrollbar for the whole app. */
.sidebar,.main{min-width:0}
img,svg{max-width:100%}


/* ---------- Azyvion AI 3.1 — account/auth ---------- */
.account-card{display:flex;align-items:center;gap:9px;padding:7px 7px 7px 6px;border-radius:11px;cursor:pointer;transition:background .12s ease}
.account-card:hover{background:rgba(255,255,255,.05)}
.account-avatar{width:30px;height:30px;flex:0 0 30px;border-radius:50%;border:1px solid rgba(0,169,217,.3);background-size:cover;background-position:center;display:grid;place-items:center;color:#bfeeff;background-color:rgba(0,169,217,.14);font:800 12px "Manrope";overflow:hidden}
.account-copy{min-width:0;display:flex;flex-direction:column;gap:2px;flex:1}
.account-copy strong{font:600 11.5px "Manrope";color:#eef5f8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.account-copy span{font-size:9px;color:#687784;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.account-menu{all:unset;width:24px;height:24px;flex:0 0 auto;border-radius:7px;color:#71808d;display:grid;place-items:center;cursor:pointer}
.account-menu:hover{background:rgba(255,255,255,.08);color:#fff}
.account-popover{position:fixed;left:12px;bottom:82px;z-index:80;padding:5px;min-width:180px;border:1px solid var(--line);background:rgba(4,19,35,.98);border-radius:10px;box-shadow:0 20px 50px rgba(0,0,0,.45)}
.account-popover button{border:0;background:transparent;color:#c9d5dd;font:500 12px var(--font-ui);padding:8px 12px;border-radius:7px;cursor:pointer}
.account-popover button:hover{background:rgba(255,255,255,.06);color:#fff}
.auth-overlay{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:20px;background:rgba(0,4,10,.82);backdrop-filter:blur(18px)}
.auth-overlay[hidden],.account-popover[hidden]{display:none}
.auth-card{position:relative;width:min(420px,100%);padding:34px;border:1px solid rgba(239,241,243,.12);border-radius:22px;background:linear-gradient(180deg,rgba(8,26,43,.96),rgba(2,11,20,.98));box-shadow:0 30px 100px rgba(0,0,0,.55);text-align:center}
.auth-mark{width:54px;height:54px;margin:0 auto 18px;border:1px solid rgba(0,169,217,.32);border-radius:16px;display:grid;place-items:center;background:rgba(0,169,217,.07);overflow:hidden}
.auth-mark img{width:38px;height:38px;object-fit:contain}
.auth-eyebrow{font-size:9px;letter-spacing:.22em;color:#5e7482;font-weight:700}
.auth-card h2{margin:10px 0 9px;font:800 30px/1 "Manrope";letter-spacing:-.045em;color:#fff}
.auth-card p{margin:0 auto 22px;max-width:330px;color:#91a0ad;font-size:13px;line-height:1.6}
.google-btn{width:100%;height:46px;border:1px solid rgba(255,255,255,.14);border-radius:11px;background:#fff;color:#1b2630;display:flex;align-items:center;justify-content:center;gap:10px;font:600 13px var(--font-ui);cursor:pointer;transition:transform .15s ease,box-shadow .15s ease,opacity .15s ease}
.google-btn:hover{transform:translateY(-1px);box-shadow:0 10px 26px rgba(0,0,0,.25)}
.google-btn:disabled{opacity:.65;cursor:default;transform:none}
.google-btn svg{width:18px;height:18px}
.google-btn.loading{opacity:.7}
.guest-btn{width:100%;height:38px;margin-top:10px;border:0;background:transparent;color:#7a8c98;font:600 12px var(--font-ui);cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.guest-btn:hover{color:#c7d3da}
.auth-note{margin-top:14px;color:#596b77;font-size:10px;line-height:1.5}
body.auth-locked .main{filter:blur(2px);pointer-events:none}
@media(max-width:860px){.account-popover{left:12px;right:auto;bottom:82px}.auth-card{padding:28px 22px}}

/* ---------- Azyvion AI 3.2 — proyectos ---------- */
.nav-label-row{display:flex;align-items:center;justify-content:space-between;padding:16px 12px 6px 20px}
.nav-label-row .nav-label{padding:0}
.nav-add{all:unset;width:20px;height:20px;display:grid;place-items:center;border-radius:6px;color:#8b98a3;cursor:pointer;font:700 14px var(--font-ui);box-sizing:border-box}
.nav-add:hover{background:rgba(255,255,255,.08);color:#fff}
.projects{padding:0 10px 6px;max-height:34vh;overflow-y:auto}
.project-item{margin-bottom:2px}
.project-row{display:flex;align-items:center;gap:6px;padding:7px 6px 7px 4px;border-radius:9px;color:#9fadb9;cursor:default}
.project-row:hover{background:rgba(255,255,255,.06)}
.proj-toggle{all:unset;width:16px;flex:0 0 16px;text-align:center;color:#657583;cursor:pointer;font-size:10px}
.proj-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;cursor:pointer;color:#c7d2da}
.proj-name:hover{color:#fff}
.proj-add,.proj-edit{all:unset;width:18px;height:18px;flex:0 0 auto;display:grid;place-items:center;color:#7a8894;border-radius:5px;cursor:pointer;font-size:12px;box-sizing:border-box}
.proj-add:hover,.proj-edit:hover{color:#fff;background:rgba(255,255,255,.08)}
.project-chats{padding-left:20px;border-left:1px solid var(--line);margin:2px 0 6px 15px}
.project-chats .h-item{font-size:12.5px}

/* ---------- settings link ---------- */
.settings-link{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:8px;padding:8px 8px 8px 7px;margin:2px 0 4px;border-radius:9px;color:#7a8894;font:600 12px var(--font-ui);cursor:pointer;width:100%}
.settings-link:hover{background:rgba(255,255,255,.06);color:#fff}

/* ---------- modales (Configuración / Proyecto) ---------- */
.modal-overlay{position:fixed;inset:0;z-index:120;display:grid;place-items:center;padding:20px;background:rgba(0,4,10,.72);backdrop-filter:blur(10px)}
.modal-overlay[hidden]{display:none}
.modal{width:min(480px,100%);max-height:86vh;overflow-y:auto;border:1px solid rgba(239,241,243,.12);border-radius:20px;background:linear-gradient(180deg,rgba(8,26,43,.98),rgba(2,11,20,.99));box-shadow:0 30px 100px rgba(0,0,0,.55);padding:22px 22px 24px}
.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.modal-head h2{margin:0;font:800 19px "Manrope";color:#fff;letter-spacing:-.02em}
.modal-close{all:unset;width:26px;height:26px;display:grid;place-items:center;border-radius:8px;color:#8b98a3;cursor:pointer}
.modal-close:hover{background:rgba(255,255,255,.08);color:#fff}
.auth-close{position:absolute;top:14px;right:14px}
.settings-tabs{display:flex;gap:4px;padding:3px;border-radius:11px;background:rgba(255,255,255,.05);margin-bottom:16px}
.settings-tab{all:unset;box-sizing:border-box;flex:1;text-align:center;padding:8px 10px;border-radius:9px;font:600 12.5px var(--font-ui);color:#8b98a3;cursor:pointer}
.settings-tab.active{background:rgba(0,169,217,.16);color:#bfeeff}
.settings-pane{display:none;flex-direction:column;gap:14px}
.settings-pane.active{display:flex}
.field-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.field-row label,.field-row span{font-size:13px;color:#c7d2da}
.field-row input[type="color"]{width:38px;height:28px;border:1px solid var(--line);border-radius:7px;background:transparent;cursor:pointer;padding:0}
.field-row select{background:rgba(255,255,255,.05);color:#eff1f3;border:1px solid var(--line);border-radius:8px;padding:6px 8px;font:600 12.5px var(--font-ui)}
.switch-row input[type="checkbox"]{width:36px;height:20px;appearance:none;background:rgba(255,255,255,.12);border-radius:20px;position:relative;cursor:pointer;transition:background .15s ease}
.switch-row input[type="checkbox"]::after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .15s ease}
.switch-row input[type="checkbox"]:checked{background:var(--cyan)}
.switch-row input[type="checkbox"]:checked::after{transform:translateX(16px)}
.settings-divider{height:1px;background:var(--line);margin:2px 0}
.field-label{display:block;font:700 11px var(--font-ui);letter-spacing:.05em;text-transform:uppercase;color:#657583;margin:12px 0 6px}
.field-label:first-child{margin-top:0}
.modal-body input[type="text"],.modal-body textarea,.settings-pane textarea{width:100%;box-sizing:border-box;background:rgba(255,255,255,.05);border:1px solid var(--line);border-radius:10px;color:#eff1f3;font:13px var(--font-ui);padding:10px 12px;resize:vertical}
.modal-body input[type="text"]:focus,.modal-body textarea:focus,.settings-pane textarea:focus{outline:2px solid #00a9d9;outline-offset:1px}
.secondary-btn{background:rgba(255,255,255,.06);border:1px solid var(--line);color:#c7d2da;border-radius:9px;padding:8px 13px;font:600 12px var(--font-ui);cursor:pointer}
.secondary-btn:hover{background:rgba(255,255,255,.1);color:#fff}
.primary-btn{background:var(--blue);border:0;color:#fff;border-radius:9px;padding:9px 16px;font:700 12.5px var(--font-ui);cursor:pointer}
.primary-btn:hover{background:#1c7ec2}
.danger-btn{background:rgba(255,90,90,.1);border:1px solid rgba(255,90,90,.35);color:#ff9a9a;border-radius:9px;padding:8px 13px;font:600 12px var(--font-ui);cursor:pointer}
.danger-btn:hover{background:rgba(255,90,90,.18)}
.modal-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:18px}
.project-files-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.project-file-row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;border:1px solid var(--line);border-radius:8px;font-size:12px;color:#c7d2da}
.project-file-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rm-file{all:unset;color:#8b98a3;cursor:pointer;font-size:11px}
.rm-file:hover{color:#fff}

/* ---------- panel de artefactos ---------- */
.artifact-panel{position:fixed;top:0;right:0;bottom:0;width:min(520px,94vw);z-index:60;background:rgba(2,10,19,.98);border-left:1px solid var(--line);display:flex;flex-direction:column;transform:translateX(0);box-shadow:-20px 0 60px rgba(0,0,0,.4)}
.artifact-panel[hidden]{display:none}
.artifact-head{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--line);font:700 12px var(--font-ui);color:#c7d2da;text-transform:lowercase}
.artifact-actions{display:flex;align-items:center;gap:6px}
.artifact-actions button{background:rgba(255,255,255,.06);border:1px solid var(--line);color:#c7d2da;border-radius:7px;padding:6px 10px;font:600 11px var(--font-ui);cursor:pointer}
.artifact-actions button:hover{background:rgba(255,255,255,.12);color:#fff}
#artifactCloseBtn{padding:6px 9px}
.artifact-body{flex:1;overflow:auto;position:relative}
.artifact-code{margin:0;padding:16px;font:12.5px "SFMono-Regular",Consolas,monospace;color:#dbe1e6;white-space:pre-wrap;word-wrap:break-word}
.artifact-frame{width:100%;height:100%;border:0;background:#fff}
@media(max-width:860px){.artifact-panel{width:100vw}}

/* code block header actions (Copy + Open artifact) */
.code-bar-actions{display:flex;align-items:center;gap:6px}
.open-artifact{background:transparent;border:1px solid var(--line);color:#8fa0ac;border-radius:6px;padding:3px 9px;font:10px var(--font-ui);letter-spacing:.04em;cursor:pointer}
.open-artifact:hover{color:#fff;border-color:rgba(0,169,217,.5)}
