/* Botón flotante */
.ai-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #4caf50;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 1000;
}

/* Overlay & contenedor principal */
.ai-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
.ai-modal.hidden {
  display: none;
}

/* Modal content: header fijo, contenido scrollable, footer fijo */
.ai-modal-content {
  width: 600px;
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  display: grid;
  grid-template-rows:
    auto   /* header: siempre visible */
    1fr    /* contenido: chat o advanced, hará scroll */
    auto   /* footer: siempre visible */
  ;
  overflow: hidden;    /* quitamos cualquier scroll aquí */
}

/* Header & Footer */
.ai-modal-header,
.ai-modal-footer {
  background: #E3F2FD;
  padding: 8px;
}
.ai-modal-header {
  display: flex;
  align-items: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.ai-modal-footer {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: #666;
}
.ai-header-logo {
  height: 24px;
  margin-right: 0.5rem;
}
.ai-header-title {
  flex: 1;
  font-weight: 600;
  color: #333;
}
.ai-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

/* ------------------ */
/* CONTENIDO SCROLL   */
/* ------------------ */
/* Tanto chat ligero como modo avanzado harán scroll aquí */
.ai-modal-content > .ai-chat,
.ai-modal-content > #aiAdvanced {
  overflow-y: auto;
}

/* Chat ligero */
.ai-chat {
  display: flex;
  flex-direction: column;
  height: 100%;      /* ocupa todo el 1fr disponible */
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.ai-chat-prompt-wrapper,
.chat-bar {
   display: flex;
   flex-wrap: wrap;
   align-items: center;
   gap: 0.5rem;
   padding: 8px;
 }
 /* Input redondeado */
.chat-input {
  flex: 1;                         /* ocupa todo el espacio posible */
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 9999px;           /* forma pill */
  font-size: 1rem;
}


/* Burbuja de chat */
.ai-chat-bubble {
  max-width: 80%;
  padding: 0.5rem 1rem;
  margin: 0.3rem 0;
  border-radius: 1rem;
  line-height: 1.4;
}
.ai-chat-bubble.user {
  background: #DCF8C6;
  align-self: flex-end;
}
.ai-chat-bubble.bot {
  background: #EEE;
  align-self: flex-start;
}

/* ------------------ */
/* MODO AVANZADO      */
/* ------------------ */
.ai-modal-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #eef5ff;
}
.ai-modal-tabs button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: bold;
  border-radius: 4px;
  transition: background 0.2s;
}
.ai-modal-tabs button.active,
.ai-modal-tabs button:hover {
  background: #4f7cff;
  color: #fff;
}

.ai-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
}
.ai-spinner {
  text-align: center;
  font-style: italic;
  margin: 1rem 0;
}
#aiSuggestions {
  flex: 1 1 auto;
  min-height: 0; /* para que flex pueda encoger */
  overflow-y: auto;
}
.ai-modal-items {
  margin: 0.5rem;
}

/* Splitter horizontal */
#aiSplitter,
.ai-splitter {
  flex: 0 0 auto;
  height: 6px;
  background: transparent;
  cursor: row-resize;
  position: relative;
  z-index: 10;
}
.ai-splitter.dragging {
  background: rgba(0,0,0,0.1);
}

/* Vistas internas */
#aiViewTabs {
  flex: 0 0 auto;
  border-top: 1px solid #ccc;
}
#aiTabContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

/* Ítems de sugerencias */
.ai-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fffbea;
  padding: 0.5rem;
  margin: 0.3rem 0.5rem;
  border-radius: 0.5rem;
}
.ai-item-icon {
  font-size: 1.2rem;
}
.ai-item-text {
  flex: 1;
  margin: 0 0.5rem;
  word-break: break-word;
}
.ai-item-btn {
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.ai-item-btn.btn-suggest {
  background: #6c5ce7;
  color: #fff;
}
.ai-item-btn.btn-suggest:hover {
  background: #5a4abd;
}
.ai-item-btn.btn-copy {
  background: #0984e3;
  color: #fff;
}
.ai-item-btn.btn-copy:hover {
  background: #076bb5;
}
.ai-item-spinner {
  margin-left: 0.5rem;
}

/* Ocultos */
.hidden {
  display: none;
}

/* Scrollbars personalizadas (opcional) */
.ai-chat-messages::-webkit-scrollbar,
#aiSuggestions::-webkit-scrollbar {
  width: 6px;
}
.ai-chat-messages::-webkit-scrollbar-thumb,
#aiSuggestions::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}



/* ------------------------ */
/* MODAL DE MEMORIA LLENA   */
/* ------------------------ */
#memoryModal .ai-modal-content {
  width: 400px;
  max-height: 70vh;
  display: grid;
  grid-template-rows:
    auto  /* header fijo */
    1fr   /* lista scrollable */
    auto  /* footer fijo */
  ;
}
#memoryModal .ai-modal-body {
  overflow-y: auto;
  padding: 8px;
}
#memoryModal .ai-modal-header,
#memoryModal .ai-chat-controls {
  background: #ffeded;
}
#memoryModal .ai-chat-controls button {
  background: #ff5252;
  color: #fff;
}
#memoryModal .ai-chat-controls button:hover {
  background: #e04848;
}
/* Contenedor pill para los dos iconos */
.button-group {
  display: flex;
  border-radius: 9999px;
  overflow: hidden;                /* une visualmente los dos botones */
  background: #f0f0f0;
}

