:root {
  --bg: #f4f6f9; --card: #fff; --line: #dde3ea; --ink: #1c2733; --sub: #5b6b7b;
  --brand: #0f5aa8; --brand-weak: #e8f1fb; --ok: #1a8a4c; --bad: #c23a3a; --warn: #b97a1a;
  --hdr-h: 57px; /* 吸顶栏高度，JS 按实测更新（窄窗口换行会变高） */
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font: 14px/1.6 "Segoe UI", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
header.bar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
header.bar h1 { font-size: 16px; margin: 0; color: var(--brand); }
header.bar .sp { flex: 1; }
#saveState { font-size: 12px; color: var(--sub); }
button { font: inherit; border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 6px 14px; cursor: pointer; }
button:hover { border-color: var(--brand); color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { opacity: .9; color: #fff; }
button:disabled { opacity: .5; cursor: wait; }
.layout { display: flex; align-items: flex-start; max-width: 1420px; margin: 0 auto; padding: 0 20px; }
aside.side { position: sticky; top: calc(var(--hdr-h) + 10px); flex: 0 0 198px; width: 198px; max-height: calc(100vh - var(--hdr-h) - 10px); overflow-y: auto; padding: 14px 10px 20px 0; }
aside.side a { display: block; padding: 7px 12px; margin: 2px 0; font-size: 13px; color: var(--sub); text-decoration: none; border-radius: 6px; border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
aside.side a .no { color: var(--sub); font-weight: 600; margin-right: 5px; font-size: 12px; font-variant-numeric: tabular-nums; }
aside.side a.on .no { color: var(--brand); }
aside.side a:hover { color: var(--brand); background: var(--brand-weak); }
aside.side a.on { color: var(--brand); background: var(--brand-weak); border-left-color: var(--brand); font-weight: 600; }
main { flex: 1; min-width: 0; margin: 0; padding: 8px 0 80px 14px; }
@media (max-width: 980px) {
  .layout { flex-direction: column; }
  aside.side { position: static; width: auto; max-height: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; }
  aside.side a { border-left: none; border: 1px solid var(--line); }
  aside.side a.on { border-color: var(--brand); }
  main { padding: 0 0 60px; }
}
section.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 16px 0; scroll-margin-top: calc(var(--hdr-h) + 12px); }
section.card > h2 { font-size: 15px; margin: 0 0 4px; color: var(--brand); border-bottom: 2px solid var(--brand-weak); padding-bottom: 8px; }
section.card > h2 .no { color: var(--sub); font-weight: 600; margin-right: 6px; }
section.card > h3 { font-size: 13.5px; margin: 18px 0 8px; color: var(--ink); }
.hint { font-size: 12px; color: var(--sub); margin: 2px 0 10px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; }
table.grid th { background: var(--brand-weak); font-weight: 600; white-space: nowrap; }
table.grid td input, table.grid td select { width: 100%; border: none; background: transparent; font: inherit; text-align: center; padding: 2px; }
table.grid td input:focus { outline: 2px solid var(--brand-weak); background: #fff; }
input.err { background: #fdeaea !important; }
label.f { display: inline-flex; flex-items: center; align-items: center; gap: 6px; margin: 4px 14px 4px 0; font-size: 13px; }
label.f > span { color: var(--sub); white-space: nowrap; }
input[type=text], input[type=date], input[type=number], textarea, select { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: #fff; color: var(--ink); }
input[type=number] { width: 110px; }
textarea { width: 100%; min-height: 110px; }
.derived { font-size: 12px; color: var(--sub); }
.badge { display: inline-block; font-size: 11px; border-radius: 4px; padding: 1px 7px; margin-left: 4px; }
.badge.ok { background: #e5f5ec; color: var(--ok); }
.badge.bad { background: #fbe9e9; color: var(--bad); }
.badge.warn { background: #fdf3e2; color: var(--warn); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ops { margin: 6px 0; display: flex; gap: 8px; flex-wrap: wrap; }
#exportPanel { margin-top: 10px; }
#exportPanel .ok { color: var(--ok); }
#exportPanel .bad { color: var(--bad); white-space: pre-wrap; font-family: Consolas, monospace; font-size: 12px; background: #fbe9e9; padding: 8px 10px; border-radius: 6px; max-height: 260px; overflow: auto; }
iframe#rmcFrame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.codes-note { font-size: 12px; color: var(--sub); }
.checkline { margin: 4px 0; font-size: 13px; }
.col2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
@media (max-width: 980px) { .col2 { grid-template-columns: 1fr; } }
footer.note { text-align: center; color: var(--sub); font-size: 12px; padding: 20px; }
