/* ==========================================================================
   公文审校 · 样式表
   原生 CSS，无构建、无外部依赖。设计基调：深红 + 米白 + 细金线，公文气。
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  /* 红 */
  --red-900: #6b0808;
  --red-800: #8b0000;
  --red-700: #a31621;
  --red-600: #b63a36;
  --red-050: #fbeeee;
  --red-025: #fdf6f5;

  /* 金 / 棕 */
  --gold-700: #8a6a1f;
  --gold-600: #a4812c;
  --gold-500: #c2a24a;
  --gold-200: #e8dcbc;

  /* 纸 / 墨 */
  --paper: #fbf8f3;
  --paper-2: #f4efe6;
  --surface: #ffffff;
  --ink: #1e1a17;
  --ink-2: #3c3631;
  --muted: #6b625a;
  --line: #e6ded1;
  --line-strong: #d3c6b2;

  /* 语义色 */
  --high: #a31621;
  --high-fg: #8b0000;
  --high-bg: #fbedee;
  --medium: #b4620a;
  --medium-fg: #8f4e05;
  --medium-bg: #fdf2e2;
  --low: #b8912f;
  --low-fg: #72560f;
  --low-bg: #fbf4dd;
  --ok: #2f6b41;
  --ok-bg: #eff6f0;

  /* 结构 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(46, 29, 15, 0.05), 0 10px 28px -18px rgba(46, 29, 15, 0.35);
  --shadow-2: 0 2px 4px rgba(46, 29, 15, 0.06), 0 22px 48px -28px rgba(46, 29, 15, 0.45);
  --maxw: 1120px;

  /* 字体：标题走中文衬线（公文标题观感），正文系统无衬线 */
  --serif: "FZXiaoBiaoSong-B05S", "方正小标宋简体", "Noto Serif SC", "Source Han Serif SC",
    "Source Han Serif CN", "STZhongsong", "华文中宋", "Songti SC", "STSong", SimSun, "宋体",
    "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ---------- 2. 重置与基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fcfaf6 0%, var(--paper) 32%, #f8f3eb 100%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: 0.01em;
  color: var(--ink);
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--red-800);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--red-700);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  word-break: break-all;
}

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(163, 22, 33, 0.16);
}

/* 焦点可见（键盘） */
:focus-visible {
  outline: 2px solid var(--red-700);
  outline-offset: 2px;
  border-radius: 3px;
}

.view-root:focus {
  outline: none;
}

.view-root h1[tabindex="-1"]:focus {
  outline: none;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--red-800);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 0.9375rem;
  transition: top 0.18s ease;
}

.skip-link:focus {
  top: 0;
  color: #fff;
}

.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;
}

/* ---------- 3. 布局骨架 ---------- */
.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 44px);
}

.main {
  flex: 1 0 auto;
  padding-block: clamp(28px, 4.4vw, 56px) clamp(56px, 8vw, 104px);
}

.view {
  animation: viewIn 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 4. 页眉（红头） ---------- */
.masthead {
  flex: none;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.15) blur(8px);
  border-bottom: 1px solid var(--line);
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand__seal {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: linear-gradient(158deg, var(--red-700), var(--red-800) 62%, var(--red-900));
  color: #fff;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  text-indent: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), inset 0 0 14px rgba(0, 0, 0, 0.16);
}

.brand__text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand__name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.15;
  color: var(--ink);
}

