.gaai,
.gaai * {
  box-sizing: border-box;
}

/* Gauge Advisor medical application assistant — beta.6 */
.gaai {
  --gaai-blue: #2563eb;
  --gaai-blue-dark: #1d4ed8;
  --gaai-indigo: #4f46e5;
  --gaai-ink: #0f172a;
  --gaai-muted: #64748b;
  --gaai-line: #dbe4f0;
  --gaai-soft: #f8fafc;
  --gaai-success: #166534;
  --gaai-warning: #92400e;
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 2147482000;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--gaai-ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.gaai button,
.gaai textarea {
  font: inherit;
}

.gaai button {
  -webkit-tap-highlight-color: transparent;
}

.gaai [hidden] {
  display: none !important;
}

.gaai .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gaai__launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 20px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--gaai-indigo) 0%, var(--gaai-blue) 68%, #0ea5e9 125%);
  box-shadow: 0 16px 38px rgba(30, 64, 175, 0.3), 0 3px 10px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  isolation: isolate;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.gaai__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 19px 44px rgba(30, 64, 175, 0.36), 0 4px 12px rgba(15, 23, 42, 0.2);
}

.gaai__launcher:active {
  transform: translateY(0);
}

.gaai__launcher:focus-visible,
.gaai button:focus-visible,
.gaai textarea:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 3px;
}

.gaai__launcher-label {
  font-weight: 750;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.gaai__launcher-pulse {
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  border: 1px solid rgba(59, 130, 246, 0.55);
  animation: gaai-pulse 3.2s ease-out 1.2s infinite;
}

.gaai[data-state="open"] .gaai__launcher-pulse,
.gaai[data-busy="true"] .gaai__launcher-pulse {
  animation: none;
}

.gaai__panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  width: min(410px, calc(100vw - 32px));
  height: min(690px, calc(100dvh - 118px));
  min-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 75px rgba(15, 23, 42, 0.24), 0 8px 24px rgba(30, 64, 175, 0.12);
  transform-origin: right bottom;
  animation: gaai-panel-in 190ms cubic-bezier(.22, .8, .36, 1) both;
}

.gaai__header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 36px 36px 36px;
  gap: 9px;
  align-items: center;
  min-height: 72px;
  padding: 12px 13px 12px 15px;
  color: #fff;
  background:
    radial-gradient(circle at 88% -20%, rgba(125, 211, 252, 0.45), transparent 38%),
    linear-gradient(135deg, #312e81 0%, #1d4ed8 58%, #2563eb 100%);
}

.gaai__identity,
.gaai__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.gaai__identity {
  width: 42px;
  height: 42px;
  color: #312e81;
  background: linear-gradient(145deg, #fff, #dbeafe);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), 0 6px 16px rgba(15, 23, 42, .18);
}

.gaai__heading {
  min-width: 0;
}

.gaai__heading h2 {
  margin: 0;
  overflow: hidden;
  color: inherit;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gaai__heading p {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 3px 0 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gaai__status-dot {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .16);
}

.gaai__icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.gaai__icon-button:hover,
.gaai__icon-button[aria-pressed="true"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.gaai__icon-button svg {
  width: 19px;
  height: 19px;
}

.gaai__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 16px 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  background:
    linear-gradient(rgba(248, 250, 252, .84), rgba(255, 255, 255, .96)),
    radial-gradient(circle at 15% 12%, #dbeafe 0, transparent 28%);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.gaai__messages::-webkit-scrollbar {
  width: 7px;
}

.gaai__messages::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #cbd5e1;
  background-clip: content-box;
}

.gaai__message {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  margin: 0 0 14px;
}

.gaai__message--user {
  justify-content: flex-end;
  padding-left: 44px;
}

.gaai__message--assistant {
  padding-right: 26px;
}

.gaai__avatar {
  width: 29px;
  height: 29px;
  margin-bottom: 2px;
  color: #3730a3;
  font-size: 10px;
  background: linear-gradient(145deg, #eef2ff, #dbeafe);
  border: 1px solid #c7d2fe;
}

.gaai__bubble {
  max-width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--gaai-line);
  border-radius: 16px 16px 16px 5px;
  color: #243147;
  background: #fff;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .055);
}

.gaai__message--user .gaai__bubble {
  color: #fff;
  border-color: #2563eb;
  border-radius: 16px 16px 5px 16px;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .18);
}

.gaai__bubble p {
  margin: 0;
  color: inherit;
  font-size: 13.5px;
  line-height: 1.52;
  white-space: pre-wrap;
}

.gaai__starters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -2px 0 18px 38px;
}

