/* Cabina — lenguaje "Consola": grafito, Geist, el acento solo marca lo interactivo. Pensado para la pantalla del Tesla (táctil, lejos del ojo). */

:root {
  /* Paleta del modo oscuro de la pantalla del Tesla: negro de cabina, tarjetas grafito sin bordes,
     texto blanco y el azul Tesla solo para lo interactivo. --ambient imita la tira de luz del Juniper. */
  --bg: #0a0a0b;
  --panel: #141415;
  --panel-2: #1d1d1f;
  --raise: #2a2a2d;
  --line: #222224;
  --text: #f4f4f5;
  --muted: #a1a1a6;
  --faint: #6b6b70;
  --accent: #3e6ae1;
  --accent-ink: #ffffff;
  --ambient: #e82127;
  --personal: #3e6ae1;
  --business: #e9a23b;
  --me: #3e6ae1;
  --me-ink: #ffffff;
  --them: #1d1d1f;
  --danger: #e82127;
  --radius: 16px;
  --tap: 60px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: var(--sans);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f4f4;
    --panel: #ffffff;
    --panel-2: #f0f0f1;
    --raise: #e5e5e7;
    --line: #e2e2e4;
    --text: #171a20;
    --muted: #5c5e62;
    --faint: #8e8e93;
    --accent: #3e6ae1;
    --accent-ink: #ffffff;
    --business: #c47f12;
    --them: #ececee;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { font-size: 18px; font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
input, textarea { user-select: text; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* color por línea: solo identifica la categoría */
.c-personal { --c: var(--personal); }
.c-business { --c: var(--business); }
.c-other { --c: var(--accent); }

/* ───────── login */

.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); text-align: center; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); }
.login-hint { color: var(--muted); margin: 10px 0 18px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 18px; margin-bottom: 24px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--faint); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button {
  height: 76px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); font-size: 1.6rem; font-family: var(--mono);
}
.keypad button:active { background: var(--raise); }
.keypad .key-soft { color: var(--muted); font-family: var(--sans); }
.keypad .key-go { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-family: var(--sans); font-size: 1.05rem; font-weight: 600; }
.login-error { min-height: 1.4em; color: var(--danger); margin-top: 16px; }

