:root {
  --ga-assistant-bg: #ffffff;
  --ga-assistant-surface: #f7f7f8;
  --ga-assistant-text: #111319;
  --ga-assistant-muted: #6e6e80;
  --ga-assistant-line: rgba(17, 19, 25, 0.08);
  --ga-assistant-radius: 18px;
}

html,
body.assistant-embed {
  height: 100%;
}

body.assistant-embed {
  margin: 0;
  overflow: hidden;
}

.assistant-page {
  padding: 2rem 0 3.2rem;
}

.assistant-page--embed {
  padding: 0;
  height: 100dvh;
  overflow: hidden;
}

.assistant-page__chat--embed {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.assistant-page__chat--embed .guardian-assistant {
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  padding: 0.8rem 0.9rem 0.7rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  overflow: hidden;
}

.assistant-page__chat--embed .guardian-assistant__messages {
  max-height: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
}

.assistant-page__hero {
  margin-bottom: 1rem;
}

.assistant-page__lead {
  margin-top: 0.35rem;
  color: #38404a;
  max-width: 70ch;
}

.guardian-assistant {
  background: var(--ga-assistant-bg);
  border: 1px solid var(--ga-assistant-line);
  border-radius: var(--ga-assistant-radius);
  box-shadow: 0 16px 48px rgba(9, 16, 25, 0.08);
  padding: 1rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.guardian-assistant > .assistant-chat-head { order: 1; }
.guardian-assistant > .guardian-assistant__messages { order: 2; }
.guardian-assistant > .guardian-assistant__attachments { order: 3; }
.guardian-assistant > .guardian-assistant__form { order: 4; }
.guardian-assistant > .guardian-assistant__disclaimer { order: 5; }

.assistant-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border-bottom: 1px solid var(--ga-assistant-line);
  padding-bottom: 0.65rem;
}

.assistant-chat-head__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.assistant-chat-head__brand img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.assistant-chat-head__brand strong {
  font-size: 0.94rem;
  font-weight: 800;
  color: #171d29;
}

.assistant-chat-head__status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #ccead9;
  background: #ebfff4;
  color: #0f6b43;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
}

.guardian-assistant__messages {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.2rem;
  overscroll-behavior: contain;
}

.guardian-assistant__messages.is-welcome {
  justify-content: center;
  align-items: center;
}

.ga-welcome {
  width: min(760px, 94%);
  margin: 0 auto;
  text-align: center;
  display: grid;
  gap: 0.9rem;
}

.ga-welcome__title {
  margin: 0;
  font-size: clamp(1.5rem, 3.4vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #0f1726;
}

.ga-welcome__lead {
  margin: 0;
  font-size: clamp(0.92rem, 1.45vw, 1.02rem);
  line-height: 1.45;
  color: #475264;
}

.ga-welcome__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.ga-welcome__chip {
  border: 0;
  background: #0f1218;
  color: #ffffff;
  border-radius: 999px;
  padding: 0.34rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
}

.ga-welcome__chip:hover {
  background: #1a2130;
}

.ga-message {
  max-width: min(90%, 700px);
  width: fit-content;
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  line-height: 1.62;
  font-size: 1.03rem;
  word-break: break-word;
}

.ga-message p {
  margin: 0;
  white-space: pre-wrap;
}

.ga-message h1,
.ga-message h2,
.ga-message h3 {
  margin: 0 0 0.45rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.ga-message h1 { font-size: 1.18rem; }
.ga-message h2 { font-size: 1.08rem; }
.ga-message h3 { font-size: 0.98rem; }

.ga-message ul,
.ga-message ol {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
}

.ga-message li {
  margin: 0.22rem 0;
}

.ga-message code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(15, 23, 38, 0.08);
  border-radius: 6px;
  padding: 0.05rem 0.34rem;
}

.ga-message blockquote {
  margin: 0.5rem 0 0;
  padding: 0.38rem 0.72rem;
  border-left: 3px solid #98abc8;
  background: rgba(152, 171, 200, 0.14);
  border-radius: 0 8px 8px 0;
}

.ga-message a {
  color: #1f4f7f;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ga-message--assistant {
  background: var(--ga-assistant-surface);
  color: var(--ga-assistant-text);
  border-top-left-radius: 6px;
  max-width: calc(100% - 0.25rem);
}

.ga-message--user {
  margin-left: auto;
  background: #12151d;
  color: #ffffff;
  border-top-right-radius: 6px;
}

.ga-user-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.ga-user-attachment {
  border: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
  background: transparent;
}

.ga-user-attachment img {
  width: 92px;
  height: 92px;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

#asistencia .ga-message--assistant {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: transparent;
  border-radius: 0;
  padding: 0.35rem 0.1rem 0.55rem;
  line-height: 1.75;
}

#asistencia .ga-message--assistant .ga-message-content > * + * {
  margin-top: 0.78rem;
}

