/* Native NEWI conversation, using the existing WESLR design tokens. */
.chat-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-block: 44px 30px; }
.chat-heading .eyebrow { margin-bottom: 12px; }
.chat-heading h1 { font-size: clamp(36px, 4vw, 52px); line-height: 1.12; letter-spacing: -.045em; font-weight: 550; }
.chat-subtitle { margin-top: 14px; color: var(--muted); }
.chat-layout { display: grid; grid-template-columns: minmax(210px, 270px) minmax(0, 1fr); gap: 38px; align-items: start; padding-bottom: 42px; }
.chat-about { padding-top: 12px; color: var(--muted); font-size: 14px; }
.chat-about .status-badge { margin-bottom: 16px; }
.chat-about h2 { color: var(--ink); font-size: 21px; font-weight: 600; line-height: 1.3; }
.chat-about p { margin-top: 16px; }
.chat-about details { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.chat-about summary, .chat-evidence summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.chat-about details a { display: inline-block; margin-top: 16px; }
.chat-window { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: #fffef9; overflow: hidden; }
.chat-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.chat-toolbar h2 { font-size: 16px; font-weight: 650; }
.chat-toolbar p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.chat-quiet { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.chat-quiet:hover { background: var(--surface); }
.chat-history-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-inline: 24px; }
.chat-history-bar:has(button:not([hidden])) { padding-block: 12px; border-bottom: 1px solid var(--line); }
.chat-history-note { font-size: 12px; color: var(--muted); }
.chat-history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-messages { max-height: min(56vh, 620px); min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px; scrollbar-gutter: stable; }
.chat-messages:empty { display: none; }
.chat-message { margin-block: 24px; max-width: 100%; }
.chat-message-user { margin-left: 10%; padding: 16px 18px; border-radius: 10px 10px 2px 10px; background: var(--surface); }
.chat-message-newi { padding-right: 5%; }
.chat-message-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.chat-message-meta strong { font-size: 13px; color: var(--ink); }
.chat-message-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.65; }
.chat-evidence { margin-top: 16px; font-size: 12px; }
.chat-evidence pre { max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; background: var(--surface); border-radius: 6px; font-size: 11px; }
.chat-native-lesson { margin-top: 18px; }
.chat-native-lesson h3 { font-size: 13px; font-weight: 650; }
.chat-native-lesson pre { font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.chat-native-facts { margin-top: 16px; font-size: 13px; }
.chat-native-facts > div { display: flex; justify-content: space-between; gap: 18px; padding-block: 7px; border-bottom: 1px solid var(--line); }
.chat-native-facts dt { color: var(--muted); }
.chat-native-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.chat-native-investigation { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; }
.chat-native-investigation h3 { font-size: 14px; font-weight: 650; }
.chat-native-investigation > p { margin-top: 10px; overflow-wrap: anywhere; }
.chat-investigation-block { margin-top: 16px; }
.chat-investigation-block h4 { font-size: 12px; font-weight: 650; margin-bottom: 6px; }
.chat-investigation-block pre { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; background: var(--surface); border-radius: 6px; font-size: 11px; }
.chat-investigation-details { margin-top: 16px; }
.chat-investigation-details summary { cursor: pointer; font-weight: 600; }
.chat-interface-note { font-size: 12px; color: var(--muted); margin-top: 12px; }
.chat-native-answer { margin-top: 18px; font-size: 14px; }
.chat-native-answer h3 { font-size: 13px; font-weight: 650; }
.chat-answer-bindings { margin: 10px 0 0; padding-left: 20px; overflow-wrap: anywhere; }
.chat-grounding { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }
.chat-grounding > summary { cursor: pointer; font-weight: 600; }
.chat-grounding-original { margin-top: 12px; padding: 10px; background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-grounding-field { display: block; margin-top: 12px; min-width: 0; }
.chat-grounding-field > span { display: block; margin-bottom: 5px; }
.chat-grounding-control { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 44px; padding: 9px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #aab9a5; border-radius: 5px; }
.chat-grounding-role { margin-top: 16px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.chat-grounding-role legend { font-weight: 600; padding-inline: 5px; }
.chat-grounding-range { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.chat-grounding-range .chat-grounding-field { margin-top: 0; }
.chat-grounding-span { margin-top: 8px; color: var(--muted); overflow-wrap: anywhere; }
.chat-grounding-feedback { margin-top: 12px; color: #773a22; overflow-wrap: anywhere; }
.chat-grounding-submit { margin-top: 16px; }
.chat-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chat-choice { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-empty { padding: 48px 28px; text-align: center; color: var(--muted); }
.chat-empty > span { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--surface); font-size: 24px; color: var(--accent); margin-bottom: 20px; }
.chat-empty h3 { color: var(--ink); font-size: 21px; font-weight: 550; }
.chat-empty p { max-width: 380px; margin: 12px auto 0; font-size: 14px; }
.chat-empty .chat-interface-label { font-size: 11px; }
.chat-error { background: #fff1e9; color: #773a22; border-top: 1px solid #e1b9a5; padding: 14px 24px; font-size: 14px; overflow-wrap: anywhere; }
.chat-composer { padding: 20px 24px; border-top: 1px solid var(--line); }
.chat-composer label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.chat-composer textarea { width: 100%; resize: vertical; min-height: 90px; max-height: 280px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #aab9a5; border-radius: 6px; padding: 12px; }
.chat-compose-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; }
.chat-compose-actions p { font-size: 11px; color: var(--muted); }
.chat-page button:disabled { opacity: .6; cursor: wait; }
.chat-page [hidden] { display: none !important; }
@media (max-width: 950px) { .chat-layout { gap: 24px; grid-template-columns: 210px minmax(0, 1fr); } }
@media (max-width: 760px) {
  .chat-heading { padding-top: 30px; align-items: start; flex-direction: column; gap: 16px; }
  .chat-layout { grid-template-columns: 1fr; gap: 24px; }
  .chat-window { order: -1; }
  .chat-about { padding: 0; }
  .chat-about > p, .chat-about details { font-size: 13px; }
  .chat-about details { margin-top: 16px; padding-top: 14px; }
  .chat-toolbar, .chat-composer { padding: 16px; }
  .chat-messages { padding-inline: 16px; max-height: 60vh; }
  .chat-empty { padding: 32px 20px; }
  .chat-message-user { margin-left: 5%; }
  .chat-compose-actions { align-items: end; }
  .chat-compose-actions p { max-width: 160px; }
  .chat-history-bar { padding-inline: 16px; flex-wrap: wrap; }
}
