:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #66758b;
  --line: #e2e8f0;
  --soft: #f5f8fc;
  --accent: #275fce;
  --accent-dark: #1d4fb2;
  --accent-soft: #eaf1ff;
  --success: #16836c;
  --danger: #b84444;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #f7f9fc; font-size: 15px; line-height: 1.6; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.site-header { height: 70px; display: flex; align-items: center; gap: 12px; padding: 0 max(24px, calc((100vw - 1120px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: #1e3d77; font-size: 16px; font-weight: 700; }
.brand-title { font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-subtitle { margin-top: 4px; color: var(--muted); font-size: 11px; }
.header-tag { margin-left: auto; padding: 5px 10px; border-radius: 999px; color: #385887; background: #f0f4fa; font-size: 12px; }
.page-shell { width: min(100% - 40px, 1020px); min-height: calc(100vh - 124px); margin: 38px auto 24px; }
.role-screen { display: grid; place-items: center; min-height: 60vh; }
.welcome-card, .content-card, .data-card { border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 14px 40px rgba(23, 44, 78, .055); }
.welcome-card { width: min(100%, 720px); padding: 46px 48px 36px; }
.eyebrow { display: block; margin-bottom: 10px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(25px, 3vw, 34px); line-height: 1.3; letter-spacing: -.02em; }
h2 { font-size: 20px; line-height: 1.4; }
.lead { margin: 8px 0 26px; color: var(--muted); }
.role-actions { display: grid; gap: 12px; margin-top: 26px; }
.role-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: left; color: var(--ink); transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.role-card:hover, .role-card:focus-visible { border-color: #a6bcec; background: #fbfcff; transform: translateY(-1px); outline: none; }
.role-icon { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.role-icon-muted { color: #58677e; background: #eef1f5; }
.role-card strong, .role-card small { display: block; }
.role-card strong { font-size: 15px; }
.role-card small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.role-arrow { margin-left: auto; color: #8c9bb0; font-size: 26px; line-height: 1; }
.privacy-note { margin: 24px 0 0; color: #8491a4; font-size: 12px; }
.content-card { padding: 38px 42px; }
.document-card { max-width: 810px; margin: 0 auto; }
.document-copy { color: #27364a; font-size: 15px; line-height: 1.9; }
.document-copy p { margin: 0 0 14px; }
.consent-last { margin-top: 22px !important; font-weight: 650; }
.independent-note { padding: 12px 15px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: #f3f7ff; color: #1e4a94; font-weight: 700; }
.button { min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: 10px; font-weight: 650; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: #2d4569; border-color: var(--line); background: #fff; }
.button-secondary:hover { border-color: #b9c8de; background: #f8faff; }
.button-wide { width: 100%; margin-top: 14px; }
.task-card, .chat-card { max-width: 850px; margin: 0 auto; padding: 30px 34px 34px; }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.phase-label { padding: 5px 9px; border-radius: 999px; color: #3860a7; background: #eff4ff; font-size: 11px; font-weight: 650; }
.progress-track { height: 6px; overflow: hidden; margin-bottom: 28px; border-radius: 999px; background: #e9edf4; }
.progress-value { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2459c3, #5485e9); transition: width .25s ease; }
.question-area { margin-bottom: 25px; }
.question-kicker { margin-bottom: 8px; color: #7c8ba0; font-size: 12px; font-weight: 650; }
.question-stem { margin: 0 0 18px; font-size: 18px; font-weight: 650; line-height: 1.7; white-space: pre-wrap; }
.choice-list { display: grid; gap: 10px; }
.choice-option { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.choice-option:hover { border-color: #b5c6e9; background: #fbfcff; }
.choice-option.selected { border-color: #86a7e8; background: #f2f6ff; }
.choice-option input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--accent); }
.choice-letter { flex: 0 0 22px; color: #49648e; font-weight: 700; }
.choice-text { color: #29374a; }
.response-section { padding-top: 23px; border-top: 1px solid var(--line); }
.section-question { margin: 0; font-size: 15px; }
.field-hint { margin: 4px 0 12px; color: var(--muted); font-size: 12px; }
.confidence-options { display: flex; flex-wrap: wrap; gap: 10px; }
.confidence-option { display: inline-flex; align-items: center; justify-content: center; min-width: 100px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #42536b; font-weight: 650; cursor: pointer; }
.confidence-option input { position: absolute; opacity: 0; pointer-events: none; }
.confidence-option:hover { border-color: #a9bce1; }
.confidence-option.selected { border-color: #6d93df; color: #214d9e; background: #eff4ff; box-shadow: inset 0 0 0 1px #6d93df; }
.task-card > .button { margin-top: 22px; min-width: 170px; }
.inline-error { min-height: 18px; margin: 9px 0 0; color: var(--danger); font-size: 13px; }
.chat-card { max-width: 820px; }
.chat-window { overflow: hidden; border: 1px solid #dde4ef; border-radius: 16px; background: #fff; }
.chat-heading { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid #e6eaf0; background: #fbfcfe; }
.chat-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #16263d; color: #fff; font-size: 11px; font-weight: 700; }
.chat-heading strong, .chat-heading small { display: block; }
.chat-heading strong { font-size: 14px; }
.chat-heading small { color: var(--muted); font-size: 11px; }
.demo-pill { margin-left: auto; padding: 4px 8px; border-radius: 999px; color: #69788b; background: #eef1f5; font-size: 10px; }
.chat-thread { display: grid; gap: 18px; min-height: 210px; max-height: 410px; overflow: auto; padding: 24px 20px; }
.chat-bubble { max-width: 88%; padding: 12px 15px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; }
.chat-bubble.user { justify-self: end; border-bottom-right-radius: 4px; background: #f0f4fa; color: #23334a; }
.chat-bubble.assistant { justify-self: start; border-bottom-left-radius: 4px; background: #f8fafc; color: #24344b; }
.chat-bubble.advice { border: 1px solid #dce7fa; background: #f4f7fd; font-weight: 650; }
.chat-bubble.is-sending { animation: message-send .28s ease-out both; }
.chat-bubble.typing-copy::after { display: inline-block; width: 1px; height: 1em; margin-left: 2px; border-right: 2px solid currentColor; content: ''; vertical-align: text-bottom; animation: caret-blink .75s steps(2, start) infinite; }
@keyframes message-send { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes caret-blink { to { visibility: hidden; } }
.typing-dots { display: flex; gap: 4px; align-items: center; height: 18px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: #78879b; animation: pulse 1s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
.chat-composer { display: flex; align-items: end; gap: 10px; padding: 13px; border-top: 1px solid #e6eaf0; }
.chat-composer textarea { flex: 1; resize: none; padding: 10px 12px; border: 1px solid #dde4ee; border-radius: 10px; background: #fff; color: #637187; font-size: 12px; line-height: 1.5; }
.chat-composer .button { min-width: 88px; }
.advice-next { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-top: 1px solid #e6eaf0; background: #fbfcfe; }
.advice-next p { margin: 0; color: #34455d; font-size: 14px; font-weight: 650; }
.advice-next .button { min-width: 120px; }
.complete-icon, .modal-check { display: grid; place-items: center; width: 48px; height: 48px; margin: 8px 0 20px; border-radius: 50%; color: var(--success); background: #eaf7f2; font-size: 23px; font-weight: 700; }
.participant-code { margin-top: 24px; padding: 10px 12px; border-radius: 9px; background: var(--soft); color: var(--muted); font-size: 12px; }
.login-card { max-width: 460px; margin: 30px auto; }
.text-button { padding: 5px 0; border: 0; background: none; color: #536983; font-size: 13px; }
.text-button:hover { color: var(--accent); }
.login-form { display: grid; gap: 9px; margin-top: 24px; }
.login-form label { font-size: 13px; font-weight: 650; }
.login-form input { width: 100%; height: 46px; padding: 10px 12px; border: 1px solid #cfd8e5; border-radius: 9px; outline: none; }
.login-form input:focus { border-color: #6e91d6; box-shadow: 0 0 0 3px #eaf1ff; }
.admin-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 22px; }
.admin-title-row .lead { margin: 6px 0 0; }
.admin-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { padding: 17px 18px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-number { margin-top: 5px; font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.stat-detail { margin-top: 3px; color: #8a97a8; font-size: 11px; }
.data-card { overflow: hidden; padding: 22px 22px 8px; }
.data-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.data-card-heading h2 { margin: 0 0 2px; font-size: 17px; }
.muted-copy { margin: 0; color: #8693a5; font-size: 11px; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; color: #68788c; font-size: 11px; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #1da179; box-shadow: 0 0 0 4px #e5f6f0; }
.list-tabs { display: flex; gap: 6px; overflow: auto; margin: 18px -2px 0; padding: 0 2px; border-bottom: 1px solid var(--line); }
.list-tab { padding: 9px 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #64738a; white-space: nowrap; font-size: 13px; }
.list-tab.active { border-bottom-color: var(--accent); color: #214d9e; font-weight: 700; }
.table-wrap { overflow: auto; max-height: 62vh; }
.session-table-wrap { max-height: 38vh; }
.table-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 19px 0 7px; }
.table-section-heading h3 { margin: 0; color: #34445a; font-size: 13px; }
.table-section-heading p { margin: 0; color: #8a97a8; font-size: 11px; }
.trial-section-heading { margin-top: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
thead { position: sticky; top: 0; z-index: 1; background: #f8fafc; }
th, td { padding: 10px 9px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: top; }
th { color: #64738a; font-size: 11px; font-weight: 700; }
td { color: #334258; }
td.question-cell { width: 300px; max-width: 300px; white-space: normal; line-height: 1.45; }
.status-chip { display: inline-block; padding: 3px 7px; border-radius: 999px; color: #8a6416; background: #fff6dd; font-size: 10px; }
.status-chip.done { color: #14745c; background: #e8f7f1; }
.delete-button { padding: 6px 9px; border: 1px solid #f0d1d1; border-radius: 8px; background: #fff; color: #a13b3b; font-size: 11px; font-weight: 650; }
.delete-button:hover { border-color: #d98989; background: #fff7f7; }
.delete-button:disabled { opacity: .55; cursor: wait; }
.empty-state { padding: 36px 12px; color: #7e8ca0; text-align: center; font-size: 13px; }
.site-footer { padding: 18px 12px 24px; color: #98a3b2; text-align: center; font-size: 11px; }
.site-footer span { padding: 0 5px; color: #c1cad5; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(18, 30, 48, .36); backdrop-filter: blur(3px); }
.modal-card { width: min(100%, 480px); padding: 30px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 17px; background: #fff; box-shadow: 0 24px 80px rgba(13, 30, 55, .2); }
.modal-card h2 { margin-bottom: 7px; font-size: 21px; }
.modal-card > p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.modal-role-actions { margin-top: 20px; }
.advice-modal-card { max-width: 420px; text-align: center; }
.advice-modal-card .modal-check { margin: 0 auto 16px; }
.advice-modal-card .button { margin-top: 19px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; border: 1px solid #d9e2f0; border-radius: 11px; background: #fff; color: #314158; box-shadow: 0 12px 35px rgba(17, 39, 72, .15); font-size: 13px; }

@media (max-width: 720px) {
  .site-header { height: 62px; padding: 0 18px; }
  .page-shell { width: min(100% - 24px, 640px); margin-top: 18px; }
  .welcome-card, .content-card { padding: 26px 22px; border-radius: 15px; }
  .task-card, .chat-card { padding: 21px 17px 24px; }
  .question-stem { font-size: 16px; }
  .confidence-option { flex: 1; min-width: 80px; padding: 10px 12px; }
  .admin-title-row { align-items: flex-start; flex-direction: column; gap: 15px; }
  .admin-actions { width: 100%; }
  .admin-actions .button { flex: 1; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-card { padding: 17px 13px 5px; }
  .table-section-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .chat-composer { align-items: stretch; flex-direction: column; }
  .chat-composer .button { align-self: flex-end; }
  .advice-next { align-items: stretch; flex-direction: column; }
  .advice-next .button { align-self: flex-end; }
}

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