#asistencia .ga-message--assistant p {
  margin: 0;
}

#asistencia .ga-message--assistant ol,
#asistencia .ga-message--assistant ul {
  margin: 0;
  padding-left: 1.5rem;
}

#asistencia .ga-message--assistant li {
  margin: 0.34rem 0;
}

#asistencia .ga-message--assistant .ga-risk {
  margin-top: 0.75rem;
}

#asistencia .ga-risk {
  display: none;
}

#asistencia .guardian-assistant {
  grid-template-rows: minmax(0, 1fr) auto auto;
}

#asistencia .guardian-assistant > .guardian-assistant__messages { order: 1; }
#asistencia .guardian-assistant > .guardian-assistant__attachments { order: 2; }
#asistencia .guardian-assistant > .guardian-assistant__form { order: 3; }
#asistencia .guardian-assistant > .guardian-assistant__disclaimer { order: 4; }

.ga-message--typing {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  color: var(--ga-assistant-muted);
}

.ga-typing-head {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.ga-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ga-typing-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.ga-typing-sub {
  font-size: 0.84rem;
  opacity: 0.9;
}

.ga-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #8f95a3;
  opacity: 0.75;
  animation: gaTyping 1.4s ease-in-out infinite;
}

.ga-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ga-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes gaTyping {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.guardian-assistant__form {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px 44px;
  align-items: center;
  gap: 0.55rem;
  background: #fff;
  border: 1px solid #d4dbe7;
  border-radius: 24px;
  padding: 0.48rem 0.5rem;
  box-shadow: 0 4px 14px rgba(13, 22, 37, 0.06);
  min-width: 0;
  transition: border-radius 140ms ease;
}

.guardian-assistant__attach {
  border: 0;
  background: transparent;
  color: #1c2638;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1;
  cursor: pointer;
}

.assistant-page__chat--embed .guardian-assistant__form {
  margin-top: 0.1rem;
}

.guardian-assistant__form.is-expanded {
  align-items: start;
  border-radius: 18px;
}

.guardian-assistant__form.is-expanded .guardian-assistant__attach,
.guardian-assistant__form.is-expanded .guardian-assistant__mic,
.guardian-assistant__form.is-expanded .guardian-assistant__send {
  align-self: end;
}

.guardian-assistant__input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ga-assistant-text);
  outline: none;
  resize: none;
  max-height: 140px;
  min-height: 28px;
  overflow-y: auto;
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.45;
  padding: 0.3rem 0.15rem;
}

.guardian-assistant__input::placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guardian-assistant__mic {
  border: 0;
  background: transparent;
  color: #202a3c;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
  cursor: pointer;
}

.guardian-assistant__mic.is-listening {
  background: #ffedf0;
  color: #b32235;
  animation: micPulse 1.1s ease-in-out infinite;
}

.guardian-assistant__send {
  border: 0;
  border-radius: 999px;
  background: #0f1218;
  color: #ffffff;
  font-weight: 700;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 160ms ease;
}

.guardian-assistant__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.guardian-assistant__attachments:empty {
  display: none;
}

.ga-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid #d6dce8;
  background: #f6f9ff;
  border-radius: 999px;
  padding: 0.18rem 0.45rem 0.18rem 0.2rem;
  cursor: zoom-in;
}

.ga-attachment-pill img {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #d2d8e4;
}

.ga-attachment-pill span {
  font-size: 0.8rem;
  font-weight: 600;
  color: #2a344a;
}

.ga-attachment-pill button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: #1b2435;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.ga-image-preview {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(10, 14, 22, 0.68);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.ga-image-preview[hidden] {
  display: none;
}

.ga-image-preview__dialog {
  position: relative;
  width: min(96vw, 1100px);
  max-height: 92vh;
  display: grid;
  place-items: center;
}

.ga-image-preview__img {
  width: auto;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
  background: #0f131a;
}

.ga-image-preview__close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #0f1218;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.guardian-assistant__send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.guardian-assistant__disclaimer {
  margin: 0;
  color: var(--ga-assistant-muted);
  text-align: center;
  font-size: 0.78rem;
}

.ga-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ga-action-chip {
  border: 0;
  background: #0f1218;
  color: #ffffff;
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  flex: 0 0 auto;
}

.ga-action-chip:hover {
  background: #1a2130;
}

@keyframes micPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(179, 34, 53, 0.18);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(179, 34, 53, 0);
  }
}

.ga-message-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.45rem;
}

