:root {
  --assistant-accent: #d86f32;
  --assistant-accent-dark: #b65322;
  --assistant-ink: #053040;
  --assistant-muted: #5f7474;
  --assistant-line: rgba(0, 83, 74, 0.16);
  --assistant-surface: #fff;
  --assistant-soft: #f6faf8;
  --assistant-shadow: 0 22px 60px rgba(2, 35, 43, 0.18);
  --assistant-mobile-bottom-gap: calc(92px + env(safe-area-inset-bottom, 0px));
  --assistant-mobile-top-gap: calc(74px + env(safe-area-inset-top, 0px));
}

.assistant-root {
  position: fixed;
  inset: 0;
  z-index: 620;
  pointer-events: none;
  font-family: inherit;
}

.assistant-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 623;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 15px 8px 8px;
  border: 1px solid rgba(216, 111, 50, 0.34);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--assistant-accent), var(--assistant-accent-dark));
  color: #fff;
  box-shadow: 0 14px 34px rgba(174, 78, 27, 0.28);
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.assistant-root.is-open .assistant-launcher {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  pointer-events: none;
  visibility: hidden;
}

.assistant-launcher__icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
}

.assistant-launcher__icon img,
.assistant-panel__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assistant-scrim {
  position: fixed;
  inset: 0;
  z-index: 620;
  background: rgba(2, 23, 26, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 82px;
  z-index: 622;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(535px, calc(100vw - 32px));
  max-height: min(650px, calc(100dvh - 116px));
  border: 1px solid var(--assistant-line);
  border-radius: 18px;
  background: var(--assistant-surface);
  box-shadow: var(--assistant-shadow);
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.assistant-root.is-open .assistant-scrim {
  opacity: 1;
  pointer-events: auto;
}

.assistant-root.is-open .assistant-panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.assistant-panel__head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(0, 83, 74, 0.11);
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 83, 74, 0.05);
  touch-action: none;
}

.assistant-panel__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(216, 111, 50, 0.25);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.assistant-panel__head h2 {
  margin: 0;
  color: var(--assistant-ink);
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: 0;
}

.assistant-panel__head p {
  margin: 3px 0 0;
  color: var(--assistant-muted);
  font-size: 12px;
  line-height: 1.3;
}

