#opys-widget-root,
#opys-widget-root * {
  box-sizing: border-box;
}

#opys-widget-root {
  --navy-900: #1a2338;
  --navy-800: #232f4d;
  --navy-700: #2c3955;
  --navy-600: #3c4a6e;
  --wine-700: #96281b;
  --wine-600: #c0392b;
  --wine-500: #d8503f;
  --amber-500: #e8601c;
  --ink-900: #1c2333;
  --ink-600: #4a5468;
  --ink-400: #8891a3;
  --line: #e7e8ee;
  --surface: #ffffff;
  --canvas: #f6f6f4;
  --success: #34d399;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-display: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--font-body);
}

@media (prefers-reduced-motion: reduce) {

  #opys-widget-root *,
  #opys-widget-root *::before,
  #opys-widget-root *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Botón flotante ---------- */
#chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  border: none;
  cursor: pointer;
  z-index: 2147483000;
  box-shadow: 0 10px 28px rgba(28, 35, 61, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease;
}

#chat-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 14px 34px rgba(28, 35, 61, .42);
}

#chat-btn:focus-visible {
  outline: 2.5px solid var(--amber-500);
  outline-offset: 3px;
}

#chat-btn svg {
  width: 24px;
  height: 24px;
  position: absolute;
  transition: opacity .2s ease, transform .25s ease;
}

#icon-chat {
  fill: #fff;
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#icon-close {
  fill: #fff;
  opacity: 0;
  transform: scale(.5) rotate(-45deg);
}

#chat-btn.is-open #icon-chat {
  opacity: 0;
  transform: scale(.5) rotate(45deg);
}

#chat-btn.is-open #icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: var(--amber-500);
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}

#chat-badge::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--amber-500);
  animation: pulso 1.8s infinite;
}

@keyframes pulso {
  0% {
    transform: scale(1);
    opacity: .8;
  }

  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

/* ---------- Ventana de chat ---------- */
#chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: min(600px, 82vh);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(20, 24, 40, .28), 0 4px 16px rgba(20, 24, 40, .08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483000;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}

#chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

#chat-header {
  position: relative;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(216, 80, 63, .35), transparent 55%),
    linear-gradient(135deg, var(--navy-800), var(--navy-600));
  padding: 16px 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.info-chat {
  min-width: 0;
}

.info-chat h4 {
  color: #fff;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: .1px;
  margin: 0 0 2px;
  line-height: 1.2;
}

.info-chat .status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .82);
  font-size: 11.5px;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .25);
  flex-shrink: 0;
}

#chat-close {
  margin-left: auto;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
  flex-shrink: 0;
  font-size: 13px;
}

#chat-close:hover {
  background: rgba(255, 255, 255, .26);
}

#chat-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ---------- Mensajes ---------- */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
  width: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #d7d8de;
  border-radius: 4px;
}

.msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  animation: msgIn .25s ease both;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg.bot {
  background: var(--surface);
  color: var(--ink-900);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.msg.user {
  background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  font-weight: 500;
}

.msg-time {
  font-size: 10.5px;
  color: var(--ink-400);
  margin: 1px 2px 4px;
}

.msg-time.r {
  text-align: right;
}

.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 11px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wine-600);
  animation: blink 1.2s infinite;
}

.typing span:nth-child(2) {
  animation-delay: .2s;
}

.typing span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes blink {

  0%,
  80%,
  100% {
    transform: scale(.7);
    opacity: .35;
  }

  40% {
    transform: scale(1.15);
    opacity: 1;
  }
}

/* ---------- Chips de respuesta rápida (compactos) ---------- */
.quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.qbtn {
  background: var(--surface);
  color: var(--wine-600);
  border: 1.3px solid rgba(192, 57, 43, .28);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .12s ease;
  font-family: var(--font-body);
  line-height: 1.4;
}

.qbtn:hover {
  background: var(--wine-600);
  color: #fff;
  border-color: var(--wine-600);
  transform: translateY(-1px);
}

.qbtn:focus-visible {
  outline: 2px solid var(--wine-600);
  outline-offset: 2px;
}