.ga-msg-btn {
  border: 0;
  background: transparent;
  color: #22314c;
  border-radius: 0;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ga-msg-btn:hover {
  color: #0f3f7a;
}

.ga-msg-btn.is-active {
  color: #164989;
}

.ga-risk {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ga-risk-lights {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
}

.ga-risk-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  opacity: 0.35;
  transform: scale(0.95);
  transition: transform 140ms ease, opacity 140ms ease;
}

.ga-risk-dot--bajo { background: #15a25e; }
.ga-risk-dot--medio { background: #f2b230; }
.ga-risk-dot--alto { background: #ec7a2d; }
.ga-risk-dot--critico { background: #dc3d4b; }

.ga-risk-dot.is-active {
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

.ga-risk-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.ga-risk-label--bajo { color: #0f6b43; }
.ga-risk-label--medio { color: #8a6409; }
.ga-risk-label--alto { color: #a14d0f; }
.ga-risk-label--critico { color: #9a1e2b; }

.assistant-page__chat--embed .guardian-assistant__disclaimer {
  line-height: 1.25;
}

.assistant-feature {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.assistant-feature__head p {
  margin: 0.2rem 0 0;
  color: #474e58;
}

.assistant-feature__link {
  display: inline-flex;
  margin-top: 0.65rem;
}

.guardian-assistant--modal {
  height: 100%;
  min-height: 0;
  padding: 0.95rem 1rem 0.85rem;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0.7rem;
  overflow: hidden;
  background: #fff;
}

.guardian-assistant--modal .guardian-assistant__messages {
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
}

.guardian-assistant--modal .guardian-assistant__form {
  margin: 0;
}

.guardian-assistant--modal .guardian-assistant__disclaimer {
  margin: 0;
  line-height: 1.25;
}

@media (max-width: 1024px) {
  .assistant-chat-head__brand strong {
    font-size: 1.08rem;
  }

  .ga-welcome__title {
    font-size: clamp(1.45rem, 3.8vw, 2.1rem);
  }

  .ga-welcome__lead {
    font-size: 1.02rem;
    line-height: 1.52;
  }

  .ga-welcome__chip,
  .ga-action-chip {
    font-size: 0.9rem;
    padding: 0.4rem 0.72rem;
  }

  .ga-message {
    font-size: 1.14rem;
    line-height: 1.78;
  }

  .guardian-assistant__input {
    font-size: 1.1rem;
    line-height: 1.6;
  }

  .guardian-assistant__disclaimer {
    font-size: 0.92rem;
  }
}

@media (max-width: 720px) {
  .guardian-assistant {
    padding: 0.9rem;
  }

  .assistant-chat-head__brand strong {
    font-size: 1.02rem;
  }

  .guardian-assistant__messages {
    max-height: none;
    min-height: 0;
    padding: 0.2rem;
  }

  .ga-welcome {
    width: min(100%, 96%);
    gap: 0.72rem;
  }

  .ga-welcome__title {
    font-size: clamp(1.42rem, 6.3vw, 2rem);
  }

  .ga-welcome__lead {
    font-size: 1rem;
    line-height: 1.5;
  }

  .ga-welcome__chips {
    gap: 0.45rem;
  }

  .ga-welcome__chip {
    font-size: 0.92rem;
    padding: 0.44rem 0.74rem;
  }

  .guardian-assistant__form {
    grid-template-columns: 36px minmax(0, 1fr) 36px 42px;
    gap: 0.5rem;
    padding: 0.56rem;
  }

  .guardian-assistant__send {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 0.86rem;
  }

  .guardian-assistant--modal {
    padding: 0.75rem 0.75rem 0.68rem;
    gap: 0.58rem;
  }

  .ga-message {
    font-size: 1.16rem;
    line-height: 1.82;
    max-width: calc(100% - 0.25rem);
    padding: 0.92rem 1rem;
  }

  .ga-message h1 { font-size: 1.26rem; }
  .ga-message h2 { font-size: 1.16rem; }
  .ga-message h3 { font-size: 1.06rem; }

  .ga-message li {
    margin: 0.3rem 0;
  }

  .guardian-assistant__input {
    font-size: 1.14rem;
    line-height: 1.62;
  }

  .guardian-assistant__disclaimer {
    font-size: 0.96rem;
    line-height: 1.35;
  }

  .ga-message--user {
    margin-left: auto;
  }

  .ga-actions {
    padding-bottom: 0.1rem;
  }
}

@media (max-width: 480px) {
  .ga-message {
    font-size: 1.18rem;
    line-height: 1.84;
  }

  .guardian-assistant__input {
    font-size: 1.16rem;
    line-height: 1.64;
  }
}
