/* ==========================================================================
   Asistente — hoja de estilos

   Oscuro, calido y con brillo: negro con fondo de ciruela, un degradado
   rosa-ambar como unico acento, y superficies de cristal que dejan pasar la
   luz de detras. Formas redondeadas y generosas. El recuadro para pegar
   siempre esta a la vista: nunca hay que buscarlo.
   ========================================================================== */

:root {
  --bg: #0d080f;
  --bg-2: #150d17;

  /* Cristal: superficies que se apoyan en el fondo, no cajas opacas. */
  --vidrio: rgba(255, 255, 255, 0.045);
  --vidrio-alto: rgba(255, 255, 255, 0.075);
  --borde: rgba(255, 255, 255, 0.09);
  --borde-alto: rgba(255, 255, 255, 0.17);

  --text: #fbf3f6;
  --muted: #b7a3ae;
  --faint: #7d6c77;

  /* El acento es un degradado; --accent es su punto medio, para bordes y texto. */
  --a1: #ff5f8f;
  --a2: #ff9e5e;
  --accent: #ff7a7c;
  --accent-ink: #1a0710;
  --grad: linear-gradient(135deg, var(--a1), var(--a2));
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 38%, transparent);

  --ok: #66d8a8;
  --danger: #ff6b78;
  --danger-soft: color-mix(in srgb, var(--danger) 15%, transparent);
  --warn: #ffb35e;

  --r: 18px;
  --r-lg: 26px;

  --sombra: 0 8px 30px -10px rgba(0, 0, 0, 0.7);
  --brillo: 0 0 28px -6px color-mix(in srgb, var(--a1) 55%, transparent);

  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf6f8;
    --bg-2: #ffffff;
    --vidrio: rgba(20, 8, 16, 0.035);
    --vidrio-alto: rgba(20, 8, 16, 0.06);
    --borde: rgba(20, 8, 16, 0.1);
    --borde-alto: rgba(20, 8, 16, 0.2);
    --text: #1d1017;
    --muted: #6a5560;
    --faint: #94808c;
    --a1: #e63c६f;
    --a1: #e03c6f;
    --a2: #e07a3c;
    --accent: #d8455f;
    --accent-ink: #ffffff;
    --ok: #1c8f63;
    --danger: #ce3b46;
    --sombra: 0 8px 26px -12px rgba(60, 20, 40, 0.35);
    --brillo: 0 0 24px -8px color-mix(in srgb, var(--a1) 40%, transparent);
  }
}

:root[data-theme="light"] {
  --bg: #faf6f8;
  --bg-2: #ffffff;
  --vidrio: rgba(20, 8, 16, 0.035);
  --vidrio-alto: rgba(20, 8, 16, 0.06);
  --borde: rgba(20, 8, 16, 0.1);
  --borde-alto: rgba(20, 8, 16, 0.2);
  --text: #1d1017;
  --muted: #6a5560;
  --faint: #94808c;
  --a1: #e03c6f;
  --a2: #e07a3c;
  --accent: #d8455f;
  --accent-ink: #ffffff;
  --ok: #1c8f63;
  --danger: #ce3b46;
  --sombra: 0 8px 26px -12px rgba(60, 20, 40, 0.35);
  --brillo: 0 0 24px -8px color-mix(in srgb, var(--a1) 40%, transparent);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

/* Luz de fondo: dos manchas suaves que tinen el negro sin llamar la atencion. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 42% at 12% -4%, color-mix(in srgb, var(--a1) 20%, transparent), transparent 66%),
    radial-gradient(52% 38% at 92% 6%, color-mix(in srgb, var(--a2) 15%, transparent), transparent 68%);
}

a { color: var(--accent); text-underline-offset: 3px; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.hidden { display: none !important; }

/* -------------------------------------------------------------- estructura */

body.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--borde);
}

