.chat-page { max-width: 72rem; padding-block: clamp(1.5rem, 3vw, 2.5rem); }
.chat-page [hidden] { display: none !important; }
.chat-intro { max-width: 48rem; }
.chat-intro h1 { margin-block: .55rem .8rem; font-size: clamp(2.8rem, 5vw, 4rem); letter-spacing: -.025em; }
.chat-intro > p:not(.category) { margin-top: .8rem; }
.chat-disclosure { font-size: .9rem; color: #505346; }
.chat-page a { overflow-wrap: anywhere; }
.chat-contact { display: flex; flex-wrap: wrap; gap: .2rem 1.5rem; margin-block: 1.5rem 2rem; padding-block: .7rem; border-block: 1px solid var(--line); }
.chat-contact a, .chat-demo > a { display: inline-flex; align-items: center; min-height: 44px; color: #783e20; font-weight: 700; }
.chat-page h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.05; }
.chat-page button { min-height: 44px; border: 1px solid var(--rust); padding: .65rem 1rem; border-radius: .2rem; background: transparent; color: var(--ink); font: 600 .95rem/1.4 var(--body); cursor: pointer; overflow-wrap: anywhere; }
.chat-page button:hover { background: #e9dfcf; }
.chat-page button:disabled { opacity: .65; cursor: wait; }
.chat-page :is(button, textarea, a, pre):focus-visible { outline: 3px solid #783e20; outline-offset: 4px; }
.chat-starter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin-top: 1rem; }
.chat-starter-grid button { text-align: left; }
.chat-workspace { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.chat-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
#chat-empty { color: #505346; }
.chat-turn { padding: 1.1rem; margin-top: 1rem; background: #fffaf1; border-left: 3px solid var(--rust); min-width: 0; }
.chat-turn-user { background: #e9e3d7; border-color: #636b5a; }
.chat-turn h3 { font: 700 .875rem/1.5 var(--body); margin-bottom: .4rem; }
.chat-turn p { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-sources { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.chat-sources a { display: inline-flex; align-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: .2rem; padding: .35rem .65rem; font-size: .875rem; }
#chat-privacy { margin-block: 1.5rem .8rem; }
.chat-page label { display: block; margin-bottom: .5rem; font-weight: 700; }
.chat-page textarea { display: block; width: 100%; min-height: 8rem; resize: vertical; border: 1px solid #777b6d; border-radius: .2rem; background: #fffcf6; padding: .8rem; font: 1rem/1.55 var(--body); color: var(--ink); }
.chat-input-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; margin-block: .5rem .8rem; font-size: .8rem; color: #505346; }
.chat-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
#chat-send { background: #783e20; color: #fffaf1; }
#chat-send:hover { background: #62311a; }
#chat-status, #chat-brief-status { margin-top: .8rem; min-height: 1.55em; font-size: .9rem; }
#chat-error { padding: 1rem; border-left: 3px solid #9b3421; margin-top: .8rem; background: #f7dfd3; overflow-wrap: anywhere; }
.chat-notice { padding: 1rem; border: 1px solid var(--rust); margin-block: 1rem; }
.chat-notice button { margin-top: .8rem; }
.chat-brief, .chat-demo { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.chat-brief > p, .chat-demo > p { margin-top: .7rem; max-width: 48rem; }
.chat-brief pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 1rem/1.6 var(--body); border: 1px solid var(--line); background: #fffcf6; padding: 1rem; max-width: 100%; }
.chat-brief .chat-actions a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: #783e20; }
.chat-demo h2 { margin-top: .6rem; }
@media (max-width: 42rem) {
  .chat-page { width: calc(100% - 2rem); }
  .chat-starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-page .chat-turn { padding: .8rem; }
  .chat-section-heading h2 { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-page *, .chat-page *::before, .chat-page *::after { scroll-behavior: auto; animation: none; transition: none; }
}

/* Conversation comes first in reading order and on small screens. */
#chat-app { display: grid; grid-template-columns: minmax(0, 2fr) minmax(15rem, 1fr); gap: 0 1.5rem; }
.chat-workspace { margin-top: 1.25rem; padding-top: 1rem; min-width: 0; }
.chat-starters { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.chat-starters h2, .chat-workspace h2 { font-size: 1.5rem; }
.chat-starter-grid { grid-template-columns: 1fr; margin-top: .8rem; }
.chat-section-heading { gap: .5rem; margin-bottom: .5rem; }
#chat-empty { display: none; }
#chat-privacy { margin-block: .6rem .8rem; }
.chat-brief { grid-column: 1 / -1; }
@media (max-width: 42rem) {
  #chat-app { grid-template-columns: minmax(0, 1fr); }
  .chat-starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-intro h1 { font-size: 2.8rem; }
}