/* Estilo base de cada botón icono */
.btn.icon-btn {
  border: none;
  background: none;
  padding: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Hover suave */
.btn.icon-btn:hover {
  background: rgba(0,0,0,0.05);
}

/* Si quieres diferenciar colores (opcional) */
.send-btn img,
.lock-btn img {
  width: 1.25rem;
  height: 1.25rem;
}


/* ── Botón salir del modo avanzado ─────────────────────────────── */
.ai-exit-btn {
  display: block;                 /* ancho completo */
  width: 100%;
  margin: 12px 0 4px;
  padding: 10px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;                    /* texto blanco */
  background: #5668ff;            /* mismo azul que tabs activos */
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ai-exit-btn:hover {
  background: #4152f4;            /* tono un poco más oscuro */
}

/* dark-mode opcional:
:root[data-theme="dark"] .ai-exit-btn {
  background:#4d6bff;
}
*/


.toast{
  position:fixed;bottom:20px;left:50%;transform:translateX(-50%);
  background:#333;color:#fff;padding:10px 16px;border-radius:8px;
  opacity:0;transition:opacity .3s;font-size:.9rem;z-index:9999}
.toast.show{opacity:1}


/* 1 ─ Botón redondo de refresco (⟳) */
.ai-icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;                 /* mismo alto que el Close */
  height:28px;
  margin:0 6px 0 4px;         /* respeta el logo y el subtitle */
  border:none;
  border-radius:50%;
  background:#f0f0f0;
  font-size:15px;             /* icono ⟳ */
  cursor:pointer;
  transition:background .2s;
}
.ai-icon-btn:hover{ background:#e2e2e2; }

/* 2 ─ Spinner global pequeño */
.ai-spinner.small{
  font-size:13px;             /* más discreto que el central */
  margin-left:6px;
  animation:ai-spin 1s linear infinite;
}
@keyframes ai-spin{
  to{ transform:rotate(1turn); }
}

/* 3 ─ Utilidad ocultar / mostrar */
.hidden{ display:none!important; }   /* ya existía; repite sólo si no la tienes */

/* ─────────────────────────────────────────────────────────── */
/* DARK MODE OVERRIDES ADICIONALES PARA AI CANVAS (theme “nv”) */
/* ─────────────────────────────────────────────────────────── */
.dark-mode {
  /* Overlay del modal */
  .ai-modal {
    background: rgba(0, 0, 0, 0.8) !important;
  }

  /* Contenedor principal */
  .ai-modal-content {
    background: #1b1b28 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7) !important;
    color: #e0e0e0 !important;
  }

 

  /* Header fijo con neón en la base */
  .ai-modal-header {
    background: #27273c !important;
    color: #fff !important;
    position: relative;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
  .ai-modal-header .ai-header-title {
    color: #fff !important;
  }
  .ai-modal-header::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f7cff, #715ce7, #4f7cff);
    filter: drop-shadow(0 0 6px rgba(111,122,255,0.8));
  }

  /* Pestañas (Todas / Repetidas / Débiles) */
  .ai-modal-tabs {
    background: transparent !important;
    display: flex;
    gap: 12px;
    padding: 8px 16px;
  }
  .ai-modal-tabs button {
    flex: none;
    padding: 6px 14px;
    background: #2e2e42 !important;
    color: #ccc !important;
    border-radius: 6px;
    border: 1px solid #3a3a5a;
    transition: all 0.2s;
  }
  .ai-modal-tabs button.active {
    background: #3a3a5a !important;
    color: #fff !important;
    border: 1px solid #4f7cff !important;
    box-shadow: 0 0 8px rgba(79,124,255,0.6);
  }

  /* Burbujas de chat */
  .ai-chat-bubble.bot {
    background: #2e2e3c !important;
    color: #ddd !important;
  }
  .ai-chat-bubble.user {
    background: #3a3a4d !important;
    color: #fff !important;
  }

  /* Ítems de sugerencias */
  .ai-item {
    background: #2e2e42 !important;
    color: #e0e0e0 !important;
    margin: 10px 16px;
    padding: 14px 18px !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  }
  .ai-item-icon {
    color: #a3a3a3 !important;
  }

  /* Botones “Sugerir” y “Copiar” */
  .ai-item-btn.btn-suggest {
    background: #715ce7 !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(113,92,231,0.6);
  }
  .ai-item-btn.btn-suggest:hover {
    background: #624bcc !important;
  }
  .ai-item-btn.btn-copy {
    background: #0874c1 !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(8,116,193,0.6);
  }
  .ai-item-btn.btn-copy:hover {
    background: #0661a3 !important;
  }

  /* Forzar iconos en modo normal (sin matices) */
  .ai-modal-content img {
    filter: none !important;
    mix-blend-mode: normal !important;
    background: none !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Botón “Análisis” en outline con glow */
  .ai-modal-footer {
    background: #27273c !important;
    padding: 16px !important;
    position: relative;
    border-top: 3px solid transparent;
  }
  .ai-modal-footer button,
  .ai-modal-footer .btn {
    display: block;
    width: calc(100% - 32px);
    margin: 0 auto;
    padding: 14px 0;
    font-size: 1.1rem;
    font-weight: 600;
    background: transparent !important;
    color: #fff !important;
    border: 2px solid #4f7cff !important;
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(79,124,255,0.6);
    transition: background 0.2s;
  }
  .ai-modal-footer button:hover,
  .ai-modal-footer .btn:hover {
    background: rgba(79,124,255,0.1) !important;
  }
  .ai-modal-footer::before {
    content: "";
    position: absolute;
    top: 0; left: 16px; right: 16px;
    height: 3px;
    background: linear-gradient(90deg, #4f7cff, #715ce7, #4f7cff);
    filter: drop-shadow(0 0 6px rgba(111,122,255,0.8));
  }

  /* Inputs y placeholders */
  .chat-input,
  .ai-modal input {
    background: #2e2e42 !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
  }
  .chat-input::placeholder,
  .ai-modal input::placeholder {
    color: #777 !important;
  }

  /* Toasts y alertas */
  .ai-modal .toast,
  .ai-modal .alert,
  .ai-modal .ai-chat-notice {
    background: #333 !important;
    color: #eee !important;
    border-color: #444 !important;
  }

  /* Scrollbars oscuros con thumb neón */
  .ai-chat-messages::-webkit-scrollbar,
  #aiSuggestions::-webkit-scrollbar {
    width: 6px;
  }
  .ai-chat-messages::-webkit-scrollbar-track,
  #aiSuggestions::-webkit-scrollbar-track {
    background: #1b1b28 !important;
  }
  .ai-chat-messages::-webkit-scrollbar-thumb,
  #aiSuggestions::-webkit-scrollbar-thumb {
    background: rgba(79,124,255,0.4);
    border-radius: 3px;
  }

  /* Selección de texto */
  .ai-modal-content ::selection,
  .ai-modal-content ::-moz-selection {
    background: rgba(79,124,255,0.4) !important;
    color: #fff !important;
  }
}



.ai-chat-row{
  width:100%;
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:8px 0;
}

.ai-chat-row.user{
  justify-content:flex-end;
}

.ai-chat-row.bot{
  justify-content:flex-start;
}

.ai-bot-avatar{
  width:34px;
  height:34px;
  object-fit:contain;
  flex:0 0 auto;
  margin-top:4px;
}

.ai-chat-bubble{
  max-width:76%;
  padding:12px 16px;
  border-radius:18px;
  line-height:1.45;
}

.ai-chat-bubble.user{
  margin-left:auto;
  background:linear-gradient(135deg,#2563eb,#7c3aed);
  color:#fff;
  border-bottom-right-radius:6px;
  text-align:left;
}

.ai-chat-bubble.bot{
  background:#343244;
  color:#f4f4f7;
  border-bottom-left-radius:6px;
  text-align:left;
}

.ai-chat-row.typing .ai-chat-bubble{
  opacity:.85;
}

/* =========================================================
   REDISEÑO BARRA DE ENTRADA — SAFEPASS AI
   ========================================================= */

/* El scroll lo controla el área de mensajes, no el chat completo */
#aiModal .ai-chat {
  min-height: 0;
  overflow: visible !important;
}

/* Contenedor exterior inferior */
#aiModal .ai-chat-prompt-wrapper {
  position: relative;
  flex: 0 0 auto;
  display: block;
  width: 100%;
  padding: 14px 16px 13px;
  margin: 0;
  gap: 0;
  overflow: visible;

  background:
    radial-gradient(
      circle at 82% 20%,
      rgba(91, 75, 255, 0.13),
      transparent 34%
    ),
    linear-gradient(
      180deg,
      rgba(12, 20, 42, 0.96),
      rgba(7, 14, 31, 0.98)
    ) !important;

  border-top: 1px solid rgba(83, 128, 255, 0.16);
}

