/* ============================================================
   Eximir IA — Chat · hoja de estilos
   Identidad: Space Grotesk (display/cuerpo) / JetBrains Mono (datos)
   Dirección: espacio profundo, liquid glass, estrellas con deriva
   (misma paleta y lenguaje visual que el launcher)
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-user-select: none; }
:root {
  --bg: #05070d;
  --bg1: #0a0f1c;
  --ink: #eef2fa;
  --soft: #8b96ab;
  --muted: #5c667a;
  --hairline: rgba(255,255,255,0.12);
  --accent: #4a9dff;
  --ok: #3fd695;
  --glass: rgba(255,255,255,0.055);
  --glass-edge: rgba(255,255,255,0.14);
  --sidebar-w: 272px;
}
html, body { width: 100%; height: 100%; overflow: hidden; touch-action: pan-x pan-y; font-family: 'Space Grotesk', sans-serif; background: var(--bg); color: var(--ink); }

/* ---------- Fondo: mesh profundo + estrellas con deriva ---------- */
#atmosphere { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(52% 44% at 18% 10%, rgba(74,157,255,.14) 0%, transparent 70%),
    radial-gradient(46% 40% at 85% 16%, rgba(139,108,255,.12) 0%, transparent 70%),
    radial-gradient(50% 46% at 78% 88%, rgba(24,201,154,.08) 0%, transparent 70%),
    radial-gradient(44% 40% at 12% 86%, rgba(255,92,157,.07) 0%, transparent 70%),
    radial-gradient(120% 100% at 50% 0%, var(--bg1) 0%, var(--bg) 68%);
}
#atmosphere::before {
  content: ""; position: absolute; left: 50%; top: 58%;
  width: 900px; height: 900px; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(74,157,255,0.13) 0%, rgba(139,108,255,0.05) 42%, transparent 70%);
  filter: blur(10px);
  transition: opacity 0.6s ease, top 0.6s ease;
}
#atmosphere.chatting::before { top: 16%; opacity: 0.5; }
/* Campo de estrellas: dos capas con parpadeo + deriva lenta (paralaje sutil) */
#atmosphere .starlayer { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: transparent; will-change: transform; }
#atmosphere .s1 {
  left: 8%; top: 12%;
  box-shadow: 12vw 6vh 0 #9fb4d8, 28vw 18vh 0 #9fb4d8, 44vw 4vh 0 #9fb4d8, 63vw 14vh 0 #9fb4d8,
    81vw 8vh 0 #9fb4d8, 5vw 38vh 0 #9fb4d8, 22vw 52vh 0 #9fb4d8, 39vw 66vh 0 #9fb4d8,
    58vw 44vh 0 #9fb4d8, 74vw 58vh 0 #9fb4d8, 88vw 36vh 0 #9fb4d8, 15vw 78vh 0 #9fb4d8,
    47vw 82vh 0 #9fb4d8, 69vw 74vh 0 #9fb4d8, 84vw 84vh 0 #9fb4d8;
  animation: twinkle 5.5s ease-in-out infinite, starDriftA 110s linear infinite alternate;
}
#atmosphere .s2 {
  left: 3%; top: 6%;
  box-shadow: 18vw 26vh 0 #7f92b8, 34vw 34vh 0 #7f92b8, 52vw 22vh 0 #7f92b8, 71vw 30vh 0 #7f92b8,
    90vw 20vh 0 #7f92b8, 10vw 58vh 0 #7f92b8, 30vw 72vh 0 #7f92b8, 55vw 62vh 0 #7f92b8,
    78vw 68vh 0 #7f92b8, 92vw 52vh 0 #7f92b8, 42vw 46vh 0 #7f92b8, 62vw 88vh 0 #7f92b8;
  animation: twinkle 7s ease-in-out 1.8s infinite, starDriftB 160s linear infinite alternate;
}
@keyframes twinkle { 0%, 100% { opacity: 0.18; } 50% { opacity: 0.65; } }
@keyframes starDriftA { from { transform: translate3d(0,0,0); } to { transform: translate3d(-70px,-45px,0); } }
@keyframes starDriftB { from { transform: translate3d(0,0,0); } to { transform: translate3d(55px,-80px,0); } }