.gaai__starters button,
.gaai__quick-replies button {
  padding: 7px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1e40af;
  background: #eff6ff;
  font-size: 11.5px;
  font-weight: 680;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.gaai__starters button:hover,
.gaai__quick-replies button:hover {
  border-color: #818cf8;
  background: #eef2ff;
  transform: translateY(-1px);
}

.gaai__quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.gaai__quick-replies button:disabled {
  opacity: .45;
  cursor: default;
  transform: none;
}

.gaai__typing {
  display: flex;
  gap: 4px;
  align-items: center;
  min-height: 31px;
  padding: 5px 18px;
  color: var(--gaai-muted);
  background: #fff;
  border-top: 1px solid #edf2f7;
  font-size: 11px;
}

.gaai__typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6366f1;
  animation: gaai-dot 1.1s infinite ease-in-out;
}

.gaai__typing span:nth-child(2) { animation-delay: .14s; }
.gaai__typing span:nth-child(3) { animation-delay: .28s; }
.gaai__typing b {
  margin-left: 5px;
  font-weight: 600;
}

.gaai__notice {
  padding: 7px 14px;
  color: #334155;
  border-top: 1px solid #dbeafe;
  background: #eff6ff;
  font-size: 11px;
  text-align: center;
}

.gaai__notice[data-tone="recording"] {
  color: #9f1239;
  border-color: #fecdd3;
  background: #fff1f2;
}

