
:root {
  --paper: #f3f4f5;
  --sheet: #ffffff;
  --sheet-deep: #eaecee;
  --line: #dcdee1;
  --line-strong: #b3b7bc;
  --ink: #25282c;
  --ink-soft: #5a5f66;
  --ink-faint: #858a91;
  --brick: #a4492b;
  --brick-deep: #84361d;
  --brick-wash: #f6e4e1;
  --stop: #a61e2d;
  --stop-wash: #f7dfe1;
  --done: #2f6b4f;
  --done-wash: #dcebe2;
  --wait: #4f5b69;
  --wait-wash: #e6eaee;
  --text-spine: #666c75;
  --drawing-spine: #3b5b73;
  --photo-spine: #3d6b57;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
}
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: 0.55; }
small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--brick); outline-offset: 1px; }
.figure { font-variant-numeric: tabular-nums; }

.page { display: none; }
.page.active { display: block; }
.app { min-height: 100%; }
.main { max-width: 1200px; margin: 0 auto; padding: 24px 32px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 14px; margin-bottom: 20px; border-bottom: 2px solid var(--ink); }
.page-head h1 { font-size: 26px; line-height: 1.3; letter-spacing: 0.04em; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.page-body > * + * { margin-top: 18px; }

.topbar { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 32px; background: var(--ink); color: #f3f4f5; }
.topbar-brand { font-family: var(--serif); font-size: 16px; letter-spacing: 0.08em; }
.topbar-nav { display: flex; align-items: center; gap: 22px; }
.topbar-link { background: none; border: 0; padding: 0; color: #c9cdd2; }
.topbar-link-active { color: #fff; border-bottom: 2px solid #d96a52; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar-user-role { padding: 0 8px; border: 1px solid #868c94; color: #d4d8dc; font-size: 12px; }
.topbar-logout { background: none; border: 0; color: #c9cdd2; text-decoration: underline; padding: 0; }

.route { background: var(--sheet); border-bottom: 1px solid var(--line); }
.route-inner { max-width: 1200px; margin: 0 auto; padding: 12px 32px 0; }
.route-project { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.route-name { font-family: var(--serif); font-size: 17px; }
.route-unit { color: var(--ink-faint); font-size: 12px; }
.route-status { display: flex; align-items: center; gap: 8px; }
.route-actor { font-size: 12px; color: var(--ink-soft); }
.route-deadlines { display: flex; gap: 6px; }
.route-links { margin-left: auto; display: flex; gap: 18px; }
.miles { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); }
.mile { border-top: 4px solid var(--line); }
.mile-done { border-top-color: var(--done); }
.mile-current { border-top-color: var(--brick); }
.mile-here { background: var(--sheet-deep); }
.mile-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; text-align: left; }
.mile-button:disabled { opacity: 1; cursor: default; color: var(--ink-faint); }
.mile-order { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 12px; flex: none; }
.mile-done .mile-order { background: var(--done); border-color: var(--done); color: #fff; }
.mile-current .mile-order { background: var(--brick); border-color: var(--brick); color: #fff; }
.mile-name { display: block; font-weight: 600; }
.mile-role { display: block; font-size: 12px; color: var(--ink-faint); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 16px; border: 1px solid var(--line-strong); background: var(--sheet); color: var(--ink); border-radius: 2px; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn-primary { background: var(--brick); border-color: var(--brick); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brick-deep); border-color: var(--brick-deep); }
.btn-danger { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn-danger-ghost { border-color: var(--stop); color: var(--stop); }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brick); text-decoration: underline; text-underline-offset: 3px; }
.link-inline { margin-left: 8px; font-size: 12px; }

.chip { display: inline-block; padding: 0 9px; border: 1px solid currentColor; font-size: 12px; line-height: 20px; white-space: nowrap; }
.tone-pending { color: var(--wait); background: var(--wait-wash); }
.tone-active { color: var(--brick); background: var(--brick-wash); }
.tone-danger { color: var(--stop); background: var(--stop-wash); }
.tone-done { color: var(--done); background: var(--done-wash); }
.tag { display: inline-block; margin-right: 6px; padding: 0 6px; border: 1px solid var(--line-strong); color: var(--ink-soft); font-size: 12px; line-height: 18px; }
.tag-danger { border-color: var(--stop); color: var(--stop); background: var(--stop-wash); }
.tag-ok { border-color: var(--done); color: var(--done); }
.tag-muted { color: var(--ink-faint); }

.panel { background: var(--sheet); border: 1px solid var(--line); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; }
.panel-note { font-size: 12px; color: var(--ink-faint); }
.panel-body { padding: 16px 18px; }
.panel-toc .panel-body { padding: 8px 0; }
.banner { padding: 10px 16px; border-left: 4px solid var(--line-strong); background: var(--sheet-deep); }
.banner-title { font-weight: 600; }
.banner-detail { color: var(--ink-soft); font-size: 13px; }
.banner-ok { border-left-color: var(--done); background: var(--done-wash); }
.banner-danger { border-left-color: var(--stop); background: var(--stop-wash); }
.banner-warn { border-left-color: var(--wait); background: var(--wait-wash); }
.banner-info { border-left-color: var(--brick); background: var(--brick-wash); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-soft); }
.empty-title { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.empty-detail { margin-top: 4px; }
.empty-actions { margin-top: 14px; }

.readouts { display: flex; gap: 0; border: 1px solid var(--line); background: var(--sheet); }
.readout { flex: 1; padding: 12px 18px; border-right: 1px solid var(--line); }
.readout:last-child { border-right: 0; }
.readout-label { font-size: 12px; color: var(--ink-faint); }
.readout-value { font-family: var(--serif); }
.readout-value .figure { font-size: 28px; line-height: 1.2; }
.readout-unit { margin-left: 4px; font-size: 12px; color: var(--ink-faint); font-family: var(--sans); }
.readout-active .figure { color: var(--brick); }
.readout-danger .figure { color: var(--stop); }
.readout-done .figure { color: var(--done); }
.readouts-tight .readout { padding: 8px 16px; }
.readouts-tight .readout-value .figure { font-size: 22px; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 32px; margin: 0; }
.kv-single { grid-template-columns: 1fr; }
.kv-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dotted var(--line-strong); }
.kv dt { width: 6em; flex: none; color: var(--ink-faint); }
.kv dd { margin: 0; }
.kv-note { margin-left: 8px; color: var(--ink-faint); }

.toc { display: block; }
.leader-row { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px 18px; background: none; border: 0; text-align: left; color: var(--ink); }
.leader-click:hover { background: var(--sheet-deep); }
.leader-lead { flex: none; min-width: 2.2em; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.leader-title { flex: 0 1 auto; min-width: 0; }
.leader-text { display: block; }
.leader-sub { display: block; color: var(--ink-faint); }
.leader-dots { flex: 1 1 24px; min-width: 24px; height: 0; border-bottom: 2px dotted var(--line-strong); }
.leader-tail { flex: none; text-align: right; font-size: 13px; }
.leader-stop .leader-text { color: var(--stop); }
.leader-muted .leader-text { color: var(--ink-faint); }
.toc-volumes .leader-row { padding: 5px 18px; }
.toc-volumes .leader-title { display: flex; align-items: baseline; gap: 12px; }
.toc-volumes .leader-sub { font-size: 12px; white-space: nowrap; }
.leader-picked { background: var(--brick-wash); box-shadow: inset 3px 0 0 var(--brick); }
.leader-mark { flex: none; }

.sheet-form { display: block; }
.sheet-form-inline { margin-top: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; }
.field { display: block; }
.field-wide { grid-column: 1 / -1; }
.field-label { display: block; margin-bottom: 4px; color: var(--ink-soft); font-size: 13px; }
.field-control { display: flex; align-items: center; gap: 8px; }
.field-unit { color: var(--ink-faint); white-space: nowrap; }
.field-hint { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-faint); }
.field-message { display: block; min-height: 18px; font-size: 12px; color: var(--stop); }
.field-error .input { border-color: var(--stop); background: var(--stop-wash); }
.input { width: 100%; min-height: 34px; padding: 4px 10px; background: #fff; border: 1px solid var(--line-strong); border-radius: 2px; }
.textarea { min-height: 70px; resize: vertical; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; margin-right: 18px; }
.check input { margin-top: 5px; }
.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 16px; }
.check-row { display: flex; gap: 16px; min-height: 34px; align-items: center; }
.check-list { display: grid; gap: 6px; margin-bottom: 14px; }
.choice-list { display: grid; gap: 8px; }
.file-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; }
.scan-control, .file-pick { display: flex; align-items: center; gap: 12px; }
.scan-box, .chosen-file { color: var(--ink-soft); }
.scan-name { font-weight: 600; margin-right: 8px; }
.scan-meta, .scan-none { color: var(--ink-faint); }
.filter-bar { display: flex; gap: 12px; align-items: center; padding: 8px 18px 12px; border-bottom: 1px solid var(--line); }
.filter-bar .input { width: 220px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 0 4px; }
.pager-text { color: var(--ink-soft); }

.register-grid { display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start; }
.entry-flag-wrap { border-left: 4px solid var(--stop); background: var(--stop-wash); }
.flag-note { padding: 0 18px 8px 56px; color: var(--stop); font-size: 13px; }

.issue-list { display: block; }
.issue { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dotted var(--line-strong); }
.issue:last-child { border-bottom: 0; }
.issue-main { flex: 1; }
.issue-message { font-weight: 600; }
.issue-sub { color: var(--ink-faint); font-size: 12px; }

.shelf { display: flex; align-items: flex-end; gap: 4px; padding: 16px 18px 0; overflow-x: auto; border-bottom: 10px solid #8b9199; background: linear-gradient(var(--sheet), var(--sheet-deep)); min-height: 260px; }
.spine { display: flex; flex-direction: column; align-items: center; justify-content: space-between; width: 46px; flex: none; padding: 8px 0; border: 1px solid rgba(0, 0, 0, 0.35); border-bottom: 0; color: #fff; background: var(--text-spine); }
.spine-drawing { background: var(--drawing-spine); }
.spine-photo { background: var(--photo-spine); }
.spine-active { outline: 3px solid var(--brick); outline-offset: 1px; }
.spine-stale { opacity: 0.45; }
.spine-name { writing-mode: vertical-rl; font-family: var(--serif); letter-spacing: 0.1em; font-size: 14px; white-space: nowrap; }
.spine-no, .spine-pages { font-size: 12px; }
.shelf-legend { display: flex; gap: 20px; padding: 8px 18px; font-size: 12px; color: var(--ink-soft); }
.legend::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; background: var(--text-spine); }
.legend-drawing::before { background: var(--drawing-spine); }
.legend-photo::before { background: var(--photo-spine); }
.legend-note { margin-left: auto; }
.bound-sheet { display: block; }
.cover { padding: 28px 24px; border: 2px solid var(--ink); text-align: center; background: var(--sheet); }
.cover-kind { font-size: 13px; letter-spacing: 0.4em; color: var(--ink-soft); }
.cover-title { margin: 10px 0 18px; font-size: 24px; }
.cover-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 16px; margin: 0; }
.cover-fact { text-align: left; }
.cover-fact dt { font-size: 12px; color: var(--ink-faint); }
.cover-fact dd { margin: 0; }

.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 360px; overflow-y: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 7px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: var(--sheet-deep); font-weight: 600; white-space: nowrap; }
.grid .num { text-align: right; }
.grid-dense th, .grid-dense td { padding: 4px 8px; }
.row-muted td { color: var(--ink-faint); }
.row-stop td { background: var(--stop-wash); }

.readouts .readout { min-width: 0; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.ws-side > * + * { margin-top: 16px; }
.book-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tabs { display: flex; border: 1px solid var(--line-strong); background: var(--sheet); }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 34px; background: none; border: 0; border-right: 1px solid var(--line); color: var(--ink-soft); }
.tab:last-child { border-right: 0; }
.tab-active { background: var(--ink); color: #f3f4f5; }
.tab-count { font-size: 12px; opacity: 0.8; }
.book-toolbar .input { width: auto; flex: 1; min-width: 0; }
.book-toolbar select.input { flex: none; width: 110px; }
.book-list { display: grid; gap: 12px; }
.book-card { display: grid; grid-template-columns: 168px 1fr; gap: 16px; width: 100%; padding: 12px; background: var(--sheet); border: 1px solid var(--line); text-align: left; }
.book-card:hover { border-color: var(--ink); }
.book-mine { box-shadow: inset 4px 0 0 var(--brick); }
.book-done .book-name { color: var(--ink-soft); }
.book-photo { display: flex; align-items: center; justify-content: center; width: 168px; height: 126px; overflow: hidden; background: var(--sheet-deep); border: 1px solid var(--line); }
.book-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-photo-empty { color: var(--ink-faint); font-size: 12px; }
.book-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.book-head { display: flex; justify-content: space-between; gap: 12px; }
.book-name { display: block; font-family: var(--serif); font-size: 18px; }
.book-unit { display: block; color: var(--ink-faint); font-size: 12px; }
.book-status { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: none; }
.book-actor { font-size: 12px; color: var(--ink-soft); }
.book-facts { color: var(--ink-soft); font-size: 13px; }
.book-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: auto; font-size: 13px; }
.book-time { margin-left: auto; color: var(--ink-faint); font-size: 12px; }
.rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.rail-bar { display: block; height: 4px; background: var(--line); }
.rail-name { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-faint); }
.rail-done .rail-bar { background: var(--done); }
.rail-current .rail-bar { background: var(--brick); }
.rail-current .rail-name { color: var(--ink); font-weight: 600; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-item { padding: 9px 0; border-bottom: 1px dotted var(--line-strong); }
.side-item:last-child { border-bottom: 0; }
.side-link { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; padding: 0; background: none; border: 0; text-align: left; }
.side-name { font-weight: 600; }
.side-text { flex-basis: 100%; color: var(--ink-soft); font-size: 12px; }
.side-empty { margin: 0; color: var(--ink-faint); }
.activity .side-item { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; }
.activity-time { grid-column: 1 / 3; color: var(--ink-faint); font-size: 12px; }
.activity-who { color: var(--ink-faint); font-size: 12px; align-self: end; }
.photo-field { display: flex; align-items: center; gap: 18px; }
.photo-frame { display: flex; align-items: center; justify-content: center; width: 200px; height: 150px; flex: none; overflow: hidden; background: var(--sheet-deep); border: 1px solid var(--line); color: var(--ink-faint); font-size: 12px; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.review-row { display: flex; align-items: center; }
.review-row .leader-row { flex: 1; }
.review-check { margin: 0 0 0 18px; }
.review-progress { margin-bottom: 8px; color: var(--ink-soft); }
.return-item { padding: 10px 0; border-bottom: 1px dotted var(--line-strong); }
.return-item:last-child { border-bottom: 0; }
.return-head { display: flex; gap: 12px; align-items: center; }
.return-by { color: var(--ink-faint); font-size: 12px; }
.return-opinion { margin-top: 4px; }
.return-flags { margin: 4px 0 0; padding-left: 20px; color: var(--stop); }
.correction-note { margin-top: 4px; color: var(--ink-soft); }
.correction-table { margin-top: 6px; }
.receipt { display: flex; align-items: center; gap: 24px; padding: 16px 20px; border: 1px solid var(--done); background: var(--done-wash); }
.receipt-line { font-weight: 600; }
.receipt-opinion { color: var(--ink-soft); }
.stamp { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 116px; height: 116px; flex: none; border: 3px double var(--stop); border-radius: 50%; color: var(--stop); transform: rotate(-8deg); font-family: var(--serif); background: rgba(255, 255, 255, 0.4); }
.stamp-line { line-height: 1.35; font-size: 12px; }
.stamp-line-0 { font-size: 20px; letter-spacing: 0.1em; }
.trail { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); background: var(--sheet); }
.trail-item { display: grid; grid-template-columns: 150px 1fr 150px; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.trail-item:last-child { border-bottom: 0; }
.trail-time { color: var(--ink-faint); }
.trail-action { font-weight: 600; }
.trail-detail { color: var(--ink-soft); font-size: 13px; }
.trail-who { text-align: right; }
.trail-who small { display: block; color: var(--ink-faint); }

.flag-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0; }
.flag-head .input { width: 240px; }
.flag-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); }
.flag-choice { display: grid; grid-template-columns: 1fr 260px; gap: 12px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.flag-meta { display: block; color: var(--ink-faint); }

#page-login { min-height: 100vh; align-items: center; justify-content: center; }
#page-login.active { display: flex; }
.login-sheet { width: 400px; padding: 36px 34px 30px; background: var(--sheet); border: 1px solid var(--line-strong); border-top: 6px solid var(--brick); }
.login-sheet h1 { font-size: 24px; letter-spacing: 0.06em; margin-bottom: 22px; }
.login-error { min-height: 22px; color: var(--stop); font-size: 13px; }

.dialog-root { display: none; }
.dialog-open { display: block; }
.dialog-mask { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(36, 40, 44, 0.45); }
.dialog { width: 520px; max-height: 90vh; overflow-y: auto; padding: 22px 24px; background: var(--sheet); border-top: 6px solid var(--brick); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); }
.dialog-wide { width: 760px; }
.dialog-title { font-size: 20px; margin-bottom: 12px; }
.dialog-text { margin: 0 0 12px; color: var(--ink-soft); }
.dialog-error { min-height: 20px; margin-top: 8px; color: var(--stop); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 60; display: grid; gap: 8px; }
.toast { max-width: 420px; padding: 10px 16px; background: var(--ink); color: #f3f4f5; border-left: 4px solid #d96a52; }
.toast-danger { background: var(--stop); border-left-color: #fff; }
