:root {
  /* Cristal: base neutra fría, vidrio translúcido y luz de color del asistente */
  --bg: #F3F4F8;
  --surface: #FFFFFF;
  --ink: #0F1222;
  --ink-2: #5D6478;
  --line: #E3E6EE;
  --chip: #E9EBF2;
  --glass: rgba(255, 255, 255, .66);
  --glass-strong: rgba(255, 255, 255, .84);
  --glass-brd: rgba(255, 255, 255, .9);
  --glass-shadow: 0 6px 24px rgba(30, 40, 90, .09);
  --acc1: #5B5BF7; --acc2: #8B5CF6; --acc3: #38BDF8; --acc4: #F472B6;
  --acc-deep: #4B47E0;
  --cobalt: var(--acc1);
  --cobalt-ink: #FFFFFF;
  --grad: linear-gradient(135deg, #5B5BF7, #7646E6);
  --danger: #D23B4E;
  --ok: #16A34A;
  --merc-2: #A0A6B8;
  --glow: rgba(91, 91, 247, .45);
  --scrim: rgba(15, 18, 34, .28);
  --aurora-a: .30;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1016; --surface: #171A24; --ink: #EEF0F6; --ink-2: #9AA1B4; --line: #262A38; --chip: #22263A;
    --glass: rgba(30, 34, 50, .58); --glass-strong: rgba(30, 34, 50, .82); --glass-brd: rgba(255, 255, 255, .08);
    --glass-shadow: 0 8px 28px rgba(0, 0, 0, .35);
    --acc1: #7C7CFF; --acc-deep: #6A6AF5; --grad: linear-gradient(135deg, #5B5BF7, #7646E6);
    --danger: #FF5A6E; --ok: #4ADE80; --merc-2: #5C6378; --glow: rgba(124, 124, 255, .5); --scrim: rgba(0, 0, 0, .5);
    --aurora-a: .26;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1016; --surface: #171A24; --ink: #EEF0F6; --ink-2: #9AA1B4; --line: #262A38; --chip: #22263A;
  --glass: rgba(30, 34, 50, .58); --glass-strong: rgba(30, 34, 50, .82); --glass-brd: rgba(255, 255, 255, .08);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  --acc1: #7C7CFF; --acc-deep: #6A6AF5;
  --danger: #FF5A6E; --ok: #4ADE80; --merc-2: #5C6378; --glow: rgba(124, 124, 255, .5); --scrim: rgba(0, 0, 0, .5);
  --aurora-a: .26;
  color-scheme: dark;
}
/* Handy: verde azulado */
:root[data-space="h2"] {
  --acc1: #0D9488; --acc2: #14B8A6; --acc3: #84CC16; --acc4: #38BDF8; --acc-deep: #0F766E;
  --grad: linear-gradient(135deg, #0F8F84, #0B6E78); --glow: rgba(20, 184, 166, .45);
}
@media (prefers-color-scheme: dark) {
  :root[data-space="h2"]:not([data-theme="light"]) { --acc1: #2DD4BF; --acc-deep: #14B8A6; }
}
:root[data-space="h2"][data-theme="dark"] { --acc1: #2DD4BF; --acc-deep: #14B8A6; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, input[type=checkbox]:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
input:focus, textarea:focus { outline: none; border-color: var(--cobalt) !important; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Esfera de luz ---------- */
.orb-core {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden; isolation: isolate;
  background: var(--acc1);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--acc1) 45%, transparent);
  transform: scale(calc(1 + var(--level, 0) * .22));
  transition: transform .08s linear;
}
.orb-core::before {
  content: ""; position: absolute; inset: -20%; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--acc1), var(--acc3), var(--acc2), var(--acc4), var(--acc1));
  filter: blur(4px) saturate(1.15);
  animation: swirl 9s linear infinite;
}
.orb-core::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.9), rgba(255,255,255,0) 46%),
              radial-gradient(circle at 70% 80%, rgba(255,255,255,.25), rgba(255,255,255,0) 40%);
}

