:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: #f4f5ef;
  background: #202522;
  --canvas: #202522;
  --surface: #303632;
  --card: #343c36;
  --raised: #3b443c;
  --ink: #f4f5ef;
  --muted: #bdc5bb;
  --dim: #acb7a9;
  --line: #4b554c;
  --input-line: #748172;
  --accent: #b4d2b5;
  --accent-ink: #203a2a;
  --wash: #3d5041;
  --amber: #e7c58e;
  --danger: #ffc2ac;
  --gutter: clamp(16px, 4.8vw, 64px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select, summary, a { -webkit-tap-highlight-color: #a4c8a72e; }
button, select, summary { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .57; cursor: not-allowed; }
a { color: var(--accent); text-underline-offset: .24em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #dbedb9; outline-offset: 3px; }
h1, h2, h3, h4, p, dl, figure { margin: 0; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.4; font-weight: 600; }
h1 { font-size: clamp(26px, 3vw, 37px); letter-spacing: .015em; }
h2 { font-size: clamp(20px, 2.1vw, 25px); }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
small { font-size: 13px; }
code, pre, blockquote, dd, li, p, summary, h1, h2, h3, .entry-title, .fact-value,
.fact-meta, .meta, .note, .account, .btn, .source, .badge, label { overflow-wrap: anywhere; }
pre { white-space: pre-wrap; }
button { border: 0; }
img, svg, video, iframe { max-width: 100%; }
.skip, .sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus {
  position: fixed; z-index: 10; top: 12px; left: 12px;
  width: auto; height: auto; clip-path: none;
  padding: 10px 14px; color: var(--ink); background: var(--surface); border-radius: 8px;
}
.shell { width: min(1100px, calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 82px; padding-block: 12px;
}
.masthead > .shell {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark, .login-mark {
  position: relative; display: inline-grid; place-items: center;
  flex: none; width: 37px; height: 39px;
  background: var(--wash); color: var(--accent);
  border: 1px solid #637a66; border-radius: 8px 13px 12px 8px;
}
.brand-mark::before, .login-mark::before {
  content: ""; display: block; width: 51%; height: 57%;
  border: 1.5px solid currentColor; border-left-width: 4px; border-radius: 2px 4px 4px 2px;
  box-shadow: inset 0 -2px 0 var(--wash), inset 0 -3px 0 currentColor;
}
.brand-name { font-size: 17px; font-weight: 620; letter-spacing: .055em; }
.head-actions, .actions, .dialog-actions, .print-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
main { min-width: 0; }
main.shell { padding-bottom: clamp(32px, 5vw, 64px); }
.wrap { min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 0; max-width: 100%; min-height: 44px; padding: 8px 15px;
  color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 11px;
  text-decoration: none; text-align: center; line-height: 1.45; font-size: 14px; font-weight: 550;
}
.btn:hover:not(:disabled) { background: var(--raised); text-decoration: none; }
.btn.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 630; }
.btn.primary:hover:not(:disabled) { background: #c5dec4; }
.btn.quiet { color: var(--muted); border-color: transparent; }
.btn.danger { color: var(--danger); border-color: #806156; }
.btn.danger:hover:not(:disabled) { background: #4d3931; }
.panel, .hero {
  min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: clamp(20px, 2.6vw, 32px);
}
.hero { padding: clamp(22px, 3vw, 38px); }
.panel + .panel, .hero + .panel, .hero + .layout, .panel + .layout { margin-top: 16px; }
.profile, .section-head, .print-head, .dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.profile { justify-content: flex-start; gap: 14px; }
.avatar {
  display: grid; place-items: center; flex: 0 0 auto;
  min-width: 54px; min-height: 54px; padding: 4px 8px;
  border-radius: 16px; color: var(--accent); background: var(--wash);
  font-size: 22px; font-weight: 550;
}
.profile > *, .section-head > *, .hero > *, .dialog-head > *, .main-col, .side-col,
.fields > *, .filters > *, .fact-main { min-width: 0; }
.section-head { margin-bottom: 14px; }
.meta, .note, .date, .fact-meta, .pagination-note { color: var(--muted); font-size: 13px; line-height: 1.65; }
.meta, .date { font-variant-numeric: tabular-nums; }
h1 + .meta, h2 + .meta, h3 + .meta { margin-top: 4px; }
.note:not(:first-child), .pagination-note:not(:first-child) { margin-top: 10px; }
.stack { display: grid; align-content: start; gap: 16px; }
.stack > *, .layout > * { min-width: 0; }
.stack > .panel + .panel { margin-top: 0; }
.layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .85fr); align-items: start; gap: 16px; }
.main-col, .side-col { display: grid; align-content: start; gap: 16px; }
.main-col > .panel + .panel, .side-col > .panel + .panel { margin-top: 0; }
.topic-list, .fact-list, .file-list, .handoff-list { padding: 0; margin: 0; list-style: none; }
.topic-card { padding-block: 14px; border-bottom: 1px solid var(--line); }
.topic-card:first-child { padding-top: 0; }
.topic-card:last-child { padding-bottom: 0; border-bottom: 0; }
.topic-card h3 { color: var(--accent); }
.topic-card :is(p, ul):not(:first-child) { margin-block: 4px 0; }
.fact-row, .file-row, .handoff-item {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  gap: 6px 12px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.fact-row > *, .file-row > *, .handoff-item > * { min-width: 0; max-width: 100%; }
.fact-row:last-child, .file-row:last-child, .handoff-item:last-child { border-bottom: 0; }
.fact-main { flex: 1 1 15rem; }
.fact-value { font-size: 16px; font-weight: 580; color: var(--ink); font-variant-numeric: tabular-nums; }
.entry-title { font-weight: 600; }
.badge {
  display: inline-flex; width: fit-content; max-width: 100%; padding: 2px 7px;
  border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 12px;
}
.empty {
  padding: 20px 0 12px; color: var(--muted); font-size: 14px;
}
.empty .btn, .empty .actions { margin-top: 10px; }
.problem, .flash {
  margin-block: 10px; padding: 10px 14px; border-radius: 9px;
  background: var(--wash); color: #e1efe1; font-size: 14px;
}
.problem { border-left: 3px solid var(--amber); background: #494438; color: #f6d8a4; }
.problem:empty, .flash:empty { display: none; }
.fields { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; align-content: start; color: var(--ink); font-size: 14px; }
.field > label, label.field, legend { font-weight: 560; }
.field small, .field .note { font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; padding: 8px 11px;
  border: 1px solid var(--input-line); border-radius: 9px;
  background-color: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.5;
}
textarea { min-height: 94px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--dim); opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
input[type=file] { font-size: 14px; }
input[type=file]::file-selector-button {
  padding: 5px 10px; margin-inline-end: 8px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; color: var(--ink); background: var(--raised);
}
.check { display: flex; align-items: flex-start; gap: 8px; padding-block: 4px; font-size: 14px; }
.check input { flex: 0 0 auto; margin: 4px 0 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.filters .field { flex: 1 1 9rem; }
.filters .actions { align-self: flex-end; }
.dl { display: grid; grid-template-columns: minmax(6em, auto) minmax(0, 1fr); align-items: baseline; gap: 6px 14px; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; }
.source { color: var(--muted); font-size: 14px; }
details { min-width: 0; }
summary { min-height: 44px; padding-block: 9px; color: var(--ink); }
details[open] > summary { color: var(--accent); }
.account { position: relative; }
.account > summary { font-size: 14px; }
.account[open] > :not(summary) { z-index: 2; }
.head-actions .account[open] > :is(div, nav, ul) {
  position: absolute; right: 0; width: min(300px, calc(100vw - 32px));
  padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: 0 10px 30px #1117116e;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; text-align: left; vertical-align: top; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 13px; }
.login { display: grid; place-items: start center; padding-block: clamp(24px, 6vh, 76px); }
.login-card {
  width: min(100%, 460px); padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line); border-radius: 24px; background: var(--surface);
}
.login-card h1 { font-size: 30px; }
.login-mark { width: 52px; height: 57px; margin-bottom: 19px; border-radius: 10px 16px 16px 10px; }
.login-card form { margin-top: 22px; }
.login-card .btn.primary { width: 100%; }
.dialog, dialog {
  width: min(620px, calc(100% - 32px)); max-height: calc(100dvh - 40px);
  min-width: 0; margin: auto; padding: clamp(19px, 3vw, 30px);
  color: var(--ink); background: var(--surface); border: 1px solid #61715f;
  border-radius: 20px; box-shadow: 0 20px 78px #1118; overflow-y: auto;
  overscroll-behavior: contain;
}
dialog::backdrop { background: #111912bd; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { align-items: flex-start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.dialog-body { display: grid; gap: 14px; }
.dialog-actions { justify-content: flex-end; margin-top: 14px; }
.print-tools { margin-bottom: 16px; }
.print-sheet {
  width: min(100%, 800px); min-width: 0; margin: 0 auto;
  padding: clamp(22px, 4vw, 42px); border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface);
}
.print-head { display: grid; justify-content: start; gap: 4px; padding-bottom: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.print-sheet h2 { margin-block: 12px 5px; }
.print-sheet .date { font-variant-numeric: tabular-nums; }
.handoff-brief { padding-block: 6px 10px; border-bottom: 1px solid var(--line); }
.handoff-brief p + p { margin-top: 3px; }
.handoff-item { display: block; padding-block: 10px; }
.handoff-item .section-head { align-items: baseline; margin-bottom: 2px; }
footer { color: var(--muted); font-size: 12px; }

.member-tools { margin-inline-start: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.member-tools .field { flex: 1 1 8em; min-width: 0; }
.member-tools select { max-width: 15em; }
.hero > .actions { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.hero > .btn { margin-top: 16px; }
.filter-panel h2 { margin-bottom: 12px; }
.topic-card .section-head { margin-bottom: 5px; }
.text-link { appearance: none; display: inline-block; max-width: 100%; padding: 4px 0; background: none; color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-align: left; overflow-wrap: anywhere; }
.text-link:hover { text-decoration-thickness: 2px; }
button.fact-row, button.file-row { width: 100%; min-height: 48px; text-align: left; background: transparent; border-radius: 0; }
button.fact-row:hover, button.file-row:hover { background: var(--card); }
.fact-main { display: grid; align-content: start; gap: 2px; }
.fact-main .entry-title { font-size: 14px; color: var(--accent); }
.fact-main .fact-meta { display: block; }
.fact-row .date { margin-inline-start: auto; }
.file-row { align-items: center; }
.file-row .fact-main { flex: 1 1 7rem; }
.file-type { flex: 0 0 auto; min-width: 36px; padding: 5px; border-radius: 7px; background: var(--wash); color: var(--accent); text-align: center; font-size: 12px; font-weight: 620; }
.go-icon { font-size: 18px; }
.dl > div { display: contents; }
.detail-value { font-size: 19px; line-height: 1.6; }
.source { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.revision { border-left: 2px solid var(--line); padding-inline-start: 13px; }
.revision .detail-value { font-size: 15px; }
#flash { position: fixed; z-index: 3; right: var(--gutter); bottom: 18px; max-width: min(34em,calc(100% - var(--gutter) * 2)); margin: 0; box-shadow: 0 8px 32px #1118; }
.manage { padding-block: 8px; }
.manage[open] { padding-bottom: 18px; }
@media (min-width: 561px) {
  .dialog-body .fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .member-tools { flex-basis: 100%; margin-inline-start: 0; }
  .member-tools select { max-width: none; }
  .file-row .fact-main { flex-basis: 5rem; }
  .fact-row .fact-main { flex-basis: 10em; }
}
@media (max-width: 810px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .shell { width: min(100% - var(--gutter) * 2, 720px); }
}
@media (max-width: 560px) {
  :root { --gutter: 14px; }
  .masthead { min-height: 65px; gap: 7px; }
  .masthead > .shell { gap: 7px; }
  .brand { gap: 7px; }
  .brand-mark { width: 30px; height: 33px; border-radius: 7px 9px 9px 7px; }
  .brand-name { font-size: 15px; }
  .head-actions { gap: 3px; justify-content: flex-end; }
  .head-actions .btn { padding-inline: 7px; }
  .panel, .hero { padding: 18px 15px; border-radius: 16px; }
  .layout, .stack, .main-col, .side-col { gap: 12px; }
  .section-head { gap: 8px; }
  .btn { padding: 8px 12px; }
  .fields { gap: 12px; }
  .filters { gap: 7px; }
  .filters .field { flex: 1 1 8rem; }
  .dialog, dialog { width: calc(100% - 18px); max-height: calc(100dvh - 20px); padding: 16px; }
  .login { padding-block: 14px 30px; }
  .login-card { padding: 24px 20px; }
  .fact-row, .file-row { padding-block: 11px; }
}
@media (max-width: 360px) {
  :root { --gutter: 10px; }
  .head-actions .btn { font-size: 13px; }
  .panel, .hero, .print-sheet { padding-inline: 12px; }
  .dl { grid-template-columns: minmax(4em, auto) minmax(0, 1fr); gap: 5px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@page { size: A4 portrait; margin: 14mm; }
@media print {
  :root {
    color-scheme: light; font-size: 10pt; line-height: 1.5;
    --canvas: #fff; --surface: #fff; --card: #fff; --raised: #fff;
    --ink: #16231b; --muted: #37483a; --dim: #37483a;
    --line: #bac4ba; --accent: #1f422a; --wash: #fff;
  }
  html, body { width: 100%; min-height: 0; margin: 0; padding: 0; color: var(--ink); background: #fff; }
  .masthead, .skip, .screen-only, .print-tools, nav, footer, .flash, .dialog, dialog,
  .actions, .btn, form, button, .sr-only { display: none !important; }
  body:has(.print-sheet) main > :not(.print-sheet):not(#handoff):not(:has(.print-sheet)) { display: none !important; }
  main.shell, .shell, .print-sheet, #handoff {
    width: 100%; max-width: none; min-height: 0; margin: 0; padding: 0;
    border: 0; border-radius: 0; box-shadow: none; color: var(--ink); background: #fff;
  }
  .print-head { margin: 0 0 3mm; padding: 0 0 3mm; }
  .print-sheet h1 { font-size: 21pt; }
  .print-sheet h2 { margin: 3mm 0 1mm; font-size: 13pt; }
  .print-sheet h3, .print-sheet .entry-title { font-size: 10.5pt; }
  .print-sheet p, .print-sheet .fact-value, .handoff-item { font-size: 10pt; }
  .print-sheet .source, .print-sheet .meta, .print-sheet .date, .print-sheet .fact-meta,
  .print-sheet .note, .pagination-note { font-size: 9pt; line-height: 1.4; }
  .handoff-item { break-inside: avoid; padding: 1.6mm 0; }
  .print-sheet :is(h1,h2,h3) { break-after: avoid; }
  .print-sheet a { color: #193b25; text-decoration: underline; }
  .print-sheet a::after { content: none; }
}