/* Línea luminosa superior muy sutil */
#aiModal .ai-chat-prompt-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 7%;
  right: 7%;
  height: 1px;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(75, 139, 255, 0.75),
    rgba(125, 76, 255, 0.8),
    transparent
  );

  box-shadow: 0 0 12px rgba(90, 98, 255, 0.55);
}

/* Caja que une input, selector y botón */
#aiModal .ai-prompt-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 8px;

  min-height: 62px;
  padding: 6px 7px 6px 6px;

  background:
    linear-gradient(
      135deg,
      rgba(10, 18, 39, 0.98),
      rgba(8, 15, 34, 0.98)
    ) !important;

  border: 1px solid rgba(77, 132, 255, 0.62);
  border-radius: 16px;

  box-shadow:
    inset 0 0 0 1px rgba(118, 76, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 0 22px rgba(54, 97, 255, 0.1);

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* Glow cuando se escribe */
#aiModal .ai-prompt-shell:focus-within {
  border-color: rgba(82, 145, 255, 0.92);

  box-shadow:
    inset 0 0 0 1px rgba(130, 75, 255, 0.16),
    0 0 0 3px rgba(63, 104, 255, 0.08),
    0 0 25px rgba(61, 92, 255, 0.17);
}

/* Input totalmente integrado */
#aiModal .ai-prompt-shell .chat-input {
  min-width: 0;
  width: 100%;
  height: 48px;

  padding: 0 12px 0 13px;
  margin: 0;

  background: transparent !important;
  background-color: transparent !important;

  border: 0 !important;
  border-radius: 12px;

  outline: none !important;
  box-shadow: none !important;

  color: #f5f7ff !important;

  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 400;
  line-height: 1;
}

/* Placeholder */
#aiModal .ai-prompt-shell .chat-input::placeholder {
  color: rgba(191, 199, 222, 0.56) !important;
  opacity: 1;
}

/* =========================================================
   SELECTOR PRO / DOM / AVANZADO
   ========================================================= */

#aiModal .ai-mode-selector {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 30;
}

/* Botón visible del selector */
#aiModal .ai-mode-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  height: 42px;
  min-width: 94px;
  padding: 0 12px;

  background:
    linear-gradient(
      180deg,
      rgba(20, 31, 58, 0.96),
      rgba(13, 22, 43, 0.96)
    ) !important;

  border: 1px solid rgba(112, 137, 194, 0.22);
  border-radius: 12px;

  color: #eef2ff !important;

  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;

  cursor: pointer;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 5px 14px rgba(0, 0, 0, 0.14);

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

#aiModal .ai-mode-trigger:hover {
  background:
    linear-gradient(
      180deg,
      rgba(25, 39, 72, 0.98),
      rgba(16, 27, 52, 0.98)
    ) !important;

  border-color: rgba(91, 137, 255, 0.48);
}

#aiModal .ai-mode-trigger:active {
  transform: translateY(1px);
}

/* Chispita IA */
#aiModal .ai-mode-spark {
  color: #5595ff !important;
  font-size: 1rem;
  line-height: 1;

  text-shadow:
    0 0 8px rgba(75, 131, 255, 0.85),
    0 0 14px rgba(125, 75, 255, 0.45);
}

/* Flecha */
#aiModal .ai-mode-chevron {
  width: 16px;
  height: 16px;
  color: rgba(214, 221, 242, 0.72) !important;
  transition: transform 0.2s ease;
}

#aiModal .ai-mode-trigger[aria-expanded="true"] .ai-mode-chevron {
  transform: rotate(180deg);
}

