/* 大马办事指南 — 「办事单据」风：米白纸、深蓝墨字、红色「已核对」印章。手机优先、大字、对比 4.5:1 以上 */
:root {
  --paper: #f7f5f0;
  --card: #ffffff;
  --ink: #14213d;
  --ink-2: #33415c;
  --muted: #59647a;
  --line: #d9d4c7;
  --line-2: #b8b2a3;
  --accent: #1f4e8c;
  --accent-soft: #e6edf6;
  --stamp: #b3261e;
  --warn: #7a4a00;
  --warn-soft: #fbf1dc;
  --tip-soft: #eef2ea;
  --radius: 6px;
  --wrap: 1080px;
  --gutter: clamp(16px, 4vw, 40px);
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: #f3d9a4; color: var(--ink); }
a { color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 20; }
.skip:focus { top: 8px; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

.draft-bar { background: var(--stamp); color: #fff; text-align: center; font-weight: 600; font-size: 15px; padding: 8px 16px; }

/* 顶部 */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none; min-height: 44px; }
.brand-mark { width: 26px; height: 26px; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 8px 10px; border-radius: var(--radius); min-height: 44px; display: inline-flex; align-items: center; }
.top nav a:hover { background: var(--accent-soft); }
@media (max-width: 640px) {
  .top .wrap { padding-top: 6px; padding-bottom: 6px; }
  .top nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; margin: 0 -10px; scrollbar-width: none; }
  .top nav a { white-space: nowrap; }
}

/* 标题 */
h1 { font: 700 clamp(28px, 5vw, 44px)/1.25 var(--serif); letter-spacing: 0; margin: 0 0 14px; max-width: 24ch; text-wrap: balance; }
h2 { font: 700 clamp(21px, 2.6vw, 26px)/1.4 var(--serif); margin: 2.2em 0 0.6em; text-wrap: balance; }
h3 { font-size: 18px; line-height: 1.5; margin: 1.6em 0 0.4em; }
.sub { font-size: clamp(17px, 1.8vw, 19px); color: var(--ink-2); margin: 0; max-width: 40em; }

/* 首页 */
.home { padding: clamp(32px, 6vw, 72px) var(--gutter) 48px; }
.home > .sub { margin-bottom: clamp(24px, 4vw, 40px); }
.group { border-top: 2px solid var(--ink); padding-top: 4px; margin-top: clamp(28px, 4vw, 44px); }
.group h2 { margin: 12px 0 4px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); column-gap: 32px; }
.list li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.list li > a { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.list li > a:hover { color: var(--accent); text-decoration: underline; }
.list p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.7; }
.list .when { color: var(--muted); font-size: 13px; }
.list .empty p { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--stamp); border: 1px solid var(--stamp); border-radius: 3px; padding: 0 5px; margin-left: 6px; vertical-align: 2px; line-height: 1.6; }

/* 文章 */
.article { padding: clamp(20px, 4vw, 40px) var(--gutter) 56px; }
.crumb { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.crumb a { color: var(--muted); }
.checked { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.stamp { display: inline-block; color: var(--stamp); border: 2px solid var(--stamp); border-radius: 4px; padding: 1px 8px; font-weight: 700; font-size: 14px; letter-spacing: 0.1em; transform: rotate(-3deg); }

.card { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 28px 0 0; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); }
.card > div { padding: 14px 16px; border-left: 1px dashed var(--line); }
.card > div:first-child { border-left: 0; }
.card dt { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.05em; }
.card dd { margin: 4px 0 0; font-size: 16px; line-height: 1.6; }
.card ul { margin: 0; padding-left: 1.1em; }
@media (max-width: 820px) {
  .card { grid-template-columns: 1fr 1fr; }
  .card > div:nth-child(3) { border-left: 0; }
  .card > div:nth-child(n+3) { border-top: 1px dashed var(--line); }
}
@media (max-width: 460px) {
  .card { grid-template-columns: 1fr; }
  .card > div { border-left: 0; }
  .card > div + div { border-top: 1px dashed var(--line); }
}

.article-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; margin-top: 8px; }
@media (min-width: 980px) {
  .article-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .toc { position: sticky; top: 20px; align-self: start; margin-top: 40px; }
  .article-grid:not(:has(.toc)) { grid-template-columns: minmax(0, 1fr); }
}
.toc p { font-weight: 700; font-size: 14px; margin: 0 0 6px; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2em; font-size: 15px; line-height: 1.6; }
.toc li { margin: 6px 0; }
.toc a { color: var(--ink-2); }
@media (max-width: 979px) { .toc { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-top: 24px; } }

.prose { max-width: 40em; }
.prose p, .prose li { overflow-wrap: anywhere; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.35em 0; }
ol.steps { list-style: none; counter-reset: s; padding-left: 0; }
ol.steps > li { counter-increment: s; position: relative; padding-left: 44px; margin: 14px 0; }
ol.steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 30px; height: 30px; border: 2px solid var(--ink); border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; line-height: 1; font-variant-numeric: tabular-nums; }
code { font-size: 0.92em; background: var(--accent-soft); padding: 1px 5px; border-radius: 3px; }

.note { background: var(--tip-soft); border: 1px solid #c9d4c0; border-radius: var(--radius); padding: 12px 16px; margin: 20px 0; }
.note p { margin: 0.3em 0; }
.note.warn { background: var(--warn-soft); border-color: #e7cf9c; }
.note.warn strong:first-child { color: var(--warn); }
.note.disclose { background: var(--card); border-color: var(--line-2); font-size: 15px; margin-top: 20px; }
.aff-tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; margin-left: 4px; white-space: nowrap; }

.table { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.6; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0ede5; font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }

.calc-box { border: 1px solid var(--line-2); background: var(--card); border-radius: var(--radius); padding: 12px 16px; margin: 28px 0; }
.calc-box p { margin: 0; font-weight: 700; }
.calc-box ul { margin: 4px 0 0; }

.sources { margin-top: 40px; border-top: 2px solid var(--ink); }
.sources h2 { margin-top: 14px; }
.sources ol { padding-left: 1.4em; }
.sources li { margin: 8px 0; }
.host { color: var(--muted); font-size: 13px; }
.hint { font-size: 14px; color: var(--muted); }
.related ul { padding-left: 1.2em; }

/* 页脚 */
.foot { border-top: 1px solid var(--line); margin-top: 24px; padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.foot-note { max-width: 46em; margin: 0 0 12px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot nav a { color: var(--ink-2); min-height: 44px; display: inline-flex; align-items: center; }
.foot-op { margin: 8px 0 0; }
.foot-op a { color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
  .list li > a, .top nav a { transition: background-color 120ms ease-out, color 120ms ease-out; }
}
@media print {
  .top nav, .toc, .foot nav, .draft-bar { display: none; }
  body { background: #fff; }
}
