/* ==========================================================================
   SURU (página de Joaquín, "TrueFrame", adaptada)
   Paleta: azules (navy, cobalto, cian, celestes)

   [SURU] Qué cambió respecto al CSS de Joaquín (todo marcado con "SURU:"):
     1. Los colores de marca ahora son los del logo nuevo (#04336B, #0351A6, #0970CF, #2AADFC).
        Se conservaron los nombres de los tokens para no tocar el resto.
     2. Se quitó lo que ya no existe: la lista "Your images" (.queue, .file-item, .file-result)
        y la píldora "Likely AI / Likely real" (.verdict), porque ahora se muestra un puntaje.
     3. Se agregó lo nuevo: login, chat, resultado, mapas de calor, JSON, diálogos.
   Lo demás (base, hero, zona de carga con esquinas, botones, miniaturas, pie) es el de Joaquín.
   ========================================================================== */

/* ===== Design tokens ===== */
:root {
  /* SURU: colores del logo nuevo (muestreados del logo del 15-sep-2026, a ratificar por Cris) */
  --navy-900: #04336b;
  --navy-700: #0b4585;
  --cobalt-600: #0351a6;
  --cobalt-500: #0970cf;
  --cyan-500: #2aadfc;
  --sky-300: #9db9e3;
  --sky-200: #cfe0f8;
  --sky-100: #e3eefc;
  --ice-50: #f3f8fe;
  --white: #ffffff;
  --muted: #47618a;
  --error: #b42318;
  /* SURU: color de la banda "no concluyente" */
  --amber: #b97a00;
  --amber-bg: #fff4d6;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 10px;

  /* SURU: alto del header (el chat ocupa el resto de la pantalla) */
  --header-h: 68px;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ice-50);
  color: var(--navy-900);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

.container {
  width: min(100% - 40px, 960px);
  margin-inline: auto;
}

/* SURU: contenedor ancho para el header y el chat */
.container-wide {
  width: min(100% - 32px, 1280px);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Header ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--sky-200);
}

.site-header .container-wide {
  min-height: var(--header-h);
  padding-block: 12px;
}

/* SURU: el header lleva el logo a la izquierda y el menú de la cuenta a la derecha */
.header-fila {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: inline-block;
  border-radius: 6px;
}

.logo {
  height: 40px;
  width: auto;
}

.logo-link:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 4px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--navy-900);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--sky-100);
}

.icon-btn:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

/* ===== Hero: texto + zona de carga ===== */
main {
  flex: 1;
}

.hero {
  display: grid;
  gap: 32px;
  align-items: center;
  padding-block: 44px 36px;
}

.thread {
  container-type: inline-size;
}

@container (min-width: 760px) {
  .hero {
    grid-template-columns: 1fr 1.2fr;
    gap: 56px;
    padding-block: 56px 40px;
  }
}

.intro h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 1rem + 4vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--navy-900);
}

.intro p {
  margin: 0;
  max-width: 44ch;
  font-size: 1.125rem;
  color: var(--muted);
}

/* ===== Zona de carga (visor) ===== */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 300px;
  padding: 40px 28px;
  background: var(--white);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Los hijos no capturan eventos: evita parpadeos al arrastrar sobre ellos */
.dropzone * {
  pointer-events: none;
}

.dropzone:hover {
  border-color: var(--sky-300);
}

/* SURU: la zona ya no envuelve al input (es un div con role=button), así que el foco va sobre ella */
.dropzone:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 4px;
}

.dropzone.is-dragover {
  background: var(--sky-100);
  border-color: var(--cobalt-500);
}

/* Esquinas del visor */
.corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 0 solid var(--cobalt-600);
  transition: transform 0.2s ease;
}

.corner-tl {
  top: 16px;
  left: 16px;
  border-top-width: 3px;
  border-left-width: 3px;
  border-top-left-radius: 8px;
}

.corner-tr {
  top: 16px;
  right: 16px;
  border-top-width: 3px;
  border-right-width: 3px;
  border-top-right-radius: 8px;
}

.corner-br {
  bottom: 16px;
  right: 16px;
  border-bottom-width: 3px;
  border-right-width: 3px;
  border-bottom-right-radius: 8px;
}

.corner-bl {
  bottom: 16px;
  left: 16px;
  border-bottom-width: 3px;
  border-left-width: 3px;
  border-bottom-left-radius: 8px;
}

