:root {
  --md-sys-color-primary: #0071e3;
  --md-sys-color-primary-hover: #0077ed;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e8f1fd;
  --md-sys-color-on-primary-container: #0040a1;

  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-container: #f5f5f7;
  --md-sys-color-surface-container-high: #ececef;
  --md-sys-color-surface-dim: #f3f2f1;

  --md-sys-color-outline: #86868b;
  --md-sys-color-outline-variant: rgba(0, 0, 0, 0.07);

  --md-sys-color-on-surface: #1d1d1f;
  --md-sys-color-on-surface-variant: #2d2d2f;
  --md-sys-color-on-surface-subtle: #58585b;

  --md-sys-color-error: #d70015;
  --md-sys-color-error-container: #ffe0df;
  --md-sys-color-on-error: #ffffff;

  --header-bg: rgba(255, 255, 255, 0.7);
  --surface-glass: rgba(255, 255, 255, 0.55);
  --tonal-hover: #dfe4ec;
  --danger-tonal-hover: #f2b8b5;

  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --elevation-2: 0 2px 4px rgba(0, 0, 0, 0.05), 0 8px 20px rgba(0, 0, 0, 0.07);
  --elevation-3: 0 4px 10px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

html[data-theme="dark"] {
  --md-sys-color-primary: #0a84ff;
  --md-sys-color-primary-hover: #409cff;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #0a3d6b;
  --md-sys-color-on-primary-container: #cfe4ff;

  --md-sys-color-surface: #1c1c1e;
  --md-sys-color-surface-container: #2c2c2e;
  --md-sys-color-surface-container-high: #3a3a3c;
  --md-sys-color-surface-dim: #201f1e;

  --md-sys-color-outline: #6e6e73;
  --md-sys-color-outline-variant: rgba(255, 255, 255, 0.09);

  --md-sys-color-on-surface: #f5f5f7;
  --md-sys-color-on-surface-variant: #c7c7cc;
  --md-sys-color-on-surface-subtle: #8e8e93;

  --md-sys-color-error: #ff453a;
  --md-sys-color-error-container: #420a08;
  --md-sys-color-on-error: #ffffff;

  --header-bg: rgba(28, 28, 30, 0.7);
  --surface-glass: rgba(28, 28, 30, 0.55);
  --tonal-hover: #48484a;
  --danger-tonal-hover: #5c1917;
  color-scheme: dark;
}

html {
  height: 100%;
  height: 100dvh;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Scrollbar unificado estilo caja de chat (composer-textarea) */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
}

body {
  background-color: #0c2129;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.288) 100%),
    linear-gradient(187deg, #0c2129 10%, #1d3b47 57%, #2f6f91 70%, #06081e 96%);
  background-size: 120px 120px, auto, auto;
  background-blend-mode: overlay, normal, normal;
  background-attachment: fixed;
  color: #f5f5f7;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  height: 100%;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
  outline: none;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn-primary:hover {
  background-color: var(--md-sys-color-primary-hover);
  box-shadow: var(--elevation-1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-tonal {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.btn-tonal:hover {
  background-color: var(--tonal-hover);
}

.btn-outlined {
  background-color: transparent;
  border-color: var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
}

.btn-outlined:hover {
  background-color: var(--md-sys-color-surface-container);
  border-color: var(--md-sys-color-outline);
  color: var(--md-sys-color-on-surface);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
}

.btn-icon:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

/* ---------- Morph (botón que crece hasta ser el panel) ---------- */

.morph {
  position: relative;
}

.morph-trigger {
  display: inline-flex;
  position: relative;
  padding: 1px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.morph.open .morph-trigger {
  opacity: 0;
  pointer-events: none;
}

.morph-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(calc(-50% + var(--nudge-x, 0px)), calc(-50% + var(--edge-nudge-y, 0px)));
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.morph.open {
  z-index: 200;
}

.morph.open .morph-panel {
  pointer-events: auto;
  background-color: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-color: var(--md-sys-color-outline-variant);
  box-shadow: var(--elevation-3);
}

/* Los dos paneles de auth (login/register) son siempre blanco translúcido, sin
   borde — a diferencia del resto del sitio, no dependen del tema claro/oscuro
   porque flotan sobre el canvas animado oscuro. */
.auth-buttons-row .morph.open .morph-panel {
  background-color: rgba(255, 255, 255, 0.88);
  border-color: transparent;
  box-shadow: var(--elevation-3);
}

/* El fondo de estos paneles es blanco fijo (no depende del tema claro/oscuro),
   así que el texto también se fija en tonos oscuros para que siempre contraste. */
.auth-buttons-row .auth-form-title {
  color: #1d1d1f;
}

.auth-buttons-row .form-field label {
  color: rgba(29, 29, 31, 0.75);
}

.auth-buttons-row .form-field input {
  background-color: rgba(255, 255, 255, 0.7);
  color: #1d1d1f;
  border-color: rgba(0, 0, 0, 0.14);
}

.auth-buttons-row .form-field input::placeholder {
  color: rgba(29, 29, 31, 0.45);
}

/* El :focus de .form-field input (base) pone un fondo que depende del tema
   (oscuro en modo oscuro) — sin este override, con el texto fijo en oscuro
   quedaba texto oscuro sobre fondo oscuro al escribir. */
.auth-buttons-row .form-field input:focus {
  background-color: rgba(255, 255, 255, 0.92);
  color: #1d1d1f;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.18);
}

.auth-buttons-row .password-toggle,
.auth-buttons-row .morph-panel-close {
  color: rgba(29, 29, 31, 0.6);
}

.auth-buttons-row .password-toggle:hover,
.auth-buttons-row .morph-panel-close:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
}

/* Los dos paneles comparten la misma forma: esquinas rectas + marcadores tipo
   visor, igual que sus botones FrameButton. Login y register solo se distinguen
   por el color del botón (outline vs. negro sólido), no por el panel. */
.auth-form-content-square .frame-marker {
  color: rgba(29, 29, 31, 0.5);
}

.morph-panel-content {
  padding: 26px;
  width: 100%;
  max-width: calc(100vw - 48px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.morph.open .morph-panel-content {
  opacity: 1;
  transition: opacity 0.18s ease 0.22s;
}

@media (prefers-reduced-motion: reduce) {
  .morph-panel, .morph-panel-content, .morph-trigger {
    transition: none !important;
  }
}

.account-morph-content {
  width: min(200px, calc(100vw - 32px));
  padding: 0.4rem;
  gap: 0.15rem;
  display: flex;
  flex-direction: column;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  width: 100%;
}

.account-menu-item:hover {
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
}

.account-menu-username {
  padding: 0.5rem 0.75rem 0.3rem;
  font-size: 0.78rem;
  color: var(--md-sys-color-on-surface-subtle);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 0.3rem;
}

/* ---------- Toasts (apilados como mazo de cartas) ---------- */

.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  width: 300px;
  max-width: calc(100vw - 3rem);
  z-index: 500;
  pointer-events: auto;
}

/* Puente transparente que cubre el espacio (gap) de separación entre avisos al estar desplegados */
.toast-container[data-expanded="1"] .toast::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
  pointer-events: auto;
}

.toast {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  background-color: var(--surface-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 400;
  box-shadow: var(--elevation-2);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transform-origin: top center;
  touch-action: pan-y;
  cursor: grab;
}

.toast-message {
  flex: 1;
}

.toast-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-sys-color-on-surface-subtle);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.toast-close:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.toast-icon-badge {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toast-success .toast-icon-badge { background: rgba(50, 215, 75, 0.18); color: #32d74b; }
.toast-danger .toast-icon-badge { background: rgba(255, 69, 58, 0.18); color: #ff453a; }
.toast-warning .toast-icon-badge { background: rgba(255, 159, 10, 0.18); color: #ff9f0a; }
.toast-info .toast-icon-badge { background: rgba(10, 132, 255, 0.18); color: #0a84ff; }

/* ---------- Auth (login / register) — minimalista, estilo Stripe/Linear ---------- */

.auth-main {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 3rem 4rem;
  background-color: #06081e;
}

@media (max-width: 600px) {
  .auth-main {
    padding: 1.5rem;
    justify-content: center;
  }
  .auth-landing {
    max-width: 100%;
    align-items: center;
    text-align: center;
  }
  .auth-buttons-row {
    align-items: center;
  }
  .auth-terminal {
    display: none;
  }
}

.auth-terminal {
  position: absolute;
  right: 0.85rem;
  bottom: 0.65rem;
  z-index: 1;
  max-width: calc(100vw - 2rem);
  font-family: var(--font-family);
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  pointer-events: none;
  user-select: none;
}

.auth-terminal-text {
  display: inline-block;
  filter: blur(0);
  opacity: 1;
  transition: filter 0.55s ease, opacity 0.55s ease;
}

.auth-terminal-text.is-blurring {
  filter: blur(10px);
  opacity: 0;
}

.auth-terminal-cursor {
  display: inline-block;
  margin-left: 2px;
  font-style: normal;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.55);
  animation: auth-terminal-blink 1s step-end infinite;
}

@keyframes auth-terminal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-terminal-cursor {
    animation: none;
  }
}

.auth-visual-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.auth-landing {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2.5rem;
  max-width: 360px;
}

.auth-buttons-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.auth-form-content {
  /* Ancho fijo (independiente del ancho animado del panel) para que content.scrollHeight
     se calcule siempre contra el mismo layout — si no, al medirse a mitad de la animación
     de ancho el texto puede envolver distinto y queda un alto de sobra una vez que termina. */
  width: min(340px, calc(100vw - 32px));
  position: relative;
  padding: 1.85rem 1.75rem 1.75rem;
  text-align: left;
}

.morph-panel-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-sys-color-on-surface-subtle);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.morph-panel-close:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.auth-form-content form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-form-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 0.15rem;
}

.auth-brand {
  align-self: center;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  display: block;
}

.app-header .brand-logo-img {
  height: 22px;
}

/* ---------- Frame button (triggers de login/register) ---------- */
/* Los triggers se apoyan directo sobre el canvas animado (siempre oscuro), por eso
   usan colores claros fijos en vez de los tokens de tema claro/oscuro del resto del sitio. */

.frame-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 2rem;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.15s ease, color 0.25s ease;
}

.frame-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.55);
}

.frame-btn:active {
  transform: scale(0.985);
}

.frame-btn.frame-btn-solid {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #0b0d14;
}

.frame-btn.frame-btn-solid:hover {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.85);
}

.frame-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.55);
  transition: transform 0.3s ease, color 0.3s ease;
  pointer-events: none;
}

.frame-btn:hover .frame-marker {
  color: #ffffff;
}

.frame-btn-solid .frame-marker {
  color: rgba(11, 13, 20, 0.4);
}

.frame-btn-solid:hover .frame-marker {
  color: #0b0d14;
}

.frame-marker-tl { top: -7.5px; left: -7.5px; }
.frame-marker-tr { top: -7.5px; right: -7.5px; }
.frame-marker-br { bottom: -7.5px; right: -7.5px; }
.frame-marker-bl { bottom: -7.5px; left: -7.5px; }

.frame-btn:hover .frame-marker-tl { transform: translate(-7px, -7px); }
.frame-btn:hover .frame-marker-tr { transform: translate(7px, -7px); }
.frame-btn:hover .frame-marker-br { transform: translate(7px, 7px); }
.frame-btn:hover .frame-marker-bl { transform: translate(-7px, 7px); }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 2.6rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-sys-color-on-surface-subtle);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.password-toggle:hover {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.password-reveal-warning {
  font-size: 0.75rem;
  color: #c78a1a;
  margin-top: -0.1rem;
}

.form-field input {
  width: 100%;
  height: 42px;
  padding: 0 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-field input::placeholder {
  color: var(--md-sys-color-on-surface-subtle);
}

.form-field input:focus {
  background-color: var(--md-sys-color-surface);
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.18);
}

.auth-error {
  font-size: 0.8rem;
  color: var(--md-sys-color-error);
  min-height: 1rem;
  margin: -0.4rem 0 -0.2rem;
}

.auth-submit {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ---------- Chat shell (interfaz unificada glass) ---------- */

.app-header {
  background-color: rgba(255, 255, 255, 0.08);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02) 60%);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  height: 52px;
  width: calc(100% - 2rem);
  max-width: 1100px;
  position: fixed;
  top: 0.85rem;
  left: 0;
  right: 0;
  margin: 0 auto;
  border-radius: 9999px;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 0.5rem 0 0.75rem;
  gap: 0.45rem;
  flex-shrink: 0;
  pointer-events: auto;
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.35rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-header.is-tts-active .brand {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(0.92) !important;
}

.brand-logo-img {
  height: 22px;
  width: auto;
  display: block;
}

.header-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.35), rgba(47, 111, 145, 0.35));
  border: 1px solid rgba(10, 132, 255, 0.45);
  color: #79c0ff;
  letter-spacing: 0.04em;
  margin-left: 0.15rem;
}

