/* ==========================================================================
   GINNOA · Components — buttons, cards, forms básicos
   ========================================================================== */

/* ---- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--button-size);
  font-weight: var(--button-weight);
  letter-spacing: var(--button-tracking);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: var(--transition-base);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-accent);
}

.btn--primary {
  background: var(--brand-primary);
  color: var(--text-on-brand);
}
.btn--primary:hover { background: var(--brand-primary-hover); color: var(--text-on-brand); }
.btn--primary:active { background: var(--brand-primary-active); }

.btn--accent {
  background: var(--brand-accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-accent);
}
.btn--accent:hover { background: var(--brand-accent-hover); color: var(--text-on-accent); }
.btn--accent:active { background: var(--brand-accent-active); }

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn--ghost:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn--link {
  background: transparent;
  color: var(--text-brand);
  padding-inline: 0;
}
.btn--link:hover { color: var(--text-link-hover); text-decoration: underline; }

.btn--sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--text-base); }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* ---- Card --------------------------------------------------------------- */

.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

/* ---- Badge -------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-full);
  background: var(--brand-primary-subtle);
  color: var(--brand-primary);
}
.badge--accent {
  background: var(--brand-accent-subtle);
  color: var(--color-amber-800);
}

/* ---- Section ------------------------------------------------------------ */

.section {
  padding-block: var(--section-py);
}
.section--lg { padding-block: var(--section-py-lg); }
.section--sm { padding-block: var(--section-py-sm); }

.section__head {
  max-width: 720px;
  margin-bottom: var(--space-12);
}
.section__head--center {
  margin-inline: auto;
  text-align: center;
}

.section--alt    { background: var(--surface-subtle); }
.section--brand  {
  background: var(--color-teal-800);
  background-image:
    radial-gradient(ellipse 60% 60% at 0% 0%, rgba(0, 95, 96, 0.5), transparent 50%),
    radial-gradient(ellipse 70% 60% at 100% 100%, rgba(255, 193, 7, 0.10), transparent 50%);
  color: var(--text-inverse);
}
.section--brand h2, .section--brand h3 { color: var(--text-inverse); }
.section--brand .eyebrow { color: var(--color-amber-400); }
.section--brand p, .section--brand .lead { color: var(--color-teal-100); }

/* Stats en sección --brand: números amber/blanco + labels claros */
.section--brand .stat__value {
  background: linear-gradient(135deg, var(--color-amber-300) 0%, #ffffff 60%, var(--color-amber-400) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.section--brand .stat__label {
  color: var(--color-teal-100);
}

/* ---- Page hero (sub-pages) — dark teal con overlay + figuras flotantes -- */

.page-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--space-20), 10vw, var(--space-32)) var(--space-16);
  color: var(--text-inverse);
  background:
    linear-gradient(135deg,
      rgba(0, 27, 28, 0.95) 0%,
      rgba(0, 44, 45, 0.85) 50%,
      rgba(0, 62, 63, 0.7) 100%),
    radial-gradient(ellipse 60% 80% at 100% 100%, rgba(255, 193, 7, 0.10), transparent 60%),
    var(--color-teal-800);
}
.page-hero__inner {
  max-width: 760px;
  position: relative;
  z-index: 2;
}
.page-hero__title {
  font-size: var(--heading-1-clamp);
  font-weight: var(--weight-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: var(--space-3) 0 var(--space-4) 0;
  color: var(--text-inverse);
  text-shadow: 0 2px 20px rgba(0, 27, 28, 0.4);
}
.page-hero__lead {
  font-size: var(--body-lg-size);
  line-height: var(--body-lg-leading);
  color: var(--color-teal-100);
  max-width: 60ch;
  text-shadow: 0 1px 10px rgba(0, 27, 28, 0.3);
}
.page-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-amber-300);
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.28);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}
.page-hero strong { color: var(--color-amber-300); }
.page-hero .sub-breadcrumb { color: rgba(255, 255, 255, 0.55); }
.page-hero .sub-breadcrumb a { color: rgba(255, 255, 255, 0.7); }
.page-hero .sub-breadcrumb a:hover { color: var(--color-amber-300); }
.page-hero .sub-breadcrumb span { color: var(--color-amber-300); }
.page-hero .btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-inverse);
  border-color: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.page-hero .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--text-inverse);
}