/* Al arrastrar, las esquinas se cierran hacia el centro */
.dropzone.is-dragover .corner-tl { transform: translate(8px, 8px); }
.dropzone.is-dragover .corner-tr { transform: translate(-8px, 8px); }
.dropzone.is-dragover .corner-br { transform: translate(-8px, -8px); }
.dropzone.is-dragover .corner-bl { transform: translate(8px, -8px); }

.dropzone-icon {
  margin-bottom: 8px;
  color: var(--cobalt-600);
}

.dropzone-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--navy-900);
}

.dropzone-sub {
  color: var(--muted);
}

.dropzone-link {
  color: var(--cobalt-600);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hint {
  margin: 12px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.message {
  min-height: 1.5em;
  margin: 4px 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.message.is-error {
  color: var(--error);
}

.demo-note {
  margin: 12px 0 0;
  padding: 8px 12px;
  background: var(--sky-100);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--navy-700);
}

/* ===== Miniatura + línea de escaneo (Joaquín) ===== */
.thumb {
  position: relative;
  width: 64px;
  height: 64px;
  flex: none;
  overflow: hidden;
  background: var(--sky-100);
  border-radius: var(--radius-md);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-name {
  margin: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Barra de progreso / puntaje (Joaquín) */
.meter {
  width: 100%;
  height: 6px;
  overflow: hidden;
  background: var(--sky-100);
  border-radius: 3px;
}

.meter-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--cobalt-600);
  transition: width 0.6s ease;
}

/* Botón para quitar una foto */
.remove-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.remove-btn:hover:not(:disabled) {
  background: var(--sky-100);
  color: var(--navy-900);
}

.remove-btn:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

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

/* ===== Botones ===== */
.btn {
  padding: 12px 22px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--cobalt-600);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--cobalt-500);
}

.btn-secondary {
  background: transparent;
  border-color: var(--sky-300);
  color: var(--navy-700);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--sky-100);
}

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

.btn-primary:disabled {
  background: var(--sky-200);
  color: var(--muted);
}

.btn-secondary:disabled {
  opacity: 0.5;
}

/* SURU: variantes de botón */
.btn-chico {
  padding: 7px 14px;
  font-size: 0.875rem;
  white-space: nowrap;
}

.btn-ancho {
  width: 100%;
}

.btn-peligro {
  border-color: #e7b4ae;
  color: var(--error);
}

.btn-peligro:hover:not(:disabled) {
  background: #fdeceb;
}

/* ===== Footer ===== */
.site-footer {
  padding-block: 24px 32px;
  border-top: 1px solid var(--sky-200);
  font-size: 0.875rem;
  color: var(--muted);
}

/* SURU: dentro del chat el aviso va en el composer, así que el pie solo se ve fuera de sesión */
body:not(.sin-sesion) .site-footer {
  display: none;
}

/* ==========================================================================
   SURU: login
   ========================================================================== */
.login-card {
  max-width: 460px;
  margin: 56px auto;
  padding: 32px 28px;
  background: var(--white);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-lg);
}

.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.15;
}

.login-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.campo {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
}

.entrada {
  display: block;
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--white);
  border: 1.5px solid var(--sky-300);
  border-radius: var(--radius-sm);
  color: var(--navy-900);
  font: inherit;
}

.entrada:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

#login-form .btn {
  width: 100%;
}

/* ==========================================================================
   SURU: estructura del chat (lista de chats | hilo + composer)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100dvh - var(--header-h) - 1px);
  width: min(100%, 1280px);
  margin-inline: auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 16px 16px 12px;
  overflow: hidden;
  background: var(--white);
  border-right: 1px solid var(--sky-200);
}

.sidebar-titulo {
  margin: 16px 0 4px;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.chat-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.chat-item {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.chat-item:hover,
.chat-item.is-active {
  background: var(--sky-100);
}

.chat-item.is-active .chat-open {
  font-weight: 600;
}

.chat-open {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--navy-900);
  font-size: 0.9375rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.chat-open:focus-visible,
.chat-del:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: -2px;
}

.chat-del {
  width: 32px;
  height: 32px;
  margin-right: 4px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.chat-item:hover .chat-del,
.chat-item:focus-within .chat-del,
.chat-item.is-active .chat-del {
  opacity: 1;
}

.chat-del:hover {
  background: var(--sky-200);
  color: var(--navy-900);
}

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.chat.is-dragover {
  background: var(--sky-100);
}

.thread {
  flex: 1;
  min-height: 0;
  padding: 0 24px;
  overflow-y: auto;
}

.thread .hero {
  max-width: 960px;
  margin-inline: auto;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 820px;
  margin-inline: auto;
  padding-block: 24px;
}

/* Mensajes */
.msg {
  display: flex;
}