.brand__sub {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.masthead__aside {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.session {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.session::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.session--mock::before {
  background: var(--gold-500);
}

.masthead__rules {
  height: 7px;
  display: grid;
  grid-template-rows: 3px 1px;
  row-gap: 3px;
  background: var(--surface);
}

.masthead__rules span:first-child {
  background: linear-gradient(90deg, var(--red-800), var(--red-700) 55%, #9c2a2a);
}

.masthead__rules span:last-child {
  background: var(--gold-500);
  opacity: 0.55;
}

/* ---------- 5. 页脚 ---------- */
.footer {
  flex: none;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 28px;
  padding-block: 22px 28px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer__brand {
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

/* ---------- 6. 通用组件 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.panel--auth {
  padding: clamp(26px, 3.4vw, 46px);
  border-top: 4px solid var(--red-800);
  animation: viewIn 0.36s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.panel--notes {
  padding: clamp(22px, 2.6vw, 30px);
  background: linear-gradient(180deg, #fffdf9, #fcf8f0);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--red-800);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  flex: none;
  background: var(--gold-600);
}

.eyebrow--center {
  justify-content: center;
}

.display {
  font-size: clamp(24px, 2.6vw, 31px);
  margin-bottom: 12px;
}

.page-head {
  margin-bottom: clamp(24px, 3vw, 36px);
}

.page-head__title {
  font-size: clamp(29px, 3.6vw, 44px);
  margin-bottom: 14px;
}

.lede {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.lede--tight {
  margin-top: 8px;
  font-size: 1rem;
}

.fineprint {
  margin-top: 18px;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* 按钮 */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 44px;
  padding: 0.58em 1.2em;
  border: 1px solid var(--btn-bd);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    box-shadow 0.16s ease, transform 0.06s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--primary {
  --btn-bg: var(--red-800);
  --btn-fg: #fff;
  --btn-bd: var(--red-800);
  box-shadow: 0 10px 22px -14px rgba(110, 8, 8, 0.95);
}

.btn--primary:hover:not(:disabled) {
  --btn-bg: var(--red-700);
  --btn-bd: var(--red-700);
}

.btn--outline {
  --btn-bg: #fff;
  --btn-fg: var(--red-800);
  --btn-bd: var(--red-800);
}

.btn--outline:hover:not(:disabled) {
  --btn-bg: var(--red-050);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-bd: var(--line-strong);
}

.btn--ghost:hover:not(:disabled) {
  --btn-bg: #fff;
  --btn-fg: var(--red-800);
  --btn-bd: #b9a489;
}

.btn--sm {
  min-height: 36px;
  padding: 0.34em 0.85em;
  font-size: 0.8125rem;
}

.btn--lg {
  min-height: 52px;
  padding: 0.68em 1.5em;
  font-size: 1.0625rem;
}

.btn--block {
  width: 100%;
}

.btn.is-busy {
  cursor: progress;
}

.btn.is-busy:disabled {
  opacity: 1;
}

.btn.dl {
  min-height: 60px;
}

.btn.dl.is-busy {
  flex-direction: row;
  align-items: center;
  gap: 0.55em;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.spinner {
  flex: none;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 表单 */
.form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.field {
  display: grid;
  gap: 8px;
}

.field__label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}

.field__hint {
  font-size: 0.8125rem;
  color: var(--muted);
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 0.62em 0.95em;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: 0.06em;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input::placeholder {
  color: #766c62;
  letter-spacing: 0.02em;
}

.input:hover {
  border-color: #bda98f;
}

.input:focus {
  outline: none;
  border-color: var(--red-700);
  box-shadow: 0 0 0 3px rgba(163, 22, 33, 0.14);
}

.input[aria-invalid="true"] {
  border-color: var(--red-700);
  background: #fffbfb;
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--red-700);
  border-radius: 0 6px 6px 0;
  background: var(--red-050);
  color: var(--red-900);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* ---------- 7. 登录视图 ---------- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  padding-top: clamp(6px, 1.4vw, 18px);
}

.auth__side {
  padding-top: 6px;
}

.side-title {
  font-size: clamp(19px, 1.7vw, 22px);
  margin-bottom: 10px;
}

.side-sub {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 28px;
  max-width: 40ch;
}

.brief {
  display: grid;
  gap: 20px;
}

.brief__item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brief__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.brief__num {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1;
  color: var(--gold-700);
  padding-top: 3px;
  font-variant-numeric: lining-nums;
}

.brief__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.brief__text {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.7;
}

.demo {
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px dashed var(--gold-500);
  border-radius: 8px;
  background: #fffdf6;
}

.demo__title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--gold-700);
  margin-bottom: 4px;
}

.demo__hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.demo__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- 8. 上传视图 ---------- */
.upload {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr);
  gap: clamp(20px, 2.6vw, 32px);
  align-items: start;
}

.upload__main {
  min-width: 0;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 300px;
  padding: clamp(28px, 4vw, 46px) 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #fff, #fffdfa);
  color: var(--ink-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.dropzone:hover {
  border-color: var(--red-600);
  background: #fffdf9;
  box-shadow: var(--shadow-1);
}

.dropzone.is-over {
  border-color: var(--red-700);
  background: var(--red-025);
  box-shadow: 0 0 0 4px rgba(163, 22, 33, 0.07) inset;
}

.dropzone__icon {
  width: 58px;
  height: 58px;
  color: var(--red-800);
  margin-bottom: 6px;
}

.dropzone__title {
  font-family: var(--serif);
  font-size: clamp(19px, 1.9vw, 22px);
  font-weight: 700;
  color: var(--ink);
}

.dropzone__hint {
  font-size: 0.9375rem;
  color: var(--muted);
}

.dropzone__meta {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.filecard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 18px;
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red-800);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  animation: viewIn 0.24s ease both;
}

.filecard__icon {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--red-800);
}

.filecard__icon svg {
  width: 22px;
  height: 22px;
}

.filecard__body {
  flex: 1 1 260px;
  min-width: 0;
}

.filecard__name {
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.filecard__meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.filecard__error {
  margin-top: 8px;
  padding: 8px 11px;
  border-left: 3px solid var(--red-700);
  background: var(--red-050);
  color: var(--red-900);
  font-size: 0.8125rem;
  border-radius: 0 5px 5px 0;
}

.filecard__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.filecard.is-uploading .filecard__actions {
  display: none;
}

.filecard__progress {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.filecard__progress .bar {
  flex: 1 1 100%;
}

.filecard__progress .progress-meta {
  flex: 1 1 auto;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-meta strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* 进度条 */
.bar {
  position: relative;
  height: 6px;
  width: 100%;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(46, 29, 15, 0.06);
}

.bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-800), var(--red-600));
  transition: width 0.5s cubic-bezier(0.22, 0.7, 0.3, 1);
}

.bar--lg {
  height: 8px;
}

.bar.is-indeterminate .bar__fill {
  width: 38%;
  animation: barSlide 1.5s ease-in-out infinite;
}

@keyframes barSlide {
  0% {
    transform: translateX(-110%);
  }
  60%,
  100% {
    transform: translateX(300%);
  }
}

/* 侧栏说明 */
.notes__title {
  font-size: 1.0625rem;
  margin-bottom: 4px;
}

.notes__sub {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.notes__list {
  display: grid;
  gap: 12px;
}

.notes__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.6;
}

.notes__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.notes__key {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--gold-700);
  padding-top: 3px;
  text-transform: uppercase;
}

.notes__foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 9. 处理中 ---------- */
.process {
  max-width: 760px;
  margin-inline: auto;
  padding-top: clamp(10px, 2vw, 28px);
  text-align: center;
}

.loader {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto clamp(26px, 3.4vw, 38px);
}

.loader__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(163, 22, 33, 0.14);
  border-top-color: var(--red-800);
  border-right-color: rgba(163, 22, 33, 0.45);
  animation: spin 2.6s linear infinite;
}

.loader__ring--2 {
  inset: 20px;
  border: 1px solid rgba(194, 162, 74, 0.4);
  border-bottom-color: var(--gold-600);
  border-left-color: rgba(194, 162, 74, 0.15);
  animation: spin 4.2s linear infinite reverse;
}

.loader__core {
  position: absolute;
  inset: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #fff, #fdf7f0);
  color: var(--red-800);
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 1px 0 #fff inset, 0 12px 26px -18px rgba(110, 8, 8, 0.8);
}

.process__title {
  font-size: clamp(25px, 3vw, 34px);
  margin-bottom: 10px;
}

.process__hint {
  color: var(--muted);
  margin-inline: auto;
  max-width: 46ch;
  font-size: 0.9375rem;
  min-height: 1.7em;
}

.progress-block {
  margin: clamp(26px, 3.4vw, 38px) 0 26px;
  text-align: left;
}

.progress-block .progress-meta {
  margin-bottom: 9px;
  font-size: 0.875rem;
}

.progress-block .progress-meta strong {
  color: var(--ink);
}

.stages {
  display: grid;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px 0;
  box-shadow: var(--shadow-1);
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 22px 11px 22px;
}

.stage::before {
  content: "";
  position: absolute;
  left: 32.5px;
  top: 50%;
  bottom: -50%;
  width: 1px;
  background: #ded2bf;
}

.stage:last-child::before {
  display: none;
}

.stage__dot {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: transparent;
  transition: all 0.2s ease;
}

.stage__body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-width: 0;
}

.stage__label {
  font-size: 0.9375rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.stage__desc {
  font-size: 0.75rem;
  color: #766c62;
}

.stage__state {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: #766c62;
  font-variant-numeric: tabular-nums;
}

.stage[data-state="active"] .stage__dot {
  border-color: var(--red-700);
  box-shadow: 0 0 0 4px rgba(163, 22, 33, 0.12);
  animation: pulse 1.8s ease-in-out infinite;
}

.stage[data-state="active"] .stage__label {
  color: var(--ink);
  font-weight: 600;
}

.stage[data-state="active"] .stage__state {
  color: var(--red-800);
  font-weight: 600;
}

.stage[data-state="done"] .stage__dot {
  border-color: var(--red-800);
  background: var(--red-800);
  color: #fff;
}

.stage[data-state="done"] .stage__dot::after {
  content: "✓";
  font-size: 12px;
  line-height: 1;
  color: #fff;
}

.stage[data-state="done"] .stage__label {
  color: var(--ink-2);
}

.stage[data-state="done"] .stage__state {
  color: var(--muted);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(163, 22, 33, 0.14);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(163, 22, 33, 0.06);
  }
}

.process__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 22px;
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.process__foot .btn {
  margin-left: 4px;
}

.confirm-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fffdf8;
  font-size: 0.875rem;
  color: var(--ink-2);
}

