:root {
  --bg: #efeee7;
  --paper: #fffefa;
  --ink: #152822;
  --muted: #53635b;
  --line: #dadfd4;
  --green: #1b5846;
  --soft: #e7f0e7;
  --amber: #f6ecd5;
  --warning: #7a4917;
  --error: #9a322a;
  font: 16px/1.55 "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button {
  min-height: 44px; padding: 8px 15px; border: 1px solid transparent;
  border-radius: 7px; color: inherit; background: transparent; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #277e67; outline-offset: 3px; }
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: #123e32; }
.plain { border-color: var(--line); background: var(--paper); }
.plain:hover { background: #eef2e9; }
.text-button { color: var(--green); padding-inline: 8px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { background: var(--soft); }
h1, h2, h3, p, dl, dd, blockquote { margin: 0; }
h1 {
  font: 650 clamp(2rem, 4.3vw, 3.4rem)/1.2 "Instrument Serif", "Songti SC", "Noto Serif CJK SC", serif;
  letter-spacing: -.035em; overflow-wrap: anywhere;
}
h2 { font-size: 1.16rem; }
h3 { font-size: 1.14rem; overflow-wrap: anywhere; }
input, textarea {
  width: 100%; border: 1px solid #b9c6ba; border-radius: 7px;
  padding: 10px 12px; color: var(--ink); background: var(--paper);
}
textarea { resize: vertical; min-height: 90px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px max(24px, calc((100vw - 1320px) / 2)); gap: 16px;
  border-bottom: 1px solid var(--line); background: var(--paper);
}
.brand, .top-actions, .toolbar, .project-meta { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.brand-mark {
  width: 30px; height: 30px; display: inline-block; border-radius: 8px;
  background: var(--green); position: relative;
}
.brand-mark::before {
  content: ""; width: 13px; height: 14px; position: absolute; inset: 7px auto auto 8px;
  border: 1px solid white; border-left-width: 3px; border-radius: 2px;
}
.brand-mark::after {
  content: ""; position: absolute; top: 12px; left: 14px; width: 5px; height: 4px;
  border-block: 1px solid white;
}
.local-state { color: var(--muted); font-size: .85rem; }
.local-state::before { content: ""; display: inline-block; border-radius: 50%; width: 7px; height: 7px; background: var(--green); margin-right: 7px; }
.shell { width: min(1320px, calc(100% - 48px)); margin: 28px auto 42px; }
.project {
  display: flex; justify-content: space-between; align-items: end; gap: 32px;
  padding: 21px 27px 30px; border: 1px solid #c9d8ca; border-radius: 14px;
  background: #e5eee3;
}
.project-context { min-width: 0; }
.project-meta { gap: 8px; color: var(--green); font-size: .88rem; margin-bottom: 8px; }
#project-kind { font-weight: 700; }
#project-question { margin-top: 10px; color: var(--muted); max-width: 66ch; overflow-wrap: anywhere; }
.metrics { display: flex; flex-shrink: 0; margin-bottom: 3px; }
.metrics div { border-left: 1px solid #bdcdbf; min-width: 86px; padding: 0 14px; }
.metrics dt { font-size: .86rem; color: var(--muted); }
.metrics dd { font: 500 2.25rem/1.15 "Instrument Serif", Georgia, serif; margin-top: 4px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 19px; margin-top: 19px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); min-width: 0; padding: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 44px; }
.toolbar { gap: 7px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.filters button { color: var(--muted); padding-inline: 12px; }
.filters button:hover, .filters button[aria-pressed="true"] { background: var(--soft); color: var(--green); }
.filters button[aria-pressed="true"] { font-weight: 700; }
.finding-list { display: grid; gap: 12px; padding-top: 13px; }
.finding { border: 1px solid var(--line); border-radius: 9px; padding: 14px 15px; }
.finding-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.status { padding: 2px 8px; border-radius: 4px; background: var(--amber); color: var(--warning); font-size: .8rem; white-space: nowrap; }
.status.approved { background: var(--soft); color: var(--green); }
.status.rejected { background: var(--bg); color: var(--muted); }
.finding p { margin-top: 7px; overflow-wrap: anywhere; white-space: pre-wrap; }
.quiet, .helper, .finding .limitation, .source-meta { color: var(--muted); font-size: .875rem; }
.references, .review-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; align-items: center; }
.review-actions { border-top: 1px solid var(--line); padding-top: 8px; }
.review-actions button, .references button { font-size: .86rem; }
.reference { color: var(--green); background: var(--soft); font-family: "IBM Plex Mono", monospace; }
.reference:hover { background: #d2e7d9; }
.bad-reference { color: var(--error); font-size: .86rem; overflow-wrap: anywhere; }
.source-list { display: grid; gap: 10px; margin-top: 13px; max-height: 62vh; overflow: auto; padding: 2px; }
.source-card { background: #f5f6ee; border: 1px solid transparent; border-left: 3px solid #adc3b3; border-radius: 5px; padding: 11px 13px; }
.source-card.selected { border-color: #29775f; background: #e1eee2; }
.source-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.source-meta strong { font-family: "IBM Plex Mono", monospace; color: var(--green); }
.source-card blockquote { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
dialog { width: min(640px, calc(100% - 28px)); max-height: calc(100dvh - 28px); border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--ink); padding: 20px; }
dialog::backdrop { background: #10261ec0; }
.dialog-heading, .dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-body { display: grid; gap: 12px; margin-top: 12px; }
.dialog-body label { display: grid; gap: 5px; font-weight: 600; }
.dialog-footer { justify-content: end; margin-top: 14px; }
.dialog-footer[hidden] { display: none; }
.dialog-row { display: flex; flex-wrap: wrap; gap: 8px; }
.error { color: var(--error); margin-top: 10px; }
.toast { position: fixed; z-index: 2; bottom: 16px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 30px); width: max-content; background: var(--ink); color: white; padding: 10px 15px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 860px) {
  .project { align-items: start; flex-direction: column; gap: 20px; }
  .metrics div:first-child { padding-left: 0; border-left: 0; }
}
@media (max-width: 690px) {
  .topbar { padding: 12px 14px; flex-wrap: wrap; }
  .local-state { order: 2; }
  .shell { width: calc(100% - 26px); margin-top: 13px; }
  .workspace { grid-template-columns: 1fr; }
  .project, .panel { padding: 14px; }
  .metrics div { min-width: 72px; padding-inline: 11px; }
  .panel-heading { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
[hidden] { display: none !important; }
.work-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 17px 0; }
.work-tabs button { border-bottom: 2px solid transparent; border-radius: 0; }
.work-tabs button[aria-pressed="true"] { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.work-tabs .quiet { margin-left: auto; }
.analysis-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #bbcdbb; background: var(--soft); padding: 14px 18px; border-radius: 9px; margin-bottom: 16px; }
.coding-list { display: grid; gap: 12px; margin-top: 16px; }
.coding-record { border: 1px solid var(--line); border-radius: 9px; padding: 15px; overflow-wrap: anywhere; }
.coding-record blockquote { margin: 9px 0; white-space: pre-wrap; }
.coding-record p { margin-top: 6px; }
.final-label { color: var(--green); font-weight: 600; }
.coding-statistics { overflow-x: auto; margin-top: 12px; }
.coding-statistics table { border-collapse: collapse; width: 100%; margin-top: 10px; min-width: 430px; font-size: .9rem; }
.coding-statistics th, .coding-statistics td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.coding-statistics th { background: var(--soft); }
.checkbox-label { display: flex !important; align-items: center; gap: 9px !important; min-height: 44px; }
.checkbox-label input { width: 20px; height: 20px; accent-color: var(--green); }
fieldset { border: 1px solid var(--line); border-radius: 7px; }
@media (max-width: 690px) { .work-tabs .quiet { margin-left: 8px; width: 100%; } }
select { font: inherit; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #b9c6ba; border-radius: 7px; color: var(--ink); background: var(--paper); }
