:root {
  --ink: #16211d;
  --muted: #66716c;
  --paper: #f5f5f0;
  --surface: #fff;
  --soft: #eceee8;
  --line: #dfe3dc;
  --acid: #d8ff72;
  --teal: #3fc8ad;
  --coral: #ff7454;
  --blue: #5b7cff;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, textarea, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -70px; z-index: 100; padding: 10px 14px; background: var(--acid); }
.skip-link:focus { top: 16px; }

.app-shell { display: grid; grid-template-columns: 278px minmax(0, 1fr); height: 100%; }
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 22px 18px; border-right: 1px solid var(--line); background: #fafaf7; }
.side-head { display: flex; align-items: center; justify-content: space-between; }
.product-mark { display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 750; line-height: 1.1; }
.product-mark small { display: block; margin-top: 5px; color: #88918d; font: 9px/1 var(--mono); letter-spacing: .06em; }
.mark-icon { display: grid; place-items: center; width: 36px; aspect-ratio: 1; border-radius: 12px; background: var(--ink); color: var(--acid); font: 800 13px/1 var(--mono); }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.side-close, .side-open { display: none; }
.new-chat { display: flex; align-items: center; width: 100%; margin: 28px 0 18px; padding: 12px 13px; border: 0; border-radius: 11px; background: var(--ink); color: white; cursor: pointer; font-weight: 700; }
.new-chat span { margin-right: 9px; font-size: 19px; font-weight: 400; }
.new-chat kbd { margin-left: auto; color: #9ba6a1; font: 9px/1 var(--mono); }
.side-nav { display: grid; gap: 5px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.side-nav button { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 0; border-radius: 9px; background: transparent; color: #5c6762; cursor: pointer; text-align: left; font-size: 13px; }
.side-nav button:hover, .side-nav button.is-active { background: var(--soft); color: var(--ink); }
.side-nav i { margin-left: auto; padding: 3px 7px; border-radius: 99px; background: white; font: normal 9px/1 var(--mono); }
.library-mini { min-height: 0; margin-top: 20px; overflow: auto; }
.side-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 9px; color: #8b948f; font: 700 9px/1 var(--mono); letter-spacing: .06em; }
.side-section-title button { border: 0; background: none; color: var(--ink); cursor: pointer; font-size: 10px; }
.scope-option { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.scope-option:hover { background: #f0f1ec; }
.scope-option.is-selected { border-color: #cad1c9; background: white; }
.scope-option input { position: absolute; opacity: 0; pointer-events: none; }
.file-glyph { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 37px; border: 1px solid #d6dad4; border-radius: 7px; background: #eef0eb; color: #78837e; font: 800 12px/1 var(--mono); }
.file-glyph.all { background: var(--acid); color: var(--ink); border-color: #b9d95f; }
.scope-option strong, .scope-option small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-option strong { font-size: 11px; }
.scope-option small { margin-top: 4px; color: #929a96; font: 9px/1 var(--mono); }
.side-foot { margin-top: auto; padding-top: 16px; }
.mode-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.mode-light { width: 9px; height: 9px; border-radius: 50%; background: #a4aaa7; box-shadow: 0 0 0 4px #eef0ec; }
body.is-live .mode-light { background: var(--teal); box-shadow: 0 0 0 4px #e1f6f1; }
body.is-demo .mode-light { background: var(--coral); box-shadow: 0 0 0 4px #ffeae5; }
.mode-card strong, .mode-card small { display: block; }
.mode-card strong { font-size: 10px; }
.mode-card small { margin-top: 3px; color: #8a938f; font: 8px/1.3 var(--mono); }
.side-foot > a { display: inline-block; margin: 15px 10px 0; color: #78827d; font: 10px/1 var(--mono); }

.workspace { position: relative; display: grid; grid-template-rows: 64px minmax(0, 1fr) auto; min-width: 0; height: 100%; background: var(--surface); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 26px; border-bottom: 1px solid var(--line); }
.crumb { display: flex; align-items: center; gap: 9px; font: 11px/1 var(--mono); }
.crumb span, .crumb b { color: #9aa29e; font-weight: 400; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 99px; color: #78817d; font: 700 8px/1 var(--mono); letter-spacing: .06em; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #a4aaa7; }
body.is-live .status-pill i { background: var(--teal); }
body.is-demo .status-pill i { background: var(--coral); }
.top-link { padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-size: 11px; }
.top-link:hover { background: var(--soft); }
.chat-main { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.welcome { width: min(870px, calc(100% - 40px)); margin: 0 auto; padding: clamp(70px, 10vh, 120px) 0 80px; }
.eyebrow { margin: 0 0 22px; color: #7d8782; font: 700 10px/1.4 var(--mono); letter-spacing: .11em; }
.eyebrow span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--teal); }
.welcome h1 { margin: 0; max-width: 760px; font-size: clamp(48px, 7vw, 84px); line-height: .96; letter-spacing: -.065em; }
.welcome h1 em { color: var(--coral); font-style: normal; }
.welcome-copy { max-width: 650px; margin: 27px 0 0; color: #58645e; font-size: 16px; line-height: 1.8; }
.sample-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 42px; }
.sample-grid button { position: relative; min-height: 142px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fafaf7; color: var(--ink); cursor: pointer; text-align: left; transition: transform .18s, border-color .18s, background .18s; }
.sample-grid button:hover { transform: translateY(-3px); border-color: #9ea8a2; background: white; }
.sample-grid span { color: var(--coral); font: 700 9px/1 var(--mono); }
.sample-grid strong, .sample-grid small { display: block; }
.sample-grid strong { margin-top: 34px; font-size: 13px; }
.sample-grid small { margin-top: 6px; color: #8a938f; font: 9px/1 var(--mono); }
.sample-grid i { position: absolute; right: 16px; top: 15px; font-style: normal; }
.workflow-note { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 14px 16px; border: 1px dashed #ccd2cb; border-radius: 12px; color: #7c8681; }
.flow-mini { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font: 700 8px/1 var(--mono); }
.flow-mini span { padding: 5px 7px; border-radius: 5px; background: var(--soft); color: #4c5752; }
.flow-mini b { color: #a6ada9; }
.workflow-note p { margin: 0; font: 9px/1 var(--mono); }
.workflow-note p b { color: var(--coral); }

.conversation { width: min(870px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 80px; }
.message { display: grid; grid-template-columns: 34px 1fr; gap: 14px; margin-bottom: 34px; }
.message-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--acid); font: 800 10px/1 var(--mono); }
.message.user .message-avatar { background: var(--soft); color: var(--ink); }
.message-body { min-width: 0; padding-top: 4px; }
.message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 10px; }
.message-meta strong { font-size: 12px; }
.message-meta span { color: #939b97; font: 9px/1 var(--mono); }
.demo-chip { padding: 4px 7px; border-radius: 99px; background: #ffe6df; color: #a43d25 !important; }
.answer-text { color: #35403b; font-size: 15px; line-height: 1.85; white-space: pre-wrap; }
.answer-text .citation { display: inline-block; margin-left: 3px; padding: 2px 6px; border-radius: 5px; background: #e6f9f4; color: #167e69; font: 700 10px/1.4 var(--mono); }
.trace-card { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--line); overflow: hidden; }
.trace-card div { padding: 11px; background: #fafaf7; }
.trace-card span, .trace-card strong { display: block; }
.trace-card span { color: #939b97; font: 8px/1 var(--mono); }
.trace-card strong { margin-top: 7px; font: 700 10px/1.2 var(--mono); }
.source-list { display: grid; gap: 8px; margin-top: 13px; }
.source-card { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.source-card > span { display: grid; place-items: center; height: 38px; border-radius: 8px; background: var(--acid); font: 800 10px/1 var(--mono); }
.source-card strong, .source-card small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-card strong { font-size: 11px; }
.source-card small { margin-top: 5px; color: #929a96; font: 8px/1 var(--mono); }
.source-card > b { color: #6f7974; font: 9px/1 var(--mono); }
.typing { display: flex; gap: 4px; padding-top: 11px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa39f; animation: pulse 1s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .2s; }.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { opacity: .25; transform: translateY(-3px); } }

.composer-wrap { padding: 12px 26px 18px; background: linear-gradient(180deg, rgba(255,255,255,0), white 18%); }
.composer { width: min(870px, 100%); margin: 0 auto; padding: 11px 13px 9px; border: 1px solid #cfd5ce; border-radius: 17px; background: white; box-shadow: 0 13px 38px rgba(22,33,29,.1); }
.composer:focus-within { border-color: #7c8882; box-shadow: 0 13px 42px rgba(22,33,29,.15); }
.composer-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scope-button { display: inline-flex; align-items: center; gap: 8px; padding: 7px 9px; border: 0; border-radius: 8px; background: var(--soft); color: var(--ink); cursor: pointer; font-size: 10px; }
.scope-button span { color: var(--teal); }
.scope-button b { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-button i { color: #87908c; font-style: normal; }
.demo-label { color: #a9503a; font: 700 8px/1 var(--mono); }
.composer textarea { display: block; width: 100%; min-height: 48px; max-height: 160px; resize: none; margin-top: 8px; padding: 9px 6px; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.5; }
.composer textarea::placeholder { color: #a1a9a5; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; }
.composer-bottom > span { padding-left: 6px; color: #a0a8a4; font: 8px/1 var(--mono); }
.send-button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--ink); color: var(--acid); cursor: pointer; font-size: 18px; }
.send-button:disabled { cursor: wait; opacity: .45; }
.disclaimer { margin: 8px 0 0; color: #a0a8a4; text-align: center; font: 8px/1 var(--mono); }

.library-dialog { width: min(680px, calc(100% - 28px)); max-height: min(780px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 22px; color: var(--ink); box-shadow: 0 40px 110px rgba(18,31,26,.28); }
.library-dialog::backdrop { background: rgba(12,20,17,.55); backdrop-filter: blur(5px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 28px 28px 0; }
.dialog-head p { margin: 0 0 8px; color: var(--teal); font: 700 9px/1 var(--mono); letter-spacing: .1em; }
.dialog-head h2 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.dialog-intro { margin: 20px 28px 0; color: #66716c; font-size: 12px; line-height: 1.7; }
.upload-box { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 22px 28px; }
.upload-box label { grid-row: span 2; display: flex; align-items: center; gap: 11px; min-height: 76px; padding: 13px; border: 1px dashed #bfc7c1; border-radius: 12px; background: #fafaf7; cursor: pointer; }
.upload-box label.is-dragging { border-color: var(--teal); background: #edf9f4; box-shadow: inset 0 0 0 1px var(--teal); }
.upload-box label span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--acid); font-size: 21px; }
.upload-box label strong, .upload-box label small { display: block; }
.upload-box label strong { font-size: 11px; }
.upload-box label small { margin-top: 4px; color: #919a95; font-size: 9px; }
.upload-box button { min-width: 105px; border: 0; border-radius: 10px; background: var(--ink); color: white; cursor: pointer; font-size: 10px; font-weight: 700; }
.upload-box button:disabled { background: #d9ddd8; color: #8e9692; cursor: not-allowed; }
.upload-box > p { margin: 0; color: #929a96; font: 8px/1.4 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-list-head { display: flex; justify-content: space-between; margin: 0 28px 11px; font-size: 11px; font-weight: 700; }
.library-list-head b { padding: 4px 8px; border-radius: 99px; background: var(--soft); font: 700 8px/1 var(--mono); }
.library-list { max-height: 280px; overflow: auto; margin: 0 28px 28px; border-top: 1px solid var(--line); }
.library-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.library-row .file-glyph { height: 38px; background: #ffe8e1; color: #a94c35; }
.library-row strong, .library-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-row strong { font-size: 11px; }.library-row small { margin-top: 5px; color: #929a96; font: 8px/1 var(--mono); }
.library-row button { border: 0; background: none; color: #a84b36; cursor: pointer; font-size: 9px; }
.empty-library { padding: 28px 0; color: #929a96; text-align: center; font-size: 11px; }
.demo-library-note { margin: 0 28px 28px; padding: 15px; border-radius: 11px; background: #fff1ed; color: #773828; }
.demo-library-note strong { font-size: 11px; }.demo-library-note p { margin: 7px 0 0; font-size: 10px; line-height: 1.6; }
.demo-library-note code { padding: 2px 4px; background: rgba(255,255,255,.7); }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; padding: 11px 15px; border-radius: 10px; background: var(--ink); color: white; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: .2s; font-size: 10px; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(310px, 90vw); box-shadow: 20px 0 70px rgba(22,33,29,.18); transform: translateX(-105%); transition: transform .25s; }
  .sidebar.is-open { transform: none; }
  .side-close, .side-open { display: grid; }
  .topbar { padding-inline: 17px; }
  .topbar .crumb { margin-right: auto; }
  .status-pill { display: none; }
  .top-link { display: none; }
}

@media (max-width: 650px) {
  .workspace { grid-template-rows: 58px minmax(0,1fr) auto; }
  .welcome, .conversation { width: min(100% - 28px, 870px); }
  .welcome { padding-top: 58px; }
  .welcome h1 { font-size: clamp(43px, 14vw, 68px); }
  .sample-grid { grid-template-columns: 1fr; }
  .sample-grid button { min-height: 104px; }
  .sample-grid strong { margin-top: 24px; }
  .workflow-note { align-items: flex-start; flex-direction: column; }
  .trace-card { grid-template-columns: repeat(2, 1fr); }
  .composer-wrap { padding: 8px 9px 12px; }
  .composer-bottom > span { display: none; }
  .scope-button b { max-width: 130px; }
  .upload-box { grid-template-columns: 1fr; }
  .upload-box label { grid-row: auto; }
  .upload-box button { min-height: 42px; }
}

/* Readability: larger metadata and stronger contrast for prolonged reading. */
:root { --muted: #4f5a55; }
.product-mark small { color: #53605a; font-size: 11px; line-height: 1.25; }
.new-chat kbd { color: #d5ddd9; font-size: 11px; }
.side-section-title { color: #53605a; font-size: 11px; }
.side-section-title button { font-size: 12px; }
.scope-option strong { font-size: 13px; }
.scope-option small { color: #56615c; font-size: 11px; line-height: 1.3; }
.mode-card strong { font-size: 12px; }
.mode-card small { color: #56615c; font-size: 11px; line-height: 1.4; }
.side-foot > a { color: #4f5a55; font-size: 12px; }
.crumb { font-size: 12px; }
.crumb span, .crumb b { color: #59645f; }
.status-pill { color: #4f5a55; font-size: 11px; }
.top-link { font-size: 13px; }
.eyebrow { color: #53605a; font-size: 12px; }
.sample-grid span { font-size: 11px; }
.sample-grid strong { font-size: 15px; }
.sample-grid small { color: #53605a; font-size: 12px; line-height: 1.35; }
.workflow-note { color: #53605a; }
.flow-mini { font-size: 11px; }
.workflow-note p { font-size: 11px; line-height: 1.4; }
.message-meta strong { font-size: 14px; }
.message-meta span { color: #59645f; font-size: 11px; }
.trace-card span { color: #59645f; font-size: 11px; }
.trace-card strong { font-size: 12px; }
.source-card strong { font-size: 13px; }
.source-card small { color: #56615c; font-size: 11px; }
.source-card > b { color: #4f5a55; font-size: 11px; }
.scope-button { font-size: 12px; }
.demo-label { font-size: 11px; }
.composer textarea { font-size: 16px; }
.composer textarea::placeholder { color: #69746e; }
.composer-bottom > span, .disclaimer { color: #59645f; font-size: 11px; }
.dialog-head p { font-size: 11px; }
.dialog-intro { color: #46524c; font-size: 14px; }
.upload-box label strong { font-size: 13px; }
.upload-box label small { color: #56615c; font-size: 12px; }
.upload-box button { font-size: 13px; }
.upload-box button:disabled { color: #4c5550; }
.upload-box > p { color: #56615c; font-size: 11px; }
.library-list-head { font-size: 13px; }
.library-list-head b { font-size: 11px; }
.library-row strong { font-size: 13px; }
.library-row small { color: #56615c; font-size: 11px; }
.library-row button { font-size: 12px; }
.empty-library { color: #56615c; font-size: 13px; }
.demo-library-note strong { font-size: 13px; }
.demo-library-note p { font-size: 12px; line-height: 1.65; }
.toast { font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