.btn-header-icon {
  color: rgba(243, 247, 249, 0.75);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-header-icon:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-header-icon.active {
  background-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.app-header .morph.open .morph-panel {
  background-color: rgba(12, 33, 41, 0.94);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

.app-header .account-menu-username {
  color: rgba(255, 255, 255, 0.65);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.app-header .account-menu-item {
  color: rgba(255, 255, 255, 0.85);
}

.app-header .account-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.app-header-spacer { flex: 1; }

/* ---------- Trigger de hover en borde izquierdo ---------- */

.sidebar-hover-trigger {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 32px;
  z-index: 95;
  pointer-events: auto;
}

/* ---------- Sidebar flotante con bordes redondeados ---------- */

.chat-sidebar {
  position: fixed;
  top: 1rem;
  bottom: 1rem;
  left: 1rem;
  width: 290px;
  max-width: calc(100vw - 2rem);
  height: calc(100vh - 2rem);
  max-height: calc(100vh - 2rem);
  background-color: rgba(10, 26, 33, 0.88);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02) 60%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.6),
    0 2px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1rem;
  gap: 0.85rem;
  z-index: 100;
  transform: translateX(calc(-100% - 2rem));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  overflow: hidden;
}

.chat-sidebar.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Puente invisible entre el borde izquierdo de la pantalla y el sidebar flotante */
.chat-sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.5rem;
  width: 1.5rem;
  pointer-events: auto;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 720px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

.sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-header.is-search-open .sidebar-title-wrap,
.sidebar-header:has(#sidebarSearchMorph.open) .sidebar-title-wrap {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
}

.sidebar-header.is-search-open .btn-sidebar-close,
.sidebar-header:has(#sidebarSearchMorph.open) .btn-sidebar-close {
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
}

.sidebar-count-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.42rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-sidebar-action {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-sidebar-action:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-sidebar-action .morph-trigger-surface {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Morph panel dentro del sidebar flotante */
.chat-sidebar .morph.open .morph-panel {
  background-color: rgba(12, 33, 41, 0.96);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  z-index: 120;
}

.sidebar-search-morph-content {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 0.25rem 0.65rem;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.sidebar-morph-search-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.sidebar-morph-search-row .search-input-icon {
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.sidebar-morph-search-row .sidebar-search-input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 0.84rem;
  font-family: inherit;
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0;
}

.sidebar-morph-search-row .sidebar-search-input::placeholder {
  color: rgba(243, 247, 249, 0.45);
}

.sidebar-morph-search-row .morph-panel-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  position: static;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.sidebar-morph-search-row .morph-panel-close:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-sidebar-close {
  color: rgba(255, 255, 255, 0.65);
  width: 30px;
  height: 30px;
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.15s ease, background-color 0.15s ease;
}

.btn-sidebar-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.chat-sidebar .btn-new-chat {
  width: 100%;
  justify-content: flex-start;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-radius: 12px;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
}

.sidebar-footer-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #30d158;
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.sidebar-footer-model {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.sidebar-footer-desc {
  font-size: 0.7rem;
  color: rgba(243, 247, 249, 0.45);
  padding-left: 1.15rem;
}

.sidebar-empty-search {
  padding: 1.5rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(243, 247, 249, 0.4);
}

.chat-sidebar .btn-new-chat:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-scroll-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-left: -1rem;
  margin-right: -1rem;
  overflow: hidden;
}

.sidebar-scroll-fade {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-scroll-fade-top {
  top: 0;
  height: 58px;
  background: linear-gradient(
    180deg,
    rgba(10, 26, 33, 0.8) 0%,
    rgba(10, 26, 33, 0.4) 45%,
    rgba(10, 26, 33, 0) 100%
  );
}

.sidebar-scroll-fade-bottom {
  bottom: 0;
  height: 62px;
  background: linear-gradient(
    0deg,
    rgba(10, 26, 33, 0.82) 0%,
    rgba(10, 26, 33, 0.42) 48%,
    rgba(10, 26, 33, 0) 100%
  );
}

.sidebar-scroll-fade.is-active {
  opacity: 1;
}

.sidebar-scroll-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(243, 247, 249, 0.72);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.15s ease,
    filter 0.15s ease;
}

.sidebar-scroll-btn svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.sidebar-scroll-btn-top {
  top: 4px;
}

.sidebar-scroll-btn-bottom {
  bottom: 4px;
}

.sidebar-scroll-btn.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%);
}

.sidebar-scroll-btn:hover {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #ffffff;
}

.sidebar-scroll-btn-top:hover {
  transform: translateX(-50%) translateY(-2px) scale(1.1);
}

.sidebar-scroll-btn-bottom:hover {
  transform: translateX(-50%) translateY(2px) scale(1.1);
}

.sidebar-scroll-btn:active {
  transform: translateX(-50%) scale(0.92);
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 1rem;
  padding-right: 0.8rem;
  padding-top: 0.25rem;
  padding-bottom: 1.5rem;
  scroll-behavior: smooth;
}

.conversation-list::-webkit-scrollbar {
  width: 4px;
}

.conversation-list::-webkit-scrollbar-track {
  background: transparent;
}

.conversation-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.conversation-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.65rem 0.65rem 0.65rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: rgba(243, 247, 249, 0.75);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.conversation-item-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
}

.conversation-item.is-renaming {
  background-color: rgba(18, 30, 38, 0.98) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
  cursor: default !important;
  padding: 0.35rem 0.45rem 0.35rem 0.65rem !important;
  z-index: 100;
}

.conversation-item.is-renaming .conversation-item-body {
  display: none !important;
}

.convo-rename-morph-row {
  display: none;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.conversation-item.is-renaming .convo-rename-morph-row {
  display: flex !important;
}

.convo-rename-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.convo-rename-input {
  flex: 1;
  min-width: 0;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #ffffff !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  padding: 0.2rem 0.15rem !important;
}

.convo-rename-input::placeholder {
  color: rgba(243, 247, 249, 0.4);
}

.convo-rename-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.convo-rename-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: rgba(255, 255, 255, 0.65);
  transition: background-color 0.15s ease, color 0.15s ease;
  pointer-events: auto;
}

.convo-rename-btn svg {
  pointer-events: none;
}

.convo-rename-btn.confirm {
  color: rgba(255, 255, 255, 0.85);
}

.convo-rename-btn.confirm:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.convo-rename-btn.cancel {
  color: rgba(255, 255, 255, 0.55);
}

.convo-rename-btn.cancel:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.conversation-item.menu-open {
  z-index: 200;
  background-color: rgba(255, 255, 255, 0.12);
}

.convo-pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-primary, #0a84ff);
  margin-right: 0.35rem;
  flex-shrink: 0;
}

.convo-generating-dots {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  margin-left: 6px;
  margin-right: 2px;
  flex-shrink: 0;
  vertical-align: middle;
}

.convo-generating-dots .generating-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #38bdf8;
  animation: convo-dot-pulse 1.2s ease-in-out infinite;
}

.convo-generating-dots .dot-1 { animation-delay: 0s; }
.convo-generating-dots .dot-2 { animation-delay: 0.2s; }
.convo-generating-dots .dot-3 { animation-delay: 0.4s; }

