/* Command Make · Asistente instantáneo en la web (Alejo) */
.cm-agent {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 85;
  font-family: var(--sans);
}

.cm-agent-fab {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 8px 18px 8px 10px;
  border: 1.5px solid rgba(63, 212, 255, .48);
  border-radius: 99px;
  background: rgba(8, 24, 42, .94);
  color: #f4f8fa;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 38px rgba(4, 10, 18, .44), 0 0 26px rgba(8, 173, 217, .22);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: transform .22s var(--ease), border-color .22s ease, box-shadow .22s ease, background .22s ease;
}
.cm-agent-fab:hover {
  transform: translateY(-2px);
  border-color: var(--cm-glow);
  background: #0a2038;
  box-shadow: 0 20px 44px rgba(4, 10, 18, .5), 0 0 32px rgba(63, 212, 255, .34);
}
.cm-agent-fab:focus-visible { outline: 2px solid var(--cm-glow); outline-offset: 3px; }
.cm-agent-fab[aria-expanded="true"] { display: none; }

.cm-agent-fab-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cm-night);
  border: 1px solid rgba(63, 212, 255, .36);
  flex: 0 0 auto;
}
.cm-agent-fab-avatar img { width: 22px; height: 22px; object-fit: contain; }
.cm-agent-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #27e3a5;
  border: 2px solid #08182a;
  box-shadow: 0 0 10px rgba(39, 227, 165, .75);
}

.cm-agent-fab-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.cm-agent-fab-copy small {
  font-size: 11px;
  font-weight: 400;
  color: #9ac5d6;
}

.cm-agent-panel {
  width: min(396px, calc(100vw - 28px));
  height: min(560px, calc(100svh - 104px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border-radius: 22px;
  background: #06111e;
  border: 1px solid rgba(63, 212, 255, .28);
  color: #eaf3f7;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .62), 0 0 42px rgba(8, 173, 217, .16);
  overflow: hidden;
  animation: cm-agent-in .22s var(--ease);
}
@keyframes cm-agent-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.cm-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #081a2d, #05101c);
  border-bottom: 1px solid rgba(63, 212, 255, .16);
}
.cm-agent-id {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.cm-agent-id-copy strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.cm-agent-id-copy span {
  display: block;
  font-size: 11.5px;
  color: #8fb8c8;
  line-height: 1.3;
}
.cm-agent-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.cm-agent-icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(63, 212, 255, .18);
  border-radius: 50%;
  background: rgba(63, 212, 255, .05);
  color: #cfe4ed;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.cm-agent-icon-btn:hover {
  background: rgba(8, 173, 217, .18);
  border-color: rgba(63, 212, 255, .5);
  color: #fff;
}
.cm-agent-icon-btn:focus-visible { outline: 2px solid var(--cm-glow); outline-offset: 2px; }
.cm-agent-icon-btn svg { width: 16px; height: 16px; }

.cm-agent-messages {
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(63, 212, 255, .28) transparent;
}
.cm-agent-msg {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cm-agent-msg--bot { align-self: flex-start; }
.cm-agent-msg--user { align-self: flex-end; }

.cm-agent-bubble {
  padding: 11px 14px;
  font-size: 13.8px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.cm-agent-msg--bot .cm-agent-bubble {
  background: rgba(13, 33, 54, .94);
  border: 1px solid rgba(63, 212, 255, .16);
  border-radius: 6px 16px 16px 16px;
  color: #e8f2f6;
}
.cm-agent-msg--user .cm-agent-bubble {
  background: linear-gradient(135deg, #08add9, #0690b8);
  color: #03111a;
  font-weight: 500;
  border-radius: 16px 16px 4px 16px;
}

.cm-agent-facts {
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  display: grid;
  gap: 6px;
  border-radius: 12px;
  background: rgba(4, 10, 18, .66);
  border: 1px solid rgba(63, 212, 255, .15);
  font-size: 12.6px;
  line-height: 1.45;
  color: #cbe2ec;
}
.cm-agent-facts li strong { color: #fff; font-weight: 600; }

.cm-agent-wa-link {
  display: inline-block;
  margin-top: 8px;
  color: #4ef0b8;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(78, 240, 184, .65);
  transition: color .18s ease;
}
.cm-agent-wa-link:hover { color: #84f8ce; }

.cm-agent-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 11px 14px;
  border-radius: 6px 16px 16px 16px;
  background: rgba(13, 33, 54, .92);
  border: 1px solid rgba(63, 212, 255, .14);
}
.cm-agent-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cm-glow);
  opacity: .35;
  animation: cm-agent-bounce 1s infinite ease-in-out;
}
.cm-agent-typing span:nth-child(2) { animation-delay: .16s; }
.cm-agent-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes cm-agent-bounce {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.cm-agent-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(63, 212, 255, .14);
  background: #08182a;
}
.cm-agent-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid rgba(63, 212, 255, .22);
  border-radius: 99px;
  background: #040d18;
  color: #f4f8fa;
  font-size: 16px;
}
.cm-agent-input::placeholder { color: #6e92a3; }
.cm-agent-input:focus {
  outline: none;
  border-color: var(--cm-blue);
  box-shadow: 0 0 0 3px rgba(8, 173, 217, .18);
}
.cm-agent-send {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--cm-blue);
  color: #04121b;
  transition: background .18s ease, transform .18s ease;
}
.cm-agent-send:hover { background: var(--cm-glow); transform: scale(1.04); }
.cm-agent-send:focus-visible { outline: 2px solid var(--cm-glow); outline-offset: 2px; }
.cm-agent-send svg { width: 18px; height: 18px; }

.cm-agent-foot {
  padding: 6px 14px 9px;
  background: #061220;
  color: #6d90a0;
  font-size: 10.5px;
  text-align: center;
  line-height: 1.4;
}

@media (max-width: 540px) {
  .cm-agent { right: 12px; bottom: 12px; }
  .cm-agent-fab { min-height: 50px; padding: 7px 14px 7px 8px; }
  .cm-agent-fab-copy small { display: none; }
  .cm-agent-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    height: min(82svh, 580px);
    border-radius: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cm-agent-panel,
  .cm-agent-typing span { animation: none; }
}