/* ---------- Sidebar de historial ---------- */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 50;
  background: rgba(10,15,28,0.72); border-right: 1px solid var(--hairline);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform 0.3s cubic-bezier(.2,.8,.2,1);
}
#sidebar.open { transform: translateX(0); }

#sidebar-header { padding: 18px 14px 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--hairline); }
#new-chat-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--ink); border: 1px solid var(--ink);
  color: #0a0f1c; font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 600;
  padding: 10px 12px; border-radius: 2px; cursor: pointer; transition: background 0.2s ease;
}
#new-chat-btn:hover { background: #fff; }
#search-wrap { position: relative; }
#search-input {
  width: 100%; background: rgba(255,255,255,0.06); border: 1px solid var(--hairline);
  border-radius: 2px; padding: 8px 12px 8px 30px; color: var(--ink);
  font-family: 'Space Grotesk', sans-serif; font-size: 12.5px; outline: none;
  transition: border-color 0.2s ease;
}
#search-input:focus { border-color: rgba(74,157,255,0.55); }
#search-input::placeholder { color: var(--muted); }
#search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--muted); }

#conv-list { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
#conv-list::-webkit-scrollbar { width: 4px; }
#conv-list::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 10px; }
.conv-group-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  color: var(--muted); padding: 14px 8px 6px; letter-spacing: 0.12em;
}
.conv-item {
  display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 2px;
  cursor: pointer; color: var(--soft); transition: background 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
}
.conv-item:hover { background: rgba(255,255,255,0.06); color: var(--ink); border-color: var(--hairline); }
.conv-item.active { background: rgba(255,255,255,0.10); color: var(--ink); border-color: rgba(255,255,255,0.30); }
.conv-title {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-family: 'Space Grotesk', sans-serif;
}
.conv-title-input {
  flex: 1; background: rgba(255,255,255,0.08); border: 1px solid rgba(74,157,255,0.55);
  border-radius: 2px; color: var(--ink); font-size: 12.5px; font-family: 'Space Grotesk', sans-serif;
  padding: 2px 6px; outline: none;
}
.conv-actions { display: none; gap: 2px; flex-shrink: 0; }
.conv-item:hover .conv-actions { display: flex; }
.conv-actions button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 3px; border-radius: 2px; display: flex;
}
.conv-actions button:hover { color: var(--ink); background: rgba(255,255,255,0.08); }
.conv-actions svg { width: 13px; height: 13px; }
#conv-empty {
  padding: 20px 10px; font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  color: var(--muted); text-align: center; line-height: 1.5;
}

#sidebar-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
#sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

/* ---------- Header ---------- */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px; transition: padding-left 0.3s cubic-bezier(.2,.8,.2,1);
}
body.sidebar-open #header { padding-left: calc(var(--sidebar-w) + 32px); }

#header-left { display: flex; align-items: center; gap: 16px; }
#sidebar-toggle {
  background: rgba(255,255,255,0.05); border: 1px solid var(--hairline); color: var(--ink);
  width: 34px; height: 34px; border-radius: 2px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: border-color 0.2s ease;
}
#sidebar-toggle:hover { border-color: rgba(255,255,255,0.4); }
#sidebar-toggle svg { width: 16px; height: 16px; }

#brand { display: flex; align-items: center; gap: 10px; }
#brand .mark {
  width: 18px; height: 18px;
  border: 1.5px solid var(--ink);
  transform: rotate(45deg) scale(0.82);
  background: transparent;
}
#brand .word { font-family: 'Space Grotesk', sans-serif; font-size: 16px; color: var(--ink); letter-spacing: -0.01em; text-decoration: none; font-weight: 600; }
#brand .word b { font-weight: 300; color: var(--soft); }