/* ---------- Entrada ---------- */
.login {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--safe-t) + 32px) 24px calc(var(--safe-b) + 32px); text-align: center;
}
.login-orb { position: relative; width: 96px; height: 96px; margin-bottom: 20px; }
.login-orb .orb-core { animation: breathe 5s ease-in-out infinite; }
.login-title { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; }
.login-copy { color: var(--ink-2); max-width: 30ch; margin: 0 0 24px; font-size: 15px; }
.login-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.login-form input {
  font: inherit; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.btn-primary { background: var(--cobalt); color: var(--cobalt-ink); padding: 14px; border-radius: 14px; font-weight: 600; }
.login-error { color: var(--danger); min-height: 1.4em; font-size: 15px; }

/* ---------- Estructura ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: calc(var(--safe-t) + 4px) 8px 4px; gap: 4px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  position: relative; z-index: 2;
}
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink); }
.icon-btn:active { background: var(--chip); }
.title {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0;
  font-weight: 600; font-size: 17px; min-height: 44px; line-height: 1.2;
}
.title-row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.title-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-badge { font-size: 12px; font-weight: 600; color: var(--cobalt); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--merc-2); flex: none; }
.conn-dot.ok { background: #2E9E5B; }
.conn-dot.bad { background: var(--danger); }

.scroller { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; }
.messages { padding: 16px 16px 8px; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.empty { padding: 8px 16px 24px; max-width: 760px; margin: 0 auto; }
.empty-lead { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 18vh 0 6px; text-align: center; }
.empty-copy { color: var(--ink-2); margin: 0 auto; max-width: 30ch; text-align: center; }

/* ---------- Mensajes ---------- */
.msg { max-width: 100%; }
.msg.user { align-self: flex-end; max-width: 84%; }
.msg.user .bubble {
  background: var(--cobalt); color: var(--cobalt-ink); padding: 9px 14px; border-radius: 20px 20px 6px 20px;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.user .imgs { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 6px; }
.msg.user .imgs img { width: 120px; height: 120px; object-fit: cover; border-radius: 16px; display: block; }
.msg.assistant { align-self: stretch; }
.msg.assistant .body { word-wrap: break-word; }
.msg.assistant .body > :first-child { margin-top: 0; }
.msg.assistant .body > :last-child { margin-bottom: 0; }
.msg.assistant .body p { margin: 0 0 .7em; }
.msg.assistant .body h3, .msg.assistant .body h4 { font-size: 17px; margin: 1em 0 .4em; }
.msg.assistant .body ul, .msg.assistant .body ol { padding-left: 1.3em; margin: 0 0 .7em; }
.msg.assistant .body li { margin: .2em 0; }
.msg.assistant .body a { color: var(--cobalt); }
.msg.assistant .body code { font: 14px ui-monospace, "SF Mono", Menlo, monospace; background: var(--chip); padding: 1px 5px; border-radius: 6px; }
.msg.assistant .body pre { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; overflow-x: auto; margin: 0 0 .7em; }
.msg.assistant .body pre code { background: none; padding: 0; font-size: 13px; }
.msg.assistant .body blockquote { margin: 0 0 .7em; padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.msg .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tool { font-size: 13px; color: var(--ink-2); background: var(--chip); padding: 3px 9px; border-radius: 999px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .actions { display: flex; gap: 2px; margin-top: 4px; margin-left: -8px; }
.msg .actions button { color: var(--ink-2); width: 36px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
.msg .actions button:active { background: var(--chip); }
.msg .actions svg { width: 18px; height: 18px; }
.msg.error .body { color: var(--danger); }
.typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--merc-2); animation: dot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.source { font-size: 12px; color: var(--ink-2); margin: 0 0 4px; text-align: right; }

/* ---------- Composer ---------- */
.composer {
  padding: 8px 10px calc(var(--safe-b) + 8px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.composer-row { display: flex; align-items: flex-end; gap: 6px; max-width: 760px; margin: 0 auto; }
.composer textarea {
  flex: 1; resize: none; font: inherit; line-height: 1.35; min-height: 44px; max-height: 150px;
  padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--cobalt); color: var(--cobalt-ink); display: grid; place-items: center; flex: none; }
.mic-orb { position: relative; width: 44px; height: 44px; flex: none; border-radius: 50%; }
.mic-orb:active .orb-core { transform: scale(.92); }
.attachments { display: flex; gap: 8px; max-width: 760px; margin: 0 auto; overflow-x: auto; }
.attachments:not(:empty) { padding-bottom: 8px; }
.thumb { position: relative; flex: none; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; display: block; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 15px; line-height: 24px; }

/* ---------- Modo voz ---------- */
.voice {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 20px);
  animation: rise .28s ease-out;
}
.voice-top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.pill-btn { padding: 8px 14px; border-radius: 999px; background: var(--chip); font-size: 15px; font-weight: 600; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink-2); }
.switch input { width: 20px; height: 20px; accent-color: var(--cobalt); }
.voice-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; min-height: 0; overflow: hidden; padding: 8px 0; }
.big-orb { position: relative; width: min(56vw, 240px); aspect-ratio: 1; border-radius: 50%; margin-bottom: 18px; flex: none; transition: width .35s ease; }
.voice.has-reply .voice-stage { justify-content: flex-start; }
.voice.has-reply .big-orb { width: min(34vw, 136px); margin: 12px 0 10px; }
.big-orb .orb-core { animation: breathe 5s ease-in-out infinite; }
.orb-ring { position: absolute; inset: -14px; border-radius: 50%; box-shadow: 0 0 0 0 var(--glow); opacity: 0; transition: opacity .3s; }
.voice[data-state="listening"] .orb-ring { opacity: 1; box-shadow: 0 0 calc(18px + var(--level, 0) * 60px) calc(4px + var(--level, 0) * 18px) var(--glow); }
.voice[data-state="listening"] .big-orb .orb-core { animation: none; }
.voice[data-state="thinking"] .big-orb .orb-core { animation: think 2.4s ease-in-out infinite; }
.voice[data-state="speaking"] .big-orb .orb-core { animation: speak .9s ease-in-out infinite; }
.voice-state { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.voice-heard { color: var(--ink-2); margin: 0; max-width: 34ch; font-size: 16px; min-height: 1.4em; flex: none; }
.voice-reply p, .voice-reply ul, .voice-reply ol, .voice-reply pre { margin: 0 0 .6em; }
.voice-reply ul, .voice-reply ol { padding-left: 1.3em; }
.voice-reply pre { white-space: pre-wrap; font-size: 13px; background: var(--surface); border-radius: 10px; padding: 8px 10px; }
.voice-reply {
  margin: 6px 0 0; width: 100%; max-width: 36ch; flex: 1 1 auto; min-height: 0; overflow-y: auto; font-size: 17px; text-align: left; padding-bottom: 24px;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent);
          mask-image: linear-gradient(to bottom, #000 80%, transparent);
}
.voice-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 36ch; }
.voice-bottom { display: flex; justify-content: center; gap: 28px; }
.round-btn { position: relative; width: 60px; height: 60px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; }
.round-btn:active { background: var(--line); }
.badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--cobalt); color: #fff; font-size: 12px; line-height: 20px; font-weight: 700; }

/* ---------- Cajón y hoja ---------- */
.drawer, .sheet { position: fixed; inset: 0; z-index: 30; display: flex; }
.drawer-scrim { flex: 1; background: var(--scrim); }
.drawer-panel {
  width: min(84vw, 340px); height: 100%; background: var(--surface); overflow-y: auto;
  padding: calc(var(--safe-t) + 8px) 8px calc(var(--safe-b) + 16px);
  animation: slide .22s ease-out;
}
.drawer-head, .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; }
.drawer-head h2, .sheet-head h2 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.conv-list { list-style: none; margin: 0; padding: 0; }
.conv-list li { display: flex; align-items: center; border-radius: 12px; }
.conv-list li.active { background: var(--chip); }
.conv-open { flex: 1; min-width: 0; text-align: left; padding: 10px 8px; }
.conv-open b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-open small { display: block; color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-act { width: 36px; height: 40px; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.conv-act svg { width: 18px; height: 18px; }
.conv-act.on { color: var(--cobalt); }
.sheet { flex-direction: column-reverse; }
.sheet-panel {
  background: var(--surface); border-radius: 20px 20px 0 0; padding: 14px 16px calc(var(--safe-b) + 20px);
  animation: rise .25s ease-out;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 4px; border-bottom: 1px solid var(--line); font-size: 16px; }
.row input { width: 22px; height: 22px; accent-color: var(--cobalt); flex: none; }
.muted { color: var(--ink-2); text-align: right; font-size: 15px; }
.btn-quiet { margin-top: 18px; width: 100%; padding: 13px; border-radius: 12px; color: var(--danger); background: var(--chip); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 90px); transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px;
  max-width: calc(100vw - 32px);
}

/* ---------- Adjuntos y documentos ---------- */
.attach-wrap { position: relative; flex: none; }
.attach-menu {
  position: absolute; bottom: 52px; left: 0; z-index: 5; min-width: 170px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 10px 30px rgba(18, 24, 35, .16);
}
.attach-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 10px; font-size: 16px; }
.attach-menu button:active { background: var(--chip); }
.stop-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.stop-btn svg { fill: currentColor; stroke: none; width: 18px; height: 18px; }
.send-btn:disabled { opacity: .45; }
.file-chip {
  display: flex; align-items: center; gap: 8px; flex: none; max-width: 240px; position: relative;
  padding: 8px 12px 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.file-chip svg { flex: none; width: 22px; height: 22px; color: var(--cobalt); }
.file-chip span { min-width: 0; display: flex; flex-direction: column; }
.file-chip b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { font-size: 12px; color: var(--ink-2); }
.file-chip button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 15px; line-height: 24px; }
.file-chip.uploading { opacity: .65; }
.attachments .file-chip { margin-top: 6px; }
.msg-files { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-bottom: 6px; }
.msg.user .msg-files .file-chip { background: color-mix(in srgb, var(--cobalt) 10%, var(--surface)); }