@keyframes convo-dot-pulse {
  0%, 80%, 100% {
    transform: scale(0.75);
    opacity: 0.35;
  }
  40% {
    transform: scale(1.25);
    opacity: 1;
    box-shadow: 0 0 4px rgba(56, 189, 248, 0.75);
  }
}

.conversation-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.btn-conversation-more {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  opacity: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.btn-conversation-more svg {
  pointer-events: none;
}

.conversation-item:hover .btn-conversation-more,
.conversation-item.menu-open .btn-conversation-more,
.btn-conversation-more:focus-visible {
  opacity: 1;
}

.btn-conversation-more:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

@media (hover: none) {
  .btn-conversation-more {
    opacity: 0.85;
  }
}

/* Menú Contextual Morph de Conversación */
.conversation-menu-dropdown {
  display: none !important;
  position: absolute;
  top: calc(100% + 4px);
  right: 0.5rem;
  z-index: 250;
  background: rgba(12, 33, 41, 0.98);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.35rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
  min-width: 155px;
  flex-direction: column;
  gap: 2px;
  transform-origin: top right;
}

.conversation-menu-dropdown[hidden] {
  display: none !important;
}

.conversation-item.menu-open .conversation-menu-dropdown:not([hidden]) {
  display: flex !important;
}

.conversation-menu-dropdown.dropup {
  top: auto;
  bottom: calc(100% + 4px);
  transform-origin: bottom right;
}

@keyframes convoMenuIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.convo-menu-action {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.convo-menu-action:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.convo-menu-action.danger {
  color: #ff6b6b;
}

.convo-menu-action.danger:hover {
  background-color: rgba(255, 69, 58, 0.2);
  color: #ff453a;
}

.conversation-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.conversation-item.active {
  background-color: rgba(10, 132, 255, 0.25);
  border-color: rgba(10, 132, 255, 0.4);
  color: #ffffff;
  font-weight: 600;
}

/* ---------- App body y Chat main ---------- */

.app-body {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 0;
  position: relative;
  overflow: hidden;
}

.chat-main {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: none;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.chat-main.is-idle {
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: calc(52px + 1.5rem);
  padding-bottom: 2rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-main:not(.is-idle) {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.idle-hero {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto 2.2rem;
  padding: 0 1rem;
}

.chat-main.is-idle .idle-hero {
  display: flex;
}

.idle-hero-icon-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.15rem;
}

.idle-hero-aura {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10, 132, 255, 0.15) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

.idle-hero-logo {
  height: 74px;
  width: auto;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.idle-hero-greeting-container {
  position: relative;
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.idle-hero-text {
  position: absolute;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.idle-hero-text.text-hello {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(
    110deg,
    #ffffff 0%,
    #e2edfd 16%,
    #a8c7fa 34%,
    #70a6ff 50%,
    #a8c7fa 66%,
    #e2edfd 84%,
    #ffffff 100%
  );
  background-size: 280% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  max-width: 100%;
  vertical-align: baseline;
  will-change: background-position;
}

@media (max-width: 600px) {
  .idle-hero-text {
    font-size: 1.55rem;
    white-space: normal;
  }
  .idle-hero-greeting-container {
    height: 60px;
  }
  .gradient-text {
    display: inline;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
}

/* ---------- Sugerencias de texto limpias sobre la caja de chat ---------- */

.composer-suggestions {
  display: none;
  width: 100%;
  max-width: 640px;
  margin: 0 auto 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 1;
  position: relative;
}

.chat-main.is-idle .composer-suggestions {
  display: flex;
}

.suggestion-text-btn {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  color: rgba(243, 247, 249, 0.75);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  padding: 0.42rem 0.95rem;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.suggestion-text-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.suggestion-text-btn:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .composer-suggestions {
    max-width: 100%;
    padding: 0 1rem;
    gap: 0.4rem;
  }
  .suggestion-text-btn {
    font-size: 0.78rem;
    padding: 0.38rem 0.8rem;
  }
}

.chat-main.is-idle #messageList {
  display: none;
}

.idle-grain-overlay {
  display: none;
}

/* ---------- Mensajes ---------- */

.message-list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(52px + 1.85rem) 0 230px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  mask-image: linear-gradient(to bottom, transparent 0px, black 65px, black calc(100% - 110px), transparent calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 65px, black calc(100% - 110px), transparent calc(100% - 40px), transparent 100%);
}

.message-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.message-list-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  padding: 2rem 1.75rem;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(10, 132, 255, 0.15);
  border: 1px solid rgba(10, 132, 255, 0.3);
  color: #79c0ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.empty-state-desc {
  font-size: 0.84rem;
  color: rgba(243, 247, 249, 0.6);
  margin: 0;
  line-height: 1.45;
}

.message-row {
  display: flex;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1rem;
}

.message-row.role-user { justify-content: flex-end; }
.message-row.role-assistant { justify-content: flex-start; }

.message-bubble-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.role-user .message-bubble-wrapper {
  align-items: flex-end;
}

.role-assistant .message-bubble-wrapper {
  align-items: flex-start;
  max-width: 100%;
  width: 100%;
}

.message-bubble {
  padding: 0.85rem 1.15rem;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  will-change: transform, border-radius, opacity;
}

.role-user .message-bubble {
  background: linear-gradient(135deg, rgba(0, 113, 227, 0.9), rgba(10, 132, 255, 0.75));
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.role-assistant .message-bubble {
  width: 100%;
  padding: 1.1rem 1.35rem;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f1f6f8;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 18px rgba(2, 8, 16, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

/* Burbuja de mensaje de voz */
.message-bubble.is-voice {
  padding: 0.55rem 0.75rem 0.55rem 0.6rem;
  white-space: normal;
}

.voice-message-player {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 240px;
  max-width: 320px;
  user-select: none;
}

.voice-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.role-assistant .voice-play-btn {
  background-color: var(--md-sys-color-primary, #0a84ff);
}

.voice-play-btn:hover {
  transform: scale(1.06);
  background-color: rgba(255, 255, 255, 0.36);
}

.role-assistant .voice-play-btn:hover {
  background-color: var(--md-sys-color-primary-hover, #409cff);
}

.voice-play-btn:active {
  transform: scale(0.95);
}

.voice-waveform-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.voice-waveform-bars {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 22px;
  width: 100%;
}

.voice-waveform-bar {
  flex: 1;
  border-radius: 2px;
  background-color: rgba(255, 255, 255, 0.32);
  transition: background-color 0.12s ease;
  min-height: 4px;
}

.voice-waveform-bar.is-played {
  background-color: #ffffff;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.75);
}

.voice-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
}

.voice-duration-label {
  font-weight: 500;
  letter-spacing: 0.02em;
}

.voice-mic-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  color: rgba(243, 247, 249, 0.45);
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-msg-action {
  background: transparent;
  border: none;
  color: rgba(243, 247, 249, 0.5);
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-msg-action:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-msg-action.is-copied {
  color: #3fb950;
  background-color: rgba(63, 185, 80, 0.16);
}

.btn-msg-action.active {
  color: #0a84ff;
  background-color: rgba(10, 132, 255, 0.16);
}

.btn-msg-action.is-speaking {
  color: #38bdf8 !important;
  background-color: rgba(56, 189, 248, 0.2) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  animation: pulse-speaking 1.5s ease-in-out infinite;
}

@keyframes pulse-speaking {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(56, 189, 248, 0); }
}

.btn-msg-action.is-speaking .speak-icon {
  display: none !important;
}

.btn-msg-action.is-speaking .stop-icon {
  display: inline-block !important;
  color: #38bdf8;
}

.role-user .message-meta {
  justify-content: flex-end;
}

.btn-msg-action.btn-delete-msg:hover {
  background-color: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.btn-msg-action.btn-edit-msg:hover {
  background-color: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
}

/* ==========================================================================
   Editor en línea de mensajes y Resubida de archivos
   ========================================================================== */

.message-inline-editor {
  width: 100%;
  max-width: 680px;
  background: rgba(14, 25, 34, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
  border-radius: 18px;
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  animation: fadeInEdit 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes fadeInEdit {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.message-edit-label {
  font-weight: 600;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.message-edit-hint {
  font-size: 0.7rem;
  color: rgba(243, 247, 249, 0.42);
}

.message-edit-textarea {
  width: 100%;
  min-height: 58px;
  max-height: 300px;
  background: transparent;
  border: none;
  color: #f5f5f7;
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  padding: 0.25rem 0;
  box-sizing: border-box;
}

.message-edit-attachments-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.message-edit-images-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.message-edit-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #091217;
}

.message-edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message-edit-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.message-edit-thumb-remove:hover {
  background: #ef4444;
  transform: scale(1.12);
}

.btn-edit-upload-file {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: rgba(243, 247, 249, 0.8);
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  height: 52px;
  transition: all 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.btn-edit-upload-file:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #38bdf8;
  color: #38bdf8;
}

.message-edit-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-edit-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(243, 247, 249, 0.75);
  border-radius: 9999px;
  padding: 0.35rem 0.95rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-edit-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-edit-submit {
  background: #0a84ff;
  color: #ffffff;
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 0.35rem 1.05rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  box-shadow: 0 2px 10px rgba(10, 132, 255, 0.3);
}

.btn-edit-submit:hover {
  background: #0070e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.45);
}

.btn-edit-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Modal de Confirmación Morph (Eliminar Chat / Mensajes)
   ========================================================================== */

.confirm-morph-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  box-sizing: border-box;
}

.confirm-morph-modal-backdrop[hidden] {
  display: none !important;
}

.confirm-morph-modal-card {
  width: 100%;
  max-width: 380px;
  background: rgba(14, 25, 34, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  box-sizing: border-box;
  transform-origin: center center;
}

.confirm-morph-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -0.25rem;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.confirm-morph-content {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.confirm-morph-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f5f5f7;
  letter-spacing: -0.01em;
}

.confirm-morph-desc {
  margin: 0;
  font-size: 0.86rem;
  color: rgba(243, 247, 249, 0.65);
  line-height: 1.5;
}

.confirm-morph-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.25rem;
}

.btn-confirm-morph-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(243, 247, 249, 0.85);
  border-radius: 9999px;
  padding: 0.6rem 1rem;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-confirm-morph-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-confirm-morph-confirm {
  flex: 1;
  background: #ef4444;
  border: 1px solid transparent;
  color: #ffffff;
  border-radius: 9999px;
  padding: 0.6rem 1rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  user-select: none;
}

.btn-confirm-morph-confirm:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-confirm-morph-confirm:active,
.btn-confirm-morph-cancel:active {
  transform: scale(0.97);
}

/* Code block styles */
.code-block-wrapper {
  margin: 0.85rem 0;
  border-radius: 10px;
  overflow: hidden;
  background: #090e13;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  white-space: normal;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 0.85rem;
  background: #111a22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
  margin: 0;
}

.code-block-lang-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.code-lang-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.code-lang-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.code-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #79c0ff;
  display: inline-block;
  flex-shrink: 0;
}
.code-lang-dot.lang-js, .code-lang-dot.lang-javascript { background: #f7df1e; box-shadow: 0 0 6px rgba(247, 223, 30, 0.4); }
.code-lang-dot.lang-ts, .code-lang-dot.lang-typescript { background: #3178c6; box-shadow: 0 0 6px rgba(49, 120, 198, 0.4); }
.code-lang-dot.lang-py, .code-lang-dot.lang-python { background: #3776ab; box-shadow: 0 0 6px rgba(55, 118, 171, 0.4); }
.code-lang-dot.lang-html, .code-lang-dot.lang-xml { background: #e34f26; box-shadow: 0 0 6px rgba(227, 79, 38, 0.4); }
.code-lang-dot.lang-css, .code-lang-dot.lang-scss { background: #264de4; box-shadow: 0 0 6px rgba(38, 77, 228, 0.4); }
.code-lang-dot.lang-go, .code-lang-dot.lang-golang { background: #00add8; box-shadow: 0 0 6px rgba(0, 173, 216, 0.4); }
.code-lang-dot.lang-sql { background: #e38c00; box-shadow: 0 0 6px rgba(227, 140, 0, 0.4); }
.code-lang-dot.lang-json { background: #cbcb41; box-shadow: 0 0 6px rgba(203, 203, 65, 0.4); }
.code-lang-dot.lang-bash, .code-lang-dot.lang-sh, .code-lang-dot.lang-shell, .code-lang-dot.lang-powershell, .code-lang-dot.lang-ps1 { background: #4eaa25; box-shadow: 0 0 6px rgba(78, 170, 37, 0.4); }
.code-lang-dot.lang-rust, .code-lang-dot.lang-rs { background: #dea584; box-shadow: 0 0 6px rgba(222, 165, 132, 0.4); }
.code-lang-dot.lang-c, .code-lang-dot.lang-cpp { background: #659ad2; box-shadow: 0 0 6px rgba(101, 154, 210, 0.4); }

.code-block-lang {
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace);
  font-size: 0.73rem;
  font-weight: 500;
  color: rgba(243, 247, 249, 0.7);
  letter-spacing: 0.3px;
  text-transform: lowercase;
}

.btn-copy-code {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(243, 247, 249, 0.7);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-copy-code:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-copy-code.is-copied {
  color: #3fb950;
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(63, 185, 80, 0.12);
}

.code-block {
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: auto;
  background: #090e13;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.code-block code.hljs {
  display: block;
  padding: 0.95rem 1.15rem 1.05rem 1.15rem;
  margin: 0;
  background: transparent !important;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre;
  word-wrap: normal;
  tab-size: 2;
  color: #abb2bf;
}

/* ==========================================================================
 * Syntax Highlighting Theme (One Dark Pro)
 * ========================================================================== */
.hljs-comment,
.hljs-quote {
  color: #5c6370 !important;
  font-style: italic !important;
}

.hljs-doctag,
.hljs-keyword,
.hljs-formula {
  color: #c678dd !important;
}

.hljs-section,
.hljs-name,
.hljs-selector-tag,
.hljs-deletion,
.hljs-subst {
  color: #e06c75 !important;
}

.hljs-literal,
.hljs-operator {
  color: #56b6c2 !important;
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute,
.hljs-meta .hljs-string {
  color: #98c379 !important;
}

.hljs-built_in,
.hljs-class .hljs-title,
.hljs-title.class_ {
  color: #e5c07b !important;
}

.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-type,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-number {
  color: #d19a66 !important;
}

.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-meta,
.hljs-selector-id,
.hljs-title {
  color: #61aeee !important;
}

.hljs-emphasis {
  font-style: italic !important;
}

.hljs-strong {
  font-weight: bold !important;
}

.hljs-link {
  text-decoration: underline !important;
}

.inline-code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.85em;
  color: #79c0ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Encabezados y Seccionado de la conversación */
.md-heading {
  font-weight: 600;
  color: #ffffff;
  line-height: 1.35;
  letter-spacing: -0.015em;
  white-space: normal;
}

.md-heading.md-h1,
.md-heading.md-h2 {
  font-size: 1.18rem;
  margin: 1.35rem 0 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.md-heading.md-h3 {
  font-size: 1.05rem;
  margin: 1.1rem 0 0.45rem;
}

.md-heading.md-h4 {
  font-size: 0.94rem;
  margin: 0.9rem 0 0.35rem;
  color: rgba(255, 255, 255, 0.95);
}

.md-heading.md-h5,
.md-heading.md-h6 {
  font-size: 0.88rem;
  margin: 0.75rem 0 0.3rem;
  color: rgba(255, 255, 255, 0.82);
}

.message-bubble > .md-heading:first-child {
  margin-top: 0.15rem;
}

/* Divisores de Sección horizontales (---, ***, ___) */
.md-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  margin: 1.25rem 0;
  width: 100%;
}

/* Tablas Markdown Responsive */
.md-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  margin: 0.95rem 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 22, 30, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  white-space: normal;
}

.md-table-wrapper::-webkit-scrollbar {
  height: 5px;
}

.md-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.md-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}

.md-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: normal;
}

.md-table thead {
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.md-table th {
  padding: 0.65rem 0.95rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
  white-space: normal;
}

.md-table td {
  padding: 0.6rem 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: rgba(243, 247, 249, 0.88);
  white-space: normal;
  word-break: break-word;
}

.md-table tbody tr:last-child td {
  border-bottom: none;
}

.md-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Listas ordenadas y desordenadas */
.md-list {
  margin: 0.65rem 0;
  padding-left: 1.4rem;
  white-space: normal;
}

.md-list li {
  margin-bottom: 0.3rem;
  color: rgba(243, 247, 249, 0.92);
  line-height: 1.55;
  white-space: normal;
}

.md-list.md-list-unordered {
  list-style-type: disc;
}

.md-list.md-list-ordered {
  list-style-type: decimal;
}

/* Listas de Tareas / Checklists */
.md-list.md-task-list {
  list-style-type: none;
  padding-left: 0;
}

.md-task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
  white-space: normal;
}

.md-task-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  margin-top: 3px;
  transition: all 0.15s ease;
}

.md-task-check.checked {
  background: var(--md-sys-color-primary, #0a84ff);
  border-color: var(--md-sys-color-primary, #0a84ff);
  color: #ffffff;
}

.md-task-item.completed .md-task-text {
  text-decoration: line-through;
  opacity: 0.65;
}

/* Citas en bloque (Blockquotes) */
.md-blockquote {
  margin: 0.85rem 0;
  padding: 0.65rem 1rem;
  border-left: 3px solid var(--md-sys-color-primary, #0a84ff);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0 10px 10px 0;
  color: rgba(243, 247, 249, 0.85);
  font-style: italic;
  white-space: normal;
}

/* Bloques de advertencia y avisos (Callouts: [!NOTE], [!TIP], etc.) */
.md-callout {
  margin: 0.85rem 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  white-space: normal;
}

.md-callout-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
}

.md-callout-note {
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.06);
}
.md-callout-note .md-callout-badge {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

.md-callout-tip {
  border-color: rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.06);
}
.md-callout-tip .md-callout-badge {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.md-callout-warning,
.md-callout-caution {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.06);
}
.md-callout-warning .md-callout-badge,
.md-callout-caution .md-callout-badge {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.md-callout-important {
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.06);
}
.md-callout-important .md-callout-badge {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.15);
}

.md-callout-body {
  font-size: 0.88rem;
  color: rgba(243, 247, 249, 0.9);
  line-height: 1.5;
}

/* Enlaces y tachado */
.md-link {
  color: var(--md-sys-color-primary, #0a84ff);
  text-decoration: none;
  border-bottom: 1px solid rgba(10, 132, 255, 0.35);
  padding-bottom: 1px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: border-color 0.15s ease, color 0.15s ease;
  word-break: break-all;
}

.md-link:hover {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.md-link-ext {
  opacity: 0.65;
  flex-shrink: 0;
}

.md-del {
  text-decoration: line-through;
  opacity: 0.65;
}


/* ---------- Estado de respuesta de la IA (Loading con A de Aether y Typing Stream) ---------- */

.ai-responding-row {
  margin-bottom: 1.25rem;
  display: flex;
  width: 100%;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
  justify-content: flex-start;
}

.ai-responding-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  width: 100%;
  min-height: 96px;
}

/* Indicador de carga: Shader WebGL Loader nativo o letra A */
.ai-aether-loading .shader-loader-canvas {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
}

.ai-aether-loading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1.25rem 0.5rem;
  min-height: 96px;
  width: 100%;
  user-select: none;
  pointer-events: none;
}

.ai-aether-morph-a {
  width: 64px;
  height: 64px;
  color: #70a6ff;
  display: block;
  overflow: visible;
  /* clean matte finish */
  animation: aetherLetterBreathe 2.4s ease-in-out infinite;
}

.ai-aether-morph-path {
  animation: aetherPathMorph 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes aetherLetterBreathe {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes aetherPathMorph {
  0%, 100% {
    d: path("M 4 21 C 6 15 10 7 12 3 C 14 7 18 15 20 21 M 7.5 14.5 C 10.5 14.5 13.5 14.5 16.5 14.5");
  }
  25% {
    d: path("M 5 21 C 7 13 10 4 12 4 C 14 4 17 13 19 21 M 8 13.5 C 10.5 15.5 13.5 15.5 16 13.5");
  }
  50% {
    d: path("M 6 21 C 9 14 12 3 14 3 C 16 7 18 16 21 21 M 9.5 13 C 12.5 14 15.5 15 18.5 15.5");
  }
  75% {
    d: path("M 3 21 C 6 16 10 3.5 12 3.5 C 14 3.5 18 16 21 21 M 7 15.5 C 10.5 13.5 13.5 13.5 17 15.5");
  }
}

/* Estado escribiendo: el texto se escribe directamente en la conversación sin fondo de burbuja */
.ai-typing-stream {
  width: 100%;
  padding: 0.85rem 0.35rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #f1f6f8;
  white-space: pre-wrap;
  word-wrap: break-word;
  user-select: text;
  min-height: 48px;
}

.ai-typing-content {
  display: inline;
  white-space: pre-wrap;
  word-break: break-word;
}

.stream-answer-block {
  margin-top: 10px;
  display: block;
}

.stream-answer-text {
  display: inline;
  white-space: pre-wrap;
  word-break: break-word;
}

.thought-text {
  display: inline;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-typing-cursor {
  display: inline-block;
  width: 2.2px;
  height: 1.15em;
  vertical-align: -0.15em;
  background: #ffffff;
  border-radius: 2px;
  margin-left: 2px;
  box-shadow: none;
  animation: aetherCursorBlink 0.7s ease-in-out infinite;
}

@keyframes aetherCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-aether-morph-a,
  .ai-aether-morph-path,
  .ai-typing-cursor {
    animation: none;
  }
}

/* ---------- Botón flotante para ir al último mensaje ---------- */

.btn-scroll-bottom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  margin-bottom: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.9);
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s ease, filter 0.15s ease;
  z-index: 10;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.75));
}

.btn-scroll-bottom.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.btn-scroll-bottom:hover {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #ffffff;
  transform: translateY(-2px) scale(1.15);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.95));
}

.btn-scroll-bottom:active {
  transform: translateY(1px) scale(0.95);
}

.chat-main.is-idle .btn-scroll-bottom {
  display: none !important;
}

/* ---------- Contenedor flotante de la caja de chat (Sombra sutil & elegante) ---------- */

.composer-floating-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: static;
  background: none;
  pointer-events: auto;
}

.chat-main:not(.is-idle) .composer-floating-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1rem 0.65rem;
  pointer-events: none;
  background: transparent;
}

.composer-floating-wrap > * {
  pointer-events: auto;
}

.chat-main:not(.is-idle) .composer {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 0.25rem;
  box-shadow:
    0 8px 28px -4px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.chat-main:not(.is-idle) .composer:focus-within {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    0 10px 32px -4px rgba(0, 0, 0, 0.42),
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.chat-main:not(.is-idle) .composer-footnote {
  width: 100%;
  max-width: 760px;
  margin: 0.35rem auto 0.25rem;
  position: relative;
  z-index: 10;
}

/* ---------- Composer unificado ---------- */

.composer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0.5rem auto 0.75rem;
  background-color: rgba(255, 255, 255, 0.08);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 60%);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 28px -4px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  border-radius: 26px;
  padding: 0.75rem 0.85rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-main.is-idle .composer {
  max-width: 640px;
  margin: 0 1.5rem;
}

.composer:focus-within {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    0 2px 6px rgba(2, 8, 16, 0.3),
    0 16px 36px -8px rgba(2, 8, 16, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.composer-textarea {
  resize: none;
  max-height: 160px;
  min-height: 24px;
  padding: 0.35rem 0.5rem;
  border: none;
  background-color: transparent;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.composer-textarea::-webkit-scrollbar {
  width: 4px;
}

.composer-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.composer-textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.composer-textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}

.composer-textarea::placeholder {
  color: rgba(243, 247, 249, 0.6);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  overflow: visible;
}

.composer-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.composer-toolbar-left::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.composer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.composer-toolbar-right::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.composer-char-count {
  font-size: 0.72rem;
  color: rgba(243, 247, 249, 0.6);
  white-space: nowrap;
  user-select: none;
}

.composer-icon-btn {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(228, 236, 239, 0.75);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.composer-icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.composer-icon-btn:active {
  transform: scale(0.9);
}

.composer-divider {
  flex-shrink: 0;
  width: 1px;
  height: 18px;
  margin: 0 0.35rem;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.18), transparent);
}

.mode-pill {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(243, 247, 249, 0.72);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mode-pill:hover {
  background-color: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: translateY(-1px);
}

.mode-pill:active {
  transform: scale(0.92);
}

.mode-pill.active {
  width: auto;
  min-width: 32px;
  padding: 0 0.72rem 0 0.55rem;
  gap: 0.35rem;
}

.mode-pill .mode-pill-label {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(-4px);
  transition: max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 0;
}

.mode-pill.active .mode-pill-label {
  max-width: 90px;
  opacity: 1;
  transform: translateX(0);
}

.mode-pill[data-mode="search"].active,
.mode-pill[data-mode="think"].active,
.mode-pill[data-mode="canvas"].active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  box-shadow: none;
}

.mode-pill[data-mode="search"].active svg,
.mode-pill[data-mode="think"].active svg,
.mode-pill[data-mode="canvas"].active svg {
  filter: none;
  animation: none;
  color: #ffffff;
}

/* Botón de micrófono independiente */
.composer-mic-btn {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.06);
  color: rgba(243, 247, 249, 0.85);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.composer-mic-btn:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.26);
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.composer-mic-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.composer-mic-btn.is-recording {
  background-color: #ff453a;
  border-color: #ff453a;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 69, 58, 0.6);
  animation: pulseRecording 1.4s ease-in-out infinite;
}

.composer-mic-btn.is-recording:hover {
  background-color: #ff5e54;
  border-color: #ff5e54;
}

.composer-mic-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
}

.composer-send {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background-color: #ffffff;
  color: #0c2129;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.composer-send:hover:not(:disabled) {
  background-color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.35);
  transform: translateY(-1px) scale(1.04);
}

.composer-send:active:not(:disabled) {
  transform: scale(0.92);
}

.composer-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.4);
  box-shadow: none;
}

.composer-send.is-generating {
  background-color: rgba(255, 255, 255, 0.16) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  opacity: 1 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.composer-send.is-generating:hover {
  background-color: #ff453a !important;
  border-color: #ff453a !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(255, 69, 58, 0.45);
  transform: scale(1.06);
}

.composer-send.is-generating .icon-send-arrow {
  display: none !important;
}

.composer-send.is-generating .icon-send-stop {
  display: block !important;
}

.composer-send.is-generating .icon-send-stop rect {
  transform-origin: center;
  animation: stopSquarePulse 1.8s ease-in-out infinite;
}

@keyframes stopSquarePulse {
  0%, 100% { opacity: 0.92; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes pulseRecording {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

@keyframes radarPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes neuralShimmer {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(6deg); }
  75% { transform: scale(1.1) rotate(-6deg); }
}

@keyframes canvasFloat {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.08) translateY(-1px); }
}

@keyframes composerRippleBurst {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0;
  }
}

.composer-click-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: composerRippleBurst 0.45s cubic-bezier(0.12, 0.8, 0.32, 1) forwards;
  z-index: 10;
}

/* ---------- Composer: adjuntos, grabación de voz ---------- */

/* ---------- Composer: adjuntos y mazo apilado con morph ---------- */

.composer-attachments {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0.45rem;
}

.composer-attachments:empty {
  display: none;
}

/* Solo 1 archivo */
.composer-single-attachment {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease;
}

.composer-single-attachment:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.4);
}

.composer-single-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.22s ease;
}

.composer-single-attachment:hover img {
  transform: scale(1.06);
}

/* Mazo apilado para > 1 archivos */
.composer-attachment-deck {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 4px;
}

/* Puente invisible interactivo para que el cursor nunca pierda el hover entre el mazo y la bandeja flotante */
.composer-attachment-deck::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: -20px;
  right: -20px;
  height: 26px;
  background: transparent;
  pointer-events: none;
  z-index: 150;
}

.composer-attachment-deck:hover::before,
.composer-attachment-deck.is-hovered::before,
.composer-attachment-deck.is-open::before {
  pointer-events: auto;
}

.deck-stack-wrapper {
  position: relative;
  width: 58px;
  height: 58px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.composer-attachment-deck:hover .deck-stack-wrapper,
.composer-attachment-deck.is-hovered .deck-stack-wrapper,
.composer-attachment-deck.is-open .deck-stack-wrapper {
  transform: scale(1.04);
}

.deck-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  background: #0c2129;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.deck-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Efecto cartas de baraja apiladas */
.deck-card:nth-child(1) {
  z-index: 3;
  transform: rotate(-3deg) translate(-2px, 0);
}

.deck-card:nth-child(2) {
  z-index: 2;
  transform: rotate(4deg) translate(4px, -2px);
  opacity: 0.9;
}

.deck-card:nth-child(3) {
  z-index: 1;
  transform: rotate(9deg) translate(8px, -4px);
  opacity: 0.75;
}

.deck-count-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  z-index: 10;
  background: var(--md-sys-color-primary, #0a84ff);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Bandeja expandida Morph al pasar el mouse (hover / open) */
.deck-morph-tray {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 200;
  background: rgba(12, 33, 41, 0.96);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 0.65rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  gap: 0.5rem;
  max-width: min(520px, calc(100vw - 48px));
  overflow-x: auto;
  animation: deckTrayIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom left;
}

@keyframes deckTrayIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.composer-attachment-deck:hover .deck-morph-tray,
.composer-attachment-deck.is-hovered .deck-morph-tray,
.composer-attachment-deck.is-open .deck-morph-tray {
  display: flex;
}

.deck-tray-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease;
}

.deck-tray-item:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.38);
}

.deck-tray-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.22s ease;
}

.deck-tray-item:hover img {
  transform: scale(1.06);
}

.composer-attachment-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.composer-attachment-remove:hover {
  background-color: #ff453a;
  transform: scale(1.1);
}

.message-bubble-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.4rem;
  max-width: 380px;
  margin-bottom: 0.45rem;
}

.message-bubble-images-grid img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.message-bubble-images-grid img:hover {
  transform: scale(1.02);
}

.composer-voice[hidden] {
  display: none;
}

.composer-voice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.5rem 0.5rem;
  width: 100%;
}

.composer-voice-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.composer-voice-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #ff453a;
  box-shadow: none;
  animation: composer-voice-pulse 1s ease-in-out infinite;
}

