/* ═══════════════════════════════════════════════════════════
   THE MILA EXPERIENCE — sistema de diseño
   Un escritorio vivo. La luz ambiental cambia con el rubro
   (--hue) y deriva lentamente sola. Elegancia > espectáculo.
   ═══════════════════════════════════════════════════════════ */

:root {
  --hue: 24;
  --acento: hsl(var(--hue) 74% 52%);
  --acento-suave: hsl(var(--hue) 80% 62% / 0.14);
  --acento-tinta: hsl(var(--hue) 60% 38%);

  --bg: #f3f3f7;
  --ink: #101223;
  --ink-dim: #4e5470;
  --ink-faint: #8d92ab;
  --line: rgba(16, 18, 35, 0.09);

  --vidrio: rgba(255, 255, 255, 0.72);
  --vidrio-borde: rgba(255, 255, 255, 0.85);
  --sombra-v: 0 24px 70px rgba(20, 24, 60, 0.13), 0 2px 8px rgba(20, 24, 60, 0.06);

  --grad-mila: linear-gradient(115deg, #ff3d8a, #7c5cff 45%, #2e7cf6 75%, #2ee6a8);

  --f-ui: "Space Grotesk", system-ui, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
  font-family: var(--f-body);
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 12% -10%, hsl(var(--hue) 85% 88% / 0.55), transparent 60%),
    radial-gradient(1100px 700px at 105% 20%, hsl(calc(var(--hue) + 40) 80% 90% / 0.5), transparent 55%),
    radial-gradient(800px 800px at 50% 115%, hsl(calc(var(--hue) - 30) 70% 90% / 0.45), transparent 60%),
    var(--bg);
  transition: background 1.2s ease;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.con-overlay { overflow: hidden; }

::selection { background: hsl(var(--hue) 80% 60% / 0.3); }
.mono { font-family: var(--f-mono); font-size: 0.76em; letter-spacing: 0.02em; }
button { font-family: inherit; cursor: pointer; }

/* luz que sigue al mouse */
#luz {
  position: fixed; z-index: 1;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--hue) 90% 70% / 0.13), transparent 65%);
  pointer-events: none;
  will-change: transform;
  transition: background 1s;
}

/* ═══════════ TOPBAR ═══════════ */
.topbar {
  position: fixed; z-index: 500;
  top: 0; left: 0; right: 0;
  height: 52px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.topbar__marca {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.22em;
  font-size: 0.85rem;
}
.topbar__punto {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--grad-mila);
  animation: latido 2.6s ease-in-out infinite;
}
@keyframes latido { 0%,100% { transform: scale(1); } 50% { transform: scale(0.75); } }
.topbar__preview {
  font-size: 0.6rem;
  color: var(--acento-tinta);
  background: var(--acento-suave);
  border: 1px dashed hsl(var(--hue) 60% 60% / 0.5);
  border-radius: 100px;
  padding: 4px 10px;
  white-space: nowrap;
}
@media (max-width: 860px) { .topbar__preview { display: none; } }

.topbar__negocio {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.8rem; color: var(--ink-dim);
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: rgba(255,255,255,0.6);
}
.topbar__centro {
  margin-left: auto; margin-right: auto;
  display: flex; align-items: baseline; gap: 10px;
  color: var(--ink-dim);
}
#topReloj { font-family: var(--f-ui); font-weight: 600; font-size: 1rem; color: var(--ink); }
#topFecha { font-size: 0.72rem; }
.topbar__acciones { display: flex; align-items: center; gap: 8px; }
.topbar__btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.65);
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 0.78rem;
  color: var(--ink-dim);
  transition: all 0.3s var(--ease);
}
.topbar__btn:hover { color: var(--ink); border-color: var(--acento); transform: translateY(-1px); }
.topbar__cta {
  border: none;
  background: var(--grad-mila);
  background-size: 180% 180%;
  color: #fff; font-weight: 600;
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 0.78rem;
  animation: gradFlujo 8s ease-in-out infinite;
  transition: box-shadow 0.3s, transform 0.3s var(--spring);
}
.topbar__cta:hover { box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35); transform: translateY(-1px); }
@keyframes gradFlujo { 0%,100% { background-position: 0% 40%; } 50% { background-position: 100% 60%; } }