/* ───────── marco */

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.tabs { min-width: 0; display: flex; gap: 6px; background: var(--bg); padding: 5px; border-radius: 16px; border: 1px solid var(--line); overflow-x: auto; }
.tab {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.tab .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tab[aria-selected="true"] { background: var(--raise); color: var(--text); }
.tab .badge { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--c); color: #0b0c0e; font: 600 0.8rem/26px var(--mono); }
.top-right { display: flex; align-items: center; gap: 14px; }
.safety-pill { display: none; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-2); color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.safety-pill svg { width: 16px; height: 16px; fill: none; stroke: var(--business); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.conn.ok { background: var(--personal); }
.conn.err { background: var(--danger); }
.clock { font: 500 1.35rem var(--mono); letter-spacing: -0.02em; }
.main { min-height: 0; position: relative; }

/* ───────── WhatsApp */

.wa { height: 100%; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.chats { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.chats-head { padding: 14px; border-bottom: 1px solid var(--line); }
.chats-head input {
  width: 100%; height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); outline: none;
}
.chats-head input:focus, .composer textarea:focus { border-color: var(--accent); }
.chat-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.chat {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  width: 100%; padding: 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; min-height: 76px;
}
.chat:active, .chat.sel { background: var(--raise); }
.chat-text { min-width: 0; }
.chat .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .preview { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chat .time { font: 0.78rem var(--mono); color: var(--faint); }
.chat.new .time { color: var(--c); }
.chat .pip { width: 12px; height: 12px; border-radius: 50%; background: var(--c); visibility: hidden; }
.chat.new .pip { visibility: visible; }
.chat.new .name { color: var(--text); }
.list-note { color: var(--muted); padding: 24px 16px; text-align: center; }

.avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--raise); color: var(--muted);
  display: grid; place-items: center; font-weight: 600; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.convo { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.convo-empty { flex: 1; display: grid; place-items: center; color: var(--faint); }
.convo-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.convo-head h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.convo-head p { margin: 2px 0 0; color: var(--muted); font: 0.85rem var(--mono); }
.icon-btn { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); font-size: 1.3rem; }
.back { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 20px 28px 12px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; user-select: text; }
.day { align-self: center; margin: 14px 0 8px; padding: 4px 12px; border-radius: 10px; background: var(--panel-2); color: var(--muted); font: 0.78rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
.msg { max-width: min(72%, 760px); padding: 10px 14px 8px; border-radius: 16px; background: var(--them); font-size: 1.12rem; line-height: 1.5; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.pending { opacity: 0.6; }
.msg.failed { outline: 1px solid var(--danger); }
.msg .author { font-size: 0.82rem; font-weight: 600; color: var(--c); margin-bottom: 2px; }
.msg .body { white-space: pre-wrap; }
.msg .t { display: block; text-align: right; font: 0.72rem var(--mono); color: var(--faint); margin-top: 4px; }
.msg a { color: var(--accent); }
.msg .tag { color: var(--muted); font-style: italic; }
.media-btn { display: flex; align-items: center; gap: 12px; margin: 2px 0 4px; padding: 10px 14px; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.media-btn .ic { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 0.9rem; }
.media-btn.bare { padding: 0; border: 0; background: none; min-height: 0; }
.media-img { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; margin: 2px 0 6px; }

.quick { display: flex; gap: 8px; padding: 10px 20px 0; overflow-x: auto; }
.safety-note { display: none; margin: 4px 20px 0; color: var(--muted); font-size: 0.76rem; line-height: 1.3; }
.chip {
  flex: none; height: 48px; padding: 0 16px; border-radius: 24px; border: 1px solid var(--line);
  background: var(--panel); white-space: nowrap;
}
.chip:active { background: var(--raise); }
.voice-panel { display: flex; flex-direction: column; gap: 8px; margin: 0 20px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.voice-message { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.4; }
.voice-preview { width: 100%; height: 42px; }
.voice-actions { display: flex; justify-content: flex-end; gap: 8px; }
.voice-actions .ghost, .voice-actions .send { height: 52px; }
.composer { display: flex; align-items: center; gap: 10px; padding: 12px 20px 16px; }
.composer textarea { flex: 1; min-width: 0; width: auto; min-height: var(--tap); max-height: 148px; height: auto; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); outline: none; line-height: 1.35; resize: none; overflow-y: auto; }
.voice-btn { flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); }
.voice-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.voice-btn:active { background: var(--raise); }
.voice-btn.recording { background: var(--danger); border-color: var(--danger); color: #fff; }
.send, .primary {
  flex: none; height: var(--tap); padding: 0 26px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.send:disabled { opacity: 0.5; }
.ghost { flex: none; display: inline-flex; align-items: center; height: 52px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); text-decoration: none; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 30;
  max-width: min(640px, calc(100% - 32px)); padding: 14px 20px; border-radius: 12px;
  background: var(--raise); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.toast.err { border-color: var(--danger); }

/* ───────── panel angosto del navegador del Tesla / pantallas angostas */

@media (max-width: 1100px) {
  html { font-size: 18px; font-variant-numeric: tabular-nums; }
  .top { padding: 8px 12px; gap: 8px; }
  .tabs { flex: 1; gap: 4px; padding: 4px; }
  .tab { height: 56px; padding: 0 12px; gap: 8px; }
  .clock { display: none; }
  .top-right { gap: 6px; }
  .safety-pill { display: flex; }
  .wa { grid-template-columns: minmax(0, 1fr); }
  .chats { border-right: 0; }
  .wa.open .chats { display: none; }
  .wa:not(.open) .convo { display: none; }
  .back { display: grid; place-items: center; width: 60px; height: 60px; }
  .chat-list { padding: 8px; }
  .chat { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; min-height: 96px; padding: 12px; }
  .avatar { width: 56px; height: 56px; }
  .chat .name { font-size: 1.05rem; }
  .chat .preview {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    white-space: normal; font-size: 0.98rem; line-height: 1.3; max-height: 2.6em;
  }
  .chat .time { font-size: 0.82rem; }
  .convo-head { gap: 12px; padding: 10px 12px; }
  .convo-head h2 { font-size: 1.22rem; }
  .convo-head p { font-size: 0.9rem; }
  .messages { padding: 16px 18px 12px; gap: 10px; }
  .msg { max-width: min(94%, 760px); padding: 14px 16px 10px; border-radius: 18px; font-size: 1.22rem; line-height: 1.5; }
  .msg .author { font-size: 0.92rem; }
  .msg .t { font-size: 0.8rem; }
  .quick { gap: 8px; padding: 8px 12px 0; }
  .safety-note { display: block; margin: 4px 12px 0; font-size: 0.85rem; }
  .chip { height: 56px; padding: 0 18px; }
  .voice-panel { margin: 0 12px; padding: 10px 12px; }
  .voice-message { font-size: 0.9rem; }
  .voice-btn { width: 64px; height: 64px; }
  .voice-actions .ghost, .voice-actions .send { height: 56px; }
  .composer { gap: 10px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .composer textarea { min-height: 64px; padding: 12px 16px; font-size: 1.05rem; }
  .send, .primary { height: 64px; padding: 0 22px; }
  .media-btn { min-height: 60px; padding: 12px 16px; }
}

@media (max-width: 480px) {
  .top { padding: 8px; }
  .tab { height: 50px; padding: 0 8px; gap: 6px; font-size: 0.9rem; }
  .tab .dot { width: 8px; height: 8px; }
  .safety-pill { height: 34px; gap: 4px; padding: 0 6px; font-size: 0.64rem; }
  .chat { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; min-height: 88px; padding: 10px; }
  .avatar { width: 48px; height: 48px; }
  .chat .preview { font-size: 0.92rem; }
  .messages { padding: 12px 12px 10px; }
  .msg { max-width: 96%; padding: 12px 14px 9px; font-size: 1.18rem; }
  .voice-panel { margin: 0 10px; padding: 8px 10px; }
  .quick { padding-left: 10px; padding-right: 10px; }
  .composer { padding-left: 10px; padding-right: 10px; }
  .send { padding: 0 16px; }
}

/* ───────── modo una mano (mano derecha, asiento del conductor)
   Riel de navegación a la IZQUIERDA (lo más cercano al conductor), objetivos de 72 px o más,
   envío y micrófono junto al riel, nada que dependa de deslizar horizontalmente. */

.rail { display: none; }

@media (min-width: 700px) {
  :root { --tap: 72px; }

  .app { grid-template-rows: minmax(0, 1fr); grid-template-columns: 120px minmax(0, 1fr); }
  .top {
    grid-column: 1; grid-row: 1; flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 10px; padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    border-bottom: 0; border-right: 1px solid var(--line); overflow-y: auto;
  }
  .main { grid-column: 2; grid-row: 1; }

  .tabs { flex: none; flex-direction: column; gap: 8px; padding: 6px; overflow: visible; border-radius: 18px; }
  .tab {
    position: relative; flex-direction: column; justify-content: center; gap: 8px;
    height: 84px; padding: 6px 4px; font-size: 0.9rem; white-space: normal; text-align: center; line-height: 1.15;
  }
  .tab .dot { width: 12px; height: 12px; }
  .tab .badge { position: absolute; top: 6px; right: 6px; }

  .top-right { flex-direction: column; align-items: center; gap: 8px; margin-top: auto; }
  .clock { display: none; } /* el Tesla ya muestra la hora: el espacio del riel es para los botones */
  .safety-pill { display: flex; flex-direction: column; height: auto; padding: 8px 6px; border-radius: 12px; font-size: 0.66rem; text-align: center; white-space: normal; line-height: 1.2; }

  .rail { display: flex; flex-direction: column; gap: 8px; }
  .rail-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: 72px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2);
  }
  .rail-btn b { font-size: 1.7rem; line-height: 1; }
  .rail-btn small { font-size: 0.78rem; color: var(--muted); }
  .rail-btn:active { background: var(--raise); }
  .rail-back { display: none; }
  .app:has(.wa.open) .rail-back { display: flex; }

  .back { display: none !important; }
  .chat { min-height: 104px; }
  .chat-list { padding: 8px; }
  .chip { height: 64px; padding: 0 22px; }
  .quick { flex-wrap: wrap; overflow: visible; }
  .icon-btn, .ghost { height: 64px; }

  /* envío y micrófono a la izquierda del campo: lo más cerca de la mano */
  .composer { gap: 12px; }
  .composer .send { order: 0; padding: 0 30px; font-size: 1.1rem; }
  .composer .voice-btn { order: 1; width: 84px; }
  .composer textarea { order: 2; }
  .voice-actions { justify-content: flex-start; }
  .voice-actions .ghost, .voice-actions .send { height: 64px; }

}

@media (min-width: 700px) and (max-height: 760px) {
  .top { gap: 8px; padding-top: 8px; }
  .tab { height: 72px; gap: 6px; }
  .rail-btn { height: 64px; }
  .rail-btn small { display: none; }
  .safety-pill span { font-size: 0.6rem; }
}

.keypad button { height: 88px; }

/* ───────── estilo Tesla: superficies planas sin bordes, pesos ligeros, la luz ambiental como único brillo */

body { font-weight: 400; letter-spacing: -0.005em; }
.top, .chats, .convo-head { background: var(--panel); }
.top { border-color: transparent; }
.tabs { background: transparent; border: 0; padding: 0; }
.tab { border-radius: 14px; color: var(--muted); font-weight: 500; }
.tab[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--c); }
.tab .badge { color: #fff; }
.chats { border-right-color: transparent; }
.chats-head, .convo-head { border-bottom-color: transparent; }
.chats-head input, .composer textarea { background: var(--panel-2); border-color: transparent; border-radius: 14px; }
.chat { border-radius: 14px; }
.chat .name { font-weight: 500; }
.chat .time, .msg .t, .day, .convo-head p { font-family: var(--sans); letter-spacing: 0; }
.day { background: transparent; color: var(--faint); font-weight: 500; }
.msg { border-radius: 20px; }
.msg.me { background: var(--me); color: var(--me-ink); }
.msg.me .t { color: rgba(255, 255, 255, 0.72); }
.msg.me a { color: #fff; text-decoration: underline; }
.chip, .ghost, .icon-btn, .voice-btn, .rail-btn, .media-btn, .keypad button { border-color: transparent; background: var(--panel-2); }
.chip { border-radius: 999px; font-weight: 500; }
.send, .primary, .keypad .key-go { border-radius: 14px; font-weight: 500; }
.brand-mark { background: var(--ambient); box-shadow: 0 0 14px var(--ambient); }
.pin-dots i.on { background: var(--ambient); border-color: var(--ambient); }
.conn.ok { background: #31c46c; }
.toast { border-color: transparent; background: var(--panel-2); }

/* tira de luz ambiental: borde derecho del riel en pantallas anchas, borde superior en celular */
.top { position: relative; }
.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--ambient) 20%, var(--ambient) 80%, transparent);
  box-shadow: 0 0 12px var(--ambient); opacity: 0.85;
}
.ambient-swatch { width: 26px; height: 26px; border-radius: 50%; background: var(--ambient); box-shadow: 0 0 12px var(--ambient); }
.ambient-btn { display: none; }

@media (min-width: 700px) {
  .top::after {
    left: auto; top: 0; bottom: 0; right: 0; width: 2px; height: auto;
    background: linear-gradient(180deg, transparent, var(--ambient) 15%, var(--ambient) 85%, transparent);
  }
  .ambient-btn { display: flex; }
}
@media (min-width: 700px) and (max-height: 760px) {
  .ambient-btn { display: none; }
}


/* ───────── lenguaje de la pantalla del coche: grises de la interfaz, íconos de trazo delgado,
   controles en píldora y teclado de PIN redondo. Sin marcas ni tipografías propietarias. */

:root {
  --bg: #000000;
  --panel: #161618;
  --panel-2: #222326;
  --raise: #393c41;
  --text: #ffffff;
  --muted: #a2a3a5;
  --faint: #6b6d70;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f4f4; --panel: #ffffff; --panel-2: #eeeeef; --raise: #dcdcde; --text: #171a20; --muted: #5c5e62; --faint: #8e8e93; }
}
body { letter-spacing: -0.01em; }
.ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* login: teclado redondo */
.brand { font-weight: 500; letter-spacing: 0.02em; }
.brand-mark { border-radius: 50%; width: 10px; height: 10px; }
.login-hint { font-size: 0.95rem; }
.keypad { grid-template-columns: repeat(3, 88px); justify-content: center; gap: 18px 26px; }
.keypad button { width: 88px; height: 88px; border-radius: 50%; font-family: var(--sans); font-weight: 300; font-size: 1.9rem; background: var(--panel-2); }
.keypad button:active { background: var(--raise); }
.keypad .key-soft { background: transparent; color: var(--muted); display: grid; place-items: center; }
.keypad .key-soft .ico { width: 30px; height: 30px; }
.keypad .key-go { font-size: 1rem; font-weight: 500; }
.pin-dots i { width: 14px; height: 14px; border-width: 1.5px; }

/* riel / pestañas como mosaicos del lanzador */
.top { background: var(--panel); }
.tab { color: var(--muted); }
.tab .ico { width: 30px; height: 30px; }
.tab .dot { display: none; }
.tab[aria-selected="true"] { background: var(--raise); color: var(--text); box-shadow: none; }
.tab[aria-selected="true"] .ico { color: var(--c); }
.tab .badge { background: var(--accent); color: #fff; font-family: var(--sans); font-weight: 600; }
.rail-btn { background: transparent; color: var(--text); }
.rail-btn:active { background: var(--raise); }
.rail-btn .ico { width: 30px; height: 30px; }
.rail-btn small { font-size: 0.74rem; }
.safety-pill { background: transparent; border: 0; color: var(--faint); }
.safety-pill svg { stroke: var(--faint); }

/* lista y conversación */
.chats { background: var(--panel); }
.chat { padding-left: 14px; padding-right: 14px; }
.chat.sel, .chat:active { background: var(--panel-2); }
.chat .name { font-weight: 500; font-size: 1.05rem; }
.chat .preview { color: var(--muted); }
.chat .pip { width: 10px; height: 10px; background: var(--accent); }
.chat.new .time { color: var(--accent); }
.avatar { background: var(--raise); color: var(--text); font-weight: 500; }
.convo { background: var(--bg); }
.convo-head { background: var(--bg); }
.convo-head h2 { font-weight: 500; font-size: 1.25rem; }
.msg { font-weight: 400; }
.msg.them { background: var(--panel-2); }
.msg .author { color: var(--muted); font-weight: 500; }

/* controles en píldora */
.chats-head input, .composer textarea { border-radius: 999px; background: var(--panel-2); padding-left: 22px; }
.composer textarea { border-radius: 28px; }
.send, .primary, .keypad .key-go { border-radius: 999px; }
.voice-btn { border-radius: 50%; background: var(--panel-2); }
.chip { background: var(--panel-2); }
.chip:active { background: var(--raise); }
.toast { border-radius: 999px; padding: 14px 26px; }
@media (max-width: 699px) { .tab .ico { display: none; } .tab .dot { display: block; } }


/* ───────── 5-oct: puntito rojo de no leídos, Hermes, luz ambiental viva y movimiento sutil */

:root { --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --hermes: #c9a2ff; }
.c-hermes { --c: var(--hermes); }

/* puntito rojo sobre la pestaña con mensajes sin leer */
.tab { position: relative; transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease); }
.tab:active { transform: scale(0.96); }
.tab .badge {
  position: absolute; top: 10px; right: 14px; width: 12px; height: 12px; min-width: 0; padding: 0;
  border-radius: 50%; background: #e82127; font-size: 0; line-height: 0; color: transparent;
  box-shadow: 0 0 0 2px var(--panel); animation: dotIn 0.35s var(--ease);
}
.tab .badge::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: #e82127;
  animation: dotHalo 2.4s ease-out infinite;
}
@keyframes dotIn { from { transform: scale(0); } 60% { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes dotHalo { 0% { transform: scale(1); opacity: 0.55; } 70%, 100% { transform: scale(2.4); opacity: 0; } }

/* luz ambiental: banda de brillo que recorre la tira + respiración suave */
.top::after {
  background: linear-gradient(90deg, transparent 0%, var(--ambient) 18%, color-mix(in srgb, var(--ambient) 55%, #fff) 50%, var(--ambient) 82%, transparent 100%);
  background-size: 250% 100%;
  animation: ambientFlowX 7s ease-in-out infinite alternate, ambientBreathe 4.5s ease-in-out infinite;
}
@media (min-width: 700px) {
  .top::after {
    width: 3px;
    background: linear-gradient(180deg, transparent 0%, var(--ambient) 14%, color-mix(in srgb, var(--ambient) 55%, #fff) 50%, var(--ambient) 86%, transparent 100%);
    background-size: 100% 250%;
    animation: ambientFlowY 7s ease-in-out infinite alternate, ambientBreathe 4.5s ease-in-out infinite;
  }
}
@keyframes ambientFlowX { from { background-position: 0% 0; } to { background-position: 100% 0; } }
@keyframes ambientFlowY { from { background-position: 0 0%; } to { background-position: 0 100%; } }
@keyframes ambientBreathe {
  0%, 100% { opacity: 0.7; box-shadow: 0 0 8px var(--ambient); }
  50% { opacity: 1; box-shadow: 0 0 18px var(--ambient), 0 0 36px color-mix(in srgb, var(--ambient) 40%, transparent); }
}
.ambient-swatch { transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease); animation: ambientBreathe 4.5s ease-in-out infinite; }

/* movimiento sutil */
.rail-btn, .chat, .chip, .send, .primary, .voice-btn, .ghost, .keypad button { transition: background-color 0.18s var(--ease), transform 0.15s var(--ease), opacity 0.18s var(--ease); }
.rail-btn:active, .chip:active, .send:active, .primary:active, .voice-btn:active, .ghost:active { transform: scale(0.95); }
.chat:active { transform: scale(0.985); }
.keypad button:active { transform: scale(0.92); }
.pin-dots i { transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.2s var(--ease); }
.pin-dots i.on { transform: scale(1.15); }
.convo-head:not([hidden]), .composer:not([hidden]), .hermes:not([hidden]), .chat-list { animation: viewIn 0.32s var(--ease); }
.msg:last-child { animation: msgIn 0.28s var(--ease); }
.toast:not([hidden]) { animation: toastIn 0.3s var(--ease); }
.login-card { animation: viewIn 0.5s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Hermes */
.hermes { height: 100%; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.hermes-head { display: flex; align-items: center; gap: 16px; padding: 14px 20px; }
.hermes-title { flex: 1; min-width: 0; }
.hermes-title h2 { margin: 0; font-size: 1.3rem; font-weight: 500; }
.hermes-title p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.hermes-speak[aria-pressed="true"] { color: var(--text); }
.hermes-speak[aria-pressed="false"] { color: var(--muted); }
.hermes-orb { position: relative; width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--hermes) 70%, #fff), var(--hermes) 45%, color-mix(in srgb, var(--hermes) 40%, #000) 100%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--hermes) 45%, transparent); animation: orbIdle 5s ease-in-out infinite; }
.hermes-orb i { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid transparent; }
.hermes-orb.thinking i { border-top-color: var(--hermes); border-right-color: color-mix(in srgb, var(--hermes) 40%, transparent); animation: spin 1s linear infinite; }
.hermes-orb.listening { animation: orbPulse 1.1s ease-in-out infinite; }
.hermes-orb.speaking { animation: orbPulse 0.7s ease-in-out infinite; }
@keyframes orbIdle { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes orbPulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 14px color-mix(in srgb, var(--hermes) 40%, transparent); } 50% { transform: scale(1.1); box-shadow: 0 0 30px var(--hermes); } }
@keyframes spin { to { transform: rotate(360deg); } }
.hermes .messages { flex: 1; }
.hermes-locked { margin: 0 20px 20px; padding: 16px 20px; border-radius: 16px; background: var(--panel-2); color: var(--muted); }
.hermes-replay { display: inline-flex; margin: 8px 0 2px; height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--raise); color: var(--text); font-size: 0.9rem; }
.msg.thinking { display: inline-flex; gap: 6px; padding: 16px 18px; }
.msg.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s ease-in-out infinite; }
.msg.thinking i:nth-child(2) { animation-delay: 0.15s; }
.msg.thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }
.hermes-mic { width: 84px; height: var(--tap); }
.hermes-mic.recording, .voice-btn.recording { background: #e82127; color: #fff; animation: micRing 1.4s ease-out infinite; }
@keyframes micRing { 0% { box-shadow: 0 0 0 0 rgba(232, 33, 39, 0.55); } 100% { box-shadow: 0 0 0 18px rgba(232, 33, 39, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ───────── animación de inicio (marca propia de Cabina; sin logos de terceros) */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 28px;
  background: #000; pointer-events: none; animation: splashOut 0.6s var(--ease) 1.9s forwards;
}
.splash-line {
  width: min(46vw, 520px); height: 3px; border-radius: 3px; transform: scaleX(0);
  background: linear-gradient(90deg, transparent, var(--ambient) 20%, color-mix(in srgb, var(--ambient) 50%, #fff) 50%, var(--ambient) 80%, transparent);
  box-shadow: 0 0 18px var(--ambient), 0 0 48px color-mix(in srgb, var(--ambient) 50%, transparent);
  animation: splashLine 1s var(--ease) 0.15s forwards;
}
.splash-word {
  color: #fff; font: 300 1.5rem/1 var(--sans); letter-spacing: 0.7em; padding-left: 0.7em; opacity: 0;
  animation: splashWord 0.9s var(--ease) 0.75s forwards;
}
@keyframes splashLine { 0% { transform: scaleX(0); opacity: 0.4; } 100% { transform: scaleX(1); opacity: 1; } }
@keyframes splashWord { from { opacity: 0; letter-spacing: 1.1em; } to { opacity: 1; letter-spacing: 0.7em; } }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }

/* ───────── notas de voz desde la lista y respuesta por voz */
.chat { position: relative; }
.play-note {
  display: grid; place-items: center; width: 64px; height: 64px; margin-left: 4px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 1.3rem; flex: none;
  transition: transform 0.15s var(--ease), background-color 0.2s var(--ease);
}
.play-note:active { transform: scale(0.92); }
.play-note.playing { background: #e82127; animation: micRing 1.4s ease-out infinite; }
.chat:has(.play-note) { grid-template-columns: 56px minmax(0, 1fr) auto 68px; }
.vr-chip { display: inline-flex; align-items: center; gap: 10px; background: var(--accent); color: #fff; font-weight: 500; }
.vr-chip .ico { width: 22px; height: 22px; }
.vr-chip.recording { background: #e82127; animation: micRing 1.4s ease-out infinite; }
.vr-sheet {
  margin: 10px 20px 0; padding: 18px 20px; border-radius: 20px; background: var(--panel-2);
  animation: viewIn 0.28s var(--ease);
}
.vr-heard { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.vr-text { margin: 0 0 16px; font-size: 1.5rem; line-height: 1.35; font-weight: 500; min-height: 1.35em; }
.vr-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.vr-actions .send { height: 72px; padding: 0 40px; font-size: 1.15rem; }
.vr-actions .ghost { height: 72px; }
.vr-actions .send:disabled { opacity: 0.4; }

/* Luz y Pantalla comparten fila para no alargar el riel */
@media (min-width: 700px) {
  .rail { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .rail > .rail-btn { grid-column: 1 / -1; }
  .rail > .ambient-btn, .rail > .fs-btn:not([hidden]) { grid-column: auto; height: 64px; }
  .rail > .ambient-btn:has(+ .fs-btn[hidden]) { grid-column: 1 / -1; }
  .fs-btn .ico { width: 24px; height: 24px; }
}
@media (min-width: 700px) and (max-height: 760px) {
  .fs-btn { display: flex; }
}