@keyframes composer-voice-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.composer-voice-time {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.composer-voice-bars {
  width: 100%;
  max-width: 380px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 1rem;
}

.composer-voice-bars span {
  width: 3px;
  min-height: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, rgba(130, 205, 255, 0.85) 100%);
  box-shadow: none;
}

/* ---------- Composer Footnote & Shortcuts ---------- */

.composer-footnote {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  max-width: 760px;
  margin: 0.45rem auto 0.75rem;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  color: rgba(243, 247, 249, 0.85);
  gap: 0.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  min-height: 22px;
}

.chat-main.is-idle .composer-footnote {
  max-width: 640px;
  margin: 0.45rem 1.5rem 0.75rem;
}

.composer-disclaimer {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-shortcuts {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: relative;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  filter: blur(6px);
  will-change: opacity, transform, filter;
}

.composer-shortcuts.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  filter: blur(0px);
}

.shortcut-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: rgba(243, 247, 249, 0.85);
  font-size: 0.73rem;
  font-weight: 500;
  user-select: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.shortcut-tag kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 0.1rem 0.32rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: #ffffff;
  box-shadow: none;
}

@media (max-width: 640px) {
  .composer-shortcuts { display: none; }
  .composer-disclaimer { text-align: center; width: 100%; }
}

/* ---------- Visor de imagen a pantalla completa ---------- */