/* ═══════════ ESCRITORIO ═══════════ */
#escritorio {
  position: fixed;
  inset: 52px 0 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(340px, 400px) 1.25fr minmax(280px, 330px);
  grid-template-rows: 1fr auto;
  gap: 16px;
  padding: 16px 16px 92px;
}

/* ═══════════ VENTANAS ═══════════ */
.ventana {
  display: flex; flex-direction: column;
  min-height: 0;
  border-radius: 20px;
  background: var(--vidrio);
  border: 1px solid var(--vidrio-borde);
  box-shadow: var(--sombra-v);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), box-shadow 0.5s;
}
.ventana:hover { box-shadow: 0 30px 80px rgba(20, 24, 60, 0.16), 0 2px 8px rgba(20, 24, 60, 0.06); }
.ventana.is-drag { opacity: 0.94; cursor: grabbing; }
.ventana.is-oculta { display: none; }
.ventana__barra {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.ventana__puntos { display: flex; gap: 5px; }
.ventana__puntos i {
  width: 9px; height: 9px; border-radius: 50%;
  background: hsl(var(--hue) 60% 80%);
}
.ventana__puntos i:nth-child(2) { background: hsl(var(--hue) 60% 68%); }
.ventana__puntos i:nth-child(3) { background: var(--acento); }
.ventana__titulo {
  font-family: var(--f-ui); font-weight: 600; font-size: 0.82rem;
  color: var(--ink-dim);
  display: flex; align-items: center; gap: 7px;
}
.ventana__vivo {
  margin-left: auto;
  font-size: 0.62rem; font-family: var(--f-mono);
  color: var(--acento-tinta);
  display: flex; align-items: center; gap: 5px;
}
.ventana__vivo::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--acento);
  animation: latido 2s ease-in-out infinite;
}
.ventana__cuerpo { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }

/* columna central y derecha apiladas */
.pila { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.pila .ventana { flex: 1; }
.pila .ventana--baja { flex: 0 0 auto; }

/* ═══════════ CHAT (WhatsApp claro) ═══════════ */
.chat { display: flex; min-height: 0; flex: 1; }
.chat__lista {
  width: 128px; flex-shrink: 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: rgba(255,255,255,0.5);
  scrollbar-width: none;
}
.chatitem {
  display: flex; gap: 7px; align-items: center;
  padding: 9px 8px;
  border-bottom: 1px solid rgba(16,18,35,0.04);
  transition: background 0.3s;
  cursor: pointer;
}
.chatitem:hover { background: rgba(16,18,35,0.04); }
.chatitem--tu .chatitem__avatar {
  background: var(--grad-mila);
  background-size: 200% 200%;
  animation: gradFlujo 8s ease-in-out infinite;
}
.chatitem.is-activo { background: hsl(var(--hue) 70% 92% / 0.6); }
.chatitem.is-nuevo { animation: itemNuevo 0.9s var(--ease); }
@keyframes itemNuevo { 0% { background: hsl(var(--hue) 80% 88%); } }
.chatitem__avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 0.7rem; font-weight: 700; color: #fff;
  background: hsl(var(--hue) 65% 62%);
}
.chatitem__cuerpo { min-width: 0; flex: 1; }
.chatitem__cuerpo b { display: block; font-size: 0.62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatitem__cuerpo span { display: block; font-size: 0.58rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatitem__lado { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.chatitem__lado .mono { font-size: 0.5rem; color: var(--ink-faint); }
.chatitem__badge {
  font-style: normal;
  min-width: 14px; height: 14px; border-radius: 100px;
  background: #25d366; color: #fff;
  font-size: 0.56rem; font-weight: 700;
  display: grid; place-items: center;
  padding: 0 4px;
}

.chat__panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat__cab {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  background: #f0f2f5;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.chat__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 0.8rem;
  font-family: var(--f-ui);
  background: var(--grad-mila);
  background-size: 200% 200%;
  animation: gradFlujo 8s ease-in-out infinite;
  flex-shrink: 0;
}
.chat__avatar--cliente {
  background: hsl(var(--hue) 65% 60%);
  animation: none;
}
.chat__quien { min-width: 0; }
.chat__quien b { display: block; font-size: 0.78rem; color: #111b21; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__quien span { font-size: 0.64rem; color: #667781; }
.chat__quien span.is-typing { color: #00a884; }

.chat__mensajes {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 8px;
  display: flex; flex-direction: column; gap: 4px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='0.04' stroke-width='1.4'%3E%3Ccircle cx='40' cy='40' r='9'/%3E%3Cpath d='M120 30q14 8 0 22'/%3E%3Crect x='180' y='40' width='22' height='16' rx='4'/%3E%3Cpath d='M60 130l14 12-14 12'/%3E%3Ccircle cx='200' cy='150' r='11'/%3E%3Cpath d='M30 210q16-14 30 0'/%3E%3Cpath d='M150 200h34m-34 10h20'/%3E%3C/g%3E%3C/svg%3E"),
    #efeae2;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}
.chat__diachip {
  align-self: center;
  background: #fff; color: #54656f;
  font-size: 0.6rem;
  padding: 4px 10px; border-radius: 7px;
  box-shadow: 0 1px 1px rgba(11,20,26,0.1);
  margin-bottom: 6px;
}
.msg {
  position: relative;
  max-width: 84%;
  padding: 6px 9px 5px;
  border-radius: 9px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #111b21;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13);
  animation: msgIn 0.36s var(--spring);
  white-space: pre-line;
  word-wrap: break-word;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(0.94); } }
.msg--in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.msg--out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 3px; }
.msg__meta {
  float: right;
  margin: 7px -2px -2px 8px;
  font-size: 0.56rem; color: #667781;
  font-family: var(--f-mono);
  display: inline-flex; gap: 3px; align-items: center;
  user-select: none;
}
.ticks { letter-spacing: -0.12em; color: #8696a0; transition: color 0.4s; }
.ticks--azul { color: #53bdeb; }

/* mensajes ricos */
.msg--audio { display: flex; align-items: center; gap: 8px; min-width: 168px; }
.audio__play {
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: #00a884; color: #fff;
  font-size: 0.6rem; flex-shrink: 0;
}
.audio__ondas { display: flex; align-items: center; gap: 1.5px; flex: 1; }
.audio__ondas i {
  width: 2.5px; border-radius: 2px;
  background: #93a5ad;
  transition: background 0.3s;
}
.audio__ondas.is-playing i { animation: onda 0.8s ease-in-out infinite alternate; background: #00a884; }
.audio__ondas.is-playing i:nth-child(2n) { animation-delay: 0.15s; }
.audio__ondas.is-playing i:nth-child(3n) { animation-delay: 0.3s; }
@keyframes onda { to { transform: scaleY(0.4); } }
.audio__dur { font-size: 0.56rem; color: #667781; }
.msg--foto { padding: 4px; max-width: 66%; }
.foto__marco {
  width: 100%; aspect-ratio: 4/3;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 2.6rem;
  background:
    radial-gradient(circle at 30% 30%, hsl(var(--hue) 70% 82%), hsl(calc(var(--hue) + 40) 60% 68%));
}
.foto__cap { padding: 5px 5px 2px; font-size: 0.74rem; }
.msg--pdf { display: flex; gap: 9px; align-items: center; min-width: 190px; background: #fff; }
.msg--pdf.msg--out { background: #d9fdd3; }
.pdf__icono {
  width: 34px; height: 40px; border-radius: 6px; flex-shrink: 0;
  background: #f15b4c; color: #fff;
  font-size: 0.55rem; font-weight: 800;
  display: grid; place-items: center;
}
.pdf__info { min-width: 0; }
.pdf__info b { display: block; font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.pdf__info span { font-size: 0.56rem; color: #667781; }
.msg--sticker { background: transparent; box-shadow: none; padding: 2px; }
.sticker { font-size: 3.4rem; line-height: 1; display: block; animation: stickerIn 0.5s var(--spring); }
@keyframes stickerIn { from { transform: scale(0.4) rotate(-14deg); opacity: 0; } }

.msg-typing {
  align-self: flex-start;
  background: #fff; border-radius: 9px; border-top-left-radius: 3px;
  padding: 10px 12px;
  display: inline-flex; gap: 4px;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13);
  animation: msgIn 0.3s var(--spring);
}
.msg-typing--out {
  align-self: flex-end;
  background: #d9fdd3;
  border-top-left-radius: 9px;
  border-top-right-radius: 3px;
}
.msg-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8696a0;
  animation: puntito 1.2s ease-in-out infinite;
}
.msg-typing i:nth-child(2) { animation-delay: 0.18s; }
.msg-typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes puntito { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat__hint {
  padding: 5px 12px;
  font-size: 0.6rem;
  color: var(--ink-faint);
  background: #f0f2f5;
  border-top: 1px solid var(--line);
  text-align: center;
  flex-shrink: 0;
}
.chat__pie {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 10px;
  background: #f0f2f5;
  flex-shrink: 0;
}
.chat__pie input {
  flex: 1; min-width: 0;
  border: none; outline: none;
  background: #fff;
  border-radius: 100px;
  padding: 9px 14px;
  font-size: 0.8rem; color: #111b21;
  font-family: var(--f-body);
  box-shadow: 0 1px 2px rgba(11,20,26,0.06);
}
.chat__pie input:focus { box-shadow: 0 0 0 2px hsl(var(--hue) 70% 60% / 0.35); }
.chat__enviar {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: #00a884; color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: transform 0.25s var(--spring), box-shadow 0.3s;
}
.chat__enviar:hover { transform: scale(1.08); box-shadow: 0 5px 14px rgba(0,168,132,0.4); }
.chat__enviar:active { transform: scale(0.9); }

/* ═══════════ CRM ═══════════ */
#crmCuerpo {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px;
  align-items: start;
  overflow: auto;
}
.crm__col { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.crm__etapa {
  font-size: 0.6rem; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding-bottom: 4px;
  border-bottom: 2px solid hsl(var(--hue) 70% 60% / 0.35);
}
.crm__card {
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  box-shadow: 0 3px 12px rgba(20,24,60,0.05);
  transition: transform 0.4s var(--ease), opacity 0.4s, box-shadow 0.3s;
  cursor: default;
}
.crm__card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20,24,60,0.1); }
.crm__card b { display: block; font-size: 0.72rem; font-family: var(--f-ui); }
.crm__card span { display: block; font-size: 0.62rem; color: var(--ink-faint); margin-top: 2px; }
.crm__card.is-moviendo { transform: translateY(-8px) scale(0.96); opacity: 0; }
.crm__card.is-llegando { animation: llegaCard 0.7s var(--spring); }
@keyframes llegaCard {
  0% { transform: translateY(10px) scale(0.94); opacity: 0; box-shadow: 0 0 0 3px hsl(var(--hue) 80% 60% / 0.4); }
}

/* ═══════════ AGENDA ═══════════ */
#agendaCuerpo { padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.agenda__fila {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  transition: transform 0.3s var(--ease);
}
.agenda__fila:hover { transform: translateX(3px); }
.agenda__fila.is-nueva { animation: llegaCard 0.9s var(--spring); }
.agenda__hora { font-size: 0.66rem; color: var(--acento-tinta); font-weight: 600; flex-shrink: 0; }
.agenda__txt { font-size: 0.7rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda__tag {
  font-style: normal; font-size: 0.54rem;
  padding: 2px 7px; border-radius: 100px;
  background: var(--acento-suave);
  color: var(--acento-tinta);
  flex-shrink: 0;
}

/* ═══════════ STATS ═══════════ */
#statsCuerpo {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px;
}
.kpi {
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 12px 10px;
  text-align: center;
}
.kpi b {
  display: block;
  font-size: clamp(1.05rem, 1.6vw, 1.5rem);
  font-weight: 600;
  background: linear-gradient(115deg, var(--acento-tinta), var(--acento));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.kpi b.is-tick { animation: kpiTick 0.5s var(--spring); }
@keyframes kpiTick { 40% { transform: scale(1.12); } }
.kpi span { display: block; font-size: 0.6rem; color: var(--ink-faint); margin-top: 3px; }

/* ═══════════ AUTOMATIZACIONES ═══════════ */
#autoCuerpo { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.auto__linea {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.66rem;
  color: var(--ink-dim);
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
}
.auto__linea.is-nueva { animation: llegaCard 0.8s var(--spring); }
.auto__linea i { font-style: normal; font-size: 0.7rem; }
.auto__linea span { flex: 1; min-width: 0; }
.auto__linea time { font-size: 0.54rem; color: var(--ink-faint); flex-shrink: 0; }

/* ═══════════ MILA PRESENTE ═══════════ */
#milaZona {
  position: fixed; z-index: 400;
  right: 12px; bottom: 6px;
  display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
#milaSprite { position: relative; animation: milaRespira 5.5s ease-in-out infinite; }
@keyframes milaRespira { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.012); } }
#milaSprite img {
  height: clamp(84px, 11vh, 110px); width: auto; display: block;
  filter: drop-shadow(0 12px 18px rgba(20,24,60,0.25));
}
#milaB { position: absolute; inset: 0; opacity: 0; }
#milaSprite.frame-b #milaA { opacity: 0; }
#milaSprite.frame-b #milaB { opacity: 1; }
.mila__pill {
  font-size: 0.58rem;
  font-family: var(--f-mono);
  color: var(--ink-faint);
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 11px;
  backdrop-filter: blur(8px);
  margin-bottom: 12px;
  white-space: nowrap;
}

/* ═══════════ TOASTS ═══════════ */
#toasts {
  position: fixed; z-index: 600;
  top: 64px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--vidrio-borde);
  border-radius: 14px;
  padding: 10px 14px 10px 10px;
  box-shadow: var(--sombra-v);
  backdrop-filter: blur(16px);
  animation: toastIn 0.55s var(--spring);
  transition: opacity 0.6s, transform 0.6s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(0.9); } }
.toast.is-out { opacity: 0; transform: translateX(40px); }
.toast__logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--grad-mila);
  color: #fff; font-weight: 700; font-family: var(--f-ui);
  display: grid; place-items: center; font-size: 0.8rem;
  flex-shrink: 0;
}
.toast b { display: block; font-size: 0.66rem; font-family: var(--f-ui); }
.toast div span { display: block; font-size: 0.68rem; color: var(--ink-dim); }