.msg-usuario {
  justify-content: flex-end;
}

.globo {
  min-width: 0;
  max-width: min(100%, 720px);
}

.msg-usuario .globo {
  padding: 10px 14px;
  background: var(--sky-100);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

.msg-suru .globo {
  width: 100%;
}

.msg-autor {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.msg-texto {
  margin: 0 0 6px;
}

.msg-texto.is-error {
  color: var(--error);
}

.foto-msg {
  display: flex;
  align-items: center;
  gap: 12px;
}

.foto-msg img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.foto-msg-vacia::before {
  content: "";
  width: 48px;
  height: 48px;
  background: var(--sky-200);
  border-radius: var(--radius-md);
}

.foto-meta {
  min-width: 0;
}

/* "Analizando…" con tres puntos y una línea de escaneo */
.analizando {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-md);
  color: var(--muted);
}

.punto {
  width: 8px;
  height: 8px;
  background: var(--cyan-500);
  border-radius: 50%;
  animation: latido 1.1s ease-in-out infinite;
}

.punto:nth-child(2) { animation-delay: 0.15s; }
.punto:nth-child(3) { animation-delay: 0.3s; }

@keyframes latido {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.analizando-texto {
  margin-left: 6px;
  font-size: 0.9375rem;
}

/* ==========================================================================
   SURU: tarjeta de resultado
   ========================================================================== */
.resultado {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-lg);
}

.res-cabecera {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
}

.gauge {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border: 6px solid var(--sky-200);
  border-radius: 50%;
}

.gauge-valor {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.gauge-de {
  font-size: 0.6875rem;
  color: var(--muted);
}

/* Colores por banda: baja = cian, no concluyente = ámbar, alta = azul marino */
.banda-baja .gauge { border-color: var(--cyan-500); }
.banda-media .gauge { border-color: var(--amber); }
.banda-alta .gauge { border-color: var(--navy-900); }

.meter-banda.banda-baja .meter-fill { background: var(--cyan-500); }
.meter-banda.banda-media .meter-fill { background: var(--amber); }
.meter-banda.banda-alta .meter-fill { background: var(--navy-900); }

.res-etiqueta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.res-banda {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.375rem;
  line-height: 1.2;
}

.res-sub {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.frases {
  margin: 0;
  padding-left: 20px;
}

.frases li {
  margin-bottom: 4px;
}

.bloque {
  padding-top: 16px;
  border-top: 1px solid var(--sky-200);
}

.bloque-titulo {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.0625rem;
}

.bloque-nota {
  margin: 0 0 10px;
  font-size: 0.875rem;
  color: var(--muted);
}

details.bloque > summary {
  font-weight: 600;
  cursor: pointer;
}

/* Chips: advertencias y etiquetas descriptivas */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 4px 12px;
  background: var(--sky-100);
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--navy-700);
}

.chip-aviso {
  background: var(--amber-bg);
  color: var(--amber);
}

.chip-marca {
  box-shadow: inset 0 0 0 1px var(--sky-300);
}

/* Visor de mapas de calor */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tab {
  padding: 6px 14px;
  background: transparent;
  border: 1.5px solid var(--sky-300);
  border-radius: 999px;
  color: var(--navy-700);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.tab:hover {
  background: var(--sky-100);
}

.tab[aria-selected="true"] {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: var(--white);
}

.tab:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

.mapa-canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  background: var(--navy-900);
  border-radius: var(--radius-md);
}

.mapa-info {
  margin: 8px 0 4px;
  font-size: 0.875rem;
  color: var(--muted);
}

.mapa-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--muted);
}

.mapa-control input {
  width: 160px;
  accent-color: var(--cobalt-600);
}