/* ---------- 10. 结果页 ---------- */
.report {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px 32px;
  padding-bottom: clamp(20px, 2.6vw, 28px);
  border-bottom: 1px solid var(--line);
}

.report__main {
  min-width: 0;
  flex: 1 1 420px;
}

.report__title {
  font-size: clamp(27px, 3.3vw, 40px);
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.report__sub {
  font-family: var(--serif);
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--ink-2);
  margin-bottom: 10px;
}

.report__meta {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-variant-numeric: tabular-nums;
}

.report__meta .sep {
  color: var(--line-strong);
}

.report__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 1 auto;
}

.report__actions .btn {
  min-width: 172px;
}

.dl {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.25;
  padding: 0.55em 1.15em;
  text-align: left;
}

.dl__label {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.9375rem;
  font-weight: 600;
}

.dl__sub {
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  opacity: 0.88;
}

.dl svg {
  width: 16px;
  height: 16px;
}

/* 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: clamp(22px, 2.6vw, 30px) 0 8px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.stat {
  position: relative;
  display: grid;
  gap: 1px;
  padding: 16px 20px 15px;
  background: var(--surface);
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--tone, transparent);
}

.stat__label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.stat__value {
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--tone-strong, var(--ink));
  font-variant-numeric: lining-nums tabular-nums;
}

.stat__hint {
  font-size: 0.6875rem;
  color: #6f665c;
  letter-spacing: 0.04em;
}

.stat--total {
  --tone: var(--gold-500);
}

.stat--high {
  --tone: var(--high);
  --tone-strong: var(--high-fg);
}

.stat--medium {
  --tone: var(--medium);
  --tone-strong: var(--medium-fg);
}

.stat--low {
  --tone: var(--low);
  --tone-strong: var(--low-fg);
}

/* 工具条 */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: 14px 0;
  margin-bottom: 4px;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar__spacer {
  flex: 1 1 auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0.34em 0.9em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--red-600);
  color: var(--red-800);
}

