#root .gr-demo-agent {
  --agent-paper: #fff;
  --agent-ink: #222;
  --agent-muted: #666463;
  --agent-line: #f0e8e7;
  --agent-tint: #fff1ef;
  --agent-red: #d6000f;
  --agent-red-dark: #aa1420;
  --agent-gutter-start: max(var(--gr-page-gutter), env(safe-area-inset-left, 0px));
  --agent-gutter-end: max(var(--gr-page-gutter), env(safe-area-inset-right, 0px));
  display: grid;
  min-width: 0;
  min-height: 0;
  height: calc(100vh - var(--gr-bottom-navigation-space));
  height: calc(100dvh - var(--gr-bottom-navigation-space));
  grid-template-rows: auto auto minmax(96px, 1fr) auto;
  background: var(--gr-page-canvas);
  color: var(--agent-ink);
}

#root .gr-demo-agent-scroll { display: contents; }

#root .gr-demo-agent-header {
  display: grid;
  min-height: calc(60px + env(safe-area-inset-top, 0px));
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) var(--agent-gutter-end) 0 var(--agent-gutter-start);
  background: #bc1a14 url("./assets/member-reference-header.png") center top / 100% auto no-repeat;
  color: #fff;
}

#root .gr-demo-agent-header h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: inherit;
  font-size: var(--gr-page-title-size);
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

#root .gr-demo-agent-header h1 img {
  flex: none;
  border: 1px solid #fff9f7;
  border-radius: 50%;
  object-fit: cover;
}

#root .gr-demo-agent-header button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
}

#root .gr-demo-agent-categories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding-inline: var(--agent-gutter-start) var(--agent-gutter-end);
  border-bottom: 1px solid var(--agent-line);
  background: var(--agent-paper);
}

#root .gr-demo-agent-categories button {
  min-width: 0;
  min-height: 46px;
  padding: 5px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--agent-muted);
  font-size: 0.875rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

#root .gr-demo-agent-categories button[aria-pressed="true"] {
  border-bottom-color: var(--agent-red);
  color: var(--agent-red);
  font-weight: 650;
}

#root .gr-demo-agent-feed {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 14px var(--agent-gutter-end) 18px var(--agent-gutter-start);
  overflow: auto;
  overscroll-behavior: contain;
}

#root :is(.gr-demo-agent-welcome, .gr-demo-agent-services) {
  border: 1px solid rgba(81, 54, 50, .045);
  border-radius: 12px;
  background: var(--agent-paper);
}

#root .gr-demo-agent-welcome {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 15px var(--gr-section-inset);
  background: linear-gradient(110deg, #fff6f3, var(--agent-paper) 72%);
}

#root .gr-demo-agent-welcome-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: #fbe1dd;
  color: var(--agent-red);
}

#root .gr-demo-agent-feed h2 {
  margin: 0;
  color: var(--agent-ink);
  font-size: var(--gr-section-heading-size);
  font-weight: var(--gr-section-heading-weight);
  line-height: 1.4;
}

#root .gr-demo-agent-welcome p {
  margin: 4px 0 0;
  color: var(--agent-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-wrap: pretty;
}

#root .gr-demo-agent-services {
  container-type: inline-size;
  padding: 12px var(--gr-section-inset) 4px;
}

#root .gr-demo-agent-services h2 {
  margin: 0 0 4px;
}

#root :is(.gr-demo-agent-skills, .gr-demo-agent-actions) {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

#root .gr-demo-agent-skill + .gr-demo-agent-skill {
  border-top: 1px solid var(--agent-line);
}

#root .gr-demo-agent-skill button {
  display: grid;
  width: 100%;
  min-height: 66px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--agent-ink);
  text-align: start;
}

#root .gr-demo-agent-skill button:disabled {
  opacity: .58;
}

#root .gr-demo-agent-skill-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #ffefeb, #f9d9d6);
  color: #bd241e;
}

#root .gr-demo-agent-skill-icon[data-tone="jade"] { background: #e8f1f6; color: #38627d; }
#root .gr-demo-agent-skill-icon[data-tone="amber"] { background: linear-gradient(145deg, #fff3df, #f8e3ca); color: #995019; }

#root .gr-demo-agent-skill-copy {
  display: grid;
  gap: 3px;
  overflow-wrap: anywhere;
}

#root .gr-demo-agent-skill-copy strong {
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.35;
}

#root .gr-demo-agent-skill-copy > span {
  color: var(--agent-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

#root .gr-demo-agent-skill-cta {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--agent-tint);
  color: var(--agent-red-dark);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

#root .gr-demo-agent-thread:not(:empty) { margin-top: 16px; }

#root .gr-demo-agent-exchange {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 10px;
}

#root .gr-demo-agent-question {
  max-width: 88%;
  justify-self: end;
  margin: 0;
  padding: 10px 13px;
  border-radius: 14px 14px 4px 14px;
  background: var(--agent-red);
  color: var(--agent-paper);
  font-size: 0.875rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#root .gr-demo-agent-answer {
  width: min(100%, 340px);
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--agent-line);
  border-radius: 4px 14px 14px;
  background: var(--agent-paper);
}

#root .gr-demo-agent-answer-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--agent-red-dark);
  font-size: 0.75rem;
  font-weight: 650;
}

#root .gr-demo-agent-answer > p {
  margin: 5px 0 0;
  color: var(--agent-ink);
  font-size: 0.875rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#root .gr-demo-agent-actions:not(:empty) {
  gap: 6px;
  margin-top: 9px;
}

