.informed-chat {
  --chat-canvas: #ffffff;
  --chat-surface: #f8fafc;
  --chat-surface-selected: #edf4ff;
  --chat-text: #101828;
  --chat-muted: #667085;
  --chat-border: #d7dee8;
  --chat-accent: #1748b5;
  --chat-accent-dark: #10378b;
  --chat-success: #167443;
  --chat-pending: #b66a08;
  --chat-danger: #b42318;
  width: min(440px, 100%);
  min-width: 380px;
  height: 100%;
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--chat-canvas);
  color: var(--chat-text);
  border-left: 1px solid var(--chat-border);
  font: 14px/1.45 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.informed-chat *,
.informed-chat *::before,
.informed-chat *::after { box-sizing: border-box; }
.informed-chat h2,
.informed-chat h3,
.informed-chat p { margin: 0; }
.informed-chat button,
.informed-chat textarea { font: inherit; }
.informed-chat button:focus-visible,
.informed-chat textarea:focus-visible { outline: 3px solid rgb(23 72 181 / 24%); outline-offset: 2px; }

.informed-chat__header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--chat-border);
}
.informed-chat__header h2 { font-size: 17px; letter-spacing: -.01em; }
.informed-chat__header p { margin-top: 2px; color: var(--chat-muted); font-size: 11px; }
.informed-chat__model-status { display: flex; align-items: center; gap: 7px; color: var(--chat-muted); font-size: 11px; white-space: nowrap; }
.informed-chat__model-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--chat-pending); box-shadow: 0 0 0 3px rgb(182 106 8 / 10%); }
.informed-chat__model-status.is-configured > span { background: var(--chat-success); box-shadow: 0 0 0 3px rgb(22 116 67 / 10%); }
.informed-chat__model-status.is-unavailable { color: var(--chat-danger); }
.informed-chat__model-status.is-unavailable > span { background: var(--chat-danger); box-shadow: 0 0 0 3px rgb(180 35 24 / 10%); }

