:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202731;
  background: #f4f4f0;
  --muted: #606873;
  --line: #d9ddd9;
  --accent: #2452bf;
  --surface: #fff;
  --soft: #f6f7f5;
  --danger: #9f352b;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { min-height: 36px; padding: 7px 13px; border: 1px solid #bdc5cb; border-radius: 5px; background: white; color: inherit; font-weight: 550; cursor: pointer; transition: background 150ms ease-out; }
button:hover:enabled { background: #eef1f5; }
button:active:enabled { background: #dfe5ef; }
button:disabled { cursor: not-allowed; color: #727984; background: #f3f4f4; border-color: #d9dde0; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; }
button.primary:hover:enabled { background: #1d429d; }
button.primary:disabled { background: #e0e6ef; border-color: #d1d9e5; color: #63718b; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #d7e3ff; color: #182c55; }
input { width: 100%; min-height: 36px; border: 1px solid #bdc5cb; border-radius: 4px; padding: 6px 9px; color: inherit; background: white; caret-color: var(--accent); }
input::placeholder { color: #6c737c; }
input:disabled { background: var(--soft); color: var(--muted); }
label { display: grid; min-width: 0; gap: 5px; font-size: 12px; font-weight: 600; }
label span { font-weight: 400; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 27px; letter-spacing: -.025em; font-weight: 620; line-height: 1.2; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
pre, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 0; padding: 12px; border-radius: 4px; background: var(--soft); max-height: 340px; overflow: auto; }
summary { cursor: pointer; font-size: 12px; }
summary:hover { color: var(--accent); }
.console { max-width: 1536px; margin: 0 auto; padding: 32px 36px 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-header p { color: var(--muted); margin-top: 7px; font-size: 13px; }
.provenance { flex: none; font-size: 11px; color: #485747; padding: 5px 9px; background: #e9eee5; border: 1px solid #d3ddce; border-radius: 4px; }
.muted, .scope-note, .observed-line, .plan-footnote, footer { color: var(--muted); }
.small { font-size: 12px; }
.connection { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin-bottom: 24px; }
.connection-line { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 12px; }
.connection details { margin-top: 9px; }
.connection summary { width: fit-content; }
#connection-target { margin-left: 10px; color: var(--muted); overflow-wrap: anywhere; font-weight: 400; }
.connection-form { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr auto; gap: 12px; align-items: end; margin-top: 16px; }
.connection-form .form-help { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #88919b; flex: none; }
.status[data-tone="good"]::before { background: #2d7753; }
.status[data-tone="active"]::before { background: var(--accent); }
.status[data-tone="error"]::before { background: #b74738; }
.status[data-tone="warning"]::before { background: #987218; }
.inline-error { margin: 12px 0 0; padding: 10px 12px; background: #fff0eb; color: var(--danger); border: 1px solid #efd5cc; border-radius: 4px; overflow-wrap: anywhere; font-size: 12px; }
.run-panel { background: var(--surface); border: 1px solid var(--line); padding: 19px 22px 15px; border-radius: 7px; }
.run-heading { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
#run-id { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.actions, .settings { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.settings { gap: 16px; }
.settings label:first-child { grid-template-columns: auto auto; gap: 5px 8px; }
.settings label:first-child input { grid-column: 1 / -1; }
.settings input { width: 110px; font-variant-numeric: tabular-nums; }
.settings label:nth-child(2) input { width: 180px; }
#control-help { font-size: 12px; margin-top: 11px; }
#limit-help { margin-top: 4px; }
.progress-line { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; font-size: 12px; }
#progress-label { font-weight: 600; }
progress { display: block; width: 100%; height: 5px; margin-top: 9px; border: 0; appearance: none; border-radius: 10px; overflow: hidden; background: #e7eae6; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #e7eae6; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.counters { display: flex; gap: 32px; margin: 16px 0 12px; flex-wrap: wrap; }
.counters div { display: flex; align-items: baseline; gap: 10px; }
.counters dt { font-size: 12px; color: var(--muted); }
.counters dd { margin: 0; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.plan-footnote { display: flex; justify-content: space-between; align-items: baseline; gap: 15px; font-size: 11px; }
.plan-footnote details { max-width: 50%; text-align: right; }
.plan-footnote pre { text-align: left; }
#coverage-note, #source-quality { margin-top: 9px; font-size: 11px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); margin-top: 24px; gap: 24px; align-items: start; }
.conversation-pane, .backend-pane { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 20px; }
.section-heading > span { font-size: 11px; }
.slots { display: flex; gap: 6px; padding: 0 20px 14px; overflow-x: auto; }
.slots:empty { display: none; }
.slots button { min-height: 33px; font-size: 12px; padding: 5px 10px; white-space: nowrap; }
.slots button[aria-pressed="true"] { color: #244a9f; background: #edf2fc; border-color: #afc3ed; }
.conversation-meta { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 9px 20px; font-size: 11px; overflow-wrap: anywhere; background: var(--soft); }
.messages { height: 510px; overflow: auto; overscroll-behavior: contain; padding: 4px 20px 20px; }
.messages:focus-visible { outline-offset: -3px; }
.turn { padding: 17px 0; border-bottom: 1px solid #edf0ec; }
.turn:last-child { border-bottom: 0; }
.turn-heading { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.turn-heading strong { font-size: 12px; font-weight: 650; }
.turn-heading span { font-size: 10px; color: var(--muted); }
.turn p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.65; max-width: 75ch; }
.turn[data-role="tool"] p { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 11px; background: var(--soft); padding: 10px; border-radius: 4px; }
.turn[data-role="assistant"] strong { color: #2b578e; }
.empty { color: var(--muted); font-size: 12px; padding: 24px 0; max-width: 60ch; }
.scope-note { padding: 0 20px; font-size: 11px; }
.observed-line { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10px; padding: 8px 20px 15px; border-bottom: 1px solid var(--line); }
.backend-pane > .inline-error { margin: 12px 20px; }
.result-section { padding: 17px 20px; border-bottom: 1px solid var(--line); }
.result-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.result-heading span { font-size: 11px; }
.result-section > .small { margin-top: 6px; }
#clusters, #decisions, #proposals { max-height: 300px; overflow: auto; }
.pages { display: flex; justify-content: end; gap: 6px; padding-top: 10px; }
.pages button { font-size: 11px; min-height: 32px; }
.result-row { border-bottom: 1px solid #e8ece8; padding: 12px 0; }
.result-row:last-child { border-bottom: 0; }
.result-row .row-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.result-row strong { font-weight: 600; font-size: 12px; overflow-wrap: anywhere; }
.result-row .count { white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.result-row .context { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin-top: 8px; max-width: 65ch; }
.result-row .meta { color: var(--muted); margin-top: 4px; font-size: 10px; overflow-wrap: anywhere; }
.result-row details { margin-top: 7px; }
.backend-details { padding: 14px 20px; }
.backend-details summary { font-weight: 600; }
.backend-details summary span { font-weight: 400; margin-left: 8px; }
.activity { margin-top: 24px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; overflow: hidden; }
.activity .section-heading { border-bottom: 1px solid var(--line); }
#events { list-style: none; margin: 0; padding: 0 20px; max-height: 235px; overflow: auto; }
#events li:not(.empty) { display: grid; grid-template-columns: 84px 108px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px solid #edf0ec; font-size: 11px; }
#events time { color: var(--muted); font-variant-numeric: tabular-nums; }
#events .event-type { color: #4a596c; }
#events .event-message { overflow-wrap: anywhere; }
footer { padding: 18px 0 0; font-size: 11px; }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-180%); z-index: 5; padding: 10px; background: white; color: var(--accent); }
.skip-link:focus { transform: translateY(0); }
[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .console { padding: 24px; }
  .toolbar { align-items: start; flex-direction: column; gap: 16px; }
  .connection-form { grid-template-columns: 1fr 1fr; }
  .connection-form button { justify-self: start; }
  .counters { gap: 12px 24px; }
}
@media (max-width: 780px) {
  .console { padding: 22px 16px; }
  .page-header { align-items: start; flex-direction: column; gap: 12px; }
  h1 { font-size: 24px; }
  .connection-line { gap: 8px 16px; }
  .workspace { grid-template-columns: 1fr; gap: 18px; margin-top: 18px; }
  .run-panel { padding: 16px; }
  .progress-line, .plan-footnote { flex-direction: column; gap: 5px; }
  .plan-footnote details { max-width: 100%; text-align: left; }
  .messages { height: 440px; }
  .connection-form { grid-template-columns: 1fr; }
  .counters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .counters div { justify-content: space-between; gap: 6px; }
  .counters dt { font-size: 11px; }
  .counters dd { font-size: 13px; }
  .settings { gap: 14px; }
  .settings label:nth-child(2) input { width: 168px; }
  #events li:not(.empty) { grid-template-columns: 76px 1fr; gap: 4px 10px; }
  #events .event-message { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

.hosted-connection { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-top: 12px; font-size: 12px; }
.hosted-connection #connection-target { margin-left: 0; }
.hosted-connection button { margin-left: auto; min-height: 32px; font-size: 12px; }
.hosted-connection a { color: var(--accent); text-underline-offset: 3px; }
.auth-gate { max-width: 650px; margin: 60px auto; padding: 24px; }
.auth-gate p { margin-top: 12px; color: var(--muted); }