/* Menú */
#aiModal .ai-mode-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);

  width: 226px;
  padding: 7px;

  background:
    linear-gradient(
      165deg,
      rgba(15, 25, 50, 0.99),
      rgba(8, 15, 33, 0.99)
    ) !important;

  border: 1px solid rgba(84, 126, 230, 0.36);
  border-radius: 15px;

  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.46),
    0 0 24px rgba(62, 84, 255, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);

  z-index: 100;
}

/* Cada opción */
#aiModal .ai-mode-option {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;

  width: 100%;
  min-height: 50px;
  padding: 7px 9px;
  margin: 0;

  background: transparent !important;
  border: 0;
  border-radius: 10px;

  color: #e8edff !important;
  text-align: left;

  cursor: pointer;

  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

#aiModal .ai-mode-option:hover {
  background: rgba(72, 103, 200, 0.15) !important;
}

/* El avanzado es un button */
#aiModal .ai-mode-option-button {
  font-family: inherit;
}

/* Radios nativos ocultos */
#aiModal .ai-mode-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Icono de opción */
#aiModal .ai-mode-option-icon {
  display: grid;
  place-items: center;

  width: 28px;
  height: 28px;

  background: rgba(69, 112, 255, 0.1) !important;
  border: 1px solid rgba(92, 133, 255, 0.18);
  border-radius: 8px;

  color: #669aff !important;
  font-size: 0.88rem;
}

/* Texto de opción */
#aiModal .ai-mode-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#aiModal .ai-mode-option-copy strong {
  color: #f4f6ff !important;
  font-size: 0.82rem;
  font-weight: 650;
}

#aiModal .ai-mode-option-copy small {
  color: rgba(185, 196, 225, 0.57) !important;
  font-size: 0.66rem;
  font-weight: 400;
}

/* Circulito indicador */
#aiModal .ai-mode-check {
  display: block;
  width: 10px;
  height: 10px;

  border: 1px solid rgba(140, 157, 202, 0.48);
  border-radius: 50%;

  box-shadow: inset 0 0 0 2px rgba(9, 17, 36, 1);
}

/* Opción seleccionada */
#aiModal .ai-mode-option:has(input:checked) {
  background: rgba(68, 102, 215, 0.16) !important;
}

#aiModal .ai-mode-option:has(input:checked) .ai-mode-check {
  background: linear-gradient(135deg, #3d91ff, #7650ff) !important;
  border-color: rgba(104, 150, 255, 0.9);

  box-shadow:
    inset 0 0 0 2px rgba(9, 17, 36, 1),
    0 0 8px rgba(77, 111, 255, 0.75);
}

/* =========================================================
   BOTÓN ENVIAR
   ========================================================= */

#aiModal .ai-prompt-shell .ai-send-btn {
  display: grid !important;
  place-items: center !important;

  width: 46px !important;
  height: 46px !important;
  min-width: 46px;

  padding: 0 !important;
  margin: 0;

  background:
    linear-gradient(
      145deg,
      #4a96ff 0%,
      #5262ff 48%,
      #743fff 100%
    ) !important;

  border: 1px solid rgba(128, 178, 255, 0.78) !important;
  border-radius: 13px !important;

  color: #ffffff !important;

  cursor: pointer;

  box-shadow:
    0 7px 18px rgba(65, 73, 255, 0.34),
    0 0 15px rgba(67, 121, 255, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

#aiModal .ai-prompt-shell .ai-send-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);

  box-shadow:
    0 9px 22px rgba(66, 71, 255, 0.43),
    0 0 20px rgba(69, 129, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

#aiModal .ai-prompt-shell .ai-send-btn:active {
  transform: translateY(1px) scale(0.98);
}

#aiModal .ai-prompt-shell .ai-send-btn svg {
  width: 22px;
  height: 22px;
  transform: translateX(1px);
  color: #ffffff !important;
}

/* =========================================================
   FRANJA DE CONFIANZA
   ========================================================= */

#aiModal .ai-trust-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;

  margin-top: 10px;
  padding: 10px 2px 0;

  border-top: 1px solid rgba(90, 119, 181, 0.13);
}

#aiModal .ai-trust-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-width: 0;
  padding: 0 8px;

  color: rgba(188, 199, 225, 0.68) !important;

  font-size: 0.62rem;
  font-weight: 450;
  line-height: 1.2;
  white-space: nowrap;
}

/* Separadores */
#aiModal .ai-trust-item:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;

  width: 1px;
  height: 18px;

  background: linear-gradient(
    180deg,
    transparent,
    rgba(107, 128, 180, 0.27),
    transparent
  );
}

#aiModal .ai-trust-item svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;

  color: #4d8fff !important;

  filter: drop-shadow(0 0 5px rgba(66, 116, 255, 0.32));
}

/* El footer viejo ya no hace falta porque tenemos la franja */
#aiModal > .ai-modal-content > .ai-modal-footer {
  display: none !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 640px) {
  #aiModal .ai-chat-prompt-wrapper {
    padding: 11px;
  }

  #aiModal .ai-prompt-shell {
    grid-template-columns: minmax(0, 1fr) auto 44px;
    gap: 5px;
    min-height: 58px;
    padding: 5px;
    border-radius: 14px;
  }

  #aiModal .ai-prompt-shell .chat-input {
    height: 46px;
    padding-left: 10px;
    font-size: 0.84rem;
  }

  #aiModal .ai-mode-trigger {
    min-width: 76px;
    height: 40px;
    padding: 0 9px;
    gap: 5px;
    font-size: 0.8rem;
  }

  #aiModal .ai-mode-spark {
    font-size: 0.85rem;
  }

  #aiModal .ai-mode-chevron {
    width: 14px;
    height: 14px;
  }

  #aiModal .ai-prompt-shell .ai-send-btn {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px;
    border-radius: 12px !important;
  }

  #aiModal .ai-mode-menu {
    right: -49px;
    width: 214px;
  }

  #aiModal .ai-trust-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 10px;
  }

  #aiModal .ai-trust-item {
    justify-content: flex-start;
    padding: 0 5px;
    white-space: normal;
    font-size: 0.61rem;
  }

  #aiModal .ai-trust-item::after {
    display: none;
  }
}

