/* ═══════════════════════════════════════════════════════════
   Wonder AI — hoja de estilos
   Dos temas. El oscuro usa negro NEUTRO (sin tinte azul) para que
   los cuatro colores del isotipo sean el único color en pantalla.
   ═══════════════════════════════════════════════════════════ */

:root,
[data-theme="oscuro"] {
  /* Colores de marca (del isotipo) */
  --blue: #4d95f8;
  --blue-cta: #2b7cf0;
  --blue-cta-hover: #4a92f6;
  --green: #2cb67d;
  --amber: #e8b23a;
  --crimson: #ec3a68;

  /* Superficies: grises neutros, cero azul */
  --bg: #000000;
  --surface: #0c0c0c;
  --surface-soft: #151515;
  --surface-hover: #1f1f1f;
  --line: #262626;
  --line-strong: #383838;
  --line-soft: #1a1a1a;

  /* Texto */
  --heading: #f5f5f5;
  --text: #e3e3e3;
  --muted: #9d9d9d;
  --muted-soft: #6f6f6f;

  /* Tintes translúcidos: se apoyan en el fondo sin ensuciar la paleta */
  --tint-blue: rgba(77, 149, 248, .14);
  --tint-blue-line: rgba(77, 149, 248, .32);
  --tint-green: rgba(44, 182, 125, .15);
  --tint-amber: rgba(232, 178, 58, .14);
  --tint-crimson: rgba(236, 58, 104, .14);
  --tint-crimson-line: rgba(236, 58, 104, .34);

  --danger-text: #ff8da8;
  --ok-text: #52d19d;
  --toast-error-bg: #3d1522;

  --scroll-thumb: #2e2e2e;
  --scroll-thumb-hover: #3f3f3f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .6);
  --shadow: 0 2px 12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .7);

  --decor-opacity: .34;

  color-scheme: dark;
}

[data-theme="claro"] {
  --blue: #3b82f6;
  --blue-cta: #1263d2;
  --blue-cta-hover: #0f57ba;
  --green: #17805a;
  --amber: #b98407;
  --crimson: #da1e55;

  --bg: #fbfcfd;
  --surface: #ffffff;
  --surface-soft: #f4f6fa;
  --surface-hover: #e9edf5;
  --line: #e4e9f2;
  --line-strong: #cfd8e8;
  --line-soft: #eef1f7;

  --heading: #12183a;
  --text: #2f3a52;
  --muted: #6b7896;
  --muted-soft: #97a2b8;

  --tint-blue: #eaf2fe;
  --tint-blue-line: #cfe1fb;
  --tint-green: #e6f6ee;
  --tint-amber: #fdf3dd;
  --tint-crimson: #fdeef2;
  --tint-crimson-line: #f7cdd9;

  --danger-text: #c31c48;
  --ok-text: #17805a;
  --toast-error-bg: #fdeef2;

  --scroll-thumb: #d2dae8;
  --scroll-thumb-hover: #b9c4d8;

  --shadow-sm: 0 1px 2px rgba(18, 39, 90, .06);
  --shadow: 0 2px 12px rgba(18, 39, 90, .08);
  --shadow-lg: 0 18px 48px rgba(18, 39, 90, .16);

  --decor-opacity: .5;

  color-scheme: light;
}