#header-right { display: flex; align-items: center; gap: 14px; }
#cosmic-link, .header-link {
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px; letter-spacing: 0.08em;
  color: var(--soft); text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--hairline); padding: 8px 12px; border-radius: 2px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, color 0.2s ease;
}
#cosmic-link:hover, .header-link:hover { border-color: rgba(255,255,255,0.4); color: var(--ink); }

#status {
  display: flex; align-items: center; gap: 7px;
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase;
}
#status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(63,214,149,0.6); }

#settings-btn {
  background: rgba(255,255,255,0.05); border: 1px solid var(--hairline); color: var(--ink);
  width: 34px; height: 34px; border-radius: 2px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: border-color 0.2s ease;
}
#settings-btn:hover { border-color: rgba(255,255,255,0.4); }
#settings-btn svg { width: 15px; height: 15px; }

/* ---------- Modal de ajustes: <dialog> nativo + PrettyModal ----------
   El contenido vive en #settings-inner para que un clic directo sobre el
   dialog (= backdrop) pueda cerrarlo sin falsos positivos. */
#settings-modal {
  position: fixed; inset: 0; margin: auto;
  width: min(420px, 90vw); max-height: min(82vh, 640px); overflow-y: auto;
  background: rgba(13,19,34,0.92); border: 1px solid var(--glass-edge);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: 16px; padding: 0; color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
}
#settings-modal::backdrop {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
#settings-inner { padding: 28px; }
#settings-modal h2 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
#settings-modal p { font-family: 'Space Grotesk', sans-serif; font-size: 12.5px; color: var(--soft); line-height: 1.5; margin-bottom: 16px; }
#settings-modal input {
  width: 100%; background: rgba(255,255,255,0.06); border: 1px solid var(--hairline);
  border-radius: 2px; padding: 10px 12px; color: var(--ink); font-family: 'JetBrains Mono', monospace;
  font-size: 12px; outline: none; margin-bottom: 14px; transition: border-color 0.2s ease;
}
#settings-modal input:focus { border-color: rgba(74,157,255,0.55); }
#settings-actions { display: flex; gap: 10px; justify-content: flex-end; }
#settings-actions button {
  font-family: 'Space Grotesk', sans-serif; font-size: 13px; padding: 9px 16px; border-radius: 2px;
  border: none; cursor: pointer;
}
#settings-cancel { background: transparent; color: var(--soft); }
#settings-save { background: var(--ink); color: #0a0f1c; font-weight: 600; }

/* ---------- Layout principal ---------- */
#main {
  position: relative; z-index: 2; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: padding-left 0.3s cubic-bezier(.2,.8,.2,1);
}
body.sidebar-open #main { padding-left: var(--sidebar-w); }

#hero { text-align: center; padding: 0 24px; transition: opacity 0.4s ease, transform 0.4s ease; }
#hero h1 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 500; font-size: clamp(28px, 4vw, 44px);
  color: var(--ink); letter-spacing: -0.03em; line-height: 1.15;
  text-shadow: 0 0 32px rgba(74,157,255,0.35), 0 0 80px rgba(139,108,255,0.18);
}
#hero p {
  margin-top: 14px; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted);
  max-width: 460px; margin-left: auto; margin-right: auto; line-height: 1.7;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---------- Hilo de conversación ---------- */
#thread {
  position: absolute; top: 0; left: 0; right: 0; bottom: 130px;
  overflow-y: auto; padding: 90px 24px 30px;
  display: none; flex-direction: column; gap: 16px; align-items: center;
  transition: left 0.3s cubic-bezier(.2,.8,.2,1);
}
body.sidebar-open #thread { left: var(--sidebar-w); }
#thread::-webkit-scrollbar { width: 5px; }
#thread::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 10px; }
/* ---------- Hilo estilo Focus: sin burbujas, documento con separadores ---------- */
.thread-inner { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 0; }