@media (max-width: 410px) {
  #aiModal .ai-prompt-shell {
    grid-template-columns: minmax(0, 1fr) 69px 42px;
  }

  #aiModal .ai-mode-trigger {
    min-width: 69px;
    padding: 0 7px;
  }

  #aiModal .ai-mode-spark {
    display: none;
  }

  #aiModal .ai-prompt-shell .chat-input {
    font-size: 0.8rem;
  }
}



/* =========================================================
   SAFEPASS AI — TEMA BUSINESS INSTITUCIONAL
   Navy + Slate + Azul corporativo
   ========================================================= */

#aiModal {
  --ai-canvas: #10141f;
  --ai-surface: #151a27;
  --ai-surface-soft: #1a2030;
  --ai-control: #20283a;
  --ai-control-hover: #263047;

  --ai-border: #2b3549;
  --ai-border-strong: #3a4862;

  --ai-accent: #5f7eea;
  --ai-accent-hover: #6d89ee;
  --ai-accent-soft: rgba(95, 126, 234, 0.12);

  --ai-text: #f3f5f9;
  --ai-text-soft: #c2cada;
  --ai-muted: #8f9bb1;
}

/* =========================================================
   CONTENEDOR GENERAL
   ========================================================= */

#aiModal .ai-modal-content {
  background: var(--ai-canvas) !important;

  border: 1px solid rgba(74, 88, 116, 0.7);
  border-radius: 18px;

  color: var(--ai-text) !important;

  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.48),
    0 4px 18px rgba(0, 0, 0, 0.22) !important;
}

/* =========================================================
   HEADER
   ========================================================= */

#aiModal .ai-modal-header {
  min-height: 68px;
  padding: 13px 17px;

  background: var(--ai-surface) !important;

  border-bottom: 1px solid var(--ai-border);
  border-radius: 18px 18px 0 0;

  color: var(--ai-text) !important;
}

/* Elimina la línea neón antigua */
#aiModal .ai-modal-header::after {
  display: none !important;
}

#aiModal .ai-header-logo {
  width: 29px;
  height: 29px;
  margin-right: 10px;

  object-fit: contain;
}

#aiModal .ai-header-title {
  color: var(--ai-text) !important;

  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

#aiModal .ai-header-subtitle {
  margin-left: 9px;

  color: var(--ai-muted) !important;

  font-size: 0.78rem;
  font-weight: 450;
  white-space: nowrap;
}

/* Refrescar */
#aiModal .ai-icon-btn {
  width: 32px;
  height: 32px;
  margin: 0 3px;

  background: transparent !important;
  border: 1px solid transparent;
  border-radius: 9px;

  color: var(--ai-muted) !important;

  box-shadow: none !important;
}

#aiModal .ai-icon-btn:hover {
  background: var(--ai-control) !important;
  border-color: var(--ai-border);

  color: var(--ai-text) !important;
}

/* Cerrar */
#aiModal .ai-close-btn {
  display: grid;
  place-items: center;

  width: 34px;
  height: 34px;
  margin-left: 7px;
  padding: 0;

  background: transparent !important;
  border: 1px solid transparent;
  border-radius: 9px;

  color: var(--ai-muted) !important;

  font-family: Arial, sans-serif;
  font-size: 27px;
  font-weight: 300;
  line-height: 1;

  box-shadow: none !important;

  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

#aiModal .ai-close-btn:hover {
  background: rgba(255, 255, 255, 0.045) !important;
  border-color: var(--ai-border);

  color: var(--ai-text) !important;
}

/* =========================================================
   ÁREA DE CONVERSACIÓN
   ========================================================= */

#aiModal .ai-chat {
  background: var(--ai-canvas) !important;
}

#aiModal .ai-chat-messages {
  padding: 24px 26px;
}

/* Burbuja usuario */
#aiModal .ai-chat-bubble.user {
  background: #293249 !important;

  border: 1px solid #36425d;
  border-radius: 17px 17px 6px 17px;

  color: var(--ai-text) !important;

  box-shadow: none !important;
}

/* Burbuja asistente */
#aiModal .ai-chat-bubble.bot {
  background: #202635 !important;

  border: 1px solid #293246;
  border-radius: 17px 17px 17px 6px;

  color: #e7eaf1 !important;

  box-shadow: none !important;
}

/* Panda menos saturado */
#aiModal .ai-bot-avatar {
  opacity: 0.82;
  filter: saturate(0.75) !important;
}

/* =========================================================
   CONTENEDOR INFERIOR
   ========================================================= */

#aiModal .ai-chat-prompt-wrapper {
  background: var(--ai-surface) !important;

  border-top: 1px solid var(--ai-border);

  box-shadow: none !important;
}

/* Elimina la línea luminosa */
#aiModal .ai-chat-prompt-wrapper::before {
  display: none !important;
}

/* Caja principal */
#aiModal .ai-prompt-shell {
  background: #111722 !important;

  border: 1px solid var(--ai-border-strong);
  border-radius: 14px;

  box-shadow: none !important;
}

/* Focus profesional, sin glow gamer */
#aiModal .ai-prompt-shell:focus-within {
  border-color: var(--ai-accent);

  box-shadow:
    0 0 0 3px rgba(95, 126, 234, 0.11) !important;
}

/* Input */
#aiModal .ai-prompt-shell .chat-input {
  background: transparent !important;
  border: 0 !important;

  color: var(--ai-text) !important;

  box-shadow: none !important;
}

#aiModal .ai-prompt-shell .chat-input::placeholder {
  color: #77849a !important;
}

/* =========================================================
   SELECTOR DE MODO
   ========================================================= */