.informed-chat__context { padding: 13px 18px 14px; background: var(--chat-surface); border-bottom: 1px solid var(--chat-border); }
.informed-chat__scope { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.informed-chat__scope > span { color: var(--chat-muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.informed-chat__scope > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.informed-chat__project-paths { display: grid; gap: 6px; margin: 9px 0 0; padding: 0; list-style: none; }
.informed-chat__project-paths li { display: grid; gap: 2px; padding: 7px 8px; border: 1px solid #cbd4e1; border-radius: 5px; background: var(--chat-canvas); overflow-wrap: anywhere; }
.informed-chat__project-paths strong { font-size: 10px; }
.informed-chat__project-paths span { color: var(--chat-muted); font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.informed-chat__chips { display: flex; gap: 6px; margin-top: 10px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: thin; }
.informed-chat__chip { flex: 0 0 auto; display: flex; align-items: baseline; gap: 5px; max-width: 196px; padding: 5px 8px; border: 1px solid #cbd4e1; border-radius: 5px; background: var(--chat-canvas); font-size: 10px; }
.informed-chat__chip span { color: var(--chat-muted); }
.informed-chat__chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.informed-chat__narrow { margin-top: 9px; border-top: 1px solid var(--chat-border); padding-top: 7px; color: var(--chat-muted); font-size: 10px; }
.informed-chat__narrow summary { cursor: pointer; color: var(--chat-accent-dark); font-weight: 700; }
.informed-chat__narrowing { display: grid; gap: 7px; padding-top: 8px; }
.informed-chat__narrowing fieldset { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 0; border: 0; padding: 0; }
.informed-chat__narrowing legend { width: 100%; color: var(--chat-text); font-weight: 650; }
.informed-chat__narrowing label { display: inline-flex; align-items: center; gap: 4px; overflow-wrap: anywhere; }
.informed-chat__narrow-status { min-height: 14px; color: var(--chat-accent-dark); }

.informed-chat__log { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 15px; overflow-x: hidden; overflow-y: auto; padding: 18px; background: #fbfcfe; }
.informed-chat__log > * { flex: 0 0 auto; min-width: 0; max-width: 100%; }
.informed-chat__turn { width: fit-content; max-width: 88%; }
.informed-chat__turn > span { display: block; margin-bottom: 4px; color: var(--chat-muted); font-size: 11px; font-weight: 650; }
.informed-chat__turn p { padding: 9px 11px; border: 1px solid var(--chat-border); border-radius: 5px; background: var(--chat-canvas); box-shadow: 0 1px 2px rgb(16 24 40 / 5%); font-size: 13px; }
.informed-chat__turn.is-user { align-self: flex-end; }
.informed-chat__turn.is-user > span { text-align: right; }
.informed-chat__turn p, .informed-chat__answer > p, .informed-chat__refusal h3, .informed-chat__outage p { white-space: pre-wrap; overflow-wrap: anywhere; }
.informed-chat__turn.is-user p { border-color: #c8d8f3; background: var(--chat-surface-selected); }

.informed-chat__proposal,
.informed-chat__answer,
.informed-chat__refusal,
.informed-chat__clarification,
.informed-chat__outage { width: 100%; overflow: hidden; display: grid; gap: 12px; padding: 15px; border: 1px solid var(--chat-border); border-radius: 5px; background: var(--chat-canvas); box-shadow: 0 1px 2px rgb(16 24 40 / 6%); }
.informed-chat__proposal > *,
.informed-chat__answer > *,
.informed-chat__refusal > *,
.informed-chat__clarification > *,
.informed-chat__outage > * { min-width: 0; max-width: 100%; }
.informed-chat__proposal { border-top: 3px solid var(--chat-accent); }
.informed-chat__proposal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.informed-chat__proposal-heading > div { min-width: 0; }
.informed-chat__proposal h3,
.informed-chat__refusal h3,
.informed-chat__clarification h3,
.informed-chat__outage h3 { font-size: 14px; line-height: 1.35; }
.informed-chat__eyeline { display: block; margin-bottom: 2px; color: var(--chat-muted); font-size: 10px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.informed-chat__draft-state { padding: 4px 7px; border: 1px solid #e6c899; border-radius: 5px; color: #8a4b05; background: #fff9ed; font-size: 10px; white-space: nowrap; }
.informed-chat__proposal-summary,
.informed-chat__answer p,
.informed-chat__refusal p,
.informed-chat__clarification p,
.informed-chat__outage p { overflow-wrap: anywhere; color: #475467; font-size: 12px; }

.informed-chat__changes { width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--chat-border); border-radius: 5px; overflow: hidden; }
.informed-chat__diff-row { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.informed-chat__diff-identity { grid-column: 1 / -1; margin: 0; padding: 7px 10px; border-bottom: 1px solid var(--chat-border); background: var(--chat-canvas); color: #475467; overflow-wrap: anywhere; font-size: 10px; font-weight: 680; }
.informed-chat__diff-row > div { min-width: 0; padding: 9px 10px; }
.informed-chat__diff-row > .is-after { border-left: 1px solid var(--chat-border); }
.informed-chat__diff-row span { display: block; margin-bottom: 3px; color: var(--chat-muted); font-size: 10px; }
.informed-chat__diff-row strong { display: block; overflow-wrap: anywhere; word-break: break-word; font-size: 12px; font-weight: 650; }
.informed-chat__diff-row .is-before { background: #fff6f5; }
.informed-chat__diff-row .is-before strong { color: #8f2d25; text-decoration: line-through; text-decoration-thickness: 1px; }
.informed-chat__diff-row .is-after { background: #f1f8f4; }
.informed-chat__diff-row .is-after strong { color: #126038; }

.informed-chat__proposal-details { display: grid; gap: 7px; margin: 0; }
.informed-chat__proposal-details > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; }
.informed-chat__proposal-details dt { color: var(--chat-muted); font-size: 11px; }
.informed-chat__proposal-details dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; font-weight: 600; }
.informed-chat__warnings { display: grid; gap: 4px; margin: 0; padding: 9px 10px 9px 27px; border-left: 3px solid var(--chat-pending); background: #fffaf1; color: #684008; font-size: 11px; }
.informed-chat__hashes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.informed-chat__hashes > div { min-width: 0; }
.informed-chat__hashes span { display: block; color: var(--chat-muted); font-size: 9px; text-transform: uppercase; letter-spacing: .03em; }
.informed-chat__hashes strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.informed-chat__review { display: grid; gap: 8px; padding: 11px; border: 1px solid #c8d8f3; border-radius: 5px; background: #f7faff; }
.informed-chat__review h4 { margin: 0; font-size: 12px; }
.informed-chat__review textarea { width: 100%; resize: vertical; border: 1px solid #bfc8d6; border-radius: 5px; padding: 7px; background: #fff; font-size: 11px; }
.informed-chat__review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.informed-chat__review-status { color: var(--chat-accent-dark); font-size: 10px; font-weight: 650; }
.informed-chat__citations { display: grid; gap: 6px; margin: 0; padding-left: 19px; }
.informed-chat__citation { width: 100%; border: 1px solid #b7c8e5; border-radius: 5px; padding: 7px 8px; background: #fff; color: var(--chat-accent-dark); text-align: left; overflow-wrap: anywhere; font-size: 10px; cursor: pointer; }
.informed-chat__citation:hover { background: var(--chat-surface-selected); }
.informed-chat__citation-path, .informed-chat__citation-hash { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 9px; line-height: 1.45; }
.informed-chat__citation-path { color: var(--chat-text); }
.informed-chat__citation-hash { color: var(--chat-muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.informed-chat__button { min-height: 36px; border: 1px solid transparent; border-radius: 5px; padding: 7px 11px; font-size: 12px; font-weight: 680; cursor: pointer; }
.informed-chat__button.is-primary { background: var(--chat-accent); color: #fff; }
.informed-chat__button.is-primary:hover { background: var(--chat-accent-dark); }
.informed-chat__button.is-secondary { border-color: var(--chat-accent); background: #fff; color: var(--chat-accent); }
.informed-chat__button.is-secondary:hover:not(:disabled) { background: var(--chat-surface-selected); }
.informed-chat__button:disabled { cursor: not-allowed; opacity: .5; }
.informed-chat__authority-note { text-align: center; color: var(--chat-muted) !important; font-size: 10px !important; }

.informed-chat__clarification { border-left: 3px solid var(--chat-accent); background: #f7faff; }
.informed-chat__answer { border-left: 3px solid var(--chat-success); background: #f5fbf8; }
.informed-chat__refusal { border-left: 3px solid var(--chat-danger); background: #fffafa; }
.informed-chat__suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.informed-chat__suggestions button { border: 1px solid #b7c8e5; border-radius: 5px; padding: 6px 8px; background: #fff; color: var(--chat-accent-dark); font-size: 11px; cursor: pointer; }
.informed-chat__suggestions button:hover { background: var(--chat-surface-selected); }
.informed-chat__outage { border-left: 3px solid var(--chat-danger); background: #fffafa; }

.informed-chat__composer { padding: 13px 18px 10px; border-top: 1px solid var(--chat-border); background: var(--chat-canvas); }
.informed-chat__composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.informed-chat__composer textarea { width: 100%; min-height: 48px; max-height: 112px; resize: vertical; border: 1px solid #bfc8d6; border-radius: 5px; padding: 8px 9px; background: #fff; color: var(--chat-text); font-size: 12px; }
.informed-chat__composer textarea:disabled { background: #f2f4f7; color: var(--chat-muted); }
.informed-chat__send { min-width: 62px; border: 0; border-radius: 5px; padding: 8px 12px; background: var(--chat-accent); color: #fff; font-size: 12px; font-weight: 680; cursor: pointer; }
.informed-chat__send:hover:not(:disabled) { background: var(--chat-accent-dark); }
.informed-chat__send:disabled { cursor: not-allowed; opacity: .46; }
.informed-chat__composer-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; color: var(--chat-muted); font-size: 9px; }
.informed-chat__composer-meta strong { color: #475467; }
.informed-chat__composer-status { min-height: 15px; margin-top: 4px !important; color: var(--chat-accent-dark); font-size: 10px; }

@media (prefers-reduced-motion: reduce) {
  .informed-chat * { scroll-behavior: auto !important; transition: none !important; }
}