.chip[aria-pressed="true"] {
  background: var(--red-800);
  border-color: var(--red-800);
  color: #fff;
}

.chip__dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--dot, var(--muted));
}

.chip__dot--high {
  background: var(--high);
}

.chip__dot--medium {
  background: var(--medium);
}

.chip__dot--low {
  background: var(--low);
}

.chip[aria-pressed="true"] .chip__dot {
  background: #fff;
  opacity: 0.85;
}

.chip__count {
  font-size: 0.75rem;
  opacity: 0.88;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--muted);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

.dot--high {
  background: var(--high);
}

.dot--medium {
  background: var(--medium);
}

.dot--low {
  background: var(--low);
}

.select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.select__input {
  min-height: 38px;
  padding: 0.3em 0.7em;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font-size: 0.875rem;
  cursor: pointer;
}

.select__input:focus {
  outline: none;
  border-color: var(--red-700);
  box-shadow: 0 0 0 3px rgba(163, 22, 33, 0.12);
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 14px 0 2px;
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 问题卡片 */
.findings {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.finding {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sev, var(--line-strong));
  border-radius: var(--radius);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.finding:hover {
  box-shadow: var(--shadow-1);
}

.finding--high {
  --sev: var(--high);
}

.finding--medium {
  --sev: var(--medium);
}

.finding--low {
  --sev: var(--low);
}

.finding__sum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 15px 20px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}

.finding__sum::-webkit-details-marker {
  display: none;
}

.finding__sum:hover {
  background: #fffdf9;
}

.finding__sum:focus-visible {
  outline-offset: -3px;
}

.finding__title {
  flex: 1 1 300px;
  min-width: 0;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.finding__loc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.finding__loc .tag {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.6875rem;
}

.finding__chev {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.finding[open] .finding__chev {
  transform: rotate(180deg);
}

.finding[open] .finding__sum {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.finding__body {
  padding: 16px 20px 18px;
}

.kv {
  display: grid;
  gap: 14px;
}

.kv__row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.kv__k {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-top: 0.32em;
}

.kv__v {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.quote {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  padding: 9px 14px;
  background: var(--paper-2);
  border-left: 2px solid var(--gold-500);
  border-radius: 0 6px 6px 0;
}

.finding__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 0.75rem;
  color: #6f665c;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.sev {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 0.18em 0.55em;
  border: 1px solid var(--sev-line, transparent);
  border-radius: 4px;
  background: var(--sev-bg, var(--paper-2));
  color: var(--sev-fg, var(--ink-2));
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.sev::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sev-fg, currentColor);
}

.sev--high {
  --sev-bg: var(--high-bg);
  --sev-fg: var(--high-fg);
  --sev-line: #efc9cc;
}

.sev--medium {
  --sev-bg: var(--medium-bg);
  --sev-fg: var(--medium-fg);
  --sev-line: #efd5ae;
}

.sev--low {
  --sev-bg: var(--low-bg);
  --sev-fg: var(--low-fg);
  --sev-line: #e5d5a3;
}

/* 提示条 / 空状态 / 预览 */
.notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-600);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #fffdf6;
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.65;
}

.notice svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--gold-700);
}

