:root {
  --ink: #1b1530;
  --ink-2: #3c3550;
  --muted: #7d7589;
  --cream: #f5efe4;
  --paper: #fffdf8;
  --line: #e4dbcc;
  --green: #128c7e;
  --green-dark: #075e54;
  --green-soft: #dff7ed;
  --violet: #6d4aff;
  --coral: #ff7a59;
  --amber: #e8a93e;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(18, 140, 126, 0.1), transparent 30%),
    radial-gradient(circle at 92% 8%, rgba(109, 74, 255, 0.09), transparent 30%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(27, 21, 48, 0.065);
  color: var(--ink-2);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1280px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 22px 32px;
  border-bottom: 1px solid rgba(228, 219, 204, 0.8);
}

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

.brand > span:last-child {
  min-width: 0;
}

.brand strong,
.brand small {
  overflow-wrap: anywhere;
}

.mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #1ba58f, #075e54);
  box-shadow: 0 8px 20px rgba(7, 94, 84, 0.24);
  font-size: 17px;
}

.brand strong {
  display: block;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
}

.top-actions a:hover {
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.68);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.13);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 392px);
  align-items: center;
  gap: clamp(36px, 6vw, 94px);
  width: min(1280px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(40px, 5.5vw, 78px) 32px clamp(40px, 5vw, 64px);
}

.copy {
  width: 100%;
  min-width: 0;
  max-width: 590px;
  overflow-wrap: anywhere;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 20px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green);
}

.eyebrow span {
  width: 24px;
  height: 1.5px;
  background: currentColor;
  opacity: 0.55;
}

.copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(44px, 5.6vw, 76px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.copy h1 em {
  font-style: italic;
  color: var(--green);
}

.lead {
  margin: 24px 0 0;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.sandbox-flow {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}

.flow-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.62);
}

.flow-step > span {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: #0c6c60;
  font-size: 9px;
  font-weight: 750;
}

.flow-step strong {
  display: block;
  font-size: 10.5px;
  line-height: 1.3;
}

.flow-step small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
}

.flow-step code {
  font-size: 8.5px;
}

.join-callout {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 15px;
  border: 1px solid #c9e9df;
  border-radius: 13px;
  background: #effaf6;
}

.join-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #d7f3e9;
  color: #0b6e61;
  font-size: 15px;
}

.join-callout strong {
  font-size: 10.5px;
}

.join-callout p {
  margin: 4px 0 0;
  font-size: 9.5px;
  line-height: 1.6;
  color: #4e6e66;
}

.debug-card {
  margin-top: 18px;
  padding: 17px;
  border-radius: 15px;
  background:
    radial-gradient(circle at 100% 0%, rgba(109, 74, 255, 0.2), transparent 35%),
    linear-gradient(145deg, #191331, #100d20);
  color: #fff;
  box-shadow: 0 18px 40px rgba(23, 18, 46, 0.16);
}

.debug-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.debug-card .eyebrow {
  margin-bottom: 6px;
  color: #9d8fe0;
  font-size: 7.5px;
}

.debug-card h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.new-session {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.64);
  font-size: 8px;
  cursor: pointer;
}

.new-session:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.meta-pill {
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(101, 226, 180, 0.14);
  color: #8ff0c9;
  font-size: 7.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.meta-pill.violet {
  background: rgba(137, 111, 255, 0.2);
  color: #cbbdff;
}

.meta-pill.coral {
  background: rgba(255, 122, 89, 0.18);
  color: #ffb9a7;
}

.meta-pill.muted {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.45);
}

.debug-card pre {
  max-height: 170px;
  margin: 12px 0 0;
  padding: 11px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
  color: #cfc6ec;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.debug-foot {
  margin: 10px 0 0;
  font-size: 7.5px;
  color: rgba(255, 255, 255, 0.34);
}

.debug-foot code {
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
}

