.assistant-page {
  max-width: 1120px;
  padding-block: clamp(2.25rem, 4vw, 4.25rem) clamp(3.25rem, 7vw, 6.5rem);
}
.assistant-intro { margin-bottom: 1.8rem; }
.assistant-intro h1 { margin: 0 0 .5rem; font-size: clamp(3rem, 5.6vw, 5.15rem); }
.assistant-intro p { margin: 0; color: var(--muted); font-size: 1.08rem; }
.assistant-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, .44fr); grid-template-areas: "conversation mode" "conversation tools"; column-gap: clamp(1.25rem, 3vw, 2.5rem); row-gap: 1.5rem; grid-template-rows: auto 1fr; align-items: start; }
.chat-panel, .mode-card { border: 1px solid var(--line); border-radius: 12px; }
.chat-panel { grid-area: conversation; overflow: hidden; background: #fffefa; min-width: 0; }
.chat-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); background: var(--sea-glass); }
.chat-bar h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.assistant-page button { cursor: pointer; }
.assistant-page button:disabled { cursor: default; }
.assistant-page [hidden] { display: none; }
.quiet-button { border: 0; background: transparent; padding: .4rem .1rem; font-weight: 600; text-decoration: underline; text-underline-offset: .23em; }
.quiet-button:disabled { color: #607167; text-decoration: none; }
.chat-log { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; height: clamp(14rem, 34vh, 22rem); overflow-y: auto; overscroll-behavior-y: contain; padding: 1.25rem 1.4rem; }
.chat-log:focus-visible, .question-row input:focus-visible { outline: 2px solid #956121; outline-offset: -2px; }
.chat-message { border-radius: .15rem .85rem .85rem; background: #f0f3eb; padding: .75rem 1rem; max-width: min(92%, 38rem); overflow-wrap: anywhere; }
.chat-message.visitor { align-self: flex-end; background: var(--deep-teal); color: white; border-radius: .85rem .15rem .85rem .85rem; }
.chat-message p { margin: .14rem 0 0; white-space: pre-line; line-height: 1.55; }
.chat-sources { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.chat-message p a { display: inline; margin: 0; }
.chat-message a { display: inline-block; margin-top: .35rem; }
.speaker { font-size: .84rem; font-weight: 700; letter-spacing: .015em; color: #3c5847; }
.visitor .speaker { color: #c5e8ed; }
.question-form { border-top: 1px solid #dce2d8; padding: 1rem 1.4rem 1.15rem; }
.question-form label, .mode-name { font-weight: 700; }
.question-row { display: flex; gap: .55rem; margin-top: .35rem; }
.question-row input { min-width: 0; width: 100%; padding: .75rem .85rem; border: 1px solid #869787; border-radius: 6px; color: var(--ink); background: #fff; font: inherit; }
.question-row input::placeholder { color: #58675f; }
.question-row .btn { flex: none; }
.question-row .btn:disabled { background: #586b5e; border-color: #586b5e; }
.question-form p, .script-note { margin: .65rem 0 0; color: var(--muted); font-size: .91rem; line-height: 1.45; }
.question-form .chat-status, .model-status { color: var(--ink); font-weight: 600; }
.chat-status:empty, .model-status:empty { display: none; }
.script-note { padding: 0 1.4rem 1rem; }
.chat-tools { grid-area: tools; display: grid; gap: 1.5rem; }
.chat-tools > a { justify-self: start; }
.chat-tools h2, .mode-card h2 { font-size: 1.9rem; line-height: 1.1; }
.mode-card { grid-area: mode; background: #edf2ed; padding: 1.2rem; }
.mode-card p { margin: .45rem 0 0; color: var(--muted); font-size: .95rem; }
.mode-card .mode-name { color: var(--ink); margin-top: .8rem; }
.mode-card button { margin-top: .95rem; }
.mode-card .model-status { font-size: .87rem; }
.sample-list { display: grid; gap: .45rem; margin-top: .75rem; }
.sample-list button { border: 1px solid #bfccbf; border-radius: 7px; background: #fffefa; text-align: left; padding: .64rem .8rem; font-size: 1rem; line-height: 1.4; }
.sample-list button:hover:enabled { background: #eff3ea; border-color: #728772; }
@media (max-width: 760px) {
  .assistant-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "mode" "conversation" "tools"; grid-template-rows: auto; }
  .chat-tools { gap: 1.25rem; }
  .chat-bar, .question-form, .chat-log { padding-inline: 1rem; }
  .question-row .btn { padding-inline: 1.1rem; }
}
@media (max-width: 380px) {
  .assistant-page { width: 93%; }
  .chat-bar, .question-form, .chat-log { padding-inline: .7rem; }
}
@media (max-width: 760px) {
  .mode-card h2 { font-size: 1.55rem; }
  .mode-card .mode-name { margin-top: .4rem; }
}

/* The floating launcher supplies its own heading and close control. */
.chat-embedded { scroll-behavior: auto; scroll-padding-top: .5rem; }
.chat-embedded body { background: #fffefa; }
.chat-embedded body > header,
.chat-embedded body > footer,
.chat-embedded .skip,
.chat-embedded .assistant-intro { display: none; }
.chat-embedded .assistant-page { width: 100%; padding: 0; }
.chat-embedded .assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  grid-template-areas: "mode" "conversation" "tools";
  gap: 0;
}
.chat-embedded .mode-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .18rem .5rem;
  padding: .65rem .85rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #f1f4ed;
}
.chat-embedded .mode-card h2 { font: 500 .9rem/1.35 var(--sans); color: var(--muted); }
.chat-embedded .mode-card .mode-name { grid-column: 2; grid-row: 1; text-align: right; }
.chat-embedded .mode-card #mode-note,
.chat-embedded .mode-card .model-status { grid-column: 1 / -1; }
.chat-embedded .mode-card p { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
.chat-embedded .mode-card button { margin: .3rem 0 0; justify-self: start; }
.chat-embedded .mode-card .btn { min-height: 2.6rem; padding: .45rem .7rem; }
.chat-embedded .chat-panel { border: 0; border-radius: 0; }
.chat-embedded .chat-bar { padding: .35rem .85rem; background: #fffefa; }
.chat-embedded .chat-bar h2 { font-size: 1.65rem; }
.chat-embedded .chat-log { height: clamp(9rem, 36vh, 18rem); padding: .65rem .85rem; gap: .65rem; }
.chat-embedded .chat-message { padding: .55rem .75rem; max-width: 96%; }
.chat-embedded .question-form { padding: .6rem .85rem .75rem; }
.chat-embedded .question-row { gap: .4rem; }
.chat-embedded .question-row input { padding: .55rem; }
.chat-embedded .question-row .btn { min-height: 2.75rem; padding: .5rem .85rem; }
.chat-embedded .chat-tools {
  display: grid;
  gap: .75rem;
  padding: .75rem .85rem 1rem;
  border-top: 1px solid var(--line);
}
.chat-embedded .sample-card h2 { font-size: 1.45rem; }
.chat-embedded .sample-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chat-embedded .sample-list button { max-width: 100%; padding: .4rem .55rem; }
@media (max-width: 340px) {
  .chat-embedded .mode-card button { grid-column: 1 / -1; }
}