.image-preview-overlay[hidden] {
  display: none;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: imgPreviewFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes imgPreviewFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.image-preview-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.15);
  object-fit: contain;
  user-select: none;
}

.image-preview-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.message-bubble img {
  max-width: 220px;
  border-radius: 12px;
  display: block;
  margin-bottom: 0.4rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .app-header {
    width: calc(100% - 1rem);
    top: 0.5rem;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: 0 0.4rem 0 0.6rem;
  }
  .app-body {
    padding: 0 0.5rem 0;
  }
  .chat-main:not(.is-idle) .message-list {
    padding-top: calc(52px + 1.25rem);
    padding-bottom: 180px;
    mask-image: linear-gradient(to bottom, transparent 0px, black 55px, black calc(100% - 90px), transparent calc(100% - 20px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 55px, black calc(100% - 90px), transparent calc(100% - 20px), transparent 100%);
  }
  .message-row {
    padding: 0 0.5rem;
  }
  .chat-main:not(.is-idle) .composer-floating-wrap {
    padding: 0 0.5rem 0.45rem;
  }
}

/* ---------- Pantalla de carga Auth (Minimalista & Elegante) ---------- */

.auth-loading-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2rem;
  max-width: 360px;
  animation: authFadeIn 0.35s ease-out both;
}