:root {
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --sidebar-w: 272px;
  --sidebar-w-min: 68px;
  --rail-w: 300px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  /* También en html: evita el destello del tema contrario antes de pintar. */
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

::selection {
  background: var(--tint-blue-line);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 3px solid transparent;
  border-radius: 8px;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  background-clip: content-box;
}

/* ── Iconos ─────────────────────────────────────────────── */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--xs {
  width: 13px;
  height: 13px;
  stroke-width: 1.9;
}

/* El botón de tema muestra el icono del tema al que vas a cambiar. */
[data-theme="oscuro"] .icon-theme-dark,
[data-theme="claro"] .icon-theme-light {
  display: none;
}

/* ── Marca ──────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  width: 36px;
  height: 36px;
  flex: none;
  object-fit: contain;
}

.brand__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.4px;
  line-height: 1;
  color: var(--heading);
  white-space: nowrap;
}

.brand--lg {
  margin-bottom: 4px;
}

.brand--lg .brand__mark {
  width: 46px;
  height: 46px;
}

.brand--lg .brand__name {
  font-size: 24px;
}

/* La marca de la barra lateral es el botón que repliega el menú. */
.brand--toggle {
  width: 100%;
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  transition: background-color .15s;
}

.brand--toggle:hover {
  background: var(--surface-soft);
}

.brand__chevron {
  margin-left: auto;
  color: var(--muted-soft);
  transition: transform .2s;
}

/* ── Botones ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color .15s, border-color .15s, color .15s;
}

.btn--primary {
  background: var(--blue-cta);
  color: #fff;
}

.btn--primary:hover {
  background: var(--blue-cta-hover);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn--ghost:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Campos ─────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--heading);
}

.field__optional {
  font-weight: 500;
  color: var(--muted-soft);
}

.field__input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field__input::placeholder {
  color: var(--muted-soft);
}

.field__input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--tint-blue);
}

.field__input:disabled {
  color: var(--muted-soft);
  background: var(--surface-soft);
}

.field__input--area {
  resize: vertical;
  min-height: 76px;
}

.field__hint {
  font-size: 11.5px;
  color: var(--muted-soft);
}

/* ═══════════════ PUERTA DE ACCESO ═══════════════ */
.gate {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  overflow: hidden;
  background: var(--bg);
}

.gate__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.gate__title {
  margin: 22px 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--heading);
}

.gate__subtitle {
  margin: 0 0 22px;
  font-size: 13.5px;
  color: var(--muted);
}

.gate__error {
  margin: 0 0 12px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--danger-text);
  background: var(--tint-crimson);
  border: 1px solid var(--tint-crimson-line);
  border-radius: var(--radius-sm);
}

.gate__legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--muted-soft);
}

/* Arcos concéntricos de la marca: acento discreto en las esquinas. */
.gate__decor,
.stage__decor {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  opacity: var(--decor-opacity);
  pointer-events: none;
  background:
    radial-gradient(circle at center,
      transparent 0 40%,
      #3b82f6 40% 40.28%,
      transparent 40.28% 43%,
      #2cb67d 43% 43.28%,
      transparent 43.28% 46%,
      #e8b23a 46% 46.28%,
      transparent 46.28% 49%,
      #da1e55 49% 49.28%,
      transparent 49.28%);
}

.gate__decor--top,
.stage__decor--top {
  top: -340px;
  left: -320px;
}

.gate__decor--bottom,
.stage__decor--bottom {
  right: -330px;
  bottom: -350px;
}

/* ═══════════════ ESQUELETO DE LA APP ═══════════════ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  /* minmax(0,1fr): sin esto la fila crece con el contenido (el mínimo
     automático de un item de grid es su contenido) y el compositor se iba
     empujando fuera de la pantalla a medida que se escribía. */
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* Los tres hijos tienen que poder encogerse por debajo de su contenido. */
.sidebar,
.main,
.rail {
  min-height: 0;
}

/* El panel de ayuda arranca oculto y se pide con el botón de la barra. */
.app:not(.is-rail-open) {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.app:not(.is-rail-open) .rail {
  display: none;
}

/* ── Barra lateral ── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 16px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar__spacer {
  flex: 1;
  min-height: 12px;
}

/* Menú replegado: solo iconos. */
.app.is-sidebar-collapsed {
  --sidebar-w: var(--sidebar-w-min);
}

.app.is-sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
  align-items: center;
}

.app.is-sidebar-collapsed .brand__name,
.app.is-sidebar-collapsed .brand__chevron,
.app.is-sidebar-collapsed .nav__item > span,
.app.is-sidebar-collapsed .nav__chevron,
.app.is-sidebar-collapsed .account__text,
.app.is-sidebar-collapsed .account__chevron {
  display: none;
}