/* ---------- Menú principal: grid de tarjetas compactas ---------- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 6px 0 8px;
  width: 100%;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 1px 2px rgba(20, 24, 40, .04);
  transition: border-color .18s ease, transform .16s ease, background .18s ease, box-shadow .18s ease;
}

.menu-card:hover {
  border-color: transparent;
  background: #fff8f7;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(192, 57, 43, .14);
}

.menu-card:active {
  transform: translateY(-1px);
}

.menu-card:focus-visible {
  outline: 2px solid var(--wine-600);
  outline-offset: 2px;
}

.menu-card .ic {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--navy-600), var(--navy-800));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(28, 35, 61, .28), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.menu-card:hover .ic {
  background: linear-gradient(145deg, var(--wine-500), var(--wine-700));
  box-shadow: 0 6px 14px rgba(192, 57, 43, .38), inset 0 1px 0 rgba(255, 255, 255, .12);
  transform: scale(1.08);
}

.menu-card .ic svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-card span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.25;
  letter-spacing: .1px;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Tarjeta de pasos ---------- */
.step-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber-500);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 13px 11px;
  margin: 2px 0 8px;
  font-size: 12.5px;
  color: var(--ink-900);
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.step-list li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  line-height: 1.5;
}

.step-list li .num {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--navy-700);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.step-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin: 9px 0 0;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--ink-600);
  line-height: 1.5;
}

.step-note svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  stroke: var(--ink-400);
  fill: none;
  stroke-width: 1.8;
}

.step-img {
  width: 100%;
  border-radius: 10px;
  margin-top: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  display: block;
}

/* ---------- Botones CTA / video ---------- */
.btn-cta,
.btn-video {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  justify-content: center;
  text-decoration: none !important;
  padding: 9px 14px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 9px;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
}

.btn-cta {
  background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(44, 57, 85, .28);
}

.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(44, 57, 85, .35);
}

.btn-video {
  background: #fff;
  color: var(--wine-600);
  border: 1.4px solid rgba(192, 57, 43, .32);
}

.btn-video:hover {
  background: #fff5f4;
}

.btn-cta svg,
.btn-video svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn-cta:focus-visible,
.btn-video:focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 2px;
}

/* ---------- Input ---------- */
#chat-input-area {
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  background: var(--surface);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  padding: 10px 15px;
  border: 1.4px solid var(--line);
  border-radius: 22px;
  font-size: 13px;
  outline: none;
  font-family: var(--font-body);
  color: var(--ink-900);
  transition: border-color .18s ease, box-shadow .18s ease;
  min-width: 0;
}

#chat-input::placeholder {
  color: var(--ink-400);
}

#chat-input:focus {
  border-color: var(--wine-500);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, .1);
}

#chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-600));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease;
  flex-shrink: 0;
}

#chat-send:hover {
  transform: scale(1.08);
}

#chat-send:focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 2px;
}

#chat-send svg {
  width: 15px;
  height: 15px;
  fill: #fff;
}

.chat-footnote {
  text-align: center;
  font-size: 10px;
  color: var(--ink-400);
  padding: 6px 0 10px;
  background: var(--surface);
}

/* ---------- Lightbox de imagen ---------- */
#chat-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 30, .88);
  z-index: 2147483200;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 30px;
}

#chat-lightbox.open {
  display: flex;
}

#chat-lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  animation: zoomIn .22s ease;
}

@keyframes zoomIn {
  from {
    transform: scale(.85);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

#chat-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
}

/* ---------- Modal de video tutorial ---------- */
#chat-video-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 30, .82);
  z-index: 2147483200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#chat-video-modal.open {
  display: flex;
}

.video-modal-box {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
  animation: zoomIn .22s ease;
  position: relative;
}

.video-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  border: none;
  color: #fff;
  cursor: pointer;
  z-index: 2;
  font-size: 13px;
}

.video-modal-head {
  padding: 20px 20px 14px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  color: #fff;
}

.video-modal-eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .6px;
  background: rgba(255, 255, 255, .16);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.video-modal-head h4 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 4px;
}

.video-modal-head p {
  font-size: 12px;
  color: rgba(255, 255, 255, .82);
  margin: 0;
  line-height: 1.5;
}

.video-modal-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.video-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-modal-fallback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  color: var(--ink-600);
  background: #f7f8fa;
  font-size: 11px;
}

.video-modal-fallback a {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 7px;
  color: #fff;
  background: var(--wine-600);
  font-weight: 700;
  text-decoration: none;
}

.video-modal-fallback a:hover {
  background: var(--wine-700);
}

.video-modal-foot {
  padding: 12px 20px 18px;
  font-size: 11px;
  color: var(--ink-600);
}

@media (max-width: 420px) {
  #chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 88px;
  }

  #chat-btn {
    right: 14px;
    bottom: 14px;
  }

  .menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}