.marca { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo { flex: none; width: 30px; height: 30px; filter: drop-shadow(var(--brillo)); }
.logo.grande { width: 56px; height: 56px; margin-bottom: 22px; }

header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

header nav { display: flex; align-items: center; gap: 3px; flex: none; }

header nav a,
header nav button {
  appearance: none;
  background: none;
  border: none;
  padding: 7px 11px;
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
header nav a:hover, header nav button:hover { background: var(--vidrio-alto); color: var(--text); }

.vista,
.wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 20px 18px 130px;
}

/* ------------------------------------------------------------------ estado */

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 20px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.dot.on { background: var(--ok); box-shadow: 0 0 12px -1px var(--ok); }
.dot.off { background: var(--danger); box-shadow: 0 0 12px -1px var(--danger); }

.spinner {
  width: 13px; height: 13px; flex: none;
  background: transparent;
  border: 2px solid var(--borde-alto);
  border-top-color: var(--accent);
  border-radius: 50%;
  box-shadow: none;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------- bloque de entrada */

.bloque-entrada {
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--vidrio);
  border: 1px solid var(--borde);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.rotulo {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

textarea, select, input {
  width: 100%;
  font-family: inherit;
  font-size: 16.5px;
  color: var(--text);
  background: var(--vidrio-alto);
  border: 1px solid var(--borde);
  border-radius: var(--r);
  padding: 14px 16px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea {
  display: block;
  min-height: 118px;
  resize: vertical;
  line-height: 1.5;
}
textarea::placeholder { color: var(--faint); }
textarea:focus, select:focus, input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
select { cursor: pointer; padding: 12px 14px; font-size: 15px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- botones */

button.primary,
button.secundario {
  appearance: none;
  width: 100%;
  padding: 16px 22px;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.14s var(--ease), filter 0.18s var(--ease),
    box-shadow 0.18s var(--ease), background-color 0.18s var(--ease);
}

button.primary {
  color: var(--accent-ink);
  background: var(--grad);
  border: none;
  box-shadow: var(--brillo);
}
button.primary:hover:not(:disabled) { filter: brightness(1.07); }
button.primary:active:not(:disabled) { transform: scale(0.985); }
button.primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

button.secundario {
  color: var(--text);
  background: var(--vidrio-alto);
  border: 1px solid var(--borde-alto);
}
button.secundario:hover { background: var(--vidrio); border-color: var(--accent-line); }
button.secundario:active { transform: scale(0.985); }

button.chico { width: auto; padding: 11px 18px; font-size: 14px; }

button.enlace {
  padding: 0;
  width: auto;
  font: inherit;
  font-size: 13.5px;
  color: var(--faint);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.enlace:hover { color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

/* --------------------------------------------------------------- opciones */

.opciones { margin-top: 16px; }

.opciones > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--faint);
  cursor: pointer;
  list-style: none;
}
.opciones > summary::-webkit-details-marker { display: none; }
.opciones > summary::after {
  content: "";
  margin-left: auto;
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s var(--ease);
}
.opciones[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.opciones > summary:hover { color: var(--text); }

.opcion { padding: 14px 0; border-top: 1px solid var(--borde); }
.opcion-nombre {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--faint);
}

.marca-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  color: var(--muted);
  cursor: pointer;
}
.marca-check input { width: auto; padding: 0; }

/* ------------------------------------------------------------ lo que dice */

.dijo { margin: 30px 0 8px; }

.translation {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.original {
  margin-top: 11px;
  font-size: 13px;
  color: var(--faint);
  overflow-wrap: anywhere;
}

.motivo { margin-top: 11px; font-size: 13px; color: var(--muted); }

/* -------------------------------------------------------------- respuestas */

.reply {
  position: relative;
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--vidrio);
  border: 1px solid var(--borde);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  overflow: hidden;
  animation: subir 0.36s var(--ease) both;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.reply::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--grad);
}
.reply:nth-child(2) { animation-delay: 0.07s; }
.reply:nth-child(3) { animation-delay: 0.14s; }

@media (hover: hover) {
  .reply:hover {
    border-color: var(--accent-line);
    transform: translateY(-2px);
    box-shadow: var(--sombra);
  }
}
.reply:active { transform: scale(0.995); }

@keyframes subir {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.reply .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.reply .num {
  margin-right: 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--faint);
}

.reply .en {
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.reply .es {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--borde);
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.reply button.copy {
  flex: none;
  width: auto;
  padding: 9px 17px;
  font: inherit;
  font-size: 13px;
  font-weight: 640;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.reply button.copy:hover {
  color: var(--accent-ink);
  background: var(--grad);
  border-color: transparent;
}
.reply button.copy.done {
  color: var(--accent-ink);
  background: var(--ok);
  border-color: transparent;
}

.reply.demo { border-style: dashed; opacity: 0.85; }
.reply.demo::before { background: var(--danger); }

/* -------------------------------------------------------------- esqueleto */

.skeleton {
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--vidrio);
  border: 1px solid var(--borde);
}
.skeleton .linea {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--vidrio-alto) 25%, var(--borde) 37%, var(--vidrio-alto) 63%);
  background-size: 400% 100%;
  animation: brillo 1.4s ease-in-out infinite;
}
.skeleton .linea + .linea { margin-top: 11px; }
.skeleton .linea.corta { width: 34%; }
.skeleton .linea.media { width: 74%; }
@keyframes brillo { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ------------------------------------------------------------------ barra */

.barra {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--borde);
}

/* ----------------------------------------------------------------- avisos */

.error {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--r);
  font-size: 14.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}
.error a { color: var(--danger); font-weight: 650; }

.demo-banner {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: var(--r);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}
.demo-banner .demo-title {
  margin-bottom: 8px;
  font-size: 14.5px;
  font-weight: 680;
  color: var(--danger);
}
.demo-banner p { margin: 0 0 7px; font-size: 13.5px; color: var(--muted); }
.demo-banner .demo-warn { color: var(--text); font-weight: 620; }
.demo-banner a { font-size: 13.5px; font-weight: 620; }

.meta {
  margin-top: 16px;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(108px + env(safe-area-inset-bottom));
  z-index: 50;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 640;
  color: var(--accent-ink);
  background: var(--grad);
  box-shadow: var(--sombra), var(--brillo);
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ ficha */

.ficha {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--vidrio-alto);
  border: 1px solid var(--borde);
}
.ficha .titulo {
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.ficha ul { margin: 0 0 14px; padding-left: 17px; }
.ficha li { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.ficha .vacio { font-size: 13.5px; color: var(--faint); }
.ficha .hilo { max-height: 150px; overflow-y: auto; }
.ficha .hilo .linea { padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--borde); }
.ficha .hilo .de-cliente { color: var(--muted); }
.ficha .hilo .de-maiko { color: var(--accent); }

/* ------------------------------------------------------------- apariencia */

.segmentado {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: var(--vidrio-alto);
  border: 1px solid var(--borde);
}
.segmentado button {
  appearance: none;
  padding: 9px 17px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.segmentado button:hover { color: var(--text); }
.segmentado button[aria-pressed="true"] { color: var(--accent-ink); background: var(--grad); }

.colores { display: flex; flex-wrap: wrap; gap: 11px; }
.colores button {
  position: relative;
  width: 38px; height: 38px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--tono);
  cursor: pointer;
  transition: transform 0.16s var(--ease);
}
.colores button:hover { transform: scale(1.08); }
.colores button[aria-pressed="true"] {
  border-color: var(--text);
  transform: scale(1.08);
}

.ayuda { margin: 0 0 16px; font-size: 14.5px; color: var(--muted); }

/* -------------------------------------------------------------- apartados */

.card {
  padding: 20px;
  margin-bottom: 14px;
  border-radius: var(--r-lg);
  background: var(--vidrio);
  border: 1px solid var(--borde);
}
.label {
  display: block;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ------------------------------------------------------------------ login */

.login-box {
  position: relative;
  z-index: 1;
  max-width: 350px;
  margin: 0 auto;
  padding: 15vh 22px 40px;
}
.login-box h1 {
  margin: 0 0 7px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.login-box .sub { margin: 0 0 28px; font-size: 15px; color: var(--muted); }
.login-box form { display: flex; flex-direction: column; gap: 12px; }

/* -------------------------------------------------------------- documentos */

.doc h2 {
  margin: 36px 0 13px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.doc h3 { margin: 22px 0 8px; font-size: 16.5px; font-weight: 650; }
.doc ul { margin: 0; padding-left: 19px; }
.doc li { margin-bottom: 8px; font-size: 15px; }
.doc li::marker { color: var(--accent-line); }
.doc .ex {
  padding: 17px;
  border-radius: var(--r);
  font-size: 14.5px;
  background: var(--vidrio-alto);
  border: 1px solid var(--borde);
}
.doc .ex p { margin: 0 0 9px; }
.doc .ex p:last-child { margin: 0; }
.doc .ex b { color: var(--accent); }

code {
  padding: 0.12em 0.45em;
  border-radius: 7px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--vidrio-alto);
  border: 1px solid var(--borde);
  overflow-wrap: anywhere;
}

kbd {
  padding: 2px 8px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  background: var(--vidrio-alto);
  border: 1px solid var(--borde-alto);
}

/* ---------------------------------------------------------------- moviles */

@media (max-width: 480px) {
  header { padding: 11px 15px; }
  header nav { gap: 0; }
  header nav a, header nav button { padding: 7px 8px; font-size: 12.5px; }
  .vista, .wrap { padding: 18px 15px 128px; }
  .barra { padding: 12px 15px calc(12px + env(safe-area-inset-bottom)); }
  .bloque-entrada { padding: 15px; }
  .translation { font-size: 22px; }
  .reply { padding: 16px 17px; }
  .reply .en { font-size: 17px; }
  textarea { min-height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* La X para vaciar la pantalla y empezar con otro cliente. */
.fila-rotulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.fila-rotulo .rotulo { margin-bottom: 0; }

.borrar-x {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--faint);
  background: var(--vidrio-alto);
  border: 1px solid var(--borde);
  border-radius: 50%;
  cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.borrar-x:hover { color: var(--danger); border-color: var(--danger); }

/* Vaciar la memoria de un cliente, dentro de su ficha. */
.ficha .olvidar {
  margin-top: 12px;
  padding: 0;
  width: auto;
  font: inherit;
  font-size: 13px;
  color: var(--faint);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ficha .olvidar:hover { color: var(--danger); }