@media (max-width: 720px) {
  .auth-loading-container {
    max-width: 100%;
    align-items: center;
    text-align: center;
  }
}

.auth-loading-logo {
  animation: authLogoBreathe 2.4s ease-in-out infinite;
}

.auth-loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0;
}

.auth-loading-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  animation: authSpin 0.7s linear infinite;
  flex-shrink: 0;
}

.auth-loading-status {
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: -0.01em;
  user-select: none;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

@keyframes authLogoBreathe {
  0%, 100% { opacity: 0.88; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.015); }
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Versión en pie de página (inferior derecha) ---------- */

.app-version-tag {
  position: fixed;
  bottom: 0.85rem;
  right: 1.15rem;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  font-family: var(--font-mono);
  line-height: 1;
  user-select: none;
  pointer-events: none;
  z-index: 40;
}

.app-version-tag .version-prefix {
  font-size: 0.68rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.32);
  letter-spacing: 0.02em;
}

.app-version-tag .version-num {
  font-size: 0.88rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.app-version-tag .version-beta {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.04em;
  margin-left: 5px;
}

@media (max-width: 768px) {
  .app-version-tag {
    display: none !important;
  }
}

body:not(.chat-idle) .app-version-tag {
  display: none !important;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.sidebar-version-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  user-select: none;
}

.sidebar-version-tag .version-num {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.sidebar-version-tag .version-beta {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
  margin-left: 4px;
}

/* ---------- Modal de Ajustes de Cuenta ---------- */

.account-modal-backdrop[hidden] {
  display: none;
}

.account-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(2, 8, 16, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.account-modal-card {
  background-color: rgba(12, 33, 41, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  width: 100%;
  max-width: 1060px;
  height: min(780px, 90vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.account-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.account-modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.account-modal-close {
  color: rgba(255, 255, 255, 0.65);
}

.account-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Layout con Categorías a la Izquierda */
.account-modal-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  width: 100%;
}

.account-modal-nav {
  width: 235px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 1.15rem 0.65rem;
  background: rgba(0, 0, 0, 0.16);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.account-modal-body {
  flex: 1;
  min-height: 0;
  padding: 2.25rem 2.85rem;
  overflow-y: auto;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.account-nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
  padding: 0.55rem 0.65rem 0.25rem;
  user-select: none;
}

.account-nav-label:not(:first-child) {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.account-modal-nav::-webkit-scrollbar,
.account-modal-body::-webkit-scrollbar {
  width: 4px;
}

.account-modal-nav::-webkit-scrollbar-track,
.account-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.account-modal-nav::-webkit-scrollbar-thumb,
.account-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.account-modal-nav::-webkit-scrollbar-thumb:hover,
.account-modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}

.account-nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.46rem 0.65rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
  font-weight: 450;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
  text-align: left;
}

.account-nav-btn svg {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  opacity: 0.5;
  transition: opacity 0.12s ease, color 0.12s ease;
}

.account-nav-btn:hover {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
}

.account-nav-btn:hover svg {
  opacity: 0.85;
}

.account-nav-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  font-weight: 500;
}

.account-nav-btn.active svg {
  opacity: 1;
  color: var(--md-sys-color-primary, #0a84ff);
}

@media (max-width: 768px) {
  .account-modal-backdrop {
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
  }

  .account-modal-card {
    max-width: 100%;
    width: 100%;
    height: 94vh;
    height: calc(100dvh - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .account-modal-header {
    padding: 0.85rem 1.15rem;
    flex-shrink: 0;
  }

  .account-modal-title {
    font-size: 1rem;
  }

  .account-modal-layout {
    flex-direction: column;
    flex: 1;
    min-height: 0 !important;
    height: 100%;
    overflow: hidden;
    width: 100%;
  }

  .account-modal-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    padding: 0.45rem 0.65rem;
    gap: 0.35rem;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: rgba(0, 0, 0, 0.22);
  }

  .account-modal-nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .account-nav-label {
    display: none !important;
  }

  .account-nav-btn {
    width: auto !important;
    flex-shrink: 0 !important;
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 0.42rem 0.72rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    gap: 0.42rem;
  }

  .account-nav-btn svg {
    width: 14px;
    height: 14px;
  }

  .account-nav-btn.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
  }

  .account-modal-body {
    flex: 1;
    min-height: 0 !important;
    height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    padding: 1.15rem 1rem 3.5rem;
    box-sizing: border-box;
  }

  .account-modal-body::-webkit-scrollbar {
    width: 4px;
  }

  .account-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
  }
}

@media (max-width: 540px) {
  .md-table th,
  .md-table td {
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
  }

  .md-heading.md-h1,
  .md-heading.md-h2 {
    font-size: 1.08rem;
  }

  .profile-card {
    flex-direction: column;
    text-align: center;
    gap: 0.85rem;
    padding: 1.1rem 0.9rem;
  }

  .profile-meta {
    align-items: center;
    width: 100%;
  }

  .profile-meta > div {
    justify-content: center;
  }

  .profile-id-row {
    justify-content: center;
  }

  .profile-id-val {
    max-width: 200px;
  }

  .account-modal-body .quota-details-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }

  .profile-session-box {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 0.75rem;
  }

  .session-desc {
    justify-content: center;
  }

  .btn-logout-subtle {
    width: 100%;
    justify-content: center;
  }

  .data-action-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .data-action-item > button,
  .data-action-item > a,
  .data-action-item .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .voice-select-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .btn-voice-preview {
    width: 100%;
    justify-content: center;
  }

  .sound-picker-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .sound-picker-controls {
    width: 100%;
    justify-content: space-between;
  }

  .sound-picker-controls .morph-select-wrapper,
  .sound-picker-controls .settings-select-sm {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .setup-2fa-secret-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .setup-2fa-secret-code {
    text-align: center;
    word-break: break-all;
  }

  .setup-2fa-box > div:last-child {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .settings-input-code {
    width: 100% !important;
  }

  .setup-2fa-box > div:last-child > .btn {
    width: 100%;
  }

  .api-workspace-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .btn-create-token-main {
    width: 100%;
    justify-content: center;
  }

  .api-token-created-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .api-token-created-row input {
    width: 100%;
  }

  .api-token-created-row button {
    width: 100%;
    justify-content: center;
  }

  .api-token-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .api-token-val {
    word-break: break-all;
  }

  .api-token-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .api-tokens-empty-state {
    flex-direction: column;
    text-align: center;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
  }

  .shortcut-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
  }

  .shortcut-keys {
    align-self: flex-start;
  }
}

@media (max-width: 380px) {
  .account-modal-backdrop {
    padding: 0.25rem;
  }

  .account-modal-card {
    height: calc(100dvh - 0.5rem);
    max-height: calc(100dvh - 0.5rem);
    border-radius: 14px;
  }

  .account-modal-header {
    padding: 0.75rem 0.85rem;
  }

  .account-modal-body {
    padding: 0.95rem 0.75rem 3.5rem;
  }

  .account-modal-body .quota-details-grid {
    grid-template-columns: 1fr !important;
  }

  .pill-choice-row {
    flex-wrap: wrap;
  }

  .pill-choice-btn {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 40%;
  }
}

.account-tab-panel[hidden] {
  display: none;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.25rem 1.4rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-avatar {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #18232e;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.profile-avatar:hover {
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.02);
}

.profile-avatar .avatar-svg,
.header-avatar-wrap .avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.profile-avatar .avatar-custom-img,
.header-avatar-wrap .avatar-custom-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.profile-avatar .avatar-edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #ffffff;
}

.profile-avatar:hover .avatar-edit-overlay {
  opacity: 1;
}

/* Header Avatar button */
.btn-header-avatar {
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.header-avatar-wrap {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #18232e;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.btn-header-avatar:hover .header-avatar-wrap {
  border-color: rgba(255, 255, 255, 0.4);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name {
  font-size: 1.08rem;
  font-weight: 600;
  color: #ffffff;
}

.profile-id-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(243, 247, 249, 0.55);
}

.profile-id-label {
  font-weight: 600;
  color: rgba(243, 247, 249, 0.4);
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.profile-id-val {
  color: rgba(243, 247, 249, 0.75);
  font-size: 0.76rem;
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
  letter-spacing: -0.01em;
}

.btn-copy-id {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(243, 247, 249, 0.55);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-copy-id:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.btn-copy-id:active {
  transform: scale(0.92);
}

.session-user-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(243, 247, 249, 0.45);
  margin-left: 0.25rem;
}

.profile-handle {
  font-size: 0.82rem;
  color: rgba(243, 247, 249, 0.45);
  font-family: var(--font-mono);
}

.profile-session-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.session-desc {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: rgba(243, 247, 249, 0.7);
}

.session-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #30d158;
  border: 1px solid rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
}

.session-desc strong {
  color: #ffffff;
  font-weight: 600;
}

.btn-logout-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.8rem;
  font-size: 0.78rem;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-logout-subtle:hover {
  background: rgba(255, 69, 58, 0.15);
  border-color: rgba(255, 69, 58, 0.35);
  color: #ff6b6b;
}

.settings-group {
  margin-bottom: 1.15rem;
}

.settings-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.45rem;
}

.pill-choice-row {
  display: flex;
  gap: 0.5rem;
}

.pill-choice-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-choice-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.pill-choice-btn.active {
  background: var(--md-sys-color-primary, #0a84ff);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.settings-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.72rem 2.5rem 0.72rem 1rem;
  border-radius: 12px;
  background-color: #0b1f28;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238faec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f3f7f9;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-select:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background-color: #0e2733;
}

.settings-select:focus {
  border-color: var(--md-sys-color-primary, #0a84ff);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
  background-color: #0e2733;
}

/* Opciones desplegables nítidas y legibles */
.settings-select option {
  background-color: #0c2129;
  color: #f3f7f9;
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
}

.settings-select option:checked,
.settings-select option:hover {
  background-color: #173e4f;
  color: #ffffff;
}

.settings-select-sm {
  width: auto;
  min-width: 175px;
  padding: 0.48rem 2.2rem 0.48rem 0.85rem;
  font-size: 0.82rem;
  background-position: right 0.75rem center;
}

/* ---------- Morph Select (Desplegables con animación Morph) ---------- */

.morph-select-wrapper {
  position: relative;
  width: 100%;
}

.morph-select-wrapper.morph-select-sm {
  width: auto;
  min-width: 175px;
}

.morph-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.68rem 1rem;
  border-radius: 12px;
  background-color: #0b1f28;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f3f7f9;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.morph-select-wrapper.morph-select-sm .morph-select-trigger {
  padding: 0.46rem 0.85rem;
  font-size: 0.82rem;
}

.morph-select-trigger:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background-color: #0e2733;
}

.morph-select-wrapper.open .morph-select-trigger {
  border-color: var(--md-sys-color-primary, #0a84ff);
  background-color: #0e2733;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.morph-select-label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.morph-select-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8faec0;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.morph-select-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(11, 31, 40, 0.98);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transform-origin: top center;
}

.morph-select-options {
  display: flex;
  flex-direction: column;
  padding: 0.35rem;
  gap: 0.2rem;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.morph-select-options::-webkit-scrollbar {
  width: 4px;
}
.morph-select-options::-webkit-scrollbar-track {
  background: transparent;
}
.morph-select-options::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}
.morph-select-options::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}

.morph-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.58rem 0.85rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 450;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  text-align: left;
}

.morph-select-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.morph-select-item.selected {
  background-color: rgba(10, 132, 255, 0.18);
  color: #ffffff;
  font-weight: 550;
}

.morph-select-check {
  display: none;
  color: var(--md-sys-color-primary, #0a84ff);
  flex-shrink: 0;
}

.morph-select-item.selected .morph-select-check {
  display: inline-block;
}

.model-choice-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.model-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all 0.15s ease;
}

.model-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.model-card.active {
  border-color: var(--md-sys-color-primary, #0a84ff);
  background: rgba(10, 132, 255, 0.12);
}

.model-card input {
  margin-top: 3px;
  accent-color: var(--md-sys-color-primary, #0a84ff);
}

.model-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}

.model-desc {
  display: block;
  font-size: 0.74rem;
  color: rgba(243, 247, 249, 0.5);
  margin-top: 2px;
}

.data-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.data-action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.data-action-item.danger {
  border-color: rgba(255, 69, 58, 0.25);
  background: rgba(255, 69, 58, 0.04);
}

.action-item-title {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
}

.action-item-desc {
  display: block;
  font-size: 0.72rem;
  color: rgba(243, 247, 249, 0.5);
  margin-top: 2px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--md-sys-color-primary, #0a84ff);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* Badge de Plan */
.badge-plan {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.badge-plan-free {
  color: rgba(243, 247, 249, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.badge-plan-enterprise {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.16);
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.badge-plan-pro {
  color: #30d158;
  background: rgba(48, 209, 88, 0.14);
  border: 1px solid rgba(48, 209, 88, 0.28);
}

.badge-plan-plus {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.28);
}

/* Textarea de Ajustes */
.settings-textarea {
  width: 100%;
  min-height: 85px;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
}

.settings-textarea:focus {
  border-color: var(--md-sys-color-primary, #0a84ff);
}

.settings-desc {
  font-size: 0.78rem;
  color: rgba(243, 247, 249, 0.55);
  margin-bottom: 0.6rem;
  line-height: 1.4;
}

/* Lista de Memorias */
.memory-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.memory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.7rem 0.95rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.15s ease;
}

.memory-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.memory-del-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.memory-del-btn:hover {
  color: #ff453a;
  background: rgba(255, 69, 58, 0.14);
}

/* Atajos de Teclado */
.shortcuts-table {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.95rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
}

.shortcut-label {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.85);
}

.shortcut-keys {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
}

kbd.shortcut-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 0.2rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

/* Botón de Peligro / Borrado */
.btn-danger-action {
  color: #ff6b6b;
  border: 1px solid rgba(255, 69, 58, 0.35);
  background: rgba(255, 69, 58, 0.08);
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-action:hover {
  background: rgba(255, 69, 58, 0.2);
  border-color: rgba(255, 69, 58, 0.6);
  color: #ffffff;
}


/* ---------- Morph Login & Dashboard Transitions ---------- */

/* Icono sutil de éxito en callback (sin fondo, sin parecer botón) */
.auth-loading-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  color: #ffffff;
  flex-shrink: 0;
}

/* Preparación para el morph de bienvenida al dashboard (evita FOUC) */
html.dashboard-morph-prep .app-header,
html.dashboard-morph-prep .idle-hero-icon-container,
html.dashboard-morph-prep .idle-hero-aura,
html.dashboard-morph-prep .idle-hero-greeting-container,
html.dashboard-morph-prep .composer-suggestions,
html.dashboard-morph-prep .composer,
html.dashboard-morph-prep .composer-footnote,
html.dashboard-morph-prep .composer-shortcuts,
html.dashboard-morph-prep .app-version-tag {
  opacity: 0 !important;
}

/* Restauración instantánea de conversación activa al recargar (evita parpadeo con dashboard) */
html.convo-restoring .idle-hero,
html.convo-restoring .composer-suggestions {
  display: none !important;
}

html.convo-restoring .chat-main.is-idle,
html.convo-restoring .chat-main {
  justify-content: flex-start !important;
  align-items: stretch !important;
  padding-top: calc(52px + 1rem) !important;
  padding-bottom: 0 !important;
}

html.convo-restoring #messageList {
  display: flex !important;
}

html.convo-restoring .composer {
  max-width: 800px !important;
  margin: 0 !important;
}


/* Preparación para el morph de bienvenida en auth al cerrar sesión */
html.auth-logout-prep .auth-landing,
html.auth-logout-prep .auth-terminal {
  opacity: 0;
}

/* Badges de estado nítidos y modernos (sin glow de IA) */
.badge-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.badge-status-pill.badge-active {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-status-pill.badge-inactive {
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Caja de configuración 2FA interactiva */
.setup-2fa-box {
  margin-top: 0.75rem;
  padding: 1rem 1.15rem;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.setup-2fa-secret-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.6rem 0;
}

.setup-2fa-secret-code {
  font-family: var(--font-mono, monospace);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.08);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(147, 197, 253, 0.2);
}

/* Inputs de Ajustes */
.settings-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.settings-input:focus {
  border-color: var(--md-sys-color-primary, #0a84ff);
}

.settings-input-code {
  width: 130px;
  text-align: center;
  font-family: var(--font-mono, monospace);
  font-size: 1rem;
  letter-spacing: 0.25em;
  font-weight: 600;
}

/* Espacio de trabajo dedicado para Claves de API */
.api-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.api-workspace-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.btn-create-token-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Caja de clave de API recién creada (copia única, espaciosa y destacada) */
.setup-api-token-box {
  padding: 1.35rem 1.6rem;
  background: rgba(14, 30, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.api-token-warning-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fde047;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.95rem;
  line-height: 1.45;
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.22);
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
}

.api-token-warning-badge svg {
  flex-shrink: 0;
  color: #facc15;
}

.api-token-created-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Lista de tokens espaciosa */
.api-tokens-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.api-token-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.api-token-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.api-token-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.api-token-name {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.88rem;
}

.api-token-val {
  font-family: var(--font-mono, monospace);
  color: rgba(243, 247, 249, 0.75);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.api-token-date {
  font-size: 0.72rem;
  color: rgba(243, 247, 249, 0.45);
}

.api-token-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Empty state para Claves de API */
.api-tokens-empty-state {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.14);
}

.api-tokens-empty-state .empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.api-tokens-empty-state .empty-state-text strong {
  display: block;
  font-size: 0.88rem;
  color: #ffffff;
  margin-bottom: 0.2rem;
}

.api-tokens-empty-state .empty-state-text p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(243, 247, 249, 0.5);
  line-height: 1.4;
}

/* Quickstart code block */
.api-quickstart-card {
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quickstart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.quickstart-code {
  margin: 0;
  padding: 1.1rem 1.35rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.84rem;
  line-height: 1.6;
  color: #93c5fd;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.35);
}

.quickstart-code code {
  white-space: pre;
  display: inline-block;
  min-width: 100%;
  font-family: inherit;
}

.code-block,
.quickstart-code {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.35);
}

.code-block::-webkit-scrollbar {
  height: 6px !important;
  width: 6px !important;
  background: transparent !important;
}

.code-block::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.22) !important;
  border-radius: 0 0 10px 10px;
}

.code-block::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22) !important;
  border-radius: 9999px !important;
}

.code-block::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45) !important;
}