#aiModal .ai-mode-trigger {
  background: var(--ai-control) !important;

  border: 1px solid var(--ai-border);
  border-radius: 11px;

  color: var(--ai-text-soft) !important;

  box-shadow: none !important;
}

#aiModal .ai-mode-trigger:hover {
  background: var(--ai-control-hover) !important;
  border-color: var(--ai-border-strong);

  color: var(--ai-text) !important;
}

/* Chispa sin resplandor */
#aiModal .ai-mode-spark {
  color: var(--ai-accent) !important;
  text-shadow: none !important;
}

#aiModal .ai-mode-chevron {
  color: var(--ai-muted) !important;
}

/* Menú desplegable */
#aiModal .ai-mode-menu {
  background: #171d2a !important;

  border: 1px solid var(--ai-border-strong);
  border-radius: 13px;

  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.42) !important;
}

/* Opciones */
#aiModal .ai-mode-option {
  background: transparent !important;

  border: 1px solid transparent;
  border-radius: 9px;

  color: var(--ai-text-soft) !important;
}

#aiModal .ai-mode-option:hover {
  background: var(--ai-control) !important;
  border-color: rgba(66, 80, 108, 0.7);
}

/* Opción seleccionada */
#aiModal .ai-mode-option:has(input:checked) {
  background: var(--ai-accent-soft) !important;
  border-color: rgba(95, 126, 234, 0.28);
}

/* Iconos del menú */
#aiModal .ai-mode-option-icon {
  background: #222b3f !important;

  border: 1px solid #303c55;

  color: var(--ai-accent) !important;
}

/* Textos */
#aiModal .ai-mode-option-copy strong {
  color: var(--ai-text) !important;
}

#aiModal .ai-mode-option-copy small {
  color: var(--ai-muted) !important;
}

/* Indicador */
#aiModal .ai-mode-check {
  border-color: #566177;

  box-shadow:
    inset 0 0 0 2px #171d2a !important;
}

#aiModal .ai-mode-option:has(input:checked) .ai-mode-check {
  background: var(--ai-accent) !important;
  border-color: var(--ai-accent);

  box-shadow:
    inset 0 0 0 2px #171d2a !important;
}

/* =========================================================
   BOTÓN ENVIAR
   ========================================================= */

#aiModal .ai-prompt-shell .ai-send-btn {
  background: var(--ai-accent) !important;

  border: 1px solid #708ced !important;
  border-radius: 12px !important;

  color: #ffffff !important;

  box-shadow:
    0 5px 12px rgba(0, 0, 0, 0.24) !important;
}

#aiModal .ai-prompt-shell .ai-send-btn:hover {
  background: var(--ai-accent-hover) !important;

  transform: translateY(-1px);

  filter: none !important;

  box-shadow:
    0 7px 16px rgba(0, 0, 0, 0.28) !important;
}

#aiModal .ai-prompt-shell .ai-send-btn:active {
  transform: translateY(0);
}

/* =========================================================
   FRANJA DE CONFIANZA
   ========================================================= */

#aiModal .ai-trust-strip {
  border-top: 1px solid rgba(63, 76, 101, 0.42);
}

#aiModal .ai-trust-item {
  color: var(--ai-muted) !important;
}

/* Iconos institucionales */
#aiModal .ai-trust-item svg {
  color: #6886e8 !important;

  filter: none !important;
}

/* Separadores discretos */
#aiModal .ai-trust-item:not(:last-child)::after {
  background: rgba(78, 91, 117, 0.42);
}

/* =========================================================
   MODO AVANZADO
   ========================================================= */

#aiModal .ai-modal-tabs {
  background: var(--ai-surface) !important;

  border-bottom: 1px solid var(--ai-border);
}

#aiModal .ai-modal-tabs button {
  background: transparent !important;

  border: 1px solid transparent;
  border-radius: 8px;

  color: var(--ai-muted) !important;

  box-shadow: none !important;
}

#aiModal .ai-modal-tabs button:hover {
  background: var(--ai-control) !important;

  color: var(--ai-text-soft) !important;
}

#aiModal .ai-modal-tabs button.active {
  background: var(--ai-control) !important;

  border-color: var(--ai-border-strong) !important;

  color: var(--ai-text) !important;

  box-shadow: none !important;
}

#aiModal .ai-item {
  background: var(--ai-surface-soft) !important;

  border: 1px solid var(--ai-border);

  color: var(--ai-text-soft) !important;

  box-shadow: none !important;
}

#aiModal .ai-item-btn.btn-suggest,
#aiModal .ai-item-btn.btn-copy,
#aiModal .ai-exit-btn {
  background: var(--ai-accent) !important;

  border: 1px solid #708ced;

  color: #ffffff !important;

  box-shadow: none !important;
}

#aiModal .ai-item-btn.btn-suggest:hover,
#aiModal .ai-item-btn.btn-copy:hover,
#aiModal .ai-exit-btn:hover {
  background: var(--ai-accent-hover) !important;
}

/* =========================================================
   SCROLLBAR
   ========================================================= */

#aiModal .ai-chat-messages::-webkit-scrollbar-track,
#aiModal #aiSuggestions::-webkit-scrollbar-track {
  background: transparent !important;
}

#aiModal .ai-chat-messages::-webkit-scrollbar-thumb,
#aiModal #aiSuggestions::-webkit-scrollbar-thumb {
  background: #38445d !important;
  border-radius: 999px;
}




/* Aviso del alcance del análisis por plan */
#aiModal .ai-scope-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  margin: 12px 16px 16px;
  padding: 14px 16px;

  background: #1a2030 !important;
  border: 1px solid #34415a;
  border-left: 3px solid #5f7eea;
  border-radius: 10px;

  color: #c5cede !important;
}

#aiModal .ai-scope-notice-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;

  min-width: 0;
}

#aiModal .ai-scope-notice-copy strong {
  color: #f1f4f9 !important;
  font-size: 0.84rem;
  font-weight: 650;
}