/* ---- Page-hero backgrounds (video o imagen custom por admin) ---------- */

.page-hero__bg-video,
.page-hero__bg-image {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.page-hero__bg-video iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.78vh;
  height: 56.25vw;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;
}
.page-hero__bg-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.page-hero__bg-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg,
      rgba(0, 27, 28, 0.78) 0%,
      rgba(0, 44, 45, 0.62) 50%,
      rgba(0, 62, 63, 0.45) 100%),
    radial-gradient(ellipse 70% 90% at 100% 100%, rgba(255, 193, 7, 0.10), transparent 60%);
  backdrop-filter: saturate(115%);
}
/* Cuando hay custom bg, la imagen/video reemplaza el gradient inicial del page-hero */
.page-hero--has-custom-bg {
  background: transparent;
}

/* Botón admin flotante sobre el page-hero (bottom-right) */
.page-hero-admin-btn {
  position: absolute;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 27, 28, 0.7);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: var(--transition-base);
  font-family: var(--font-body);
}
.page-hero-admin-btn:hover {
  background: var(--brand-accent);
  color: var(--color-teal-900);
  border-color: var(--brand-accent);
  transform: translateY(-2px);
}
.page-hero-admin-btn i { font-size: 13px; }

/* ---- Modal genérico (hero video / hero bg / cualquier admin) ----------- */

.hero-modal {
  border: none;
  padding: 0;
  border-radius: var(--radius-2xl);
  background: transparent;
  max-width: 520px;
  width: calc(100% - var(--space-8));
  /* El reset global (* { margin:0 }) anula el margin:auto que centra el
     <dialog> nativo abierto con showModal(). Lo restauramos. */
  margin: auto;
  max-height: calc(100dvh - var(--space-8));
}
.hero-modal::backdrop {
  background: rgba(0, 27, 28, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hero-modal__form {
  background: var(--surface-page);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  box-shadow: var(--shadow-2xl);
}
.hero-modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.hero-modal__close:hover { background: var(--surface-subtle); color: var(--text-primary); }
.hero-modal h3 {
  font-size: var(--heading-5-size);
  font-weight: var(--weight-bold);
}
.hero-modal__lead {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}
.hero-modal__lead code {
  background: var(--surface-muted);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}
.hero-modal label {
  font-size: var(--label-size);
  font-weight: var(--label-weight);
}
.hero-modal input[type="text"],
.hero-modal input[type="url"] {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  width: 100%;
}
.hero-modal input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: var(--ring-brand);
}
.hero-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.hero-modal__status {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--surface-subtle);
  color: var(--text-secondary);
}
.hero-modal__status[data-kind="ok"]  { background: var(--color-success-50); color: var(--color-success-700); }
.hero-modal__status[data-kind="err"] { background: var(--color-danger-50);  color: var(--color-danger-700); }

/* ---- Hero-bg modal extras (radios + preview) -------------------------- */

.hero-bg-type {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.hero-bg-radio {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-base);
  font-size: var(--text-sm);
}
.hero-bg-radio:hover {
  border-color: var(--brand-primary);
  background: var(--surface-page);
}
.hero-bg-radio input[type="radio"] {
  accent-color: var(--brand-primary);
  flex-shrink: 0;
}
.hero-bg-radio:has(input:checked) {
  border-color: var(--brand-accent);
  background: var(--brand-accent-subtle);
}
.hero-bg-radio span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-medium);
}
.hero-bg-radio span i {
  width: 18px;
  color: var(--color-teal-700);
}
.hero-bg-radio:has(input:checked) span i { color: var(--color-amber-800); }

.hero-bg-image-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}
#hero-bg-image-preview {
  width: 120px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
#hero-bg-video-field input,
#hero-bg-image-field input[type="text"] {
  width: 100%;
  margin-top: var(--space-2);
}