#root .gr-demo-agent-actions a {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--agent-tint);
  color: var(--agent-red-dark);
  font-size: 0.8125rem;
  font-weight: 650;
  text-decoration: none;
}

#root .gr-demo-agent-composer {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 9px var(--agent-gutter-end) 9px var(--agent-gutter-start);
  border-top: 1px solid var(--agent-line);
  background: var(--agent-paper);
}

#root .gr-demo-agent-member-composer {
  --agent-composer-field: #fffaf7;
  --agent-composer-line: #dfd4cf;
  gap: 4px;
  padding: 6px max(10px, env(safe-area-inset-right, 0px)) 7px max(10px, env(safe-area-inset-left, 0px));
  border-top-color: var(--agent-composer-line);
  background: #f6f1ee;
}

#root .gr-demo-agent-guest-login {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 999px;
  background: var(--agent-tint);
  color: var(--agent-red-dark);
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}

#root .gr-demo-agent-voice-help {
  display: flex;
  min-width: 0;
  min-height: 18px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3px 8px;
  padding-inline: 2px;
  color: var(--agent-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

#root .gr-demo-agent-voice-help[hidden] { display: none; }

#root .gr-demo-agent-example {
  flex: none;
  min-height: 44px;
  padding: 0 0 0 5px;
  border: 0;
  background: transparent;
  color: var(--agent-red-dark);
  font-size: 0.75rem;
  font-weight: 650;
}

#root .gr-demo-agent-composer-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

#root .gr-demo-agent-composer-row[data-mode="text"][data-has-text="true"] {
  grid-template-columns: 44px minmax(0, 1fr) 54px;
}

#root .gr-demo-agent-composer-row[data-has-text="false"] .gr-demo-agent-send,
#root .gr-demo-agent-send[hidden] { display: none; }

#root .gr-demo-agent-composer-row button {
  min-width: 0;
  min-height: 44px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--agent-paper);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#root .gr-demo-agent-composer-row .gr-demo-agent-input-switch {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border-color: var(--agent-composer-line);
  border-radius: 50%;
  background: var(--agent-composer-field);
  color: var(--agent-ink);
}

#root .gr-demo-agent-composer-row .gr-demo-agent-hold {
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: var(--agent-composer-line);
  border-radius: 999px;
  background: var(--agent-composer-field);
  color: var(--agent-ink);
  font-size: 1rem;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

#root .gr-demo-agent-send { background: var(--agent-red-dark); }

#root .gr-demo-agent-composer-row button:disabled {
  border-color: var(--agent-composer-line);
  background: #ece6e2;
  color: var(--agent-muted);
  cursor: default;
}

#root .gr-demo-agent-composer-row .gr-demo-agent-hold[data-voice-state="processing"] {
  border-color: #e1c9c2;
  background: #f4e7e2;
  color: var(--agent-muted);
}

#root .gr-demo-agent-composer-row .gr-demo-agent-hold:is([data-voice-state="recording"], [data-voice-state="release"]) {
  border-color: #d3a6a0;
  background: #f3ddda;
  color: var(--agent-red-dark);
}

#root .gr-demo-agent-composer-row .gr-demo-agent-hold[data-voice-state="cancel"] {
  border-color: var(--agent-red-dark);
  background: var(--agent-red-dark);
  color: var(--agent-paper);
}

#root .gr-demo-agent-voice-progress {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#root .gr-demo-agent-voice-progress > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: gr-demo-agent-voice-pulse 1.1s ease-in-out infinite;
}

#root .gr-demo-agent-voice-progress > span:nth-child(2) { animation-delay: 120ms; }
#root .gr-demo-agent-voice-progress > span:nth-child(3) { animation-delay: 240ms; }

@keyframes gr-demo-agent-voice-pulse {
  0%, 65%, 100% { opacity: .45; }
  30% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #root .gr-demo-agent-voice-progress > span { animation: none; }
}

#root .gr-demo-agent-member-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: max(2.75rem, min(5.375rem, 25dvh));
  padding: 10px 11px;
  resize: none;
  field-sizing: content;
  border: 1px solid var(--agent-composer-line);
  border-radius: 9px;
  background: var(--agent-composer-field);
  color: var(--agent-ink);
  font: inherit;
  font-size: max(16px, 1rem);
  line-height: 1.4;
}

#root .gr-demo-agent-composer textarea::placeholder { color: var(--agent-muted); }

#root .gr-demo-agent :is(a, button:not(:disabled), textarea) { -webkit-tap-highlight-color: transparent; }
#root .gr-demo-agent :is(a, button:not(:disabled)) { cursor: pointer; }

#root .gr-demo-agent :is(a, button, textarea):focus-visible {
  outline: 2px solid var(--agent-red-dark);
  outline-offset: 2px;
}

#root .gr-demo-agent-header button:focus-visible { outline-color: #fff9f7; }
#root .gr-demo-agent-categories button:focus-visible { outline-offset: -3px; }
#root .gr-demo-agent :is(a, button:not(:disabled)):active { filter: brightness(.94); }

#root .gr-demo-agent-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@container (width < 12rem) {
  #root .gr-demo-agent-skill button {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  #root .gr-demo-agent-skill-cta {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-height: 480px) {
  #root .gr-demo-agent {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  #root .gr-demo-agent-scroll {
    display: block;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #root .gr-demo-agent-feed { overflow: visible; }
}