/* user-select:text: el reset global lo bloquea y las respuestas de la IA
   deben poder copiarse */
.msg, .msg * { user-select: text; -webkit-user-select: text; }
.msg { max-width: 100%; width: 100%; padding: 22px 4px 24px; border-bottom: 1px solid var(--hairline); font-size: 15px; line-height: 1.7; background: none; border-radius: 0; }
.msg::before {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 10px;
}
.msg.user { align-self: stretch; text-align: right; color: var(--ink); font-family: 'Space Grotesk', sans-serif; font-weight: 500; font-size: 16px; line-height: 1.5; }
.msg.user::before { content: "Tú"; color: var(--muted); }
.msg.ai { align-self: stretch; color: #c9d3e6; border: none; border-bottom: 1px solid var(--hairline); font-family: 'Space Grotesk', sans-serif; }
.msg.ai::before { content: "Eximir"; color: var(--accent); }
.msg.ai .tag { display: none; }
.save-suggest {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 16px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--hairline);
  color: var(--soft); font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.08em; padding: 8px 14px; border-radius: 2px; cursor: pointer;
  text-transform: uppercase; max-width: 100%;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.save-suggest:hover { border-color: rgba(255,255,255,0.4); color: var(--ink); }
.save-suggest.saved { opacity: 0.7; cursor: default; border-color: rgba(63,214,149,0.4); color: var(--ok); }
.save-suggest .ss-label { font-weight: 600; }
.save-suggest .ss-preview {
  text-transform: none; letter-spacing: 0; font-size: 10px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.memory-confirm {
  align-self: center; margin: 14px 0; font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ok); padding: 7px 0; border: none; background: none;
}
/* Tarjeta de confirmación de acción (memoria · Eclipse · Ideas) */
.action-card {
  align-self: stretch; display: flex; align-items: center; gap: 12px;
  margin: 12px 0; padding: 12px 16px;
  border: 1px solid rgba(63,214,149,0.35); border-radius: 10px;
  background: rgba(63,214,149,0.08);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.action-card .action-icon { font-size: 20px; line-height: 1; }
.action-card .action-body { flex: 1; min-width: 0; }
.action-card .action-dest {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ok); margin-bottom: 3px;
}
.action-card .action-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.action-card .action-detail {
  font-size: 12.5px; color: var(--soft); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis;
}
.action-card .action-link {
  flex-shrink: 0; font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ok); text-decoration: none;
  border: 1px solid rgba(63,214,149,0.35); border-radius: 6px; padding: 6px 10px;
  transition: background 0.18s ease;
}
.action-card .action-link:hover { background: rgba(63,214,149,0.14); }
/* Formulario de movimiento incompleto (intención sin monto) */
.intent-form {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-top: 14px; padding: 12px 14px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--hairline); border-radius: 10px;
}
.intent-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft);
}
.intent-form .if-desc { flex: 1 1 180px; }
.intent-form select, .intent-form input {
  background: rgba(255,255,255,0.06); border: 1px solid var(--hairline); border-radius: 6px;
  color: var(--ink); font-family: 'Space Grotesk', sans-serif; font-size: 13.5px;
  padding: 7px 10px; outline: none; min-width: 90px;
  transition: border-color 0.18s ease;
}
.intent-form select:focus, .intent-form input:focus { border-color: rgba(255,255,255,0.35); }
.intent-form select option { background: #0e1524; color: var(--ink); }
.intent-form .if-actions { display: flex; gap: 8px; flex-basis: 100%; margin-top: 2px; }
.intent-form .if-actions button {
  border-radius: 6px; padding: 8px 14px; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.intent-form .if-confirm {
  background: rgba(63,214,149,0.12); border: 1px solid rgba(63,214,149,0.4); color: var(--ok);
}
.intent-form .if-confirm:hover { background: rgba(63,214,149,0.22); }
.intent-form .if-confirm:disabled { opacity: 0.6; cursor: default; }
.intent-form .if-cancel {
  background: none; border: 1px solid var(--hairline); color: var(--soft);
}
.intent-form .if-cancel:hover { border-color: rgba(255,255,255,0.3); color: var(--ink); }
.intent-form .if-note, .dest-choice .if-note {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
/* Elector de destino: 💡 Ideas vs 🧠 Memoria */
.dest-choice {
  display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding: 12px 14px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--hairline); border-radius: 10px;
}
.dest-choice .dc-preview {
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dest-choice .dc-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.dest-choice .dc-buttons button {
  background: rgba(255,255,255,0.05); border: 1px solid var(--hairline); border-radius: 8px;
  color: var(--ink); font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 600;
  padding: 9px 16px; cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.dest-choice .dc-buttons button:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.09); }
.dest-choice .dc-buttons button:disabled { opacity: 0.55; cursor: default; }
.dest-choice .dc-dismiss { flex: 0 0 auto; color: var(--muted) !important; font-weight: 400 !important; }
/* Markdown dentro de respuestas de la IA */
.msg.ai .ai-body p { margin: 0 0 8px; }
.msg.ai .ai-body p:last-child { margin-bottom: 0; }
.msg.ai .ai-body ul, .msg.ai .ai-body ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.ai .ai-body li { margin: 2px 0; }
.msg.ai .ai-body code {
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
  background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 2px;
}
.msg.ai .ai-body pre {
  background: rgba(255,255,255,0.05); border: 1px solid var(--hairline); padding: 10px 12px; border-radius: 2px;
  overflow-x: auto; margin: 6px 0 8px;
}
.msg.ai .ai-body pre code { background: none; padding: 0; }
.msg.ai .ai-body h1, .msg.ai .ai-body h2, .msg.ai .ai-body h3 {
  font-size: 14.5px; margin: 10px 0 4px; font-weight: 600;
}
.msg.ai .ai-body a { color: var(--accent); text-decoration: underline; }
.msg.ai .ai-body blockquote {
  margin: 6px 0; padding-left: 10px; border-left: 2px solid var(--hairline); opacity: 0.85;
}

#send-btn.busy { opacity: 0.45; pointer-events: none; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: 0.5; animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 0.9; } }

/* ---------- Dock de entrada (liquid glass) ---------- */
#dock-wrap { position: relative; z-index: 5; width: min(600px, 90vw); transition: transform 0.4s cubic-bezier(.2,.8,.2,1), left 0.3s cubic-bezier(.2,.8,.2,1); }
#dock-wrap.docked { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); }
body.sidebar-open #dock-wrap.docked { left: calc(50% + (var(--sidebar-w) / 2)); }

#dock { background: rgba(12,18,32,0.78); border: 1px solid var(--glass-edge); border-radius: 28px; padding: 18px 20px 14px 24px; backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1); transition: border-color 0.2s ease; }
#dock:focus-within { border-color: rgba(74,157,255,0.55); }
#dock textarea { width: 100%; background: transparent; border: none; outline: none; resize: none; color: var(--ink); font-family: 'Space Grotesk', sans-serif; font-size: 14.5px; line-height: 1.5; max-height: 120px; min-height: 24px; }
#dock textarea::placeholder { color: var(--muted); }

#dock-footer { display: flex; align-items: center; justify-content: flex-end; margin-top: 12px; }

#send-btn { width: 38px; height: 38px; border-radius: 50%; border: none; flex-shrink: 0; background: var(--ink); color: #0a0f1c; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.15s ease, background 0.2s ease; opacity: 0.35; pointer-events: none; }
#send-btn.ready { opacity: 1; pointer-events: auto; }
#send-btn.ready:hover { background: #fff; }
#send-btn:active { transform: scale(0.9); }
#send-btn svg { width: 15px; height: 15px; }

#hint { text-align: center; margin-top: 12px; font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--muted); letter-spacing: 0.08em; }

/* ---------- Responsivo ---------- */
@media (max-width: 980px) {
  #status { display: none; }
}
@media (max-width: 760px) {
  #header { padding: 16px 18px; }
  /* En móvil el sidebar es un overlay: el contenido NO debe desplazarse
     (antes #main/#thread/#dock se corrían 272px detrás del velo) */
  body.sidebar-open #header { padding-left: 18px; }
  body.sidebar-open #main { padding-left: 0; }
  body.sidebar-open #thread { left: 0; }
  body.sidebar-open #dock-wrap.docked { left: 50%; }
  /* "Volver" se mantiene visible: era la única vía de regreso al launcher */
  #brand .word { font-size: 14px; }
}

/* ==================================================================
   MODO CLARO — misma paleta que el inicio (launcher).
   El tema lo pone shared/theme.js como clase en <html>; el oscuro de
   arriba es el diseño base y aquí solo van los overrides del claro.
   Es GLOBAL: alternarlo aquí cambia todo el ecosistema.
   ================================================================== */
html.light {
  --bg: #F5F7FE;
  --bg1: #EAF2FF;
  --ink: #0f172a;
  --soft: #5b6b84;
  --muted: #94a3b8;
  --hairline: rgba(15,23,42,0.10);
  --glass: rgba(255,255,255,0.55);
  --glass-edge: rgba(15,23,42,0.10);
}

/* Fondo: el cielo profundo se sustituye por el mesh aireado del launcher.
   Las estrellas se ocultan (en claro no tienen lectura sobre blanco). */
html.light #atmosphere {
  background:
    radial-gradient(52% 44% at 18% 10%, rgba(96,165,250,.22) 0%, transparent 70%),
    radial-gradient(46% 40% at 85% 16%, rgba(129,140,248,.16) 0%, transparent 70%),
    radial-gradient(50% 46% at 78% 88%, rgba(45,212,167,.13) 0%, transparent 70%),
    linear-gradient(135deg, #EAF2FF 0%, #F7F9FF 45%, #EFF6FF 100%);
}
html.light #atmosphere::before { opacity: .35; }
html.light #atmosphere .starlayer { display: none; }

/* Superficies de cristal: en claro el "glass" es blanco translúcido con
   sombra suave, no un velo sobre negro. */
html.light #sidebar,
html.light #header,
html.light #dock,
html.light #settings-inner,
html.light .msg.ai .bubble,
html.light .conv-item,
html.light .chip {
  background: rgba(255,255,255,.72);
  border-color: rgba(15,23,42,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 10px 30px -18px rgba(15,23,42,.28);
}
html.light .conv-item:hover,
html.light .chip:hover { background: rgba(255,255,255,.92); border-color: rgba(15,23,42,.2); }
html.light .conv-item.active { background: rgba(74,157,255,.12); border-color: rgba(37,99,235,.35); }

/* Burbuja del usuario: sigue siendo la superficie con más peso visual. */
html.light .msg.user .bubble { background: #0f172a; color: #fff; border-color: transparent; }

html.light #input,
html.light #search-input,
html.light #settings-inner input { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.12); color: var(--ink); }
html.light #input::placeholder,
html.light #search-input::placeholder { color: var(--muted); }

html.light #send-btn { background: #0f172a; color: #fff; }
html.light #new-chat-btn { background: rgba(74,157,255,.12); border-color: rgba(37,99,235,.35); color: #1d4ed8; }

html.light #settings-modal::backdrop { background: rgba(15,23,42,.28); }
html.light .save-suggest,
html.light .action-card,
html.light .intent-form,
html.light .dest-choice { background: rgba(255,255,255,.82); border-color: rgba(15,23,42,.12); }

/* Código y datos: sobre blanco necesitan un fondo propio para no perderse. */
html.light .bubble code,
html.light .bubble pre { background: rgba(15,23,42,.06); color: #0f172a; }