/* ---- Floating shapes (overlay flotante en heroes oscuros) -------------- */

.hero-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.shape {
  position: absolute;
  user-select: none;
}

/* Spirals (isotipo GINNOA) — sobre overlay teal oscuro, usamos versión blanca */
.shape--spiral {
  filter: drop-shadow(0 4px 14px rgba(255, 193, 7, 0.15)) brightness(0) invert(1);
}
.shape--spiral-1 { width: 90px;  top: 16%;  left: 6%;   opacity: 0.22; animation: float-a 14s ease-in-out infinite; }
.shape--spiral-2 { width: 130px; top: 62%;  left: 88%;  opacity: 0.18; animation: float-b 18s ease-in-out infinite; }
.shape--spiral-3 { width: 50px;  top: 80%;  left: 18%;  opacity: 0.28; animation: float-c 11s ease-in-out infinite; }
.shape--spiral-4 { width: 200px; top: 8%;   left: 78%;  opacity: 0.10; animation: float-d 22s ease-in-out infinite; }

/* Font Awesome icons — tonos claros sobre fondo oscuro */
.shape--icon {
  color: var(--color-amber-300);
  font-style: normal;
  text-shadow: 0 2px 12px rgba(255, 193, 7, 0.2);
}
.shape--icon-1  { font-size: 38px;  top: 26%; left: 22%; opacity: 0.32; color: var(--color-amber-300); animation: float-a 13s ease-in-out infinite; }
.shape--icon-2  { font-size: 54px;  top: 72%; left: 70%; opacity: 0.24; color: var(--color-teal-200);  animation: float-b 16s ease-in-out infinite; }
.shape--icon-3  { font-size: 30px;  top: 22%; left: 60%; opacity: 0.34; color: var(--color-amber-400); animation: float-c 12s ease-in-out infinite; }
.shape--icon-4  { font-size: 44px;  top: 52%; left: 8%;  opacity: 0.22; color: var(--color-teal-100);  animation: float-d 19s ease-in-out infinite; }
.shape--icon-5  { font-size: 36px;  top: 84%; left: 50%; opacity: 0.28; color: var(--color-amber-300); animation: float-a 17s ease-in-out infinite; }
.shape--icon-6  { font-size: 48px;  top: 42%; left: 92%; opacity: 0.18; color: var(--color-teal-200);  animation: float-b 15s ease-in-out infinite; }
.shape--icon-7  { font-size: 32px;  top: 10%; left: 42%; opacity: 0.34; color: var(--color-amber-300); animation: float-c 13s ease-in-out infinite; }
.shape--icon-8  { font-size: 28px;  top: 90%; left: 30%; opacity: 0.30; color: var(--color-teal-100);  animation: float-d 14s ease-in-out infinite; }
.shape--icon-9  { font-size: 56px;  top: 34%; left: 50%; opacity: 0.14; color: var(--color-amber-200); animation: float-a 21s ease-in-out infinite; }
.shape--icon-10 { font-size: 36px;  top: 56%; left: 38%; opacity: 0.22; color: var(--color-amber-400); animation: float-b 16s ease-in-out infinite; }

@keyframes float-a {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(15px, -25px) rotate(8deg); }
}
@keyframes float-b {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(-20px, 18px) rotate(-12deg); }
}
@keyframes float-c {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%      { transform: translate(12px, 20px) rotate(15deg); }
  66%      { transform: translate(-18px, -12px) rotate(-8deg); }
}
@keyframes float-d {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%      { transform: translate(25px, 15px) rotate(20deg); }
}

@media (prefers-reduced-motion: reduce) {
  .shape { animation: none !important; }
}

@media (max-width: 640px) {
  .shape--spiral-4, .shape--icon-2, .shape--icon-6, .shape--icon-9 { display: none; }
}