/* ═══════════ DOCK ═══════════ */
.dock {
  position: fixed; z-index: 550;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--vidrio-borde);
  box-shadow: var(--sombra-v);
  backdrop-filter: blur(20px);
}
.dock__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; background: transparent;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 1.05rem;
  color: var(--ink-dim);
  transition: background 0.3s, transform 0.3s var(--spring);
}
.dock__item span { font-size: 0.52rem; font-family: var(--f-mono); }
.dock__item:hover { background: rgba(255,255,255,0.8); transform: translateY(-3px); }
.dock__item.is-activo { background: var(--acento-suave); color: var(--acento-tinta); }
.dock__item.is-bounce { animation: dockBounce 0.5s var(--spring); }
@keyframes dockBounce { 40% { transform: translateY(-9px); } }

/* ═══════════ FRASE DE APERTURA ═══════════ */
#frase {
  position: fixed; inset: 0; z-index: 800;
  display: grid; place-items: center;
  pointer-events: none;
  background: transparent;
  transition: background 0.9s ease;
}
#frase.is-v1 { background: rgba(243, 243, 247, 0.82); backdrop-filter: blur(10px); }
#frase.is-out { opacity: 0; transition: opacity 0.9s ease; }
.frase__caja { text-align: center; }
.frase__l1, .frase__l2 { display: block; opacity: 0; }
.frase__l1 {
  font-family: var(--f-ui); font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 4.2rem);
  letter-spacing: -0.03em;
  transform: translateY(24px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.frase__l2 {
  font-family: var(--f-serif); font-style: italic;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  background: var(--grad-mila);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  transform: translateY(24px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
#frase.is-v1 .frase__l1 { opacity: 1; transform: none; }
#frase.is-v2 .frase__l2 { opacity: 1; transform: none; }

/* ═══════════ SELECTOR DE NEGOCIO ═══════════ */
#selector {
  position: fixed; inset: 0; z-index: 700;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(243, 243, 247, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
  overflow: auto;
}
#selector.is-abierto { opacity: 1; pointer-events: auto; }
.selector__caja { text-align: center; max-width: 860px; width: 100%; }
.selector__titulo {
  font-family: var(--f-ui); font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
}
.selector__titulo em {
  font-family: var(--f-serif); font-style: italic; font-weight: 400;
  background: var(--grad-mila);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.selector__sub { color: var(--ink-dim); font-size: 0.9rem; margin-top: 8px; }
#selectorGrid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.selector__card {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.8);
  border-radius: 18px;
  padding: 20px 10px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 6px 20px rgba(20,24,60,0.06);
  transition: transform 0.35s var(--spring), box-shadow 0.35s, border-color 0.3s;
  animation: cardEntra 0.6s var(--ease) backwards;
  animation-delay: calc(var(--i) * 0.05s);
}
@keyframes cardEntra { from { opacity: 0; transform: translateY(26px); } }
#selector.is-abierto .selector__card { animation-play-state: running; }
.selector__card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: hsl(var(--h) 70% 60%);
  box-shadow: 0 18px 40px hsl(var(--h) 70% 50% / 0.22);
}
.selector__emoji { font-size: 2rem; transition: transform 0.35s var(--spring); }
.selector__card:hover .selector__emoji { transform: scale(1.2) rotate(-6deg); }
.selector__card b { font-family: var(--f-ui); font-size: 0.78rem; font-weight: 600; }
.selector__cerrar {
  margin-top: 26px;
  border: none; background: transparent;
  color: var(--ink-faint);
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.selector__cerrar:hover { color: var(--ink); }

/* velo de transición entre universos */
#velo {
  position: fixed; inset: 0; z-index: 750;
  background: hsl(var(--hue) 80% 92% / 0.9);
  backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.45s ease;
}
#velo.is-activo { opacity: 1; }

/* ═══════════ MARCA CHIBITECH ═══════════ */
.marca-chibitech {
  position: fixed; z-index: 400;
  left: 14px; bottom: 12px;
  opacity: 0.85;
  transition: opacity 0.3s, transform 0.3s var(--spring);
}
.marca-chibitech:hover { opacity: 1; transform: translateY(-2px); }
.marca-chibitech img { height: 44px; width: auto; display: block; }
@media (max-width: 1350px) { .marca-chibitech { display: none; } }

/* ═══════════ RESPONSIVE ═══════════ */

/* tablet: dos columnas, sin arrastre */
@media (max-width: 1180px) {
  #escritorio {
    grid-template-columns: minmax(320px, 380px) 1fr;
    overflow-y: auto;
  }
  .pila--derecha { display: contents; }
  .ventana { animation: none; }
  .ventana__barra { cursor: default; }
  #milaZona { display: none; }
  #selectorGrid { grid-template-columns: repeat(4, 1fr); }
}

/* móvil: una ventana a la vez, dock como tabs */
@media (max-width: 860px) {
  body { overflow: hidden; }
  .topbar { height: 48px; padding: 0 12px; gap: 8px; }
  .topbar__centro { display: none; }
  .topbar__negocio span:last-child { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__cta { display: none; }
  #escritorio {
    inset: 48px 0 0 0;
    display: block;
    padding: 10px 10px 76px;
  }
  .ventana { display: none; height: 100%; border-radius: 18px; }
  .ventana.is-visible-movil { display: flex; }
  .pila { display: contents; }
  .chat { flex-direction: column; }
  .chat__lista {
    display: flex; flex-direction: row;
    width: 100%; height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden;
    flex-shrink: 0;
    scrollbar-width: none;
  }
  .chatitem {
    position: relative;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 66px;
    padding: 8px 6px 6px;
    border-bottom: none;
  }
  .chatitem__avatar { width: 32px; height: 32px; font-size: 0.8rem; }
  .chatitem__cuerpo b { font-size: 0.54rem; max-width: 60px; text-align: center; }
  .chatitem__cuerpo span { display: none; }
  .chatitem__lado .mono { display: none; }
  .chatitem__badge { position: absolute; top: 4px; right: 10px; }
  .dock {
    bottom: 10px;
    width: calc(100vw - 20px);
    justify-content: space-around;
  }
  .dock__item { padding: 6px 8px; flex: 1; }
  #selectorGrid { grid-template-columns: repeat(2, 1fr); }
  .selector__card { padding: 16px 8px 13px; }
  #milaZona { display: flex; right: 10px; bottom: 84px; opacity: 0.92; }
  body.movil-chat #milaZona { display: none; }
  #milaSprite img { height: 74px; }
  .mila__pill { display: none; }
  #toasts { top: 56px; right: 8px; left: 8px; align-items: flex-end; }
  .msg { font-size: 0.84rem; }
}

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