.verdict {
  margin-top: clamp(24px, 3vw, 34px);
  padding: clamp(34px, 5vw, 58px) 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.verdict__mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #cfe3d3;
  background: var(--ok-bg);
  color: var(--ok);
}

.verdict__mark svg {
  width: 30px;
  height: 30px;
}

.verdict__title {
  font-size: clamp(23px, 2.6vw, 30px);
  margin-bottom: 12px;
}

.verdict__text {
  max-width: 52ch;
  margin-inline: auto;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.8;
}

.verdict__hint {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: #6f665c;
}

.empty-filter {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 46px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fffdf9;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
}

.preview {
  margin-top: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.preview__sum {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-2);
}

.preview__sum::-webkit-details-marker {
  display: none;
}

.preview__sum .muted {
  font-weight: 400;
  font-size: 0.8125rem;
}

.preview__sum .finding__chev {
  margin-left: auto;
}

.preview[open] .finding__chev {
  transform: rotate(180deg);
}

.preview__text {
  margin: 0;
  padding: 18px 22px 22px;
  border-top: 1px solid var(--line);
  background: #fffdf9;
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.95;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 420px;
  overflow: auto;
}

.result-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  margin-top: clamp(26px, 3.4vw, 38px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.result-foot .fineprint {
  margin: 0;
  max-width: 52ch;
}

/* ---------- 11. 状态页（错误等） ---------- */
.state {
  max-width: 640px;
  margin: clamp(8px, 2vw, 26px) auto 0;
  padding: clamp(30px, 4vw, 46px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red-800);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.state__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red-050);
  color: var(--red-800);
}