.code-block::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.quickstart-code::-webkit-scrollbar {
  display: block !important;
  height: 6px !important;
  width: 6px !important;
}

.quickstart-code::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.35) !important;
  border-radius: 4px;
}

.quickstart-code::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25) !important;
  border-radius: 4px;
}

.quickstart-code::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5) !important;
}

/* --- Controles de audio y volumen en Ajustes / Perfil --- */
/* --- Controles de audio y volumen en Ajustes / Perfil --- */
.volume-slider-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.volume-slider-row:hover,
.volume-slider-row:focus-within {
  background: rgba(255, 255, 255, 0.038);
  border-color: rgba(255, 255, 255, 0.12);
}

.volume-icon {
  color: var(--md-sys-color-primary, #0a84ff);
  flex-shrink: 0;
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s ease, opacity 0.15s ease;
  user-select: none;
}

.volume-icon:hover {
  transform: scale(1.12);
  color: #3b9eff;
}

.volume-icon:active {
  transform: scale(0.92);
}

.volume-icon.is-muted {
  color: rgba(255, 255, 255, 0.38);
}

/* Barra de volumen con relleno azul dinámico (Progress Fill Track) */
.settings-range {
  --volume-percent: 65%;
  --slider-fill-color: #0a84ff;
  --slider-fill-active: #0071e3;
  --slider-track-bg: rgba(255, 255, 255, 0.09);
  --slider-track-hover: rgba(255, 255, 255, 0.14);

  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    var(--slider-fill-color) 0%,
    var(--slider-fill-color) var(--volume-percent),
    var(--slider-track-bg) var(--volume-percent),
    var(--slider-track-bg) 100%
  );
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: height 0.16s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.16s ease;
}