#aiModal .ai-scope-notice-copy span {
  color: #9ca8bb !important;
  font-size: 0.73rem;
  line-height: 1.45;
}

#aiModal .ai-scope-upgrade-btn {
  flex: 0 0 auto;

  padding: 8px 12px;

  background: #273149 !important;
  border: 1px solid #465675;
  border-radius: 8px;

  color: #e9edf6 !important;

  font-size: 0.73rem;
  font-weight: 600;

  cursor: pointer;
}

#aiModal .ai-scope-upgrade-btn:hover {
  background: #303b55 !important;
  border-color: #5f7197;
}

#aiModal .ai-analysis-error {
  margin: 18px 16px;
  padding: 14px 16px;

  background: rgba(190, 65, 74, 0.08) !important;
  border: 1px solid rgba(210, 80, 90, 0.26);
  border-radius: 10px;

  color: #d9a6aa !important;
  font-size: 0.8rem;
}

#aiModal .ai-empty-result {
  margin: 16px;
  padding: 16px 18px;

  background: #1a2030 !important;
  border: 1px solid #34415a;
  border-radius: 10px;

  color: #aeb9cc !important;
}

#aiModal .ai-empty-result > strong {
  display: block;
  margin-bottom: 7px;

  color: #f1f4f9 !important;
  font-size: 0.88rem;
}

#aiModal .ai-empty-result p {
  margin: 4px 0 0;

  color: #aeb9cc !important;
  font-size: 0.76rem;
  line-height: 1.55;
}

#aiModal .ai-empty-result p strong,
#aiModal .ai-empty-result p b {
  color: #dce3ef !important;
}

#aiModal #analysisResults {
  display: block;
  padding: 16px 20px;

  color: #b7c1d2 !important;
  font-size: 0.8rem;
  line-height: 1.65;
  opacity: 1 !important;
}





/* =========================================================
   SAFEPASS AI — PANEL DE CRÉDITOS Y TOP-UPS
   ========================================================= */

#aiModal .ai-credits-panel-row {
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 10px;
  align-items: flex-start;
}

#aiModal .ai-credits-panel-row .ai-bot-avatar {
  width: 31px;
  height: 31px;
  margin-top: 6px;
  opacity: 0.8;
}

/* Tarjeta principal */
#aiModal .ai-credits-panel {
  width: min(100%, 680px);
  min-width: 0;
  padding: 18px;

  background:
    linear-gradient(
      155deg,
      rgba(27, 34, 51, 0.98),
      rgba(19, 25, 39, 0.98)
    ) !important;

  border: 1px solid #34415a;
  border-radius: 15px;

  color: var(--ai-text, #f3f5f9) !important;

  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);

  overflow: hidden;
}

/* Cabecera */
#aiModal .ai-credits-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;

  margin-bottom: 15px;
}

#aiModal .ai-credits-panel-header > div {
  min-width: 0;
}

#aiModal .ai-credits-eyebrow {
  display: block;
  margin-bottom: 5px;

  color: #7f97ee !important;

  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#aiModal .ai-credits-panel h4 {
  margin: 0 !important;

  color: #f4f6fb !important;

  font-family: inherit !important;
  font-size: 1rem !important;
  font-weight: 650 !important;
  line-height: 1.28 !important;
  letter-spacing: -0.015em;
}

#aiModal .ai-credits-permanent {
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 27px;
  padding: 0 9px;

  background: rgba(76, 175, 128, 0.09) !important;
  border: 1px solid rgba(86, 190, 139, 0.22);
  border-radius: 999px;

  color: #80c9a5 !important;

  font-size: 0.65rem;
  font-weight: 650;
  white-space: nowrap;
}

/* Resumen de saldo */
#aiModal .ai-credit-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;

  margin-bottom: 14px;
}

#aiModal .ai-credit-stat {
  min-width: 0;
  padding: 11px 12px;

  background: #151c2a !important;
  border: 1px solid #2d394f;
  border-radius: 10px;
}

#aiModal .ai-credit-stat-label {
  display: block;
  margin-bottom: 4px;

  color: #8996aa !important;

  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.2;
}

#aiModal .ai-credit-stat-value {
  display: block;

  color: #eef2f8 !important;

  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.15;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Paquetes */
#aiModal .ai-topup-packages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#aiModal .ai-topup-package {
  position: relative;
  min-width: 0;
  padding: 13px;

  background: #1a2232 !important;
  border: 1px solid #303d54;
  border-radius: 11px;

  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

#aiModal .ai-topup-package:hover {
  transform: translateY(-1px);

  background: #1d2638 !important;
  border-color: #465a7d;
}

/* Paquete central como recomendado */
#aiModal .ai-topup-package:nth-child(2) {
  border-color: rgba(95, 126, 234, 0.58);

  background:
    linear-gradient(
      160deg,
      rgba(37, 48, 73, 0.98),
      rgba(27, 35, 53, 0.98)
    ) !important;
}

#aiModal .ai-topup-package:nth-child(2)::before {
  content: "Mejor valor";

  position: absolute;
  top: -8px;
  right: 10px;

  padding: 3px 7px;

  background: #5f7eea !important;
  border-radius: 999px;

  color: #ffffff !important;

  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

#aiModal .ai-topup-package-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;

  margin-bottom: 11px;
}

#aiModal .ai-topup-package-copy strong {
  color: #f3f5fa !important;

  font-size: 0.91rem;
  font-weight: 700;
  line-height: 1.2;
}

#aiModal .ai-topup-package-copy span {
  color: #9eabc0 !important;

  font-size: 0.72rem;
  font-weight: 500;
}

/* Botones comprar */
#aiModal .ai-topup-buy-btn {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;

  background: #263149 !important;
  border: 1px solid #3e4d6a;
  border-radius: 8px;

  color: #e9edf7 !important;

  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 650;

  cursor: pointer;

  box-shadow: none !important;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

#aiModal .ai-topup-buy-btn:hover {
  background: #303d59 !important;
  border-color: #536889;
  transform: translateY(-1px);
}