/* Ramas del modelo */
.ramas,
.niveles {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rama-fila {
  display: grid;
  gap: 6px;
}

.rama-nombre {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.rama-detalle {
  font-size: 0.8125rem;
  color: var(--muted);
}

.meter-rama {
  height: 8px;
}

.rama-numeros {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.voto {
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 600;
}

.voto-falso {
  background: var(--navy-900);
  color: var(--white);
}

.voto-real {
  background: var(--sky-100);
  color: var(--navy-700);
}

.nivel-fila {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 90px;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
}

.nivel-valor {
  color: var(--muted);
  text-align: right;
}

.datos {
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: 0.9375rem;
}

/* JSON */
details.json {
  padding-top: 16px;
  border-top: 1px solid var(--sky-200);
}

details.json > summary {
  font-weight: 600;
  cursor: pointer;
}

.json-pre {
  max-height: 340px;
  margin: 10px 0;
  padding: 14px;
  overflow: auto;
  background: var(--navy-900);
  border-radius: var(--radius-md);
  color: #d6e6ff;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.json-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Respuestas rápidas (botones tipo ChatGPT) */
.rapidas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rapida {
  padding: 8px 14px;
  background: var(--white);
  border: 1.5px solid var(--sky-300);
  border-radius: 999px;
  color: var(--cobalt-600);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.rapida:hover {
  background: var(--sky-100);
}

.rapida:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

/* SURU: aviso de estado del servicio (js/estado.js) */
.aviso-estado {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0;
  padding: 10px 16px;
  text-align: center;
  font-size: 0.9375rem;
  font-weight: 600;
  border-bottom: 1px solid transparent;
}

.aviso-degradado {
  background: #fff4d6;
  color: #6b4a00;
  border-color: #f0d68a;
}

.aviso-mantenimiento,
.aviso-falla {
  background: #fde8e8;
  color: #7a1c1c;
  border-color: #f0b4b4;
}

/* SURU: pregunta escrita bajo el resultado (chat de explicación) */
.pregunta-caja {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pregunta {
  display: flex;
  gap: 8px;
}

.pregunta-entrada {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--white);
  border: 1.5px solid var(--sky-300);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9375rem;
}

.pregunta-entrada:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

.pregunta-nota {
  margin: 0;
}

.hint-recomendado {
  max-width: 560px;
  margin-inline: auto;
}

/* ==========================================================================
   SURU: barra inferior (fotos por enviar + botones)
   ========================================================================== */
.composer {
  padding: 10px 24px 14px;
  background: var(--white);
  border-top: 1px solid var(--sky-200);
}

.composer > * {
  max-width: 820px;
  margin-inline: auto;
}

.composer .message {
  min-height: 0;
  margin-block: 0 4px;
}

.composer .message:empty {
  display: none;
}

.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 0 8px;
  padding: 0;
  list-style: none;
}

.tray-item {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
  padding: 6px 4px 6px 6px;
  background: var(--ice-50);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-md);
}

.tray-item .thumb {
  width: 44px;
  height: 44px;
}

.tray-item .file-meta {
  min-width: 0;
}

.composer-fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.composer-guia {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Cuando hay fotos en la bandeja, el costo y el botón se van a la derecha */
.costo {
  margin-left: auto;
}

.chat-note {
  margin-block: 8px 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.chat-note.is-warn {
  color: var(--amber);
}

/* ==========================================================================
   SURU: diálogos (consentimiento y "Mis datos")
   ========================================================================== */
dialog {
  width: min(100% - 32px, 560px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-lg);
  color: var(--navy-900);
}

dialog::backdrop {
  background: rgba(4, 51, 107, 0.45);
}

.dlg-cuerpo {
  padding: 24px;
}

.dlg-cuerpo h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
}

.dlg-lista {
  margin: 0 0 14px;
  padding-left: 20px;
  font-size: 0.9375rem;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.checks label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;
  cursor: pointer;
}

.checks input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--cobalt-600);
}

.dlg-botones {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.dlg-botones-col {
  flex-direction: column;
}

.datos-linea {
  margin: 4px 0;
}

/* ===== Responsive ===== */
.solo-movil {
  display: none;
}

@media (max-width: 859px) {
  .solo-movil {
    display: grid;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
  }

  /* La lista de chats se abre encima del chat con el botón de arriba */
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 5;
    width: min(86%, 320px);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 24px rgba(4, 51, 107, 0.2);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .thread {
    padding-inline: 14px;
  }

  .composer {
    padding-inline: 14px;
  }

}

@media (max-width: 639px) {
  .logo {
    height: 30px;
  }

  .composer-guia {
    display: none;
  }

  .composer-fila {
    flex-wrap: wrap;
  }

  .composer-fila .btn-primary {
    margin-left: auto;
  }

  .res-cabecera {
    flex-direction: column;
    align-items: flex-start;
  }

  .nivel-fila {
    grid-template-columns: 56px minmax(0, 1fr) 80px;
  }

  .dlg-botones {
    flex-direction: column-reverse;
  }

  .btn {
    width: auto;
  }
}

/* ===== Accesibilidad: menos movimiento ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

/* ==========================================================================
   SURU: la cuenta (abajo a la izquierda, como en Claude) y sus menús
   ========================================================================== */
.usuario {
  flex: none;
  padding-top: 10px;
  border-top: 1px solid var(--sky-200);
}

.usuario-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--navy-900);
  text-align: left;
  cursor: pointer;
}

.usuario-btn:hover,
.usuario-btn[aria-expanded="true"] {
  background: var(--sky-100);
}

.usuario-btn:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--navy-900);
  border-radius: 50%;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
}

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