.state__icon svg {
  width: 24px;
  height: 24px;
}

.state__title {
  font-size: clamp(23px, 2.6vw, 30px);
  margin-bottom: 10px;
}

.state__code {
  margin-top: 18px;
  font-size: 0.75rem;
  color: var(--muted);
}

.state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

/* ---------- 12. Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
}

.toast__item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #27211c;
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.6;
  box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.65);
  animation: toastIn 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.toast__item--error {
  background: var(--red-900);
}

.toast__item--success {
  background: #1f5734;
}

.toast__item svg {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  opacity: 0.85;
}

.toast__item.is-leaving {
  animation: toastOut 0.2s ease both;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- 13. 响应式 ---------- */
@media (max-width: 960px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  .auth__side {
    padding-top: 0;
  }

  .upload {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload .panel--notes {
    order: 2;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15.5px;
  }

  .masthead__inner {
    min-height: 66px;
  }

  .brand__seal {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .brand__name {
    font-size: 18px;
  }

  .brand__sub {
    letter-spacing: 0.2em;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report__actions {
    width: 100%;
  }

  .report__actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .toolbar {
    position: static;
    gap: 10px 14px;
    padding: 12px 0;
  }

  .legend {
    display: none;
  }

  .finding__sum {
    padding: 14px 16px;
  }

  .finding__body {
    padding: 14px 16px 16px;
  }

  .kv__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .kv__k {
    padding-top: 0;
  }

  .stage {
    padding-inline: 16px;
    gap: 12px;
  }

  .stage::before {
    left: 26.5px;
  }

  .stage__desc {
    display: none;
  }

  .process__foot {
    justify-content: flex-start;
    text-align: left;
  }

  .toast {
    bottom: 14px;
  }
}

@media (max-width: 520px) {
  .brand {
    gap: 10px;
  }

  .brand__name {
    white-space: nowrap;
    letter-spacing: 0.1em;
  }

  .brand__sub {
    letter-spacing: 0.14em;
  }

  .masthead__aside {
    gap: 8px;
  }

  .session {
    display: none;
  }

  .report__meta .sep {
    display: none;
  }

  .dropzone {
    min-height: 228px;
    padding: 26px 18px;
  }

  .dropzone__icon {
    width: 46px;
    height: 46px;
  }

  .filecard {
    padding: 16px;
  }

  .filecard__actions {
    width: 100%;
    margin-left: 0;
  }

  .filecard__actions .btn {
    flex: 1 1 0;
  }

  .report__actions .btn {
    flex: 1 1 100%;
  }

  .btn-row .btn {
    flex: 1 1 100%;
  }

  .state {
    padding: 26px 22px;
  }

  .stat {
    padding: 13px 15px;
  }
}

/* ---------- 14. 动效偏好 & 打印 ---------- */
@media (max-width: 400px) {
  .brand__seal {
    width: 34px;
    height: 34px;
    font-size: 19px;
  }

  .btn--sm {
    min-height: 34px;
    padding: 0.3em 0.7em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .bar__fill {
    transition: none;
  }
}

@media print {
  body {
    background: #fff;
  }

  .masthead__aside,
  .footer,
  .toolbar,
  .report__actions,
  .result-foot,
  .toast,
  .skip-link {
    display: none !important;
  }

  .finding,
  .stats,
  .verdict,
  .preview {
    box-shadow: none;
    break-inside: avoid;
  }

  .main {
    padding-block: 0;
  }
}