.assistant-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 83, 74, 0.13);
  border-radius: 50%;
  background: #fff;
  color: var(--assistant-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.assistant-panel__body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.assistant-messages {
  display: grid;
  gap: 9px;
  max-height: 310px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.assistant-message {
  max-width: 92%;
  padding: 11px 12px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.42;
}

.assistant-message p {
  margin: 0;
}

.assistant-message p + p {
  margin-top: 6px;
}

.assistant-message--assistant {
  justify-self: start;
  border: 1px solid rgba(0, 83, 74, 0.1);
  border-top-left-radius: 6px;
  background: var(--assistant-soft);
  color: var(--assistant-ink);
}

.assistant-message--user {
  justify-self: end;
  border-top-right-radius: 6px;
  background: #005b50;
  color: #fff;
}

.assistant-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.assistant-choice {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(0, 83, 74, 0.14);
  border-radius: 999px;
  background: #fff;
  color: var(--assistant-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.assistant-choice--guide:hover,
.assistant-choice--back:hover {
  border-color: rgba(216, 111, 50, 0.42);
  background: #fffaf5;
}

.assistant-choice--action {
  border-color: rgba(216, 111, 50, 0.38);
  background: var(--assistant-accent);
  color: #fff;
  box-shadow: 0 9px 20px rgba(216, 111, 50, 0.2);
}

.assistant-choice--action:hover {
  background: var(--assistant-accent-dark);
}

.assistant-choice--back {
  color: var(--assistant-muted);
}

.assistant-zone-highlight {
  outline: 3px solid rgba(216, 111, 50, 0.32);
  outline-offset: 4px;
  border-radius: 16px;
  transition: outline-color 160ms ease;
}

@media (min-width: 900px) {
  .assistant-panel {
    top: 88px;
    right: 24px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    width: min(660px, calc(100vw - 48px));
    max-height: none;
  }

  .assistant-panel__head {
    flex: 0 0 auto;
    align-self: stretch;
    min-height: 0;
    max-height: 86px;
    grid-template-columns: 40px minmax(0, 1fr) 32px;
    z-index: 5;
    padding: 10px 14px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 83, 74, 0.12);
    isolation: isolate;
  }

  .assistant-panel__avatar {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .assistant-close {
    width: 32px;
    height: 32px;
  }

  .assistant-panel__body {
    flex: 1 1 auto;
    min-height: 0;
    background: #fff;
  }

  .assistant-messages {
    max-height: none;
    min-height: 0;
  }
}

@media (max-width: 768px) {
  .assistant-root {
    z-index: 190;
  }

  .assistant-root.is-blocked-by-overlay {
    z-index: 80;
  }

  .assistant-root.is-blocked-by-overlay .assistant-launcher,
  .assistant-root.is-blocked-by-native-select .assistant-launcher {
    pointer-events: none;
  }

  .assistant-root.is-blocked-by-native-select .assistant-launcher {
    opacity: 0;
    visibility: hidden;
  }

  .assistant-launcher {
    right: 16px;
    bottom: var(--assistant-mobile-bottom-gap);
    justify-content: center;
    gap: 0;
    width: 52px;
    height: 52px;
    min-height: 52px;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 12px 26px rgba(174, 78, 27, 0.24);
  }

  .assistant-launcher > span:not(.assistant-launcher__icon) {
    display: none;
  }

  .assistant-launcher__icon {
    width: 36px;
    height: 36px;
  }

  .assistant-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    min-height: 0;
    max-height: min(84dvh, calc(100dvh - var(--assistant-mobile-top-gap)));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .assistant-panel__handle {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(5, 48, 64, 0.18);
    transform: translateX(-50%);
  }

  .assistant-panel__head {
    padding: 19px 14px 12px;
    grid-template-columns: 40px 1fr auto;
  }

  .assistant-panel__avatar {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .assistant-panel__body {
    gap: 13px;
    padding: 13px 13px calc(13px + env(safe-area-inset-bottom, 0px));
  }

  .assistant-messages {
    max-height: none;
    min-height: 0;
  }

  .assistant-message {
    max-width: 95%;
    font-size: 14px;
  }

  .assistant-choice {
    min-height: 44px;
    font-size: 13px;
  }
}

@media (max-width: 768px) and (max-height: 720px) {
  .assistant-panel {
    min-height: 0;
    max-height: calc(100dvh - var(--assistant-mobile-top-gap) - var(--assistant-mobile-bottom-gap));
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-scrim,
  .assistant-panel,
  .assistant-launcher {
    transition: none;
  }
}

/* Mi Cuenta concentra acciones privadas, mensajes y formularios largos. El
   espacio se reserva desde el contenedor común para que el launcher no tape
   botones o feedback, sin sumar excepciones por cada acción. */
body.account-page .account-shell {
  padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px)) !important;
}

body.account-page .account-form-footer {
  padding-inline-end: 76px;
}

body.account-page .assistant-launcher {
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  justify-content: center;
  gap: 0;
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
}

body.account-page .assistant-launcher > span:not(.assistant-launcher__icon) {
  display: none;
}

@media (min-width: 900px) {
  body.account-page .assistant-panel {
    width: min(440px, calc(100vw - 48px));
  }

  body.account-page:has(.assistant-root.is-open) .account-shell {
    max-width: none;
    margin-left: max(0px, calc((100vw - var(--max, 1240px)) / 2));
    margin-right: 488px;
  }
}

@media (min-width: 900px) and (max-width: 1199px) {
  body.account-page .assistant-panel {
    width: min(400px, calc(100vw - 48px));
  }

  body.account-page:has(.assistant-root.is-open) .account-shell {
    margin-right: 463px;
  }

  body.account-page:has(.assistant-root.is-open) .account-hero,
  body.account-page:has(.assistant-root.is-open) .account-context-card {
    grid-template-columns: 1fr;
  }

  body.account-page:has(.assistant-root.is-open) .account-app {
    grid-template-columns: 1fr;
  }

  body.account-page:has(.assistant-root.is-open) .account-sidebar {
    position: static;
  }

  body.account-page:has(.assistant-root.is-open) .account-sidebar-card,
  body.account-page:has(.assistant-root.is-open) .account-section-nav {
    display: none;
  }

  body.account-page:has(.assistant-root.is-open) .account-mobile-section-control {
    display: block;
  }
}

@media (max-width: 768px) {
  /* Mi Cuenta usa la misma ancla inferior que las páginas públicas y suma la
     altura de su navegación fija. */
  body.account-page .assistant-launcher {
    top: auto;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--mobile-nav-height, 72px) + 20px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
    min-height: 52px;
  }

  body.account-page .account-shell {
    padding-bottom: var(--account-space-7, 32px) !important;
  }

  body.account-page .account-form-footer {
    padding-inline-end: 0;
  }
}