.settings-range:hover {
  height: 8px;
  background: linear-gradient(
    to right,
    var(--slider-fill-color) 0%,
    var(--slider-fill-color) var(--volume-percent),
    var(--slider-track-hover) var(--volume-percent),
    var(--slider-track-hover) 100%
  );
  border-color: rgba(255, 255, 255, 0.10);
}

.settings-range:active {
  height: 8px;
  background: linear-gradient(
    to right,
    var(--slider-fill-active) 0%,
    var(--slider-fill-active) var(--volume-percent),
    var(--slider-track-hover) var(--volume-percent),
    var(--slider-track-hover) 100%
  );
}

/* Thumb (manija) estilo Apple / macOS / Linear - Precisión artesanal */
.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  cursor: grab;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 1px rgba(0, 0, 0, 0.5);
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.14s ease;
}

.settings-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 0 1px rgba(0, 0, 0, 0.6);
}

.settings-range:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(10, 132, 255, 0.28);
}

.settings-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(10, 132, 255, 0.35);
}

/* Soporte Firefox */
.settings-range::-moz-range-track {
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    var(--slider-fill-color) 0%,
    var(--slider-fill-color) var(--volume-percent),
    var(--slider-track-bg) var(--volume-percent),
    var(--slider-track-bg) 100%
  );
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.settings-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  cursor: grab;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 0.14s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.14s ease;
}

.settings-range:active::-moz-range-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(10, 132, 255, 0.28);
}

/* Badge de porcentaje / valor con fuente monoespaciada tabular */
.settings-value-badge {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.52rem;
  border-radius: 6px;
  background: rgba(10, 132, 255, 0.10);
  color: #3b9eff;
  border: 1px solid rgba(10, 132, 255, 0.22);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  min-width: 40px;
  text-align: center;
  transition: all 0.18s ease;
  user-select: none;
  flex-shrink: 0;
}

.settings-value-badge.is-zero {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.08);
}

.sound-picker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 1rem;
}

.sound-picker-row:last-child {
  border-bottom: none;
}

.sound-picker-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.sound-picker-title {
  font-size: 0.84rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

.sound-picker-desc {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.35;
}

.sound-picker-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.settings-select-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  min-width: 175px;
}

/* ==========================================================================
   Modos de Chat (Buscar, Pensar, Canvas) y Componentes de Inferencia
   ========================================================================== */

/* Badges de Modo en Burbujas de Mensaje */
.message-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  width: fit-content;
  user-select: none;
}

.message-mode-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-mode-badge.mode-search {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.message-mode-badge.mode-think {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.message-mode-badge.mode-canvas {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

/* Modo Pensar: Acordeón de Razonamiento */
.thought-accordion {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 9px;
  margin: 6px 0 12px 0;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.thought-accordion:hover {
  border-color: rgba(168, 85, 247, 0.25);
}

.thought-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  color: rgba(243, 247, 249, 0.72);
  background: rgba(255, 255, 255, 0.02);
  transition: color 0.15s ease, background 0.15s ease;
}

.thought-header:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.045);
}

.thought-summary-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
}

.thought-icon {
  color: #c084fc;
  flex-shrink: 0;
}

.thought-chevron {
  color: rgba(255, 255, 255, 0.45);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

details.thought-accordion[open] .thought-chevron {
  transform: rotate(180deg);
}

.thought-content {
  padding: 10px 14px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(243, 247, 249, 0.65);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}

.thought-accordion.is-thinking {
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.03);
}

.thought-pulse {
  animation: thoughtPulseAnim 1.4s ease-in-out infinite;
}

@keyframes thoughtPulseAnim {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 4px #c084fc); }
}

/* Modo Buscar: Callout Pill y Fuentes */
.search-callout-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  font-size: 0.8rem;
  color: rgba(243, 247, 249, 0.9);
  margin-bottom: 10px;
  width: fit-content;
  max-width: 100%;
}

.search-callout-icon {
  color: #38bdf8;
  display: inline-flex;
  flex-shrink: 0;
}

.search-callout-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-callout-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  padding: 1.5px 6px;
  border-radius: 4px;
  margin-left: 6px;
  flex-shrink: 0;
}

/* --- Voz de lectura (Texto a voz / TTS) --- */
.voice-select-row {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
}

.voice-select-row .settings-select {
  flex: 1;
}

.btn-voice-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.52rem 0.95rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-voice-preview:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-voice-preview.is-speaking,
#btnPreviewThinkingAudio.is-speaking {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  animation: pulse-speaking 1.5s ease-in-out infinite;
}

.btn-voice-preview.is-speaking .preview-speak-icon {
  display: none !important;
}

.btn-voice-preview.is-speaking .preview-stop-icon {
  display: inline-block !important;
  color: #38bdf8;
}

/* Floating TTS Selection Pill */
.floating-tts-pill {
  position: fixed;
  z-index: 9999;
  display: none;
  animation: fadeInTtsPill 0.16s ease forwards;
}

@keyframes fadeInTtsPill {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.btn-tts-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: rgba(18, 24, 32, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: #f3f7f9;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.btn-tts-pill:hover {
  background: rgba(28, 36, 48, 0.98);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  transform: scale(1.03);
}

.btn-tts-pill.is-speaking {
  background: rgba(14, 40, 58, 0.96);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* --- Header TTS Indicator (Sin fondo / sin píldora: solo ondas, texto y botón puros) --- */
.header-tts-status {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: 0 !important;
  color: #e2f1fd;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: default;
  z-index: 60;
  pointer-events: auto;
  user-select: none;
  white-space: nowrap;
}

.header-tts-status:hover {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.header-tts-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.header-wave-bar {
  width: 2.5px;
  height: 100%;
  border-radius: 3px;
  background: #38bdf8;
  animation: header-wave-bar 1.1s ease-in-out infinite alternate;
  transform-origin: center;
}

.header-wave-bar.bar-1 { animation-delay: 0.0s; height: 35%; }
.header-wave-bar.bar-2 { animation-delay: 0.22s; height: 75%; }
.header-wave-bar.bar-3 { animation-delay: 0.45s; height: 100%; }
.header-wave-bar.bar-4 { animation-delay: 0.18s; height: 60%; }
.header-wave-bar.bar-5 { animation-delay: 0.35s; height: 40%; }

@keyframes header-wave-bar {
  0% {
    transform: scaleY(0.25);
    opacity: 0.55;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
  100% {
    transform: scaleY(0.35);
    opacity: 0.7;
  }
}

.header-tts-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(243, 247, 249, 0.85);
  letter-spacing: -0.01em;
}

.header-tts-timer {
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  color: #38bdf8;
  min-width: 34px;
}

.header-tts-stop-btn {
  background: transparent !important;
  border: none !important;
  color: rgba(243, 247, 249, 0.75);
  cursor: pointer;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, transform 0.15s ease;
}

.header-tts-stop-btn:hover {
  background: transparent !important;
  color: #ef4444 !important;
  transform: scale(1.18);
}

@media (max-width: 580px) {
  .header-tts-label {
    display: none;
  }
  .header-tts-status {
    gap: 0.55rem;
  }
}