.app.is-sidebar-collapsed .brand--toggle,
.app.is-sidebar-collapsed .nav__item,
.app.is-sidebar-collapsed .account {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  width: 48px;
  margin: 0 auto;
}

.app.is-sidebar-collapsed .nav__dot {
  position: absolute;
  top: 7px;
  right: 9px;
}

.app.is-sidebar-collapsed .nav__item {
  position: relative;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: background-color .15s, color .15s;
}

.nav__item > span:first-of-type {
  flex: 1;
  min-width: 0;
}

.nav__item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.nav__item.is-active {
  background: var(--surface-hover);
  color: var(--heading);
  font-weight: 600;
}

.nav__item--primary {
  font-weight: 600;
  color: var(--heading);
}

.nav__icon-spark {
  color: var(--blue);
}

.nav__chevron {
  color: var(--muted-soft);
}

.nav__count {
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: var(--radius-pill);
}

.nav__item.is-active .nav__count {
  color: var(--text);
  background: var(--surface);
}

.nav--minor .nav__item {
  padding: 8px 12px;
  font-size: 13px;
}

.nav--minor .icon {
  width: 17px;
  height: 17px;
}

.nav__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--blue);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: background-color .15s, border-color .15s;
}

.account:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.account__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

.account__text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.account__name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account__plan {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--blue);
}

.account__chevron {
  color: var(--muted-soft);
}

/* ── Columna central ── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--heading);
  white-space: nowrap;
}

.pill {
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--blue);
  background: var(--tint-blue);
  border: 1px solid var(--tint-blue-line);
  border-radius: var(--radius-pill);
}

.topbar__right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  transition: background-color .15s, color .15s;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.icon-btn.is-on {
  color: var(--blue);
  background: var(--tint-blue);
}

.icon-btn__dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: var(--crimson);
  border: 1.5px solid var(--bg);
  border-radius: 50%;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 3px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  transition: background-color .15s;
}

.user-chip:hover {
  background: var(--surface-soft);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text);
  background: var(--surface-hover);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.menu__head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}

.menu__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
}

.menu__email {
  overflow: hidden;
  font-size: 11.5px;
  color: var(--muted-soft);
  text-overflow: ellipsis;
}

.menu__item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}

.menu__item:hover {
  background: var(--surface-soft);
}

.menu__item--danger {
  color: var(--crimson);
}

/* ── Escenario ── */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.stage__decor {
  z-index: 0;
}

.view {
  position: relative;
  z-index: 1;
  display: none;
  height: 100%;
  overflow-y: auto;
}

.view.is-active {
  display: flex;
  flex-direction: column;
}

/* ── Vista chat ──────────────────────────────────────────
   El compositor va anclado abajo y solo .chat-scroll hace scroll.
   Antes todo vivía en un mismo bloque con scroll: al crecer el
   textarea la barra de escribir se hundía fuera de la pantalla. */
.view--chat {
  padding: 0 28px;
  overflow: hidden;
}

.chat-scroll {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.chat-scroll__inner {
  width: 100%;
  max-width: 720px;
  /* margin-top:auto empuja el contenido abajo SIN romper el scroll
     (justify-content:flex-end recorta la parte de arriba en Chrome). */
  margin: auto auto 0;
  padding-bottom: 4px;
}

/* Sin conversación, el bloque de bienvenida va centrado. */
.view--chat:not(.is-conversation) .chat-scroll__inner {
  margin-bottom: auto;
}

.dock {
  flex: none;
  width: 100%;
  max-width: 830px;
  margin: 0 auto;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 32px;
  text-align: center;
}

.hero__spark {
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
}

.hero__title {
  margin: 0 0 12px;
  font-size: 31px;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -.6px;
  color: var(--heading);
}

.hero__subtitle {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* Hilo de conversación */
.thread {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 28px 0 8px;
}

.turn {
  display: flex;
  gap: 10px;
  max-width: 100%;
}

.turn--user {
  justify-content: flex-end;
}

.turn__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
}

.turn__avatar img {
  width: 20px;
  height: 20px;
}

.turn__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 78%;
}