/* ---------- Comentarios y permisos ---------- */
.commentary { font-size: 14px; color: var(--ink-2); font-style: italic; margin: 0 0 4px; }
.commentary:empty { display: none; }
.approval {
  margin: 8px 0; padding: 12px 14px; border-radius: 16px; background: var(--surface);
  border: 1.5px solid var(--cobalt); box-shadow: 0 4px 18px color-mix(in srgb, var(--cobalt) 18%, transparent);
}
.approval p { margin: 0 0 8px; }
.approval-title { font-weight: 700; }
.approval pre { background: var(--chip); border-radius: 10px; padding: 8px 10px; overflow-x: auto; margin: 0 0 10px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.approval-actions button { padding: 9px 12px; border-radius: 12px; font-size: 15px; font-weight: 600; }
.voice-approval { width: 100%; max-width: 36ch; text-align: left; }
.voice-approval:empty { display: none; }

/* ---------- Botones genéricos ---------- */
.btn-secondary { background: var(--chip); color: var(--ink); padding: 12px 14px; border-radius: 14px; font-weight: 600; }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); padding: 12px 14px; border-radius: 14px; font-weight: 600; }
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled { opacity: .5; }
.face-btn { width: 100%; max-width: 320px; margin-bottom: 18px; }

/* ---------- Cajón ---------- */
.drawer-nav { display: flex; flex-direction: column; padding: 0 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drawer-nav button { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-radius: 12px; font-weight: 600; }
.drawer-nav button:active { background: var(--chip); }
.drawer-nav svg { color: var(--cobalt); }
.search {
  width: 100%; font: inherit; font-size: 16px; padding: 9px 12px; margin: 0 0 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.conv-list li.pinned:not(.active) { background: color-mix(in srgb, var(--chip) 45%, transparent); }
.list-note { padding: 10px 8px; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); margin-right: 6px; vertical-align: middle; animation: dot 1.2s infinite ease-in-out; }

/* ---------- Hojas ---------- */
.sheet-panel { max-height: 88dvh; overflow-y: auto; }
.sheet-label { margin: 16px 4px 2px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.row span small { display: block; margin-top: 2px; text-align: left; }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.row.col input[type=range] { width: 100%; height: auto; accent-color: var(--cobalt); }
.row-actions { display: flex; gap: 8px; flex: none; }
.row-btn { display: block; width: 100%; text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 16px; }
.mode-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 8px; }
.mode-pick button { padding: 12px 8px; border-radius: 14px; background: var(--bg); border: 1.5px solid var(--line); text-align: left; display: flex; flex-direction: column; gap: 4px; }
.mode-pick button b { font-size: 15px; }
.mode-pick button small { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.mode-pick button.on { border-color: var(--cobalt); background: color-mix(in srgb, var(--cobalt) 8%, var(--surface)); }

/* ---------- Páginas (Automatizaciones) ---------- */
.page { position: fixed; inset: 0; z-index: 25; background: var(--bg); display: flex; flex-direction: column; animation: rise .25s ease-out; }
.page-head {
  display: grid; grid-template-columns: auto 1fr 44px; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 6px) 12px 8px; border-bottom: 1px solid var(--line);
}
.page-head h2 { margin: 0; font-size: 17px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-body { flex: 1; overflow-y: auto; padding: 16px 16px calc(var(--safe-b) + 24px); }
.page-body > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.auto-banner { background: var(--chip); border-radius: 14px; padding: 12px 14px; font-size: 15px; color: var(--ink-2); margin-bottom: 14px; }
.auto-empty { text-align: center; padding: 28px 8px; }
.auto-list { list-style: none; padding: 0; margin: 0 auto 16px; display: flex; flex-direction: column; gap: 10px; }
.auto-card { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 16px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); }
.auto-card.paused .auto-main b, .auto-card.paused .auto-when { opacity: .55; }
.auto-main { flex: 1; min-width: 0; text-align: left; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.auto-main b { font-size: 16px; }
.auto-when { font-size: 15px; color: var(--cobalt); font-weight: 600; }
.auto-main .muted { text-align: left; font-size: 13px; }
.auto-warn { color: var(--danger); font-size: 13px; font-weight: 600; }
.auto-info { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px 12px; margin-bottom: 14px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv span { color: var(--ink-2); }
.kv b { text-align: right; }
.auto-prompt { white-space: pre-wrap; margin: 12px 0 0; font-size: 15px; }
.auto-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.auto-actions .btn-primary, .auto-actions .btn-danger { grid-column: 1 / -1; }
.auto-h { font-size: 17px; margin: 8px 0 10px; }
.auto-results { display: flex; flex-direction: column; gap: 8px; }
.auto-out { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; }
.auto-out summary { padding: 12px 0; font-weight: 600; font-size: 15px; cursor: pointer; }
.auto-out .body { padding-bottom: 12px; font-size: 15px; word-wrap: break-word; }
.auto-out .body p { margin: 0 0 .6em; }
.auto-out .body pre { white-space: pre-wrap; background: var(--chip); padding: 8px; border-radius: 8px; font-size: 13px; }
.auto-out.failed summary { color: var(--danger); }
.page-body > .btn-secondary { display: block; width: 100%; margin-top: 4px; }

.auto-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 0; }
.field input, .field textarea, .field select, .when input, .when select {
  font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); width: 100%;
}
.field textarea { resize: vertical; line-height: 1.4; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { display: inline-block; padding: 7px 12px; border-radius: 999px; background: var(--chip); font-size: 14px; font-weight: 600; }
.seg label input:checked + span { background: var(--cobalt); color: var(--cobalt-ink); }
.seg label input:focus-visible + span { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.when { display: none; gap: 8px; align-items: center; margin-bottom: 6px; }
.when label { display: flex; align-items: center; gap: 8px; flex: 1; white-space: nowrap; }
.auto-form[data-type="daily"] .when-time, .auto-form[data-type="weekdays"] .when-time,
.auto-form[data-type="weekly"] .when-time, .auto-form[data-type="weekly"] .when-weekly,
.auto-form[data-type="interval"] .when-interval, .auto-form[data-type="once"] .when-once,
.auto-form[data-type="custom"] .when-custom { display: flex; }
.hint { font-size: 13px; color: var(--ink-2); margin: 2px 0 0; }
.toggle { position: relative; width: 50px; height: 30px; flex: none; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked + span { background: #2E9E5B; }
.toggle input:checked + span::after { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 2px solid var(--cobalt); outline-offset: 2px; }

/* ---------- Archivos de Hermes ---------- */
.media-block { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.media-slot:empty { display: none; }
.audio-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.audio-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.audio-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-head a { color: var(--cobalt); font-weight: 600; font-size: 14px; text-decoration: none; }
.audio-card audio { width: 100%; height: 40px; }
.media-img img { max-width: 100%; max-height: 360px; border-radius: 14px; display: block; }
.media-video { width: 100%; border-radius: 14px; }

/* ---------- Hoy ---------- */
.today { display: flex; flex-direction: column; gap: 10px; }
.today-head { margin: 10px 2px 4px; }
.today-greet { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.today-date { margin: 2px 0 0; color: var(--ink-2); text-transform: none; }
.today-date::first-letter { text-transform: uppercase; }
.today-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px;
}
.today-card > b { font-size: 16px; }
.today-card span { font-size: 15px; }
.today-card small { color: var(--ink-2); font-size: 13px; }
.today-card.alert { border: 1.5px solid var(--cobalt); }
.today-auto-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; text-align: left; padding: 0; }
.today-auto-head b { font-size: 16px; }
.today-text { font-size: 15px; color: var(--ink); }
.today-text p { margin: 0 0 .5em; }
.today-foot { text-align: center; font-size: 13px; margin-top: 4px; }
.pre { white-space: pre-wrap; font-size: 14px; background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 4px 0; }
.sub { margin: 8px 0 0; font-weight: 600; font-size: 14px; color: var(--ink-2); }

/* ---------- Acciones hacia el iPhone ---------- */
.iphone-actions { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.iphone-actions .ia-title { margin: 0; font-weight: 700; }
.iphone-actions ul { margin: 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.iphone-actions li.done { color: var(--ink-2); text-decoration: line-through; }
.iphone-actions .btn-primary { padding: 10px 12px; }

/* ---------- Selectores ---------- */
.target-switch { display: flex; gap: 6px; margin: 0 auto 12px; flex-wrap: wrap; }
.target-switch button, .seg.tabs button, .seg-mini button {
  padding: 7px 12px; border-radius: 999px; background: var(--chip); font-size: 14px; font-weight: 600;
}
.target-switch button.on, .seg.tabs button.on, .seg-mini button.on { background: var(--cobalt); color: var(--cobalt-ink); }
.seg-mini { display: inline-flex; gap: 2px; background: var(--chip); border-radius: 999px; padding: 2px; flex: none; }
.seg-mini button { background: transparent; padding: 6px 10px; font-size: 13px; }
.voice-top { gap: 8px; }
.target-pick { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.target-pick button { text-align: left; padding: 12px; border-radius: 14px; background: var(--bg); border: 1.5px solid var(--line); }
.target-pick button.on { border-color: var(--cobalt); background: color-mix(in srgb, var(--cobalt) 8%, var(--surface)); }
.target-pick button:disabled:not(.on) { opacity: .45; }
.live-msg .body { font-size: 16px; }

/* ---------- Memoria y habilidades ---------- */
.mem-box { display: flex; flex-direction: column; gap: 10px; }
.mem-list { display: flex; flex-direction: column; gap: 8px; }
.mem-item { display: flex; gap: 4px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px 4px 6px 10px; }
.mem-item textarea { flex: 1; font: inherit; font-size: 15px; line-height: 1.4; border: 0; background: transparent; color: var(--ink); resize: vertical; padding: 4px 0; }
.mem-count { font-size: 13px; color: var(--ink-2); margin: 0; text-align: right; }
.mem-count.over { color: var(--danger); font-weight: 600; }
.mem-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skill-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.skill-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.skill-item small { color: var(--ink-2); font-size: 13px; }
.skill-body { font-size: 15px; word-wrap: break-word; }
.skill-body pre { white-space: pre-wrap; background: var(--chip); padding: 8px; border-radius: 8px; font-size: 13px; }
.skill-body code { font: 13px ui-monospace, Menlo, monospace; }

/* ---------- Gasto ---------- */
.usage-hero { text-align: center; padding: 8px 0 16px; }
.usage-hero p { margin: 0; }
.usage-total { font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.usage-rows { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; }
.usage-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.usage-row:last-child { border-bottom: 0; }
.usage-row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.usage-row small { color: var(--ink-2); font-size: 13px; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 9em 1fr auto; align-items: center; gap: 8px; font-size: 14px; }
.bar-row i { display: block; height: 10px; border-radius: 5px; background: var(--chip); position: relative; overflow: hidden; }
.bar-row i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--cobalt); border-radius: 5px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; padding: 4px 0; }
.spark i { flex: 1; max-width: 22px; height: var(--h); background: var(--cobalt); border-radius: 3px 3px 0 0; min-width: 3px; opacity: .85; }

/* ---------- Copias ---------- */
.backup-ok { font-weight: 600; }
.backup-list { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.backup-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.backup-list li span { display: flex; flex-direction: column; }
.backup-list small { color: var(--ink-2); }
.backup-list a { text-decoration: none; color: var(--ink); }
.page-body .btn-primary { display: block; width: 100%; margin: 8px 0; }

/* ---------- Espacios (un Hermes cada uno) ---------- */
.space-tabs {
  display: flex; gap: 6px; padding: 6px 12px 8px; justify-content: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.space-tabs button {
  position: relative; flex: 1; max-width: 180px; padding: 8px 12px; border-radius: 999px;
  background: var(--chip); font-weight: 700; font-size: 15px; color: var(--ink-2);
}
.space-tabs button.on { background: var(--cobalt); color: var(--cobalt-ink); }
.space-tabs button .dot { position: absolute; top: 4px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }


/* ---------- Bloqueo ---------- */
.lock { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }

@keyframes swirl { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.04); border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%; } }
@keyframes think { 0%,100% { transform: scale(.96) rotate(0); border-radius: 50%; } 50% { transform: scale(1.02) rotate(180deg); border-radius: 46% 54% 52% 48% / 55% 45% 55% 45%; } }
@keyframes speak { 50% { transform: scale(1.07); border-radius: 47% 53% 49% 51% / 53% 47% 53% 47%; } }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes slide { from { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Conectores */
.cn-box { display: flex; flex-direction: column; gap: 10px; }
.cn-h { margin: 14px 0 0; }
.cn-card, .cn-list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.cn-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.cn-list { padding: 0 14px; }
.cn-head, .cn-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cn-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cn-list > :last-child { border-bottom: 0; }
.cn-row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.cn-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cn-txt b { font-size: 16px; overflow-wrap: anywhere; }
.cn-txt small, .cn-sub, .cn-group { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.cn-sub { margin: 0; }
.cn-group { text-transform: uppercase; letter-spacing: .04em; font-size: 12px; font-weight: 600; }
.cn-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--chip); color: var(--cobalt); }
.cn-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cn-icon.google svg { stroke: none; }
.cn-icon.google svg path:nth-child(1) { fill: #4285F4; } .cn-icon.google svg path:nth-child(2) { fill: #34A853; }
.cn-icon.google svg path:nth-child(3) { fill: #FBBC05; } .cn-icon.google svg path:nth-child(4) { fill: #EA4335; }
.cn-pill { flex: none; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.cn-pill.ok { background: #DDF3E6; color: #17663A; }
.cn-pill.warn { background: #FBEBCF; color: #8A5300; }
.cn-pill.bad { background: #F8DCD6; color: #9B2F1C; }
.cn-pill.off { background: var(--chip); color: var(--ink-2); }
.cn-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cn-chip { background: var(--chip); border-radius: 999px; padding: 5px 10px; font-size: 14px; }
.cn-chip small { color: var(--ink-2); }
.cn-extra:empty { display: none; }
.cn-cal { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.cn-cal small { color: var(--ink-2); }
.cn-cal li.off { color: var(--ink-2); }
.cn-txt small.cn-note { color: var(--ink); opacity: .8; }
.cn-link { align-self: flex-start; color: var(--cobalt); font-weight: 600; font-size: 15px; padding: 2px 0; }
.cn-link:disabled { opacity: .6; }
.cn-details summary { display: flex; align-items: center; gap: 12px; list-style: none; cursor: pointer; }
.cn-details summary::-webkit-details-marker { display: none; }
.cn-details[open] .cn-cal { margin: 10px 0 0 46px; }
.cn-details.cn-row { display: block; }
.cn-ask { margin-top: 12px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cn-pill.ok { background: #18392A; color: #7DDBA3; }
  :root:not([data-theme="light"]) .cn-pill.warn { background: #3D2E12; color: #F2C26B; }
  :root:not([data-theme="light"]) .cn-pill.bad { background: #432019; color: #F29B87; }
}
:root[data-theme="dark"] .cn-pill.ok { background: #18392A; color: #7DDBA3; }
:root[data-theme="dark"] .cn-pill.warn { background: #3D2E12; color: #F2C26B; }
:root[data-theme="dark"] .cn-pill.bad { background: #432019; color: #F29B87; }

/* ======================================================================
   Cristal — capa visual: luz de color arriba, vidrio translúcido, esfera de luz
   ====================================================================== */
:root {
  --aurora:
    radial-gradient(70% 42% at 12% -6%, color-mix(in srgb, var(--acc1) calc(var(--aurora-a) * 100%), transparent), transparent 72%),
    radial-gradient(55% 36% at 88% -2%, color-mix(in srgb, var(--acc3) calc(var(--aurora-a) * 90%), transparent), transparent 72%),
    radial-gradient(50% 30% at 52% -10%, color-mix(in srgb, var(--acc2) calc(var(--aurora-a) * 85%), transparent), transparent 70%);
}
body { background: var(--aurora), var(--bg); background-repeat: no-repeat; background-color: var(--bg); font-feature-settings: "ss01", "cv11"; }
.app { background: transparent; }

/* Superficies de vidrio */
.glass, .today-card, .auto-card, .auto-info, .auto-out, .audio-card, .mem-item, .skill-item, .usage-rows,
.backup-list li, .iphone-actions, .cn-card, .cn-list, .file-chip, .approval {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
}
.today-card, .auto-card, .cn-card, .cn-list, .usage-rows, .auto-info, .iphone-actions { border-radius: 22px; }
.auto-out, .audio-card, .mem-item, .skill-item, .backup-list li { border-radius: 18px; }
.today-card.alert, .approval { border: 1.5px solid color-mix(in srgb, var(--acc1) 70%, transparent); }

/* Barra superior: transparente, botones de vidrio */
.topbar { background: transparent; border-bottom: 0; -webkit-backdrop-filter: none; backdrop-filter: none; padding: calc(var(--safe-t) + 6px) 12px 2px; grid-template-columns: 40px 1fr 40px; }
.icon-btn { border-radius: 50%; }
.topbar .icon-btn {
  width: 40px; height: 40px; background: var(--glass); border: 1px solid var(--glass-brd); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
}
.topbar .icon-btn svg { width: 20px; height: 20px; }
.title { font-size: 16px; }
.mode-badge { color: var(--acc1); }
.conn-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

/* Selector de asistente: control segmentado de vidrio */
.space-tabs { background: transparent; border: 0; padding: 4px 12px 6px; }
.space-tabs:not([hidden]) { display: flex; justify-content: center; }
.space-tabs::before { content: none; }
.space-tabs { gap: 0; }
.space-tabs button {
  flex: 0 1 auto; min-width: 96px; max-width: 160px; padding: 7px 18px; background: transparent; color: var(--ink-2);
  font-weight: 600; transition: background .2s, color .2s;
}
.space-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 6px rgba(30, 40, 90, .14); }
.space-tabs button.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grad); margin-right: 7px; vertical-align: 1px; }
.space-tabs { --pad: 3px; }
.space-tabs > :first-child { margin-left: 0; }
#spaceTabs:not([hidden]) {
  width: fit-content; margin: 2px auto 4px; padding: 3px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-brd); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .space-tabs button.on { background: rgba(255,255,255,.14); box-shadow: none; } }
:root[data-theme="dark"] .space-tabs button.on { background: rgba(255,255,255,.14); box-shadow: none; }

/* Mensajes */
.messages { gap: 16px; padding-top: 12px; }
.msg.user .bubble { background: var(--grad); border-radius: 22px 22px 8px 22px; padding: 10px 15px; box-shadow: 0 6px 18px color-mix(in srgb, var(--acc1) 28%, transparent); }
.msg.assistant .body {
  background: var(--glass); border: 1px solid var(--glass-brd); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  border-radius: 8px 22px 22px 22px; padding: 13px 16px; line-height: 1.5;
}
.msg.assistant .body:empty { display: none; }
.msg.assistant.live-msg .body, .msg.error .body { background: var(--glass); }
.msg.assistant .body a { color: var(--acc-deep); font-weight: 500; }
.msg.assistant .body pre { background: color-mix(in srgb, var(--bg) 70%, transparent); border-color: var(--line); }
.msg .meta { margin: 0 4px 6px; }
.tool { background: transparent; padding: 0; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.tool::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.msg .actions { margin-left: 2px; }
.typing i { background: var(--acc1); }
.commentary { margin: 0 4px 6px; }

/* Vacío */
.empty-lead { font-size: 32px; letter-spacing: -.025em; }

/* Barra de escribir: una pastilla de vidrio flotante */
.composer { background: transparent; border-top: 0; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 6px 12px calc(var(--safe-b) + 10px); }
.composer-row {
  align-items: center; gap: 4px; padding: 5px 5px 5px 4px; border-radius: 30px;
  background: var(--glass-strong); border: 1px solid var(--glass-brd); box-shadow: 0 10px 34px rgba(30, 40, 90, .14);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
}
.composer textarea { border: 0 !important; background: transparent; padding: 10px 6px; min-height: 42px; }
.composer .icon-btn { width: 40px; height: 40px; color: var(--ink-2); }
.send-btn { background: var(--grad); width: 42px; height: 42px; box-shadow: 0 4px 14px color-mix(in srgb, var(--acc1) 40%, transparent); }
.stop-btn { width: 42px; height: 42px; }
.mic-orb { width: 42px; height: 42px; }
.attach-menu { background: var(--glass-strong); border: 1px solid var(--glass-brd); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-radius: 18px; bottom: 54px; }
.attach-menu svg { color: var(--acc1); }

/* Botones */
.btn-primary { background: var(--grad); border-radius: 16px; box-shadow: 0 6px 18px color-mix(in srgb, var(--acc1) 30%, transparent); }
.btn-secondary { background: var(--glass); border: 1px solid var(--glass-brd); border-radius: 16px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.pill-btn { background: var(--glass); border: 1px solid var(--glass-brd); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.target-switch button.on, .seg.tabs button.on, .seg-mini button.on, .seg label input:checked + span { background: var(--grad); }
.auto-when, .cn-link, .audio-head a { color: var(--acc-deep); }
.drawer-nav svg, .cn-icon, .file-chip svg { color: var(--acc1); }
.bar-row i::after, .spark i { background: var(--grad); }
.toggle input:checked + span { background: var(--ok); }
.mode-pick button.on, .target-pick button.on { border-color: var(--acc1); background: color-mix(in srgb, var(--acc1) 10%, var(--surface)); }
.mode-pick button, .target-pick button { background: var(--glass); }
input:focus, textarea:focus { border-color: var(--acc1) !important; }
button:focus-visible, a:focus-visible { outline-color: var(--acc1); }

/* Cajón y hojas de vidrio */
.drawer-scrim { background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.drawer-panel {
  background: color-mix(in srgb, var(--surface) 80%, transparent); border-radius: 0 28px 28px 0;
  -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: 10px 0 40px rgba(15, 18, 34, .18);
}
.drawer-head h2 { font-size: 28px; letter-spacing: -.02em; padding-top: 6px; }
.drawer-nav { border-bottom: 0; }
.drawer-nav button { padding: 10px 10px; font-weight: 550; }
.search { background: var(--chip); border: 0; border-radius: 14px; padding: 10px 12px; }
.conv-list li { border-radius: 14px; }
.conv-list li.active { background: color-mix(in srgb, var(--acc1) 12%, transparent); }
.sheet-panel {
  background: color-mix(in srgb, var(--surface) 86%, transparent); border-radius: 28px 28px 0 0;
  -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: 0 -10px 40px rgba(15, 18, 34, .16);
}
.sheet-panel::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: -4px auto 10px; }

/* Páginas */
.page { background: var(--aurora), var(--bg); background-repeat: no-repeat; background-color: var(--bg); }
.page-head { border-bottom: 0; }
.page-head h2 { font-size: 17px; font-weight: 650; }
.today-greet, .usage-total { letter-spacing: -.03em; }
.today-greet { font-size: 32px; }

/* Entrada y bloqueo */
.login, .lock { background: var(--aurora), var(--bg); background-repeat: no-repeat; background-color: var(--bg); }
.login-orb { width: 112px; height: 112px; margin-bottom: 26px; }
.login-orb .orb-core { box-shadow: 0 10px 50px var(--glow); }
.login-title { font-size: 36px; letter-spacing: -.03em; }
.login-form input { background: var(--glass-strong); border: 1px solid var(--glass-brd); border-radius: 16px; box-shadow: var(--glass-shadow); }

.toast { background: color-mix(in srgb, var(--ink) 88%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-radius: 16px; }

/* Modo voz: siempre oscuro, la esfera como luz viva */
.voice {
  --bg: #0B0D13; --surface: #171A24; --ink: #EEF0F6; --ink-2: #9AA1B4; --line: #262A38; --chip: rgba(255,255,255,.08);
  --glass: rgba(255,255,255,.07); --glass-strong: rgba(30,34,50,.8); --glass-brd: rgba(255,255,255,.1);
  color-scheme: dark; color: var(--ink);
  background:
    radial-gradient(60% 40% at 50% 38%, color-mix(in srgb, var(--acc1) 16%, transparent), transparent 70%),
    #0B0D13;
}
.voice .pill-btn, .voice .seg-mini { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); color: var(--ink); }
.voice .seg-mini button { color: var(--ink-2); }
.voice .seg-mini button.on { color: #fff; }
.voice .switch { color: var(--ink-2); }
.big-orb { width: min(62vw, 250px); }
.big-orb .orb-core { overflow: visible; background: transparent; box-shadow: none; animation: breathe 6s ease-in-out infinite; }
.big-orb .orb-core::before {
  inset: -6%; filter: blur(26px) saturate(1.2);
  background:
    radial-gradient(circle at 32% 40%, var(--acc1), transparent 58%),
    radial-gradient(circle at 70% 34%, var(--acc3), transparent 54%),
    radial-gradient(circle at 56% 74%, var(--acc2), transparent 56%),
    radial-gradient(circle at 30% 76%, var(--acc4), transparent 46%);
  animation: swirl 14s linear infinite;
}
.big-orb .orb-core::after {
  inset: 24%; filter: blur(16px);
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,0) 70%);
  opacity: calc(.55 + var(--level, 0) * .45);
}
.voice[data-state="thinking"] .big-orb .orb-core::before { animation-duration: 3s; }
.voice[data-state="speaking"] .big-orb .orb-core::before { animation-duration: 6s; }
.big-orb .orb-ring {
  inset: -18%; box-shadow: none !important; z-index: -1;
  background: radial-gradient(circle, var(--glow), transparent 66%);
  transform: scale(calc(.85 + var(--level, 0) * .6)); transition: opacity .3s, transform .08s linear;
}
.voice-state { font-size: 24px; font-weight: 650; letter-spacing: -.015em; }
.voice-heard { color: var(--ink-2); }
.round-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: var(--ink); }
.round-btn:active { background: rgba(255,255,255,.16); }
#voiceStop { background: #F2385A; border: 0; color: #fff; }
#voiceStop:active { background: #D92A4B; }
.voice .approval { background: rgba(255,255,255,.06); }
.voice .tool { color: var(--ink-2); }

/* Pastillas de estado (conectores) con el mismo lenguaje */
.cn-icon { background: color-mix(in srgb, var(--acc1) 12%, transparent); border-radius: 12px; }
.cn-chip { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.voice .voice-stage { overflow: visible; }
.voice .switch { gap: 6px; font-size: 14px; white-space: nowrap; }
.voice .switch input { width: 18px; height: 18px; }
.voice .voice-top { gap: 6px; }
.voice .pill-btn { padding: 8px 12px; }