#aiModal .ai-topup-package:nth-child(2) .ai-topup-buy-btn {
  background: #5f7eea !important;
  border-color: #708ced;

  color: #ffffff !important;
}

#aiModal .ai-topup-package:nth-child(2) .ai-topup-buy-btn:hover {
  background: #6d89ee !important;
  border-color: #7e98ef;
}

#aiModal .ai-topup-buy-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

/* Nota de pago seguro */
#aiModal .ai-topup-note {
  position: relative;

  margin: 14px 0 0 !important;
  padding: 11px 12px 11px 35px;

  background: rgba(70, 87, 120, 0.08) !important;
  border: 1px solid rgba(75, 92, 126, 0.24);
  border-radius: 9px;

  color: #8e9bb0 !important;

  font-size: 0.66rem !important;
  font-weight: 400;
  line-height: 1.45 !important;
}

#aiModal .ai-topup-note::before {
  content: "✓";

  position: absolute;
  left: 12px;
  top: 50%;

  display: grid;
  place-items: center;

  width: 15px;
  height: 15px;

  background: rgba(95, 126, 234, 0.15) !important;
  border: 1px solid rgba(95, 126, 234, 0.32);
  border-radius: 50%;

  color: #86a0f4 !important;

  font-size: 0.56rem;
  font-weight: 800;

  transform: translateY(-50%);
}

/* Cargando y error */
#aiModal .ai-credits-loading,
#aiModal .ai-credits-error {
  padding: 14px;

  background: #151c2a !important;
  border: 1px solid #2d394f;
  border-radius: 10px;

  color: #9ca8ba !important;

  font-size: 0.73rem;
  line-height: 1.4;
}

#aiModal .ai-credits-loading {
  animation: aiCreditsPulse 1.4s ease-in-out infinite;
}

#aiModal .ai-credits-error {
  border-color: rgba(210, 80, 90, 0.28);

  color: #d2a0a5 !important;
}

@keyframes aiCreditsPulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

/* Evita tamaños heredados raros */
#aiModal .ai-credits-panel *,
#aiModal .ai-credits-panel *::before,
#aiModal .ai-credits-panel *::after {
  box-sizing: border-box;
}

/* =========================================================
   RESPONSIVE DEL PANEL DE CRÉDITOS
   ========================================================= */

@media (max-width: 720px) {
  #aiModal .ai-credits-panel {
    padding: 15px;
  }

  #aiModal .ai-credit-stats {
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    overflow-x: auto;
    padding-bottom: 3px;
  }

  #aiModal .ai-topup-packages {
    grid-template-columns: 1fr;
  }

  #aiModal .ai-topup-package {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 104px;
    align-items: center;
    gap: 10px;
  }

  #aiModal .ai-topup-package-copy {
    margin: 0;
  }

  #aiModal .ai-topup-package:nth-child(2)::before {
    top: -7px;
  }
}

@media (max-width: 480px) {
  #aiModal .ai-chat-messages {
    padding: 15px 12px;
  }

  #aiModal .ai-credits-panel-row {
    gap: 6px;
  }

  #aiModal .ai-credits-panel-row .ai-bot-avatar {
    width: 25px;
    height: 25px;
  }

  #aiModal .ai-credits-panel {
    padding: 13px;
    border-radius: 13px;
  }

  #aiModal .ai-credits-panel-header {
    gap: 8px;
  }

  #aiModal .ai-credits-panel h4 {
    font-size: 0.88rem !important;
  }

  #aiModal .ai-credits-permanent {
    min-height: 24px;
    padding: 0 7px;
    font-size: 0.58rem;
  }

  #aiModal .ai-credit-stats {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  #aiModal .ai-credit-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding: 9px 10px;
  }

  #aiModal .ai-credit-stat-label {
    margin: 0;
  }

  #aiModal .ai-credit-stat-value {
    font-size: 0.82rem;
  }

  #aiModal .ai-topup-package {
    grid-template-columns: minmax(0, 1fr) 90px;
    padding: 11px;
  }

  #aiModal .ai-topup-buy-btn {
    min-height: 32px;
    font-size: 0.65rem;
  }

  #aiModal .ai-topup-note {
    padding-left: 32px;
    font-size: 0.61rem !important;
  }
}



/* =========================================================
   SAFEPASS AI — INDICADOR COMPACTO DE CRÉDITOS
   ========================================================= */

#aiModal .ai-credits-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  min-height: 31px;
  padding: 0 10px;
  margin-left: 4px;

  background: #20283a !important;
  border: 1px solid #303b52;
  border-radius: 9px;

  color: #cbd3e2 !important;

  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1;

  cursor: pointer;

  box-shadow: none !important;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

#aiModal .ai-credits-indicator:hover,
#aiModal .ai-credits-indicator[aria-expanded="true"] {
  background: #263047 !important;
  border-color: #465675;

  color: #f1f4fa !important;
}

#aiModal .ai-credits-indicator-dot {
  width: 7px;
  height: 7px;

  background: #6f8dec !important;
  border-radius: 50%;

  box-shadow:
    0 0 0 3px rgba(95, 126, 234, 0.1);
}

#aiModal .ai-credits-indicator[data-empty="true"] {
  border-color: rgba(205, 113, 74, 0.34);

  color: #d9b09b !important;
}

#aiModal
.ai-credits-indicator[data-empty="true"]
.ai-credits-indicator-dot {
  background: #d5845f !important;

  box-shadow:
    0 0 0 3px rgba(213, 132, 95, 0.1);
}

@media (max-width: 720px) {
  #aiModal .ai-credits-indicator {
    min-height: 29px;
    padding: 0 8px;
    font-size: 0.65rem;
  }

  #aiModal .ai-header-subtitle {
    display: none;
  }
}

@media (max-width: 480px) {
  #aiModal .ai-credits-indicator {
    margin-left: auto;
  }

  #aiModal .ai-icon-btn {
    display: none;
  }
}