.bubble {
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 16px;
}

.turn--user .bubble {
  color: #fff;
  background: var(--blue-cta);
  border-bottom-right-radius: 6px;
}

.turn--assistant .bubble {
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.bubble a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.turn--assistant .bubble a {
  color: var(--blue);
}

.turn__actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .15s;
}

.turn:hover .turn__actions,
.turn__actions:focus-within {
  opacity: 1;
}

.turn__action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  transition: background-color .15s, color .15s, border-color .15s;
}

.turn__action:hover {
  color: var(--heading);
  background: var(--surface-hover);
}

.turn__action.is-done {
  color: var(--green);
  border-color: var(--tint-green);
  background: var(--tint-green);
}

/* ── "Pensando": el símbolo de Wondertech con pulso ──────
   Dos animaciones desfasadas (símbolo y halo) sobre una curva
   suave: se lee como respiración, no como parpadeo. */
.thinking {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.thinking__orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
}

.thinking__orb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle,
      var(--tint-blue) 0%,
      transparent 70%);
  animation: halo 2.4s cubic-bezier(.45, 0, .55, 1) infinite;
}

.thinking__mark {
  position: relative;
  width: 28px;
  height: 28px;
  animation: pulso 2.4s cubic-bezier(.45, 0, .55, 1) infinite;
  will-change: transform, opacity;
}

@keyframes pulso {

  0%,
  100% {
    transform: scale(.9);
    opacity: .6;
  }

  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes halo {

  0%,
  100% {
    transform: scale(.75);
    opacity: .35;
  }

  50% {
    transform: scale(1.15);
    opacity: .9;
  }
}

.thinking__note {
  font-size: 12.5px;
  color: var(--muted);
  animation: toast-in .25s ease-out;
}

/* ── Compositor ── */
.composer-wrap {
  width: 100%;
  max-width: 720px;
  margin: 14px auto 0;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 10px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.chip button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted-soft);
  background: none;
  border: none;
  line-height: 1;
}

.chip button:hover {
  color: var(--crimson);
}

.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}

.composer:focus-within {
  border-color: var(--tint-blue-line);
  box-shadow: 0 0 0 3px var(--tint-blue), var(--shadow);
}

.composer__plus {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--muted);
  background: var(--surface-soft);
  border: none;
  border-radius: 50%;
  transition: background-color .15s, color .15s;
}

.composer__plus:hover {
  color: var(--heading);
  background: var(--surface-hover);
}

.composer__input {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  padding: 8px 0;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
}

.composer__input::placeholder {
  color: var(--muted-soft);
}

.composer__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  transition: background-color .15s, color .15s;
}

.composer__icon:hover {
  color: var(--heading);
  background: var(--surface-soft);
}

.composer__icon.is-recording {
  color: var(--crimson);
  background: var(--tint-crimson);
}

.composer__send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  color: var(--muted);
  background: var(--surface-soft);
  border: none;
  border-radius: 50%;
  transition: background-color .15s, color .15s;
}

.composer__send-active {
  display: none;
}

.composer.is-ready .composer__send {
  color: #fff;
  background: var(--blue-cta);
}

.composer.is-ready .composer__send-idle {
  display: none;
}

.composer.is-ready .composer__send-active {
  display: block;
}

.composer.is-busy .composer__send {
  opacity: .45;
  pointer-events: none;
}

.composer__error {
  margin: 8px 2px 0;
  font-size: 12.5px;
  color: var(--danger-text);
}

/* ── Sugerencias ── */
.suggestions {
  width: 100%;
  margin: 20px auto 0;
  text-align: center;
}

.suggestions__caption {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted-soft);
}

.suggestions__row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.suggestion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  transition: border-color .15s, background-color .15s, transform .15s;
}

.suggestion:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.suggestion__icon--blue {
  color: var(--blue);
}

.suggestion__icon--green {
  color: var(--green);
}

.suggestion__icon--amber {
  color: var(--amber);
}

.suggestion__icon--crimson {
  color: var(--crimson);
}

