:root {
  color-scheme: light;
  --paper: #F4F4F5;
  --surface: #fff;
  --violet: #532EFC;
  --blue: #2776FC;
  --ink: #18181B;
  --muted: #52525B;
  --line: #E4E4E7;
  --line-strong: #D4D4D8;
  --soft-violet: #E3DCFF;
  --warning: #FFAA11;
  --error: #9D2C22;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-size: 14px; }
button, input, select { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
svg { display: block; }
.app-shell { min-height: 100vh; }

.topbar { min-height: 76px; padding: 0 clamp(20px, 5.2vw, 84px); display: flex; justify-content: space-between; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.5); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--violet); color: white; }
.brand-mark svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 14px; font-weight: 650; letter-spacing: -.025em; }
.brand-copy small, .micro-label, .identity-label, .demo-badge, .eyebrow, .field-label, .endpoint-note, .result-state, .result-meta, .citation-label, .source-label, .source-availability, .metric-label, .metric small, .system-title, .page-footer { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.brand-copy small { color: var(--muted); font-size: 9px; letter-spacing: .09em; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.demo-badge { display: inline-flex; gap: 8px; align-items: center; color: #7A4B00; font-size: 9px; letter-spacing: .1em; }
.demo-badge span, .eyebrow-dot, .endpoint-dot, .system-indicator, .metric-dot, .result-state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); flex: none; }
.demo-badge span { background: #A56500; }
.identity-picker { min-height: 42px; padding: 0 11px; display: flex; align-items: center; gap: 9px; position: relative; border: 1px solid var(--line-strong); background: var(--surface); }
.identity-icon { color: var(--violet); }
.identity-icon svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.4; }
.identity-label { color: var(--muted); font-size: 8px; letter-spacing: .075em; white-space: nowrap; }
.identity-picker select { max-width: 235px; padding: 7px 18px 7px 1px; border: 0; appearance: none; background: transparent; color: var(--ink); font-size: 11px; cursor: pointer; }
.chevron { width: 12px; height: 12px; margin-left: -17px; pointer-events: none; fill: none; stroke: var(--muted); stroke-width: 1.4; }

.main-content { width: min(1100px, calc(100% - 48px)); margin: 0 auto; padding: 50px 0 24px; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 32px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 16px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; letter-spacing: .11em; }
.eyebrow-dot { width: 6px; height: 6px; }
.eyebrow-slash { color: #a1a7a2; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; color: var(--ink); font-size: clamp(28px, 4vw, 42px); line-height: 1.12; letter-spacing: -.055em; font-weight: 580; }
h1 > span { color: var(--violet); }
.intro-description { max-width: 530px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.access-context { min-width: 260px; margin-bottom: 2px; padding: 12px 15px; display: flex; gap: 11px; align-items: center; border: 1px solid var(--line); background: rgba(255,255,255,.58); }
.context-icon { color: var(--violet); }
.context-icon svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.35; stroke-linejoin: round; }
.access-context > div:last-child { display: grid; gap: 5px; }
.micro-label { color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.access-context strong { font-size: 11px; font-weight: 560; }
.access-context i, .endpoint-note i, .result-meta i, .metric small i, .page-footer i { padding: 0 3px; color: #A1A1AA; font-style: normal; }

.query-card, .answer-card, .source-card { border: 1px solid var(--line); background: var(--surface); }
.query-card { padding: 20px 24px 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-index { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--violet); font-family: ui-monospace, monospace; font-size: 9px; }
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.025em; font-weight: 620; }
.endpoint-note { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .015em; }
.endpoint-dot { width: 5px; height: 5px; }
.field-label { display: block; margin: 0 0 8px 1px; color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.query-input-row { display: flex; gap: 10px; }
.query-input-row input { width: 100%; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 0; background: #fff; color: var(--ink); font-size: 13px; }
.query-input-row input::placeholder { color: #939b95; }
.query-input-row button { height: 48px; min-width: 150px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--violet); border-radius: 0; background: var(--violet); color: #fff; cursor: pointer; font-size: 12px; font-weight: 560; transition: background-color 150ms ease-out, border-color 150ms ease-out; }
.query-input-row button:hover { border-color: #4020D8; background: #4020D8; }
.query-input-row button:disabled { cursor: wait; opacity: .75; }
.query-input-row button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.query-hint { min-height: 28px; padding-top: 12px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.query-hint svg { width: 13px; height: 13px; fill: none; stroke: var(--blue); stroke-width: 1.15; }
.query-hint kbd { margin-left: auto; padding: 2px 5px; border: 1px solid var(--line); color: #89908b; font-family: ui-monospace, monospace; font-size: 9px; }

.results-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 16px; margin-top: 16px; align-items: stretch; }
.answer-card { min-height: 308px; display: flex; flex-direction: column; }
.result-topline { min-height: 44px; padding: 0 19px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.result-state { display: inline-flex; gap: 7px; align-items: center; color: var(--violet); font-size: 8px; letter-spacing: .1em; }
.result-state-dot { width: 6px; height: 6px; }
.result-state.is-loading .result-state-dot { background: #b7833c; animation: pulse 1.1s infinite ease-in-out; }
.result-state.is-error, .result-state.is-error .result-state-dot { color: var(--error); }
.result-state.is-error .result-state-dot { background: var(--error); }
.result-meta { color: #7e8780; font-size: 8px; letter-spacing: .045em; white-space: nowrap; }
.answer-body { flex: 1; min-height: 194px; padding: 24px 21px 22px; }
.empty-state { max-width: 420px; min-height: 145px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-icon { width: 40px; height: 40px; margin-bottom: 12px; display: grid; place-items: center; border: 1px solid var(--line); background: #FAFAFA; color: var(--violet); }
.empty-icon svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.25; }
.empty-state h2 { margin: 0 0 7px; color: var(--ink); font-size: 15px; font-weight: 590; letter-spacing: -.02em; }
.empty-state p { max-width: 360px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.answer-content h2 { margin: 2px 0 11px; color: var(--ink); font-size: 19px; line-height: 1.35; font-weight: 580; letter-spacing: -.035em; }
.answer-content p { margin: 0; color: #3F3F46; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.answer-eyebrow { margin: 0 0 9px !important; color: var(--muted) !important; font-family: ui-monospace, monospace; font-size: 8px !important; letter-spacing: .1em; text-transform: uppercase; }
.answer-error h2 { color: var(--error); }
.citation-footer { min-height: 54px; padding: 9px 17px; display: flex; justify-content: space-between; align-items: center; gap: 14px; border-top: 1px solid var(--line); }
.citation-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 8px; letter-spacing: .1em; white-space: nowrap; }
.citation-icon { color: var(--muted); }
.citation-icon svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.25; }
.citation-list { display: flex; justify-content: end; gap: 7px; flex-wrap: wrap; }
.citation-button { padding: 6px 9px; display: inline-flex; gap: 6px; align-items: center; border: 1px solid #C4B5FD; border-radius: 0; background: #FAF9FF; color: #4322D7; cursor: pointer; font-family: ui-monospace, monospace; font-size: 9px; transition: background-color 130ms ease-out; }
.citation-button:hover, .citation-button[aria-current="true"] { background: var(--soft-violet); }
.citation-button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.no-citations { color: #939b95; font-size: 10px; }

.source-card { min-height: 308px; display: flex; flex-direction: column; }
.source-topline { min-height: 44px; padding: 0 17px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.source-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.source-icon { color: var(--violet); }
.source-icon svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.source-availability { display: inline-flex; gap: 6px; align-items: center; color: #8a938c; font-size: 7px; letter-spacing: .06em; white-space: nowrap; }
.source-availability > span { width: 5px; height: 5px; border-radius: 50%; background: #a8afaa; }
.source-availability.is-ready { color: var(--violet); }
.source-availability.is-ready > span { background: var(--violet); }
.source-availability.is-error { color: var(--error); }
.source-availability.is-error > span { background: var(--error); }
.source-content { flex: 1; padding: 20px 19px; }
.source-placeholder { min-height: 174px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.document-illustration { width: 44px; height: 48px; margin-bottom: 12px; position: relative; display: grid; place-items: center; color: #71717A; }
.document-illustration svg { width: 41px; height: 46px; stroke: currentColor; stroke-width: 1.1; stroke-linecap: square; }
.document-illustration svg .document-fold { stroke: var(--paper); stroke-width: 2.8; }
.document-illustration span { width: 6px; height: 6px; position: absolute; right: 1px; bottom: 1px; border: 1px solid var(--violet); background: #fff; }
.source-placeholder h2 { margin: 0 0 7px; font-size: 13px; font-weight: 580; }
.source-placeholder p { max-width: 240px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.source-document { color: #3F3F46; font-size: 11px; line-height: 1.8; }
.source-document .source-document-head { margin: 0 0 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; color: var(--violet); font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: .03em; }
.source-document p { margin: 0 0 9px; }
.source-document h3 { margin: 12px 0 6px; color: var(--ink); font-size: 11px; font-weight: 630; }
.source-access { min-height: 38px; padding: 8px 14px; display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.access-lock { color: var(--muted); }
.access-lock svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.15; }

.system-panel { margin-top: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.48); }
.system-title { min-height: 39px; padding: 0 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 8px; letter-spacing: .1em; }
.system-indicator { width: 6px; height: 6px; }
.system-title h2 { margin: 0; font: inherit; }
.system-separator, .system-subtitle { color: #879088; }
.system-metrics { display: grid; grid-template-columns: repeat(3, 1fr); }
.metric { min-height: 86px; padding: 13px 16px 12px; display: grid; grid-template-columns: 1fr; align-content: start; gap: 7px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 8px; letter-spacing: .095em; }
.metric-value { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 560; }
.metric-dot { width: 6px; height: 6px; }
.metric-dot.idle { background: #8c958e; }
.metric-dot.checking { background: #b7833c; animation: pulse 1.1s infinite ease-in-out; }
.metric-dot.offline { background: var(--error); }
.metric small { color: #858e87; font-size: 8px; }
.demo-notice { min-height: 40px; margin: 0; padding: 9px 16px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; line-height: 1.5; }
.demo-notice svg { width: 14px; height: 14px; flex: none; stroke: var(--muted); stroke-width: 1.15; }
.page-footer { padding: 18px 1px 0; display: flex; justify-content: space-between; gap: 10px; color: #71717A; font-size: 8px; letter-spacing: .085em; }

.citation-dialog { width: min(640px, calc(100% - 32px)); max-height: min(80vh, 740px); padding: 0; border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); color: var(--ink); }
.citation-dialog::backdrop { background: rgba(24, 24, 27, .42); }
.dialog-head { padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-head h2 { margin: 6px 0 0; color: var(--ink); font-size: 19px; font-weight: 580; letter-spacing: -.03em; }
.dialog-close { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--muted); cursor: pointer; }
.dialog-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.dialog-meta { padding: 11px 22px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, monospace; font-size: 9px; }
.citation-dialog pre { max-height: 50vh; margin: 0; padding: 22px; overflow: auto; color: #3F3F46; font: 12px/1.8 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; }
.dialog-foot { min-height: 42px; padding: 10px 22px; display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(400px, calc(100% - 40px)); padding: 12px 15px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 12px; line-height: 1.5; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 150ms ease-out, transform 150ms ease-out; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: #d9b9b4; color: var(--error); }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 760px) {
  .topbar { min-height: 68px; padding: 0 20px; }
  .topbar-right { gap: 12px; }
  .demo-badge { font-size: 8px; }
  .identity-picker { min-height: 38px; gap: 6px; padding: 0 8px; }
  .identity-label, .identity-icon { display: none; }
  .identity-picker select { max-width: 200px; font-size: 10px; }
  .main-content { width: min(100% - 36px, 620px); padding-top: 38px; }
  .intro-row { align-items: start; flex-direction: column; gap: 19px; margin-bottom: 23px; }
  .access-context { min-width: 0; }
  .results-grid { grid-template-columns: 1fr; }
  .answer-card, .source-card { min-height: 275px; }
  .source-placeholder { min-height: 158px; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 15px; gap: 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-copy strong { font-size: 12px; }
  .brand-copy small { font-size: 7px; }
  .topbar-right { gap: 9px; }
  .demo-badge { gap: 5px; font-size: 7px; }
  .demo-badge span { width: 5px; height: 5px; }
  .identity-picker { max-width: 151px; }
  .identity-picker select { width: 117px; padding-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
  .chevron { width: 10px; height: 10px; margin-left: -12px; }
  .main-content { width: calc(100% - 30px); padding-top: 30px; }
  .eyebrow { margin-bottom: 13px; font-size: 8px; }
  h1 { max-width: 360px; font-size: 31px; }
  .intro-description { font-size: 12px; }
  .query-card { padding: 16px 14px 13px; }
  .section-heading { align-items: start; flex-direction: column; gap: 9px; margin-bottom: 16px; }
  .section-heading h2 { font-size: 15px; }
  .query-input-row { flex-direction: column; gap: 8px; }
  .query-input-row input, .query-input-row button { height: 45px; }
  .query-input-row button { width: 100%; }
  .query-hint { font-size: 9px; }
  .result-topline { padding: 0 12px; }
  .result-meta { font-size: 7px; }
  .answer-body { padding: 19px 15px; }
  .citation-footer { align-items: start; flex-direction: column; gap: 7px; padding: 10px 13px; }
  .citation-list { justify-content: start; }
  .source-topline { padding: 0 12px; }
  .source-availability { font-size: 6px; }
  .source-content { padding: 16px 14px; }
  .system-metrics { grid-template-columns: 1fr; }
  .metric { min-height: auto; padding: 10px 13px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .metric-value { font-size: 10px; }
  .metric small { font-size: 7px; }
  .demo-notice { padding: 10px 12px; align-items: start; font-size: 8px; }
  .page-footer { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
