/* One non-modal surface around the existing assistant. The body remains a
   normal reading/working page; only this bounded window owns its scrolling. */
.ep-assistant-host {
  --ep-host-paper: #ffffff;
  --ep-host-ink: #3a4659;
  --ep-host-muted: #657087;
  --ep-host-line: #d7deea;
  --ep-host-soft: #f2f5fa;
  --ep-host-blue: #47658e;
  --ep-host-radius: var(--ds-radius-lg, 16px);
  --ep-assistant-host-viewport-height: 100dvh;
  --ep-assistant-host-keyboard-offset: 0px;
  position: fixed;
  z-index: 1250;
  right: 24px;
  bottom: 24px;
  width: min(400px, calc(100vw - 24px));
  height: min(720px, 82dvh);
  max-width: calc(100vw - 24px);
  max-height: calc(var(--ep-assistant-host-viewport-height) - 76px);
  min-width: 0;
  min-height: 0;
  color: var(--ep-host-ink);
  font-family: var(--ds-sans, system-ui, sans-serif);
  font-size: var(--ds-text-sm, 14px);
  line-height: var(--ds-leading-ui, 1.5);
  color-scheme: light;
  isolation: isolate;
}
.ep-assistant-host *, .ep-assistant-host *::before, .ep-assistant-host *::after { box-sizing: border-box; }
.ep-assistant-host[hidden], .ep-assistant-host[data-state="minimized"], .ep-assistant-host[data-state="closed"],
.ep-assistant-launcher[hidden], .ep-assistant-host [hidden] { display: none !important; }
.ep-assistant-host [data-assistant-host-panel] {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--ep-host-line);
  border-radius: var(--ep-host-radius);
  background: var(--ep-host-paper);
  box-shadow: var(--ds-shadow-3, 0 2px 6px #22344e10, 0 16px 40px #22344e29);
}
.ep-assistant-host .ep-assistant-host__heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: none;
  gap: 0 6px;
  min-height: 56px;
  padding: 5px 7px 5px 12px;
  border-bottom: 1px solid var(--ep-host-line);
  background: var(--ep-host-paper);
}
.ep-assistant-host [data-assistant-host-drag] {
  display: flex;
  align-items: center;
  flex: 1 1 106px;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 7px 4px;
  border: 0;
  border-radius: var(--ds-radius-sm, 8px);
  background: transparent;
  color: #26374f;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  text-align: left;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.ep-assistant-host [data-assistant-host-drag]:active { cursor: grabbing; }
.ep-assistant-host .ep-assistant-host__title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; }
.ep-assistant-host [data-assistant-host-drag] :is(img, svg) { width: 24px; height: 24px; flex: none; }
.ep-assistant-host .ep-assistant-host__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 0 0 0 auto; }
.ep-assistant-host .ep-assistant-host__actions > :is(button, a),
.ep-assistant-host :is([data-assistant-host-mode], [data-assistant-host-inline]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 10px;
  border: 0;
  border-radius: var(--ds-radius-sm, 8px);
  background: transparent;
  color: var(--ep-host-ink);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.ep-assistant-host .ep-assistant-host__actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.ep-assistant-host .ep-assistant-host__actions > :is(button, a):hover,
.ep-assistant-host [data-assistant-host-drag]:hover { background: var(--ep-host-soft); }
.ep-assistant-host :is([data-assistant-host-pin][aria-pressed="true"], [data-assistant-host-mode][aria-pressed="true"]) { color: #2f4a73; background: #e5edf8; }
.ep-assistant-host [data-assistant-host-full] { min-height: 44px; color: var(--ep-host-blue); font-size: 12px; line-height: 1.5; text-underline-offset: .2em; }
.ep-assistant-host .ep-assistant-host__actions > [data-assistant-host-full] { width: auto; max-width: 124px; padding-inline: 8px; font-size: 12px; }
.ep-assistant-host .ep-assistant-host__menu {
  position: absolute;
  z-index: 80;
  top: 52px;
  right: 8px;
  width: min(260px, calc(100% - 16px));
  max-height: min(480px, calc(100% - 64px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--ep-host-line);
  border-radius: var(--ds-radius-md, 12px);
  background: var(--ep-host-paper);
  box-shadow: var(--ds-shadow-2, 0 1px 2px #22344e0a, 0 8px 24px #22344e13);
}
.ep-assistant-host .ep-assistant-host__menu > :is(button, a) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 44px;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--ds-radius-sm, 8px);
  background: transparent;
  color: var(--ep-host-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.ep-assistant-host .ep-assistant-host__menu > :is(button, a):hover { background: var(--ep-host-soft); }
.ep-assistant-host .ep-assistant-host__source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: none;
  gap: 0 10px;
  min-width: 0;
  max-height: 116px;
  overflow-y: auto;
  padding: 5px 12px;
  border-bottom: 1px solid #e7ebf1;
  background: #f7f9fc;
  color: var(--ep-host-muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.ep-assistant-host .ep-assistant-host__source > :first-child { min-width: 0; flex: 1 1 170px; }
.ep-assistant-host .ep-assistant-host__source > nav { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; max-width: 100%; }
.ep-assistant-host .ep-assistant-host__source > nav > :is(button, a) { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; padding: 6px 7px; border: 0; border-radius: var(--ds-radius-sm, 8px); color: var(--ep-host-blue); background: transparent; font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; text-decoration: none; }
.ep-assistant-host .ep-assistant-host__source > nav > :is(button, a):hover { background: #e9eff8; }
.ep-assistant-host .ep-assistant-host__menu .ep-assistant-host__source { display: block; max-height: none; overflow: visible; padding: 7px 0 0; margin-top: 4px; border-top: 1px solid var(--ep-host-line); border-bottom: 0; background: transparent; }
.ep-assistant-host .ep-assistant-host__menu .ep-assistant-host__source > span { display: block; padding: 6px 10px; color: var(--ep-host-muted); font-size: 12px; line-height: 1.6; }
.ep-assistant-host .ep-assistant-host__menu .ep-assistant-host__source > nav { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.ep-assistant-host .ep-assistant-host__menu .ep-assistant-host__source > nav > :is(button, a) { justify-content: flex-start; width: 100%; padding-inline: 10px; text-align: left; }
.ep-assistant-host [data-assistant-host-source] { color: var(--ep-host-blue); text-align: left; overflow-wrap: anywhere; }
.ep-assistant-host button[data-assistant-host-source] { min-height: 44px; margin: 0; padding: 7px 0; border: 0; background: transparent; font: inherit; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.ep-assistant-host .ep-assistant-host__notice { flex: none; max-height: 160px; min-width: 0; overflow-y: auto; margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--ep-host-line); background: #f0f4fa; color: var(--ep-host-ink); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.ep-assistant-host .ep-assistant-host__notice:empty { display: none; }
.ep-assistant-host .ep-assistant-host__notice p { margin: 0; }
.ep-assistant-host .ep-assistant-host__notice :is(button, a) { min-width: 44px; min-height: 44px; padding: 8px 11px; border: 1px solid var(--ep-host-line); border-radius: var(--ds-radius-sm, 8px); margin: 7px 7px 0 0; color: var(--ep-host-blue); background: var(--ep-host-paper); font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; }
.ep-assistant-host [data-assistant-host-status] { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ep-assistant-host .ep-assistant-host__position { display: flex; align-items: center; flex-wrap: wrap; flex: none; gap: 5px; min-width: 0; padding: 7px 12px; border-bottom: 1px solid var(--ep-host-line); background: var(--ep-host-soft); }
.ep-assistant-host .ep-assistant-host__position > :is(button, a) { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 7px; border: 1px solid var(--ep-host-line); border-radius: var(--ds-radius-sm, 8px); background: var(--ep-host-paper); color: var(--ep-host-blue); font: inherit; font-size: 14px; cursor: pointer; }
.ep-assistant-host .ep-assistant-host__menu .ep-assistant-host__position { border-top: 1px solid var(--ep-host-line); border-bottom: 0; padding: 8px 0 2px; margin-top: 4px; background: transparent; }
.ep-assistant-host .ep-assistant-host__chat,
.ep-assistant-host [data-assistant-host-chat] {
  container: ep-assistant-shell / inline-size;
  position: relative;
  flex: 1 1 0%;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ep-host-paper);
}
.ep-assistant-host [data-assistant-host-chat] > .ep-chat-shell,
.ep-assistant-host [data-assistant-host-chat] > .ep-decompose > .ep-chat-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--ep-host-paper);
  box-shadow: none;
}
.ep-assistant-host [data-assistant-host-chat] > .ep-decompose { height: 100%; min-height: 0; }
.ep-assistant-host .ep-chat-shell .ep-chat-conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.ep-assistant-host .ep-chat-shell .ep-chat-header,
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-chat-header,
.ep-assistant-host .ep-chat-shell .ep-coach-low-suggestions,
.ep-assistant-host .ep-chat-shell [data-entry-materials] { display: none; }
.ep-assistant-host .ep-chat-shell .ep-chat-header h2 { font-size: 14px; line-height: 1.4; }
.ep-assistant-host .ep-chat-shell .ep-chat-header p { font-size: 12px; }
.ep-assistant-host .ep-chat-shell .ep-chat-header .ep-chat-avatar { width: 36px; height: 36px; flex: none; }
.ep-assistant-host .ep-chat-shell .ep-assistant-profile-trigger { gap: 8px; min-height: 44px; }
.ep-assistant-host .ep-chat-shell .ep-chat-header-actions { gap: 4px; }
.ep-assistant-host .ep-chat-shell .ep-chat-messages { flex: 1 1 0%; min-height: 0; padding: 16px 12px 18px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ep-assistant-host .ep-chat-shell .ep-chat-composer { min-width: 0; min-height: 0; padding-inline: 12px; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer { flex: 0 1 auto; max-height: min(180px, max(164px, 25%)); padding: 8px 12px 10px; overflow-y: auto; overscroll-behavior: contain; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface { padding: 7px 8px; border-radius: 16px; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface:has(.ep-coach-images--draft) { grid-template-columns: 72px minmax(0, 1fr); align-items: start; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface > .ep-coach-images--draft { grid-column: 1; grid-row: 1; width: 72px; max-height: 72px; gap: 6px; margin: 0; overflow-y: auto; }
.ep-assistant-host .ep-chat-shell .ep-coach-images--draft .ep-coach-image { flex-basis: 100%; width: 100%; }
.ep-assistant-host .ep-chat-shell .ep-coach-images--draft .ep-coach-image img { height: 48px; object-fit: contain; }
.ep-assistant-host .ep-chat-shell .ep-coach-images--draft .ep-coach-image figcaption { padding: 2px 4px; font-size: 11px; line-height: 16px; }
.ep-assistant-host .ep-chat-shell .ep-coach-images--draft .ep-coach-image-status { min-height: 48px; padding: 4px; font-size: 11px; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface:has(.ep-coach-images--draft) > .ep-coach-input { grid-column: 2; grid-row: 1; width: 100%; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface:has(.ep-coach-images--draft) > .ep-coach-composer-footer { grid-column: 1 / -1; grid-row: 2; width: 100%; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface:has(.ep-assistant-profile-tag-row) > .ep-assistant-profile-tag-row { grid-column: 1 / -1; grid-row: 1; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface:has(.ep-assistant-profile-tag-row):has(.ep-coach-images--draft) > :is(.ep-coach-images--draft, .ep-coach-input) { grid-row: 2; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-compose-surface:has(.ep-assistant-profile-tag-row):has(.ep-coach-images--draft) > .ep-coach-composer-footer { grid-row: 3; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer .ep-coach-input,
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer .ep-coach-input:is(:focus, :focus-within, :focus-visible) { max-height: 64px; min-height: 44px; padding: 8px 4px; overflow-y: auto; font-size: 16px; }
.ep-assistant-host .ep-chat-shell .ep-coach-keyboard-hint { display: none; }
.ep-assistant-host .ep-chat-shell .ep-coach-send-cost { margin-top: 5px; font-size: 12px; line-height: 1.5; }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-suggestions > header h2 { font-size: 21px; }
.ep-assistant-host .ep-chat-shell .ep-coach-low-suggestions .ep-coach-suggestion-card { padding: 12px; }
.ep-assistant-host .ep-chat-shell .ep-chat-low-more > .ep-chat-more-items { max-height: min(340px, calc(100% - 16px)); }
.ep-assistant-host .ep-chat-shell .ep-chat-latest { right: 12px; max-width: calc(100% - 24px); }
.ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-sidebar-toggle { display: grid; }
.ep-assistant-host .ep-chat-shell.is-low-barrier :is(.ep-coach-record-sidebar, .ep-coach-sidebar-backdrop) { display: none; position: absolute; }
.ep-assistant-host .ep-chat-shell.is-low-barrier.is-sidebar-open .ep-coach-sidebar-backdrop { display: block; }
.ep-assistant-host .ep-chat-shell.is-low-barrier.is-sidebar-open .ep-coach-record-sidebar { display: block; inset: 0 auto 0 0; width: min(292px, calc(100% - 44px)); border-radius: 0; }
.ep-assistant-host .ep-chat-shell .ep-coach-image img { max-width: 100%; }
.ep-assistant-host .ep-chat-shell .ep-coach-reference-chip { max-width: 100%; }
.ep-assistant-host :is(button, a, summary, input, textarea, [tabindex]):focus-visible { outline: 2px solid var(--ds-focus, #3f669b); outline-offset: 2px; }
.ep-assistant-host[data-mode="inline"] {
  position: relative;
  inset: auto !important;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  height: min(680px, 72dvh);
  min-height: 380px;
  max-height: none;
  margin-block: 16px;
}
.ep-assistant-host[data-mode="inline"] [data-assistant-host-panel] { box-shadow: var(--ds-shadow-2, 0 1px 2px #22344e0a, 0 8px 24px #22344e13); }
.ep-assistant-host[data-mode="inline"] [data-assistant-host-drag] { cursor: default; touch-action: auto; }
[data-assistant-inline-mount] { clear: both; width: 100%; min-width: 0; }
[data-assistant-inline-mount]:empty { display: none; }
.ep-assistant-launcher {
  position: fixed;
  z-index: 1250;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 2px;
  border: 1px solid #b7c7e0;
  border-radius: 50%;
  color: #47658e;
  background: var(--ep-assistant-card, #fbfbfd);
  box-shadow: var(--ds-shadow-2, 0 1px 2px #22344e0a, 0 8px 24px #22344e13);
  font: 600 14px/1 var(--ds-sans, system-ui, sans-serif);
  cursor: pointer;
  touch-action: manipulation;
}
.ep-assistant-launcher:hover { border-color: #47658e; background: #f2f5fa; }
.ep-assistant-launcher :is(img, .ep-assistant-character, .ep-assistant-character-frame) { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ep-assistant-launcher > svg { width: 25px; height: 25px; }
.ep-assistant-launcher [data-assistant-host-activity] { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #47658e; }
.ep-assistant-launcher [data-assistant-host-activity][data-busy="true"] { background: #9a6a24; }
.ep-assistant-launcher:focus-visible { outline: 2px solid var(--ds-focus, #3f669b); outline-offset: 4px; }
body:has(.ep-packing-float:not([hidden])) .ep-assistant-launcher { right: 108px; }
body.ep-exam-active :is(.ep-assistant-host, .ep-assistant-launcher),
body:has(.migration-review-page) :is(.ep-assistant-host, .ep-assistant-launcher) { display: none !important; }

@media (max-width: 640px) {
  .ep-assistant-host[data-mode="float"] {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: max(0px, var(--ep-assistant-host-keyboard-offset)) !important;
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
    height: min(78dvh, calc(var(--ep-assistant-host-viewport-height) - 12px));
    max-height: calc(var(--ep-assistant-host-viewport-height) - 12px);
    min-height: 0;
    margin: 0;
  }
  .ep-assistant-host[data-mode="float"] [data-assistant-host-panel] { border-radius: 16px 16px 0 0; border-bottom: 0; }
  .ep-assistant-host .ep-assistant-host__heading { gap: 0 4px; padding: 4px 6px 4px 10px; }
  .ep-assistant-host [data-assistant-host-drag] { flex-basis: 82px; font-size: 14px; }
  .ep-assistant-host .ep-assistant-host__actions { gap: 0; }
  .ep-assistant-host .ep-assistant-host__source { padding-inline: 10px; max-height: 88px; }
  .ep-assistant-host .ep-chat-shell .ep-chat-header { padding-inline: 7px; }
  .ep-assistant-host .ep-chat-shell .ep-chat-messages { padding: 13px 10px 16px; }
  .ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer { padding: 6px 10px max(10px, env(safe-area-inset-bottom)); max-height: min(180px, max(164px, 25%)); }
  .ep-assistant-host .ep-chat-shell .ep-coach-keyboard-hint { display: none; }
  .ep-assistant-host[data-mode="inline"] { min-height: 360px; height: min(640px, 74dvh); }
  .ep-assistant-launcher { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  body:has(.ep-packing-float:not([hidden])) .ep-assistant-launcher { right: 16px; }
  /* Keep the existing bag reachable above the open drawer. If the virtual
     keyboard leaves no such space, hide it only until this drawer is reduced. */
  body:has(.ep-assistant-host[data-mode="float"][data-state="open"]:not([hidden])) .ep-packing-float {
    top: max(4px, calc(var(--ep-assistant-host-top, 30dvh) - 76px));
    bottom: auto;
  }
  body.ep-assistant-host-top-tight:has(.ep-assistant-host[data-mode="float"][data-state="open"]:not([hidden])) .ep-packing-float { visibility: hidden; pointer-events: none; }
}
@media (max-height: 580px) {
  .ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer { padding-block: 5px 8px; }
  .ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer .ep-coach-input,
  .ep-assistant-host .ep-chat-shell.is-low-barrier .ep-coach-low-composer .ep-coach-input:is(:focus, :focus-within, :focus-visible) { max-height: 64px; }
}
@media print {
  .ep-assistant-host, .ep-assistant-launcher, [data-assistant-inline-mount] { display: none !important; }
}