.stage__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 16px 0 14px;
  font-size: 11.5px;
  color: var(--muted-soft);
}

/* ── Vistas de lista ── */
.view--list {
  gap: 16px;
  padding: 28px 32px 40px;
}

.view__head {
  max-width: 760px;
}

.view__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--heading);
}

.view__subtitle {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 760px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, background-color .15s;
}

.row:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.row__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--muted);
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
}

.row__body {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
}

.row__title {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__meta {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted-soft);
}

.row__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.row__actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.row__action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted-soft);
  background: transparent;
  border: none;
  border-radius: 8px;
  transition: background-color .15s, color .15s;
}

.row__action:hover {
  color: var(--heading);
  background: var(--surface-hover);
}

.row__action--danger:hover {
  color: var(--crimson);
  background: var(--tint-crimson);
}

.row__tag {
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-hover);
  border-radius: var(--radius-pill);
}

.row__tag--ok {
  color: var(--ok-text);
  background: var(--tint-green);
}

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--muted-soft);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ── Zona de subida ── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: 760px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  transition: border-color .15s, background-color .15s;
}

.dropzone:hover,
.dropzone.is-over {
  background: var(--tint-blue);
  border-color: var(--blue);
}

.dropzone__icon {
  width: 26px;
  height: 26px;
  color: var(--blue);
}

.dropzone__title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading);
}

.dropzone__hint {
  font-size: 11.5px;
  color: var(--muted-soft);
}

/* ── Paneles ── */
.panel {
  max-width: 760px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel + .panel {
  margin-top: 10px;
}

.panel__tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--blue);
  background: var(--tint-blue);
  border-radius: var(--radius-pill);
}

.panel__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--heading);
}

.panel__text {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--muted);
}

.panel__list {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.panel--form {
  max-width: 480px;
}

.panel__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.panel__note {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--green);
}

/* ── Rail derecho ── */
.rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 18px;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.card {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.card__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
}

.card__icon--amber {
  color: var(--amber);
  background: var(--tint-amber);
}

.card__icon--blue {
  color: var(--blue);
  background: var(--tint-blue);
}

.card__title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading);
}

.card__text {
  margin: 6px 0 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 24px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* Máscara en vez de SVG con color fijo: así el icono sigue al tema. */
.checklist li::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 16px;
  height: 16px;
  background: var(--muted-soft);
  -webkit-mask: var(--check-mask) no-repeat center / 16px 16px;
  mask: var(--check-mask) no-repeat center / 16px 16px;
}

:root {
  --check-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.2 2.4 2.4 4.6-4.9'/%3E%3C/svg%3E");
}

.categories {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.category {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 8px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  transition: background-color .15s;
}

.category:hover {
  background: var(--surface-hover);
}

.category > span {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.category__icon--blue {
  color: var(--blue);
}

.category__icon--green {
  color: var(--green);
}

.category__icon--amber {
  color: var(--amber);
}

.category__icon--crimson {
  color: var(--crimson);
}

.category__chevron {
  color: var(--muted-soft);
}

.card--cta .card__title {
  font-size: 14px;
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(2px);
}

.modal__card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal__title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
}

.modal__text {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--muted);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ── Aviso flotante ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 70;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--heading);
  background: var(--surface-hover);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  animation: toast-in .2s ease-out;
}

.toast--error {
  color: var(--danger-text);
  background: var(--toast-error-bg);
  border-color: var(--tint-crimson-line);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ── Adaptación a pantallas menores ── */
@media (max-width: 1220px) {

  .app,
  .app.is-rail-open {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .app.is-rail-open .rail,
  .rail {
    display: none;
  }
}

@media (max-width: 900px) {

  .app,
  .app.is-rail-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .suggestions__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero__title {
    font-size: 25px;
  }

  .hero__title br,
  .hero__subtitle br {
    display: none;
  }

  .view--chat {
    padding: 0 16px;
  }

  .view--list {
    padding: 20px 16px 32px;
  }

  .turn__body {
    max-width: 88%;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