/* ---- Feature grid (servicios, etapas, etc.) ----------------------------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.feature {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-7);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: var(--transition-base);
  height: 100%;
}
.feature:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-brand);
  transform: translateY(-2px);
}

.feature__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--brand-accent-subtle);
  color: var(--color-amber-800);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.feature h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.feature p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.feature__link {
  margin-top: auto;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-brand);
}
.feature__link:hover { color: var(--text-link-hover); }

/* ---- Stat block --------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-6) var(--space-8);
  margin-top: var(--space-12);
}
.stats > div {
  padding: var(--space-4) 0;
  position: relative;
}
@media (min-width: 768px) {
  .stats > div:not(:last-child)::after {
    content: "";
    position: absolute;
    right: calc(var(--space-8) / -2);
    top: 20%;
    bottom: 20%;
    width: 1px;
    background: var(--border-subtle);
  }
  .section--brand .stats > div:not(:last-child)::after {
    background: rgba(255, 255, 255, 0.12);
  }
}
.stat__value {
  font-family: var(--font-heading);
  font-size: clamp(2.75rem, 4vw + 1rem, 4rem);
  font-weight: var(--weight-extrabold);
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-teal-500), var(--color-amber-600));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat__label {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-snug);
  max-width: 26ch;
}

/* ---- Logo wall (aliados) ------------------------------------------------ */

.logo-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
  align-items: stretch;
}
.logo-wall__item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
  text-align: center;
  font-size: var(--text-sm);
  min-height: 90px;
  transition: var(--transition-base);
}
.logo-wall__item:hover {
  border-color: var(--brand-primary);
  color: var(--text-brand);
  transform: translateY(-2px);
}

/* ---- CTA banner --------------------------------------------------------- */

.cta-banner {
  background: linear-gradient(135deg, var(--color-teal-500), var(--color-teal-700));
  color: var(--text-inverse);
  border-radius: var(--radius-2xl);
  padding: clamp(var(--space-10), 5vw, var(--space-16));
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-8);
  align-items: center;
}
.cta-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 100% at 100% 50%, rgba(255, 193, 7, 0.2), transparent 60%);
  pointer-events: none;
}
.cta-banner > * { position: relative; }
.cta-banner h2 {
  font-size: var(--heading-3-clamp);
  font-weight: var(--weight-bold);
  color: var(--text-inverse);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-2);
}
.cta-banner p {
  color: var(--color-teal-100);
  max-width: 50ch;
}
@media (max-width: 768px) {
  .cta-banner { grid-template-columns: 1fr; text-align: left; }
}

/* ---- List with check ---------------------------------------------------- */

.check-list { display: grid; gap: var(--space-3); }
.check-list li {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}
.check-list li::before {
  content: "✓";
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--brand-accent-subtle);
  color: var(--color-amber-800);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  margin-top: 2px;
}

/* ==========================================================================
   Chatbot widget — burbuja flotante bottom-right
   ========================================================================== */

.chatbot {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: var(--z-fixed);
}
body.has-admin-aside .chatbot { display: none; }

.chatbot__toggle {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  background-image: linear-gradient(135deg, var(--color-teal-600), var(--color-teal-800));
  color: var(--text-inverse);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px -8px rgba(0, 95, 96, 0.55), 0 2px 6px rgba(0, 27, 28, 0.15);
  transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base) var(--ease-out);
}
.chatbot__toggle:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 16px 32px -10px rgba(0, 95, 96, 0.7), 0 4px 10px rgba(0, 27, 28, 0.2); }
.chatbot__toggle i { font-size: 22px; transition: transform var(--duration-base) var(--ease-spring), opacity var(--duration-fast) var(--ease-out); }
.chatbot__toggle-open  { position: absolute; }
.chatbot__toggle-close { position: absolute; opacity: 0; transform: rotate(-90deg); }
.chatbot.is-open .chatbot__toggle-open  { opacity: 0; transform: rotate(90deg); }
.chatbot.is-open .chatbot__toggle-close { opacity: 1; transform: rotate(0); }
.chatbot.is-open .chatbot__toggle { background-image: linear-gradient(135deg, var(--color-teal-800), var(--color-teal-900)); }

.chatbot__dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-success-500);
  box-shadow: 0 0 0 2px var(--color-teal-700);
  animation: chatbot-pulse 2.2s ease-in-out infinite;
}
@keyframes chatbot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.85; }
}
.chatbot.is-open .chatbot__dot { display: none; }

