:root {
  color-scheme: light;
  --page: #f3f5f3;
  --paper: #ffffff;
  --paper-muted: #f8faf8;
  --ink: #17212b;
  --ink-soft: #35424e;
  --muted: #66727c;
  --line: #d7ddd9;
  --line-strong: #b9c3bd;
  --brand: #8f1d2c;
  --brand-dark: #701722;
  --brand-soft: #f8e9eb;
  --accent: #0f6f68;
  --accent-soft: #e5f2f0;
  --warning: #8a5a00;
  --warning-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #feeceb;
  --success: #176b45;
  --success-soft: #e7f4ed;
  --focus: #1f6feb;
  --shadow: 0 10px 28px rgba(23, 33, 43, 0.08);
  --radius: 8px;
  --radius-sm: 6px;
  --font-sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 42%, transparent);
  outline-offset: 2px;
}

.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;
}

.app-shell {
  min-height: 100vh;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 2px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-body {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 252px;
  gap: 24px;
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.sidebar,
.progress-rail {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.sidebar {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar-heading,
.progress-heading {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-nav {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-nav a {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 8px 8px;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.section-nav a:hover {
  color: var(--ink);
  background: var(--paper-muted);
}

.section-nav a.is-active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 700;
}

.nav-index {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.nav-state {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.section-nav a.is-complete .nav-state {
  color: var(--success);
}

.main-column {
  min-width: 0;
  max-width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.document-header {
  padding: 34px 42px 26px;
  border-bottom: 1px solid var(--line);
}

.document-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-title {
  max-width: 760px;
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
  letter-spacing: 0;
}

.document-lede {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.doc-section {
  padding: 34px 42px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 88px;
}

.doc-section:first-child {
  border-top: 0;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.section-index {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.section-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: 0;
}

.section-description {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
}

.section-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--paper-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.section-status.is-complete {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
}

.section-status.is-optional {
  color: var(--muted);
  background: var(--paper-muted);
  border-color: var(--line);
}

.section-nav a.is-optional {
  color: var(--muted);
}

.subsection {
  min-width: 0;
  padding: 22px 0 0;
  border-top: 1px dashed var(--line);
  margin-top: 22px;
}

.subsection:first-child {
  padding-top: 0;
  border-top: 0;
  margin-top: 0;
}

.subsection-title {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.45;
}

.subsection-copy {
  margin: -4px 0 14px;
  color: var(--ink-soft);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-grid.cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.field-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-3 {
  grid-column: span 3;
}

.field-label {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-required {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  line-height: 1.6;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #8d9b93;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  outline: 0;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.textarea.tall {
  min-height: 150px;
}

.input::placeholder,
.textarea::placeholder {
  color: #98a39c;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  color: var(--ink-soft);
  background: var(--paper-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.choice:hover {
  border-color: var(--line-strong);
}

.choice:has(input:checked) {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
}

.choice input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--brand);
}

.choice-copy {
  display: grid;
  gap: 0;
}

.choice small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.hint-box,
.warning-box,
.success-box {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--paper-muted);
  font-size: 13px;
}

.warning-box {
  color: #6e4a00;
  background: var(--warning-soft);
  border-color: #ead49b;
}

.success-box {
  color: #145c3d;
  background: var(--success-soft);
  border-color: #b9ddc9;
}

.hint-box strong,
.warning-box strong {
  color: inherit;
}

.example-panel {
  min-width: 0;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-muted);
}

.example-panel > summary {
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.example-panel > summary::-webkit-details-marker {
  display: none;
}

.example-panel > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: 4px;
  font-weight: 800;
}

.example-panel[open] > summary::before {
  content: "−";
}

.example-content {
  padding: 0 12px 12px;
  min-width: 0;
  overflow-x: auto;
  color: var(--ink-soft);
  font-size: 13px;
}

.example-content ul,
.example-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.example-content li + li {
  margin-top: 4px;
}

.data-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--paper);
  table-layout: fixed;
}

.data-table.compact {
  min-width: 620px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  color: var(--ink-soft);
  background: var(--paper-muted);
  font-size: 12px;
  font-weight: 800;
}

.data-table td {
  font-size: 13px;
}

.data-table .input,
.data-table .select,
.data-table .textarea {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.data-table .textarea {
  min-height: 70px;
}

.cell-stack {
  display: grid;
  gap: 6px;
}

.row-number {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.table-actions-note {
  color: var(--muted);
  font-size: 12px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  color: var(--ink-soft);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.btn:hover {
  color: var(--ink);
  background: var(--paper-muted);
  border-color: #8d9b93;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover {
  color: #ffffff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-accent {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn-accent:hover {
  color: #ffffff;
  background: #0b5b55;
  border-color: #0b5b55;
}

.btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
}

.btn-danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn svg,
.icon-button svg,
.status-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.icon-button:hover {
  color: var(--ink);
  background: var(--paper-muted);
  border-color: var(--line);
}

.progress-card {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.progress-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-value strong {
  font-size: 28px;
  line-height: 1;
}

.progress-value span {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e7ece8;
  border-radius: 999px;
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.progress-list {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.progress-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  color: var(--muted);
  font-size: 12px;
}

.progress-list li.is-complete {
  color: var(--success);
}

.progress-list li.is-attention {
  color: var(--warning);
}

.status-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-stat {
  padding: 10px;
  background: var(--paper-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.summary-stat strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.summary-stat span {
  color: var(--muted);
  font-size: 11px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 33, 43, 0.46);
}

.dialog-backdrop[hidden] {
  display: none;
}

.dialog {
  width: min(560px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(23, 33, 43, 0.24);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-title {
  margin: 0;
  font-size: 20px;
}

.dialog-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dialog-body {
  margin-top: 16px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  background: var(--paper-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.check-list li.is-warning {
  background: var(--warning-soft);
  border-color: #ead49b;
}

.check-list li.is-complete {
  background: var(--success-soft);
  border-color: #b9ddc9;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: grid;
  gap: 8px;
}

.toast-item {
  min-width: 260px;
  max-width: 380px;
  padding: 12px 14px;
  color: #ffffff;
  background: var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast-item.is-error {
  background: var(--danger);
}

.toast-item.is-success {
  background: var(--success);
}

.mobile-menu-button {
  display: none;
}

@media (max-width: 1280px) {
  .app-body {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .progress-rail {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    padding: 10px 14px;
  }

  .brand-subtitle,
  .topbar-actions .btn-label {
    display: none;
  }

  .app-body {
    display: block;
    padding: 14px;
  }

  .sidebar {
    position: fixed;
    inset: 64px 0 auto 0;
    z-index: 50;
    max-height: calc(100vh - 64px);
    border-width: 0 0 1px;
    border-radius: 0;
    transform: translateY(-110%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateY(0);
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .main-column {
    box-shadow: none;
  }

  .document-header,
  .doc-section {
    padding-right: 22px;
    padding-left: 22px;
  }

  .field-grid,
  .field-grid.cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .field.span-2,
  .field.span-3 {
    grid-column: auto;
  }

  .choice-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .topbar-brand {
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .document-header,
  .doc-section {
    padding-right: 16px;
    padding-left: 16px;
  }

  .document-title {
    font-size: 24px;
  }

  .section-title {
    font-size: 21px;
  }

  .section-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog-backdrop {
    padding: 12px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .sidebar,
  .progress-rail,
  .table-actions,
  .button-row,
  .dialog-backdrop,
  .toast {
    display: none !important;
  }

  .app-body {
    display: block;
    padding: 0;
  }

  .main-column {
    border: 0;
    box-shadow: none;
  }

  .doc-section {
    break-inside: avoid;
  }
}
