:root {
  --ink: #17242f;
  --muted: #687580;
  --line: #dce3e7;
  --soft: #f4f7f7;
  --paper: #fbfcfb;
  --teal: #0d746b;
  --teal-dark: #075950;
  --teal-soft: #e8f4f1;
  --amber: #b16e1e;
  --amber-soft: #fbf2e5;
  --danger: #a5443c;
  --blue: #2563eb;
  --blue-soft: #edf4ff;
  --shadow: 0 18px 50px rgba(22, 42, 52, .09);
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: #eef2f2;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.topbar {
  height: 74px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(251, 252, 251, .96);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 39px; height: 39px; display: grid; place-items: center;
  border-radius: 11px; color: white; background: var(--teal);
  font-family: STSong, SimSun, serif; font-size: 22px; box-shadow: 0 5px 14px rgba(13,116,107,.22);
}
.brand div { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-family: STSong, SimSun, serif; font-size: 20px; letter-spacing: .12em; }
.brand small, .brand span { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.standard-badge { padding: 7px 10px; border: 1px solid #cddaf8; border-radius: 999px; color: #315ca8; background: var(--blue-soft); font-size: 11px; }
.status-pill { padding: 7px 11px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); font-size: 12px; }
.status-pill i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #39a690; }

.workspace { min-height: calc(100vh - 74px); display: grid; grid-template-columns: 210px minmax(440px, 1fr) 470px; }
.workspace.workbench-collapsed { grid-template-columns: 210px minmax(560px, 1fr); }
.sidebar, .conversation, .inspector { min-width: 0; }
.sidebar { padding: 30px 20px; background: #f7f9f8; border-right: 1px solid var(--line); }
.sidebar-label { margin: 0 8px 14px; color: #89939a; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; display: flex; gap: 12px; padding: 0 8px 24px; color: #8b959b; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 21px; top: 31px; height: 25px; width: 1px; background: #ccd5d8; }
.steps li > span { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #ccd5d8; border-radius: 50%; background: white; font-size: 12px; }
.steps li.active > span { color: white; border-color: var(--teal); background: var(--teal); }
.steps li div { display: flex; flex-direction: column; gap: 3px; }
.steps li strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.steps li small { font-size: 11px; }
.sample-title { margin-top: 10px; }
.sample-list { display: grid; gap: 8px; }
.sample-card { width: 100%; padding: 11px 12px; text-align: left; border: 1px solid transparent; border-radius: 10px; background: white; color: var(--ink); transition: .2s ease; }
.sample-card:hover { border-color: #a8cbc5; transform: translateY(-1px); box-shadow: 0 7px 20px rgba(24,62,67,.07); }
.sample-card span, .sample-card small { display: block; }
.sample-card span { font-size: 12px; font-weight: 600; }
.sample-card small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.privacy-note { margin: 28px 4px 0; padding: 13px; display: flex; gap: 9px; border-radius: 10px; color: #5e706f; background: #edf3f1; font-size: 10px; line-height: 1.55; }
.privacy-note p { margin: 0; }

.conversation { display: flex; flex-direction: column; padding: 34px clamp(24px, 4vw, 58px) 24px; background: var(--paper); }
.workspace.workbench-collapsed .conversation { padding-left: clamp(32px, 7vw, 110px); padding-right: clamp(32px, 7vw, 110px); }
.conversation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .18em; }
h1 { margin: 0; font-family: STSong, SimSun, serif; font-size: clamp(24px, 2.6vw, 34px); font-weight: 600; line-height: 1.25; }
.scenario-badge { flex: 0 0 auto; padding: 7px 10px; border: 1px solid #d8e0e2; border-radius: 999px; color: var(--muted); background: white; font-size: 11px; }
.scenario-badge.detected { border-color: #a8d2ca; color: var(--teal-dark); background: var(--teal-soft); }
.scope-note { margin-top: 22px; padding: 12px 14px; display: flex; gap: 10px; border-left: 3px solid #d6a761; background: var(--amber-soft); color: #6e5c45; font-size: 12px; line-height: 1.55; }
.scope-note span { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #cf9b52; border-radius: 50%; font-family: serif; font-size: 11px; }
.scope-note p { margin: 0; }
.messages { flex: 1; min-height: 250px; max-height: calc(100vh - 350px); overflow-y: auto; padding: 26px 3px 18px; scrollbar-width: thin; }
.message { max-width: 88%; margin-bottom: 16px; animation: rise .25s ease; }
.message.assistant { margin-right: auto; }
.message.user { margin-left: auto; }
.message-label { margin: 0 0 5px 3px; color: #879198; font-size: 10px; }
.bubble { padding: 13px 15px; border-radius: 4px 14px 14px 14px; background: #eef3f2; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.user .bubble { color: white; border-radius: 14px 4px 14px 14px; background: var(--teal); }
.summary-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.summary-tags span { padding: 4px 7px; border-radius: 5px; color: var(--teal-dark); background: #dfeeea; font-size: 10px; }
.composer { padding: 12px; border: 1px solid #cfd9dc; border-radius: 14px; background: white; box-shadow: var(--shadow); }
.composer:focus-within { border-color: #7fb8ae; box-shadow: 0 16px 45px rgba(13,116,107,.12); }
.composer textarea { width: 100%; min-height: 88px; padding: 5px 7px; resize: none; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; line-height: 1.65; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-tools { display: flex; align-items: center; gap: 12px; }
.tool-button, .link-button { padding: 5px; border: 0; color: var(--teal); background: transparent; font-size: 11px; }
.tool-button.listening { color: var(--danger); }
.save-state { color: #9aa3a8; font-size: 10px; }
.primary-button, .secondary-button, .ghost-button { border-radius: 9px; transition: .18s ease; }
.primary-button { padding: 10px 15px; border: 1px solid var(--teal); color: white; background: var(--teal); font-size: 12px; font-weight: 600; }
.primary-button:hover { background: var(--teal-dark); }
.primary-button span { margin-left: 7px; }
.secondary-button { padding: 10px 15px; border: 1px solid #aebdc0; color: var(--ink); background: white; font-size: 12px; }
.ghost-button { padding: 8px 12px; border: 1px solid var(--line); color: #536068; background: white; font-size: 12px; }
.full { width: 100%; }

.inspector { padding: 22px 22px 18px; overflow-y: auto; max-height: calc(100vh - 74px); border-left: 1px solid var(--line); background: #f7f9f8; }
.workspace.workbench-collapsed .inspector { display: none; }
.flow-card { max-width: 94%; margin: 0 auto 18px 0; padding: 17px; border: 1px solid #d5dfe2; border-radius: 4px 16px 16px 16px; background: white; box-shadow: 0 10px 28px rgba(22,42,52,.07); animation: rise .25s ease; }
.flow-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.flow-card-head h2 { margin: 0; font-size: 15px; }
.flow-card-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.flow-step { padding: 4px 7px; border-radius: 999px; color: #315ca8; background: var(--blue-soft); font-size: 9px; white-space: nowrap; }
.inline-facts { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.inline-fact-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid #e9edef; }
.inline-fact-row:last-child { border-bottom: 0; }
.inline-fact-row label { color: #68757d; font-size: 10px; font-weight: 600; }
.inline-fact-row input { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid #e0e5e7; border-radius: 7px; outline: 0; font-size: 11px; }
.inline-fact-row input:focus { border-color: #7fb8ae; }
.inline-questions { margin-top: 13px; display: grid; gap: 6px; }
.inline-question { padding: 9px 10px; text-align: left; border: 1px solid #e0e5e7; border-radius: 8px; color: #56636a; background: #fafbfb; font-size: 10px; }
.inline-question:hover { border-color: #9bc6bf; background: white; }
.flow-actions { margin-top: 15px; display: flex; justify-content: flex-end; gap: 8px; }
.flow-decision { padding: 13px; border-radius: 9px; color: #43525c; background: #f5f8f8; font-size: 11px; line-height: 1.75; }
.flow-report { max-width: 100%; }
.flow-report .report-body { margin-top: 4px; }
.workbench-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.workbench-head h2 { margin: 0; font-size: 20px; }
.workbench-head p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.workbench-head-actions { display: flex; align-items: center; gap: 7px; }
.workbench-toggle { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #d5dddf; border-radius: 8px; color: #56636a; background: white; font-size: 23px; line-height: 1; }
.workbench-toggle:hover { color: var(--teal-dark); border-color: #9bc6bf; background: var(--teal-soft); }
.workbench-launcher { position: fixed; z-index: 20; right: 0; top: 50%; min-width: 46px; padding: 15px 8px 13px; display: flex; flex-direction: column; align-items: center; gap: 5px; transform: translateY(-50%); border: 1px solid #a8cbc5; border-right: 0; border-radius: 12px 0 0 12px; color: white; background: var(--teal); box-shadow: 0 10px 28px rgba(13,116,107,.22); }
.workbench-launcher[hidden] { display: none; }
.workbench-launcher span { writing-mode: vertical-rl; letter-spacing: .18em; font-size: 12px; font-weight: 700; }
.workbench-launcher small { font-size: 9px; opacity: .8; }
.workbench-launcher:hover { background: var(--teal-dark); }
.workbench-status { padding: 6px 9px; border-radius: 999px; color: #5d6870; background: #e9edef; font-size: 10px; white-space: nowrap; }
.workbench-status.running { color: #1e53b7; background: var(--blue-soft); }
.progress-meta { margin-top: 18px; display: flex; justify-content: space-between; color: #6f7a81; font-size: 10px; }
.progress-track { height: 4px; margin: 8px 0 18px; overflow: hidden; border-radius: 999px; background: #e0e4e8; }
.progress-track i { display: block; width: 12%; height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }
.tabs { display: flex; padding: 3px; border-radius: 9px; background: #e8eded; }
.tab { flex: 1; padding: 8px 4px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(21,46,52,.08); font-weight: 600; }
.panel { padding-top: 23px; }
.activity-log { display: grid; gap: 9px; min-height: 280px; max-height: calc(100vh - 355px); overflow-y: auto; }
.activity-empty { min-height: 240px; display: grid; place-content: center; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.7; }
.activity-item { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.activity-item header { display: flex; justify-content: space-between; gap: 10px; color: #7a858c; font-size: 9px; }
.activity-item strong { color: #33434e; font-size: 11px; }
.activity-item p { margin: 7px 0 0; color: #647078; font-size: 10px; line-height: 1.55; }
.activity-item.running { border-color: #b8cdf8; background: #f7faff; }
.latest-button { margin-top: 14px; }
.task-checklist { display: grid; gap: 10px; }
.task-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.task-row > span:first-child { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #71808a; background: #edf0f2; font-size: 10px; }
.task-row.done > span:first-child { color: white; background: var(--blue); }
.task-row strong, .task-row small { display: block; }
.task-row strong { font-size: 11px; }
.task-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.task-row em { color: #758087; font-size: 9px; font-style: normal; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.facts-table { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: white; }
.fact-row { display: grid; grid-template-columns: 105px 1fr auto; min-height: 42px; align-items: center; border-bottom: 1px solid #e9edef; }
.fact-row:last-child { border-bottom: 0; }
.fact-label { padding: 9px 10px; color: #6c777e; background: #fafbfb; font-size: 10px; }
.fact-value { width: 100%; min-width: 0; padding: 8px 7px; border: 0; outline: 0; color: var(--ink); background: white; font-size: 11px; }
.fact-state { margin-right: 8px; padding: 3px 6px; border-radius: 999px; color: var(--teal-dark); background: var(--teal-soft); font-size: 9px; white-space: nowrap; }
.fact-state.pending { color: #8b6531; background: var(--amber-soft); }
.question-block { margin: 22px 0 18px; }
.question-title { display: flex; justify-content: space-between; margin-bottom: 8px; color: #59666d; font-size: 11px; font-weight: 600; }
.question-title em { min-width: 19px; padding: 2px 6px; border-radius: 999px; color: var(--amber); background: var(--amber-soft); font-style: normal; text-align: center; }
.question-list { display: grid; gap: 6px; }
.question { width: 100%; padding: 9px 10px; display: flex; gap: 8px; align-items: flex-start; text-align: left; border: 1px solid #e0e5e7; border-radius: 8px; color: #56636a; background: white; font-size: 10px; line-height: 1.5; }
.question:hover { border-color: #9bc6bf; }
.question span { color: var(--amber); }
.report-empty { min-height: 300px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.report-empty > span { width: 50px; height: 58px; margin: 0 auto 12px; display: grid; place-items: center; border: 1px solid #cbd4d6; border-radius: 5px; background: white; font-family: STSong, serif; font-size: 21px; box-shadow: 7px 7px 0 #e6ebeb; }
.report-empty p { max-width: 260px; font-size: 11px; line-height: 1.7; }
.report-body { display: grid; gap: 12px; }
.report-lead { padding: 13px; border-radius: 9px; color: var(--teal-dark); background: var(--teal-soft); font-size: 11px; line-height: 1.65; }
.report-section { padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.report-section h3 { margin: 0 0 8px; font-size: 11px; }
.report-section p, .report-section li { color: #56636a; font-size: 10px; line-height: 1.65; }
.report-section ul { margin: 0; padding-left: 17px; }
.risk-high { border-left: 3px solid var(--danger); }
.report-heading { margin-bottom: 8px; }

dialog { width: min(470px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(13, 28, 35, .35); backdrop-filter: blur(3px); }
dialog form { padding: 22px; }
.dialog-head, .dialog-actions { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-head p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.dialog-head button { border: 0; background: transparent; font-size: 22px; }
dialog label { display: grid; gap: 6px; margin-top: 16px; color: var(--muted); font-size: 11px; }
dialog input, dialog textarea { padding: 10px; border: 1px solid var(--line); border-radius: 8px; outline: 0; }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 20px; }
.review-dialog { width: min(720px, calc(100vw - 32px)); }
.review-facts-list { max-height: min(56vh, 520px); margin-top: 16px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.review-fact-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #e9edef; }
.review-fact-row:last-child { border-bottom: 0; }
.review-fact-row label { margin: 0; color: #536068; font-size: 11px; font-weight: 600; }
.review-fact-row input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; outline: 0; font-size: 11px; }
.review-fact-row input:focus { border-color: #7fb8ae; }
.review-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; color: #6e5c45; background: var(--amber-soft); font-size: 10px; line-height: 1.6; }
.report-confirm-summary { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; color: #43525c; background: #f8faf9; font-size: 12px; line-height: 1.8; }
.report-confirm-summary strong { color: var(--teal-dark); }

@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 185px minmax(410px, 1fr) 410px; }
  .workspace.workbench-collapsed { grid-template-columns: 185px minmax(410px, 1fr); }
  .conversation { padding-left: 28px; padding-right: 28px; }
  .workspace.workbench-collapsed .conversation { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace.workbench-collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .inspector { max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  .messages { max-height: 430px; }
}
@media (max-width: 560px) {
  .topbar { height: 64px; padding: 0 14px; }
  .brand span:not(.brand-mark), .status-pill, .standard-badge { display: none; }
  .workspace { min-height: calc(100vh - 64px); }
  .conversation { padding: 24px 16px 18px; }
  .conversation-head { display: block; }
  .scenario-badge { display: inline-block; margin-top: 12px; }
  .composer-bottom { align-items: flex-end; }
  .save-state { display: none; }
  .inspector { padding: 22px 16px; }
}

@media print {
  .topbar, .sidebar, .conversation, .tabs, .report-heading .link-button, #regenerateButton, .workbench-toggle, .workbench-launcher { display: none !important; }
  .workspace { display: block; }
  .inspector { max-height: none; border: 0; background: white; }
  #reportPanel { display: block !important; }
}