.gaai__notice[data-tone="success"] {
  color: var(--gaai-success);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.gaai__notice[data-tone="error"] {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

.gaai__record-cancel {
  margin-left: 5px;
  padding: 2px 7px;
  border: 1px solid #fda4af;
  border-radius: 999px;
  color: #9f1239;
  background: #fff;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.gaai__composer {
  flex: 0 0 auto;
  padding: 11px 12px 9px;
  border-top: 1px solid var(--gaai-line);
  background: #fff;
}

.gaai__composer textarea {
  display: block;
  width: 100%;
  min-height: 43px;
  max-height: 126px;
  margin: 0;
  padding: 10px 11px;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: var(--gaai-ink);
  background: #f8fafc;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.45;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.gaai__composer textarea:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.gaai__composer textarea::placeholder {
  color: #94a3b8;
}

.gaai__composer-actions {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding-top: 7px;
}

.gaai__mic {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  color: #475569;
  background: #fff;
  cursor: pointer;
}

.gaai__mic svg {
  width: 18px;
  height: 18px;
}

.gaai[data-recording="true"] .gaai__mic {
  color: #fff;
  border-color: #e11d48;
  background: #e11d48;
  animation: gaai-record 1.25s infinite ease-in-out;
}

.gaai__privacy {
  overflow: hidden;
  color: #94a3b8;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gaai__privacy a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gaai__send {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
}

.gaai__send svg {
  width: 15px;
  height: 15px;
}

.gaai__send:disabled,
.gaai__mic:disabled {
  opacity: .55;
  cursor: progress;
}

.gaai__footer {
  flex: 0 0 auto;
  padding: 0 14px 9px;
  color: #94a3b8;
  background: #fff;
  font-size: 8.5px;
  line-height: 1.35;
  text-align: center;
}

.gaai__result {
  margin: 6px 0 16px 38px;
  padding: 15px;
  border: 1px solid #c7d2fe;
  border-top: 3px solid #4f46e5;
  border-radius: 16px;
  background: linear-gradient(160deg, #fff 0%, #f8faff 70%, #eef2ff 130%);
  box-shadow: 0 7px 22px rgba(30, 64, 175, .1);
}

.gaai__result[data-status="application-review"],
.gaai__result[data-status="unsupported"] {
  border-color: #fcd34d;
  border-top-color: #d97706;
  background: linear-gradient(160deg, #fff 0%, #fffbeb 125%);
}

.gaai__result-eyebrow {
  margin-bottom: 5px;
  color: #4f46e5;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
}

.gaai__result[data-status="application-review"] .gaai__result-eyebrow,
.gaai__result[data-status="unsupported"] .gaai__result-eyebrow {
  color: #b45309;
}

.gaai__result h3 {
  margin: 0 0 8px;
  color: var(--gaai-ink);
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.gaai__result-lead,
.gaai__result-fit {
  margin: 0;
  color: #334155;
  font-size: 11.5px;
  line-height: 1.48;
}

.gaai__result-lead {
  color: #1e3a8a;
  font-weight: 750;
}

.gaai__result-fit {
  margin-top: 6px;
}

.gaai__result-next {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  color: #334155;
  background: #f8fbff;
  font-size: 10.5px;
  line-height: 1.42;
}

.gaai__result-next strong {
  display: block;
  margin-bottom: 4px;
  color: #1e3a8a;
  font-size: 10.5px;
}

.gaai__result-next p {
  margin: 0;
}

.gaai__result-next ul {
  margin: 0;
  padding-left: 17px;
}

.gaai__result-next li + li {
  margin-top: 3px;
}

.gaai__result-profile {
  margin: -5px 0 11px;
  padding: 7px 8px;
  border-radius: 8px;
  color: #475569;
  background: #f1f5f9;
  font-size: 9px;
  line-height: 1.4;
}

.gaai__result-items {
  display: grid;
  gap: 7px;
}

.gaai__result-item {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .85);
}

.gaai__result-item > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: #3730a3;
  background: #eef2ff;
  font-size: 11px;
  font-weight: 800;
}

.gaai__result-item small,
.gaai__result-item strong {
  display: block;
}

.gaai__result-item small {
  margin-bottom: 1px;
  color: #64748b;
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.gaai__result-item strong {
  color: #1e293b;
  font-size: 11.5px;
  line-height: 1.3;
}

.gaai__result-rationale,
.gaai__result-tradeoff {
  margin: 4px 0 0;
  color: #475569;
  font-size: 9.5px;
  line-height: 1.4;
}

.gaai__result-tradeoff {
  color: #7c2d12;
}

.gaai__result-item .gaai__result-evidence-meta {
  margin-top: 4px;
  color: #64748b;
  font-size: 8px;
  font-weight: 560;
  letter-spacing: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-transform: none;
}

.gaai__coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.gaai__coverage span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: 8.5px;
  font-weight: 760;
  letter-spacing: .02em;
}

.gaai__coverage span[data-coverage="calculated"] {
  color: #1e40af;
  background: #dbeafe;
}

.gaai__coverage span[data-coverage="unsupported"],
.gaai__coverage span[data-coverage="missing"],
.gaai__coverage span[data-coverage="review"] {
  color: #92400e;
  background: #fef3c7;
}

.gaai__result-warning {
  margin-top: 10px;
  padding: 9px 10px;
  border-left: 3px solid #d97706;
  border-radius: 7px;
  color: #78350f;
  background: #fffbeb;
}

.gaai__result-warning strong {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
}

.gaai__result-warning p {
  margin: 3px 0 0;
  color: inherit;
  font-size: 9.5px;
  line-height: 1.4;
}

.gaai__evidence {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  background: #f8fafc;
}

.gaai__evidence--missing {
  border-color: #fbbf24;
  background: #fffbeb;
}

.gaai__evidence--assumptions {
  border-color: #93c5fd;
  background: #eff6ff;
}

.gaai__evidence > strong {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
}

.gaai__evidence > p,
.gaai__evidence-entry p {
  margin: 4px 0 0;
  color: inherit;
  font-size: 9.5px;
  line-height: 1.4;
}

.gaai__evidence-entry + .gaai__evidence-entry {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(100, 116, 139, .2);
}

.gaai__evidence small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 8px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.gaai__result-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.gaai__action {
  width: 100%;
  min-width: 0;
  min-height: 35px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 720;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
  cursor: pointer;
}

.gaai__action--primary {
  color: #fff;
  border: 1px solid #4f46e5;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
}

.gaai__action--secondary {
  color: #3730a3;
  border: 1px solid #a5b4fc;
  background: #eef2ff;
}

.gaai__result-disclaimer {
  margin: 9px 0 0;
  color: #94a3b8;
  font-size: 8.5px;
  line-height: 1.4;
}

.gaai__single-action {
  margin: -5px 0 16px 38px;
}

.gaai__single-action .gaai__action {
  min-height: 38px;
  padding-inline: 14px;
}

@keyframes gaai-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes gaai-pulse {
  0%, 62% { opacity: 0; transform: scale(1); }
  70% { opacity: .7; }
  100% { opacity: 0; transform: scale(1.16); }
}

@keyframes gaai-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

@keyframes gaai-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .25); }
  50% { box-shadow: 0 0 0 6px rgba(225, 29, 72, 0); }
}

@media (max-width: 520px) {
  .gaai {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .gaai__launcher {
    width: 58px;
    min-width: 58px;
    height: 58px;
    padding: 0;
  }

  .gaai__launcher-label {
    display: none;
  }

  .gaai__panel {
    right: 0;
    bottom: 68px;
    width: calc(100vw - 24px);
    height: min(690px, calc(100dvh - 92px - env(safe-area-inset-bottom)));
    min-height: 420px;
    border-radius: 18px;
  }

  .gaai__messages {
    padding-inline: 13px;
  }

  .gaai__message--assistant {
    padding-right: 12px;
  }

  .gaai__message--user {
    padding-left: 34px;
  }

  .gaai__starters,
  .gaai__result,
  .gaai__single-action {
    margin-left: 36px;
  }

  .gaai__result-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-height: 600px) and (min-width: 521px) {
  .gaai__panel {
    height: calc(100dvh - 94px);
    bottom: 66px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gaai *,
  .gaai *::before,
  .gaai *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .gaai__launcher,
  .gaai__header,
  .gaai__message--user .gaai__bubble,
  .gaai__send,
  .gaai__action--primary {
    border: 2px solid ButtonText;
    color: ButtonText;
    background: Canvas;
  }
}