.phone-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.phone {
  position: relative;
  width: min(392px, 100%);
  max-width: 100%;
  min-width: 0;
  height: 786px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 47px;
  padding: 9px;
  background: linear-gradient(160deg, #3f3a4e, #0a0812 55%);
  box-shadow:
    0 54px 110px rgba(23, 18, 46, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.phone::before {
  content: "";
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 15px;
  width: 84px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #090711;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.phone-status {
  flex: 0 0 29px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 19px 5px;
  background: #075e54;
  color: #fff;
  font-size: 9px;
  font-weight: 650;
  border-radius: 38px 38px 0 0;
}

.status-icons {
  letter-spacing: 0.06em;
  font-size: 7.5px;
  opacity: 0.8;
}

.wa-head {
  flex: 0 0 59px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  background: #075e54;
  color: #fff;
}

.wa-back {
  font-size: 25px;
  line-height: 1;
  font-weight: 300;
  opacity: 0.9;
}

.wa-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #8b73ff, #5a36e8);
  color: #fff;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.wa-contact {
  flex: 1;
  min-width: 0;
}

.wa-contact strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wa-contact small {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 7.5px;
  color: rgba(255, 255, 255, 0.65);
}

.wa-online {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7df0b8;
}

.wa-head-icons {
  font-size: 13px;
  letter-spacing: 0.16em;
  opacity: 0.82;
}

.wa-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 13px 12px 8px;
  background-color: #efeae2;
  background-image:
    radial-gradient(rgba(102, 86, 58, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 18% 28%, rgba(255, 255, 255, 0.45), transparent 18%),
    radial-gradient(circle at 82% 72%, rgba(255, 255, 255, 0.35), transparent 16%);
  background-size: 19px 19px, 100% 100%, 100% 100%;
  scrollbar-width: thin;
  scrollbar-color: #c8bfae transparent;
}

.wa-day {
  width: fit-content;
  margin: 0 auto 12px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: #827a6a;
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.08em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.wa-msg {
  position: relative;
  max-width: 83%;
  margin-bottom: 9px;
  padding: 8px 10px 16px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  animation: wa-in 200ms ease both;
}

.wa-msg p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wa-msg.bot {
  background: #fff;
  color: #2a2a2a;
  border-top-left-radius: 2px;
}

.wa-msg.user {
  margin-left: auto;
  background: #d9fdd3;
  color: #1f2a22;
  border-top-right-radius: 2px;
}

.wa-time {
  position: absolute;
  right: 8px;
  bottom: 5px;
  font-size: 7px;
  color: #8e9890;
}

.wa-msg.user .wa-time {
  color: #6d8f6a;
}

.wa-msg.user .wa-time::after {
  content: " ✓✓";
  color: #53bdeb;
  letter-spacing: -0.15em;
}

.wa-note {
  background: #fff8e4;
  color: #6f5a2e;
}

.wa-typing {
  display: flex;
  gap: 3px;
  width: fit-content;
  padding: 11px 13px;
  margin-bottom: 8px;
  border-radius: 8px;
  border-top-left-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.wa-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9c9c9c;
  animation: wa-typing 1.1s infinite ease-in-out;
}

.wa-typing i:nth-child(2) { animation-delay: 0.16s; }
.wa-typing i:nth-child(3) { animation-delay: 0.32s; }

.wa-system {
  width: fit-content;
  max-width: 88%;
  margin: 3px auto 12px;
  padding: 5px 9px;
  border-radius: 6px;
  background: #fdf0d5;
  color: #7c6226;
  font-size: 8px;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.wa-quick {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow-x: hidden;
  padding: 8px 10px;
  background: #f0f2f5;
  border-top: 1px solid #e1e4e8;
}

.wa-quick button {
  flex: 0 0 auto;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid #d8e5e2;
  border-radius: 999px;
  background: #fff;
  color: #0d6b60;
  font-size: 8px;
  font-weight: 600;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease;
}

.wa-quick button:hover {
  background: #effaf6;
  border-color: #b7ddd4;
}

.wa-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px 11px;
  background: #f0f2f5;
}

.wa-emoji {
  width: 27px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #8a8f94;
  font-size: 17px;
}

.wa-composer input {
  flex: 1;
  min-width: 0;
  height: 35px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  padding: 0 13px;
  color: #222;
  font-size: 10.5px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.wa-composer input::placeholder {
  color: #9aa0a6;
}

.wa-composer button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #128c7e;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 9px rgba(18, 140, 126, 0.28);
  transition: transform 140ms ease, opacity 140ms ease;
}

.wa-composer button:hover:not(:disabled) {
  transform: scale(1.04);
}

.wa-composer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.phone-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  width: 392px;
  margin-top: 15px;
  font-size: 8px;
  letter-spacing: 0.03em;
  color: #91887a;
}

.phone-caption span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.phone-caption i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 20px 32px 30px;
  border-top: 1px solid var(--line);
  font-size: 8.5px;
  color: #9a9183;
}

.footer a:hover {
  color: var(--green-dark);
}

@keyframes wa-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes wa-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 1060px) {
  .layout {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .phone-stage {
    justify-self: center;
  }
  .copy {
    max-width: 680px;
  }
}

/* Portatiles de 900/768 px de alto: el telefono completo debe caber
   sin recortar la cabecera de la pagina. */
@media (min-width: 1061px) and (max-height: 960px) {
  .layout {
    align-items: start;
    padding-top: 20px;
    padding-bottom: 16px;
  }
  .phone {
    height: min(700px, calc(100vh - 150px));
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 16px;
  }
  .top-actions {
    gap: 10px;
    font-size: 10px;
  }
  .top-actions .badge {
    display: none;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 30px 16px 40px;
  }
  .phone {
    width: 100%;
    max-width: 392px;
    height: min(786px, 82vh);
    border-radius: 38px;
    padding: 7px;
  }
  .phone::before {
    top: 12px;
    width: 74px;
    height: 17px;
  }
  .phone-status {
    border-radius: 31px 31px 0 0;
  }
  .phone-caption {
    width: 100%;
  }
  .footer {
    flex-direction: column;
    gap: 6px;
    padding: 16px;
  }
}

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