.chatbot__panel {
  position: absolute;
  bottom: calc(100% + var(--space-3));
  right: 0;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--surface-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: 0 24px 60px -20px rgba(0, 27, 28, 0.45), 0 4px 12px rgba(0, 27, 28, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-spring);
}
.chatbot.is-open .chatbot__panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.chatbot__head {
  background: linear-gradient(135deg, var(--color-teal-700), var(--color-teal-900));
  color: var(--text-inverse);
  padding: var(--space-4) var(--space-5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.chatbot__head-brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.chatbot__head-brand strong { display: block; font-size: var(--text-sm); font-weight: var(--weight-bold); }
.chatbot__head-brand small { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--color-teal-200); }
.chatbot__status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success-500); display: inline-block; }
.chatbot__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chatbot__avatar img { width: 26px; height: 26px; filter: brightness(0) invert(1); }
.chatbot__close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); color: var(--text-inverse); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chatbot__close:hover { background: rgba(255, 255, 255, 0.18); }

.chatbot__thread {
  flex: 1; overflow-y: auto; padding: var(--space-4);
  background: var(--surface-subtle);
  display: flex; flex-direction: column; gap: var(--space-3);
}

.chatbot-msg {
  display: flex; gap: var(--space-2); max-width: 88%;
  animation: chatbot-msg-in 0.25s ease-out;
}
@keyframes chatbot-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chatbot-msg__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-teal-700);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chatbot-msg__avatar img { width: 18px; height: 18px; filter: brightness(0) invert(1); }
.chatbot-msg__bubble {
  background: var(--surface-page); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm); line-height: var(--leading-relaxed);
  border-top-left-radius: 4px;
}
.chatbot-msg__bubble p { margin: 0; }
.chatbot-msg__bubble p + p { margin-top: var(--space-2); }
.chatbot-msg__bubble a { color: var(--text-brand); font-weight: var(--weight-semibold); }
.chatbot-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.chatbot-msg--user .chatbot-msg__avatar { display: none; }
.chatbot-msg--user .chatbot-msg__bubble {
  background: var(--brand-accent); color: var(--color-teal-900);
  border-color: transparent;
  border-top-left-radius: var(--radius-lg); border-top-right-radius: 4px;
}

.chatbot-suggest {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-top: var(--space-2); padding-left: 40px;
}
.chatbot-chip {
  padding: var(--space-2) var(--space-3);
  background: var(--surface-page); border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs); color: var(--text-primary);
  cursor: pointer; transition: var(--transition-base); text-align: left;
}
.chatbot-chip:hover {
  background: var(--brand-accent-subtle); border-color: var(--brand-accent); color: var(--color-amber-800);
}

.chatbot-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.chatbot-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-teal-500); opacity: 0.4;
  animation: chatbot-typing 1.2s ease-in-out infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

.chatbot__form {
  display: flex; align-items: flex-end; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-page); border-top: 1px solid var(--border-subtle);
}
.chatbot__form textarea {
  flex: 1; resize: none;
  border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body); font-size: var(--text-sm);
  line-height: var(--leading-snug); max-height: 120px;
  background: var(--surface-page);
}
.chatbot__form textarea:focus {
  outline: none; border-color: var(--brand-primary); box-shadow: var(--ring-brand);
}
.chatbot__send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-accent); color: var(--color-teal-900); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  transition: var(--transition-base);
}
.chatbot__send:hover { background: var(--color-amber-300); transform: scale(1.05); }

.chatbot__legal {
  padding: var(--space-2) var(--space-4) var(--space-3);
  font-size: 10px; color: var(--text-muted);
  background: var(--surface-page); border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: var(--space-2);
}
.chatbot__legal i { color: var(--color-teal-400); }

@media (max-width: 640px) {
  .chatbot { right: var(--space-3); bottom: var(--space-3); }
  .chatbot__panel {
    position: fixed; bottom: 0; right: 0; left: 0; top: 0;
    width: 100%; height: 100dvh; max-height: 100dvh;
    border-radius: 0;
  }
}