.usuario-nombre {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usuario-plan {
  font-size: 0.8125rem;
  color: var(--muted);
}

.usuario-flecha {
  flex: none;
  color: var(--muted);
}

/* Los menús son "fixed": la barra lateral recorta lo que se sale de ella (cuenta.js los ubica junto a su botón) */
.menu {
  position: fixed;
  z-index: 40;
  min-width: 240px;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--sky-200);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 28px rgba(4, 51, 107, 0.18);
}

.submenu {
  min-width: 260px;
}

.menu-correo {
  margin: 0;
  padding: 8px 10px 6px;
  overflow: hidden;
  font-size: 0.8125rem;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-sep {
  margin: 6px 0;
  border: 0;
  border-top: 1px solid var(--sky-200);
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--navy-900);
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible,
.menu-item[aria-expanded="true"] {
  background: var(--sky-100);
  outline: none;
}

.menu-flecha {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
}

kbd {
  padding: 1px 7px;
  background: var(--ice-50);
  border: 1px solid var(--sky-200);
  border-radius: 6px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
}

/* ==========================================================================
   SURU: tipo de imagen (botones bajo la zona de carga)
   ========================================================================== */
.tipos {
  margin-top: 18px;
}

.tipos-titulo {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 0.9375rem;
}

.tipos-opcional {
  font-weight: 400;
  color: var(--muted);
}

.tipos-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tipo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--white);
  border: 1.5px solid var(--sky-300);
  border-radius: 999px;
  color: var(--navy-700);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.tipo-chip:hover:not([aria-disabled="true"]) {
  background: var(--sky-100);
}

.tipo-chip[aria-checked="true"] {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: var(--white);
}

.tipo-chip:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

.tipo-pronto {
  border-style: dashed;
  color: var(--muted);
  cursor: help;
}

.tipo-etiqueta {
  padding: 0 7px;
  background: var(--sky-100);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--navy-700);
}

.tipos-nota {
  margin: 10px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.tipo-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.tipo-select select {
  max-width: 170px;
  padding: 9px 10px;
  background: var(--white);
  border: 1.5px solid var(--sky-300);
  border-radius: var(--radius-sm);
  color: var(--navy-900);
  font: inherit;
}

.nota-tipo {
  margin-top: 8px;
  color: var(--navy-700);
}

/* ==========================================================================
   SURU: costo junto al botón Analizar (como el "1 min · 20 · Generar" de Meshy)
   ========================================================================== */
.costo {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.costo.is-warn {
  color: var(--error);
}

.btn-analizar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   SURU: Configuración (ventana con secciones), Uso, Planes, Ayuda
   ========================================================================== */
.dlg-ancho {
  width: min(100% - 32px, 860px);
}

.config {
  position: relative;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: min(560px, calc(100dvh - 64px));
}

.config-nav {
  padding: 20px 12px;
  background: var(--ice-50);
  border-right: 1px solid var(--sky-200);
}

.config-titulo {
  margin: 0 8px 12px;
  font-family: var(--font-display);
  font-size: 1.125rem;
}

.config-lista {
  margin: 0;
  padding: 0;
  list-style: none;
}

.config-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--navy-900);
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.config-item:hover {
  background: var(--sky-100);
}

.config-item[aria-current="true"] {
  background: var(--sky-200);
  font-weight: 600;
}

.config-item:focus-visible {
  outline: 3px solid var(--cobalt-500);
  outline-offset: -2px;
}

.config-panel {
  padding: 28px 32px;
  overflow-y: auto;
  max-height: calc(100dvh - 64px);
}

.config-panel:focus {
  outline: none;
}

.config-cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
}

