:root {
  --ink: #14213d;
  --muted: #667085;
  --line: #e4e9f1;
  --panel: #ffffff;
  --canvas: #f4f7fb;
  --blue: #1769e0;
  --blue-soft: #eaf2ff;
  --green: #16825d;
  --green-soft: #e9f8f1;
  --shadow: 0 14px 34px rgba(23, 42, 78, .09);
}

html[data-theme="dark"] {
  --ink: #edf4ff;
  --muted: #9caac0;
  --line: #26354b;
  --panel: #111b2b;
  --canvas: #09111f;
  --blue: #59a4ff;
  --blue-soft: #172d49;
  --green: #55d6a5;
  --green-soft: #12392f;
  --shadow: 0 14px 34px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.page-shell { min-height: 100vh; display: grid; grid-template-columns: 370px minmax(0, 1fr); }
.question-sidebar { height: 100vh; overflow: hidden; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); }
.side-header { padding: 20px 20px 14px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 750; margin-bottom: 24px; }
.brand img { width: 132px; height: 40px; object-fit: contain; }
.title-row, .header-actions, .insight-head, .progress-label, .composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-actions { gap: 7px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: 28px; line-height: 1.15; }
.eyebrow { margin-bottom: 4px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.home-link { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 20px; }
.reward-card { display: grid; grid-template-columns: 1fr 1fr; background: linear-gradient(135deg, #102a56, #1769e0); color: #fff; border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; }
.reward-card div + div { border-left: 1px solid rgba(255,255,255,.24); padding-left: 18px; }
.reward-card span { display: block; font-size: 21px; font-weight: 800; }
.reward-card small { color: rgba(255,255,255,.72); }
.search-box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: color-mix(in srgb, var(--panel) 84%, var(--canvas)); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; padding: 10px 0; }
.filter-tabs { display: flex; gap: 5px; margin-top: 12px; }
.filter-tab { border: 0; border-radius: 8px; background: transparent; color: var(--muted); padding: 7px 11px; }
.filter-tab.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.question-list { overflow-y: auto; padding: 10px; }
.question-card { width: 100%; border: 1px solid transparent; border-radius: 13px; background: transparent; padding: 14px; text-align: left; color: inherit; }
.question-card:hover { background: color-mix(in srgb, var(--panel) 72%, var(--canvas)); border-color: var(--line); }
.question-card.active { background: var(--blue-soft); border-color: #bad3fa; }
.question-card h3 { margin-bottom: 8px; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta, .card-progress { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.mini-track { height: 4px; margin: 9px 0 5px; overflow: hidden; background: #e5ebf4; border-radius: 9px; }
.mini-track span, .progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2a77e6, #17a57b); }
.list-state { padding: 32px 18px; color: var(--muted); text-align: center; }
.answer-workspace { min-width: 0; height: 100vh; }
.welcome-state { min-height: 100%; display: grid; align-content: center; justify-items: center; padding: 40px; text-align: center; }
.welcome-state p { max-width: 610px; color: var(--muted); font-size: 16px; }
.welcome-icon { width: 68px; height: 68px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #1769e0, #21a87d); box-shadow: var(--shadow); font-size: 34px; font-weight: 800; }
.steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.steps span { padding: 8px 13px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); color: var(--muted); }
.chat-state { height: 100%; display: flex; flex-direction: column; }
.question-header { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: center; gap: 32px; min-height: 112px; padding: 20px 28px; background: var(--panel); border-bottom: 1px solid var(--line); }
.question-heading h2 { margin: 0; font-size: 19px; line-height: 1.4; }
.progress-label { color: var(--muted); font-size: 12px; }
.progress-label strong { color: var(--ink); }
.progress-track { height: 8px; margin-top: 8px; overflow: hidden; background: #e8edf5; border-radius: 99px; }
.workspace-body { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.conversation-column { min-width: 0; display: flex; flex-direction: column; }
.message-list { min-height: 0; flex: 1; overflow-y: auto; padding: 28px max(24px, 7vw); }
.message { max-width: 760px; margin-bottom: 20px; }
.message.user { margin-left: auto; }
.message-label { margin: 0 8px 5px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.message.user .message-label { text-align: right; }
.message-bubble { padding: 13px 16px; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; background: var(--panel); white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 3px 10px rgba(24,45,82,.04); }
.message.user .message-bubble { color: #fff; background: var(--blue); border-color: var(--blue); border-radius: 16px 16px 4px 16px; }
.composer { padding: 12px max(20px, 7vw) 20px; background: linear-gradient(transparent, var(--canvas) 16%); }
.composer-box { border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.composer textarea { width: 100%; min-height: 72px; resize: vertical; padding: 14px 16px 4px; border: 0; outline: 0; color: var(--ink); background: var(--panel); }
.composer-actions { padding: 8px 10px 10px 14px; }
.icon-button { border: 0; background: transparent; color: var(--blue); font-weight: 700; }
.file-hint { margin-left: 6px; color: #98a2b3; font-size: 11px; }
.send-button { min-width: 76px; padding: 9px 18px; border: 0; border-radius: 10px; background: var(--blue); color: white; font-weight: 750; }
.send-button:disabled { opacity: .55; cursor: wait; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.file-chip { display: flex; align-items: center; gap: 7px; max-width: 220px; padding: 6px 9px; border: 1px solid #cfe0f8; border-radius: 8px; background: var(--blue-soft); color: #285789; font-size: 12px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { padding: 0; border: 0; background: transparent; color: inherit; }
.composer-status { min-height: 18px; margin: 7px 4px 0; color: var(--muted); font-size: 12px; }
.answer-insight { overflow-y: auto; padding: 24px; background: var(--panel); border-left: 1px solid var(--line); }
.answer-insight h3 { margin-bottom: 0; }
.rating-badge { min-width: 58px; color: var(--blue); font-size: 27px; font-weight: 850; text-align: right; }
.rating-badge small { font-size: 12px; color: var(--muted); }
.answer-status { margin: 18px 0; color: var(--muted); }
.section-item { display: grid; grid-template-columns: 20px 1fr; gap: 9px; padding: 10px 0; border-bottom: 1px solid #eef1f5; }
.section-mark { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: #eef2f7; color: var(--muted); font-size: 11px; }
.section-item.done .section-mark { background: var(--green-soft); color: var(--green); }
.section-item.na { opacity: .62; }
.section-item strong { display: block; font-size: 13px; text-transform: capitalize; }
.section-item small { color: var(--muted); }
.document-review { margin-top: 16px; }
.document-item { padding: 9px 0; border-bottom: 1px solid #eef1f5; }
.document-item strong, .document-item small { display: block; overflow-wrap: anywhere; }
.document-item small { color: var(--muted); }
.complete-notice { margin-top: 18px; padding: 13px; border: 1px solid #bce7d6; border-radius: 12px; background: var(--green-soft); color: #126548; }
.complete-notice p { margin: 5px 0 0; font-size: 12px; }
.reward-rule { margin-top: 20px; padding: 14px; border-radius: 12px; background: #f5f7fb; }
.reward-rule span, .reward-rule strong, .reward-rule small { display: block; }
.reward-rule span, .reward-rule small { color: var(--muted); font-size: 11px; }
.reward-rule strong { margin: 3px 0; }

html[data-theme="dark"] .reward-card { background: linear-gradient(135deg, #162943, #194c86); }
html[data-theme="dark"] .home-link { background: #142238; }
html[data-theme="dark"] .question-card.active { border-color: #315e91; }
html[data-theme="dark"] .mini-track,
html[data-theme="dark"] .progress-track { background: #26354b; }
html[data-theme="dark"] .section-mark { background: #243249; }
html[data-theme="dark"] .section-item,
html[data-theme="dark"] .document-item { border-bottom-color: #233147; }
html[data-theme="dark"] .reward-rule { background: #172235; }
html[data-theme="dark"] .file-chip { border-color: #315e91; }

@media (max-width: 980px) {
  .page-shell { grid-template-columns: 310px minmax(0, 1fr); }
  .workspace-body { grid-template-columns: 1fr; }
  .answer-insight { display: none; }
  .question-header { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 700px) {
  .page-shell { display: block; }
  .question-sidebar { width: 100%; }
  .answer-workspace { display: none; }
  body.question-selected .question-sidebar { display: none; }
  body.question-selected .answer-workspace { display: block; }
  .question-header { padding: 16px; }
  .message-list { padding: 20px 14px; }
  .composer { padding: 10px 12px 14px; }
}