.panel-subtitulo {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.2;
}

h4.panel-subtitulo {
  margin-top: 24px;
  font-size: 1rem;
}

.ajuste {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--sky-200);
}

.ajuste-texto {
  min-width: 0;
}

.ajuste-titulo {
  margin: 0;
  font-weight: 600;
}

.ajuste-sub {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.ajuste-valor {
  margin: 0;
  color: var(--navy-700);
}

.entrada-corta {
  width: auto;
  min-width: 150px;
  margin: 0;
}

/* Interruptor (checkbox con aspecto de interruptor) */
.interruptor {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  cursor: pointer;
}

.interruptor input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.interruptor-pista {
  position: absolute;
  inset: 0;
  background: var(--sky-300);
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

.interruptor-pista::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.interruptor input:checked + .interruptor-pista {
  background: var(--cobalt-600);
}

.interruptor input:checked + .interruptor-pista::after {
  transform: translateX(18px);
}

.interruptor input:focus-visible + .interruptor-pista {
  outline: 3px solid var(--cobalt-500);
  outline-offset: 2px;
}

.interruptor input:disabled + .interruptor-pista {
  opacity: 0.5;
}

/* Uso */
.uso-resumen {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.uso-fila {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 1.4fr) 84px;
  align-items: center;
  gap: 8px 20px;
  padding: 14px 0;
  border-top: 1px solid var(--sky-200);
  border-bottom: 1px solid var(--sky-200);
}

.meter-uso {
  height: 10px;
}

.uso-pct {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: right;
}

/* Planes */
.planes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.plan {
  position: relative;
  padding: 18px;
  border: 1.5px solid var(--sky-200);
  border-radius: var(--radius-md);
}

.plan-actual {
  border-color: var(--cobalt-600);
}

.plan-nombre {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.plan-precio {
  margin: 2px 0 10px;
  color: var(--muted);
}

.plan-etiqueta {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 10px;
  background: var(--cobalt-600);
  border-radius: 999px;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
}

.plan-lista {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9375rem;
}

/* Ayuda, registro de cambios, atajos */
.ayuda-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--sky-200);
}

.ayuda-item summary {
  font-weight: 600;
  cursor: pointer;
}

.ayuda-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.cambio h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.atajos {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 24px;
  margin: 0;
}

.atajos dt {
  margin: 0;
}

.atajos dd {
  margin: 0;
  text-align: right;
}

/* Aviso corto (por ejemplo, "esa página aún no está publicada") */
.aviso {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: min(92%, 460px);
  margin: 0;
  padding: 10px 16px;
  background: var(--navy-900);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 0.9375rem;
  transform: translateX(-50%);
  box-shadow: 0 6px 22px rgba(4, 51, 107, 0.3);
}

@media (max-width: 639px) {
  .config {
    grid-template-columns: minmax(0, 1fr);
  }

  .config-nav {
    padding: 12px 10px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--sky-200);
  }

  .config-lista {
    display: flex;
    gap: 4px;
    overflow-x: auto;
  }

  .config-item {
    white-space: nowrap;
  }

  .config-panel {
    padding: 18px 16px;
    max-height: calc(100dvh - 180px);
  }

  .uso-fila {
    grid-template-columns: minmax(0, 1fr);
  }

  .uso-pct {
    text-align: left;
  }

  .tipo-select span {
    display: none;
  }

  .costo {
    order: 5;
    flex-basis: 100%;
    white-space: normal;
  }
}

/* ==========================================================================
   SURU: buscador de chats y fecha de cada chat (como en Claude)
   ========================================================================== */
.buscador {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--ice-50);
  border: 1.5px solid var(--sky-200);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.buscador:focus-within {
  border-color: var(--cobalt-500);
}

.buscador input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  background: transparent;
  border: 0;
  color: var(--navy-900);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
}

.buscador input::-webkit-search-cancel-button {
  cursor: pointer;
}

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

.chat-titulo {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-fecha {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}
