/* 溯源帳本：黑白帳本、等寬數字，只有印章紅一個強調色。紅色只給三件事：相符的印、鍵盤焦點、被選中的那一格。正負數不用顏色，只用正負號。 */
:root {
  --ink: #201B1A; --ink-2: #4A4441; --muted: #6F6864; --rule: #D8D2CC; --rule-2: #EDE8E3; --paper: #FAF9F7; --sheet: #FFFFFF;
  --seal: #A31621; --seal-tint: #F7ECEA;
  --sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  --drawer-w: 460px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.7 var(--sans); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
h1, h2, h3, h4, p, ul, ol, dl, dd, blockquote, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .92em; }
small { font-size: .82em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.muted { color: var(--muted); }
.fine { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ── 頂欄 ── */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding: 12px 20px 10px; border-bottom: 3px double var(--ink); background: var(--paper); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-seal { width: 42px; height: 42px; color: var(--seal); flex: none; transform: rotate(-8deg); }
.brand-seal svg { width: 100%; height: 100%; display: block; }
.brand-text { min-width: 0; }
.brand h1 { font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: .14em; }
.brand p { font-size: 13px; color: var(--muted); line-height: 1.4; }
.keybar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.kstate { font-size: 12.5px; padding: 3px 10px; border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; }
.kstate.ok { border-color: var(--ink); color: var(--ink); font-weight: 700; }
.kinput { display: flex; gap: 6px; min-width: 0; flex: 1 1 240px; max-width: 380px; }
.kinput input { flex: 1; min-width: 0; height: 40px; padding: 6px 10px; border: 1.5px solid var(--ink); border-radius: 2px; background: #fff; font-family: var(--mono); font-size: 13px; }
.keynote { padding: 0 20px; font-size: 13px; }
.keynote.bad { padding: 8px 20px; background: var(--ink); color: #fff; }

.btn { min-height: 40px; padding: 6px 14px; border: 1.5px solid var(--ink); background: #fff; color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; border-radius: 2px; white-space: nowrap; transition: background .12s var(--ease), color .12s var(--ease); }
.btn:hover:not(:disabled) { background: var(--ink); color: #fff; }
.btn.solid { background: var(--ink); color: #fff; }
.btn.solid:hover:not(:disabled) { background: #000; }
.btn.ghost { border-color: #B9B2AC; font-weight: 600; }
.btn.sm { min-height: 32px; padding: 2px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 版面：左邊是帳本的索引標籤，右邊是帳頁 ── */
.shell { display: flex; align-items: flex-start; max-width: 1480px; margin: 0 auto; transition: margin-right .22s var(--ease); }
.tabs { position: sticky; top: 0; flex: none; width: 58px; display: flex; flex-direction: column; gap: 5px; padding: 16px 0 16px 10px; z-index: 6; }
.tabs button { position: relative; writing-mode: vertical-rl; display: flex; align-items: center; gap: 6px; padding: 10px 0; width: 48px; min-height: 96px; border: 1.5px solid var(--ink); border-right: 0; border-radius: 5px 0 0 5px; background: var(--paper); font-weight: 700; font-size: 14px; letter-spacing: .22em; cursor: pointer; line-height: 1.15; }
.tabs button i { font-style: normal; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.tabs button:hover { background: #fff; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; width: 49.5px; }
.tabs button[aria-selected="true"] i { color: #D9D2CC; }
.tabs .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--seal); }
main { flex: 1; min-width: 0; margin: 16px 16px 24px 0; padding: 0 0 20px; background: var(--sheet); border: 1.5px solid var(--ink); min-height: 76vh; }
main:focus { outline: none; }
.page { padding: 18px 28px 6px; }
.modebar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 7px 28px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--rule); background: var(--paper); }
.modebar.demo { background: repeating-linear-gradient(135deg, #fff 0 6px, var(--rule-2) 6px 12px); color: var(--ink); }
.modebar.demo span { background: #fff; padding: 0 6px; }
.modebar.bad { display: block; padding: 12px 28px; }
.modebar .btn { margin-left: 4px; }
.tag-demo, .tag-live { display: inline-block; font-size: 11.5px; font-weight: 700; line-height: 1.5; padding: 0 7px; letter-spacing: .06em; white-space: nowrap; vertical-align: 1px; }
.tag-demo { border: 1px solid var(--ink); background: repeating-linear-gradient(135deg, #fff 0 4px, var(--rule-2) 4px 8px); margin-left: 8px; color: var(--ink); }
.modebar .tag-demo { margin-left: 0; background: var(--ink); color: #fff; }
.tag-live { background: var(--ink); color: #fff; }

.pagehead { max-width: 62em; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .18em; color: var(--muted); }
.pagehead h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.3; font-weight: 800; margin-top: 2px; letter-spacing: .01em; }
.sub { margin-top: 6px; font-size: 14.5px; color: var(--ink-2); }
.sub b { border-bottom: 1px dashed var(--ink); font-weight: 700; }

/* ── 表單 ── */
.subjbox { margin-top: 14px; }
.subjbox > summary { display: none; }
.subject { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 12px 14px; border: 1px solid var(--rule); background: var(--paper); }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.field.grow { flex: 1 1 320px; }
.field.full, .subject .full { flex: 1 1 100%; }
.field.range { flex-direction: row; align-items: center; gap: 6px; }
.field label, .tp-row label, .ctl label { font-size: 12px; color: var(--muted); font-weight: 600; }
select, input[type="text"], textarea { min-height: 40px; padding: 6px 10px; border: 1.5px solid var(--ink); border-radius: 2px; background: #fff; min-width: 0; max-width: 100%; }
select { cursor: pointer; }
select:disabled, input:disabled { border-color: var(--rule); color: var(--muted); background: var(--rule-2); cursor: not-allowed; }
textarea { width: 100%; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; }
.field.range input { width: 6.2em; font-family: var(--mono); }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.form-err { flex: 1 1 100%; background: var(--ink); color: #fff; padding: 8px 12px; font-size: 13.5px; }

/* ── 載入與錯誤 ── */
.loading { display: flex; align-items: center; gap: 10px; padding: 22px 0; color: var(--muted); font-size: 14px; }
.spin { width: 14px; height: 14px; border: 2px solid var(--rule); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.si-error { margin: 14px 0; border: 2px solid var(--ink); padding: 12px 16px; background: #fff; font-size: 14px; max-width: 60em; }
.si-error b { display: block; font-size: 15.5px; }
.si-error ul { margin: 4px 0 0; padding-left: 20px; }
.si-error-trace { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.err-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.si-error-retry { min-height: 40px; padding: 6px 14px; border: 1.5px solid #B9B2AC; background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; border-radius: 2px; margin-top: 10px; }
.err-acts .si-error-retry { margin-top: 0; }
.si-error-retry:disabled { opacity: .5; cursor: not-allowed; }

/* ── 印章 ── */
.stamp { display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans); font-weight: 800; font-size: 12px; line-height: 1; white-space: nowrap; vertical-align: middle; }
.stamp.ok { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--seal); color: var(--seal); transform: rotate(-9deg); }
.stamp.big.ok { width: 58px; height: 58px; font-size: 17px; border-width: 2.5px; letter-spacing: .04em; outline: 1px solid var(--seal); outline-offset: -6px; flex: none; }
.stamp.bad { background: var(--ink); color: #fff; padding: 5px 7px; border-radius: 2px; transform: rotate(-3deg); }
.stamp.bad em { font-style: normal; font-family: var(--mono); font-weight: 400; margin-left: 5px; }
.stamp.big.bad { font-size: 16px; padding: 9px 12px; flex: none; }
.stamp.given, .stamp.na { border: 1px dashed var(--muted); color: var(--muted); padding: 4px 6px; font-weight: 600; font-size: 11.5px; }
.stamp.na { border-style: dotted; }
.stamp.wait { color: var(--muted); }
.stamp.big.given, .stamp.big.na { font-size: 13px; padding: 8px 10px; }
@keyframes thunk { 0% { transform: scale(1.9) rotate(-9deg); opacity: 0; } 70% { transform: scale(.94) rotate(-9deg); opacity: 1; } 100% { transform: scale(1) rotate(-9deg); opacity: 1; } }
.stairs .stamp.big.ok { animation: thunk .34s var(--ease) both; }
.stairs .s2 .stamp.big.ok { animation-delay: .1s; } .stairs .s3 .stamp.big.ok { animation-delay: .2s; } .stairs .s4 .stamp.big.ok { animation-delay: .3s; }

/* ── 可點的數字 ── */
.n { font-family: var(--mono); font-size: inherit; background: none; border: 0; border-bottom: 1px dashed #8E8782; padding: 0 1px; margin: 0; cursor: pointer; color: inherit; line-height: 1.35; border-radius: 0; text-align: inherit; }
.n:hover, .n:focus-visible { background: var(--seal-tint); border-bottom-color: var(--seal); }
.n.bad { background: var(--ink); color: #fff; padding: 0 5px; border-bottom-color: var(--ink); }
.n0 { font-family: var(--mono); }
p .n, li .n { font-family: inherit; font-weight: 700; }

/* ── 帳表 ── */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; margin-top: 8px; }
.lt { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; }
.lt th, .lt td { padding: 7px 8px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; font-weight: 400; }
.lt thead th { font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1.5px solid var(--ink); white-space: nowrap; vertical-align: bottom; }
.lt tbody th { font-weight: 600; }
.lt th small, .lt td small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.lt .r { text-align: right; font-family: var(--mono); white-space: nowrap; }
.lt .c { text-align: center; white-space: nowrap; }
.lt .d { color: var(--ink-2); }
.lt .f { color: var(--ink-2); font-size: 12.5px; min-width: 11em; }
.lt .f2 { color: var(--ink-2); font-size: 12.5px; }
.lt .mob { display: none; }
.lt tr.total > * { border-top: 1.5px solid var(--ink); border-bottom: 3px double var(--ink); font-weight: 700; }
.lt tfoot tr.total > * { background: var(--paper); }
.lt.slim th, .lt.slim td { padding: 6px 7px; }
.pickrow.on > * { background: var(--seal-tint); }
.pickrow.on > th { box-shadow: inset 3px 0 0 var(--seal); }
.rowbtn { font-family: var(--mono); font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; border-bottom: 1px solid var(--ink); }
.rowbtn small { display: inline !important; margin-left: 6px; font-family: var(--sans); border: 1px dotted var(--muted); padding: 0 4px; }
.rowbtn:hover { background: var(--seal-tint); }

/* ── 壹　對帳階梯 ── */
.tamperbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 14px; padding: 8px 12px; background: var(--ink); color: #fff; font-size: 13.5px; }
.tamperbar b { border: 1px solid #fff; padding: 0 8px; }
.tamperbar .btn { min-height: 30px; padding: 0 10px; margin-left: auto; }
.subjrow { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 20px; margin-top: 14px; }
.subjline { font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.subjline b { font-weight: 700; margin-right: 8px; color: var(--ink); }
.subjline .tag-demo { margin: 0 8px 0 0; }
.tally { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; margin-top: 8px; padding: 10px 0; border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--rule); }
.tally-main { display: flex; align-items: baseline; gap: 8px; }
.tally-n { font-family: var(--mono); font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.tally-l { font-size: 14px; font-weight: 700; }
.tally-list { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.tally-list div { display: flex; align-items: baseline; gap: 6px; }
.tally-list dt { font-size: 12.5px; color: var(--muted); }
.tally-list dd { font-family: var(--mono); font-size: 18px; font-weight: 700; }
.tally-list .bad dt { color: var(--ink); font-weight: 800; }
.tally-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tally-meta b { color: var(--ink); font-family: var(--mono); }
.level { margin-top: 4px; font-size: 13px; color: var(--ink-2); max-width: 78em; }
.hero { position: relative; margin-top: 12px; }
.lt.cmp { max-width: 1020px; }
.level b { background: var(--ink); color: #fff; padding: 0 6px; margin-right: 6px; font-weight: 700; }

.stairs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; margin-top: 30px; border-bottom: 3px double var(--ink); }
@media (min-width: 1280px) {
  /* 階梯左上角本來是空的，把核對總數放進去 */
  .hero .tally { position: absolute; top: 0; left: 0; width: 25%; margin: 0; padding: 0 12px 0 0; border: 0; display: block; }
  .hero .tally-list { display: flex; flex-wrap: nowrap; gap: 0 14px; margin-top: 2px; white-space: nowrap; }
  .hero .tally-list dd { font-size: 15px; }
  .hero .tally-list dt { font-size: 12px; }
  .hero .stairs { margin-top: 0; }
}
.step { position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left; background: #fff; border: 1.5px solid var(--ink); border-bottom: 0; padding: 12px 14px 12px; cursor: pointer; min-width: 0; transition: background .12s var(--ease); }
.step + .step { margin-left: -1.5px; }
.step.s1 { min-height: 196px; } .step.s2 { min-height: 228px; } .step.s3 { min-height: 260px; } .step.s4 { min-height: 292px; }
@media (min-width: 1280px) { .step.s1 { min-height: 200px; } .step.s2 { min-height: 238px; } .step.s3 { min-height: 276px; } .step.s4 { min-height: 314px; } }
.step:hover { background: var(--paper); }
.step.on { box-shadow: inset 0 6px 0 var(--ink); background: var(--paper); }
.step-k { font-size: 21px; font-weight: 800; letter-spacing: .08em; line-height: 1.3; }
.step.on .step-k::after { content: "　明細在下面"; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.step-pick { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.step-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 8px; border-bottom: 1px dotted var(--rule); padding: 1px 0; }
.step-row i { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; }
.step-row b { font-family: var(--mono); font-size: 15px; font-weight: 700; white-space: nowrap; margin-left: auto; }
.step.s4 .step-row b { font-size: 17px; }
.step-seal { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 10px; }
.step-seal small { font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.step-riser { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); }
.step-riser::after { content: " ↗"; font-family: var(--mono); }

.stepdetail { padding: 16px 0 6px; }
.dh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.dh h3 { font-size: 18px; font-weight: 800; }
.dh .nav { display: flex; flex-wrap: wrap; gap: 6px; }
.dh4 { font-size: 13.5px; font-weight: 800; margin-top: 16px; letter-spacing: .04em; }
.dp { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; max-width: 68em; }
.dp.rule { border-left: 3px solid var(--ink); padding-left: 10px; color: var(--ink); }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; }
.cols2 > div { min-width: 0; }

.findings { margin-top: 20px; padding-top: 12px; border-top: 1.5px solid var(--ink); }
.findings h3, .tamper h3, .sec h3 { font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.tamper h3 small, .sec h3 small { margin-left: 10px; font-weight: 400; color: var(--muted); letter-spacing: 0; font-size: 13px; }
.findings ul { list-style: none; padding: 0; margin-top: 6px; }
.findings li { position: relative; padding: 6px 0 6px 30px; border-bottom: 1px solid var(--rule-2); font-size: 13.5px; max-width: 78em; }
.findings li::before { position: absolute; left: 0; top: 7px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.findings li.ok::before { content: "符"; border: 1.5px solid var(--seal); color: var(--seal); border-radius: 50%; transform: rotate(-9deg); font-size: 11px; }
.findings li.note::before { content: "註"; border: 1px solid var(--ink); }
.findings li.bad::before { content: "！"; background: var(--ink); color: #fff; }
.tamper { margin-top: 20px; padding: 14px 16px; border: 1.5px dashed var(--ink); background: var(--paper); }
.tp-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-top: 10px; }
.tp-row label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-row input { width: 9em; font-family: var(--mono); }

/* ── 證據抽屜 ── */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w), 100vw); background: #fff; border-left: 2px solid var(--ink); z-index: 30; display: flex; flex-direction: column; transform: translateX(102%); visibility: hidden; transition: transform .22s var(--ease), visibility 0s linear .22s; box-shadow: -18px 0 40px rgba(32, 27, 26, .12); }
.drawer.open { transform: none; visibility: visible; transition: transform .22s var(--ease), visibility 0s; }
.drawer:focus { outline: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 18px; border-bottom: 3px double var(--ink); background: var(--paper); flex: none; }
.drawer-kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .3em; flex: 1; }
.drawer-back, .drawer-close { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1.5px solid var(--ink); border-radius: 2px; cursor: pointer; flex: none; }
.drawer-back svg, .drawer-close svg { width: 18px; height: 18px; }
.drawer-back:hover, .drawer-close:hover { background: var(--ink); color: #fff; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; font-size: 13.5px; }
.drawer-body h3 { font-size: 19px; font-weight: 800; line-height: 1.35; }
.ev-where { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ev-cmp { display: grid; grid-template-columns: 1fr 1fr auto; margin-top: 12px; border: 1.5px solid var(--ink); }
.ev-cmp > div { padding: 8px 10px; min-width: 0; }
.ev-cmp > div + div { border-left: 1px solid var(--ink); }
.ev-cmp > div > span:not(.stamp) { display: block; font-size: 12px; font-weight: 700; }
.ev-cmp > div > span small { margin-left: 6px; font-weight: 400; color: var(--muted); }
.ev-cmp b { display: block; font-family: var(--mono); font-size: 18px; line-height: 1.4; }
.ev-cmp-st { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: var(--paper); min-width: 72px; }
.ev-cmp-st .stamp { margin-top: 2px; }
.ev-note { margin-top: 8px; padding: 6px 10px; border: 1px dashed var(--muted); font-size: 13px; }
.ev-sec { margin-top: 18px; }
.ev-sec > h4, .ev-h4 { font-size: 12px; font-weight: 800; letter-spacing: .16em; padding-bottom: 3px; border-bottom: 1.5px solid var(--ink); margin-bottom: 8px; }
.ev-h4 { margin-top: 18px; }
.ev-sec p + p, .ev-sec p + .calc, .ev-sec .calc + p { margin-top: 6px; }
.calc { font-family: var(--mono); font-size: 12.5px; line-height: 1.75; background: var(--paper); border-left: 3px solid var(--ink); padding: 6px 10px; margin-top: 6px; }
.calc b { font-size: 14px; }
.clause { border-left: 3px double var(--ink); padding: 2px 0 2px 12px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.clause cite { display: block; font-family: var(--mono); font-style: normal; font-size: 11.5px; color: var(--muted); }
.ev-src { display: grid; gap: 3px; font-size: 12.5px; margin-top: 6px; }
.ev-src > div { display: grid; grid-template-columns: 5.2em minmax(0, 1fr); gap: 8px; }
.ev-src dt { color: var(--muted); }
.ev-src dd { min-width: 0; }
.ev-src dd small { display: block; color: var(--muted); }
.ev-src code, .hash { word-break: break-all; }
.ev-how { padding-left: 20px; }
.ev-how li + li { margin-top: 3px; }
.diffbox { margin-top: 12px; border: 2px solid var(--ink); padding: 0 12px 12px; }
.diffbox h4 { margin: 0 -12px; padding: 6px 12px; background: var(--ink); color: #fff; font-size: 15px; font-family: var(--mono); }
.diffbox h4 small { margin-left: 10px; font-family: var(--sans); font-weight: 400; opacity: .8; }
.diffbox-h { margin-top: 10px; font-weight: 800; font-size: 12.5px; letter-spacing: .08em; }
.diffbox ol, .diffbox ul { padding-left: 20px; margin-top: 2px; }
.diffbox .report { margin-top: 6px; font-size: 11.5px; min-height: 0; }
.diffbox .btn { margin-top: 6px; }
.scrim { position: fixed; inset: 0; background: rgba(32, 27, 26, .35); z-index: 25; }

/* ── 各分頁共用的小零件 ── */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--rule); background: var(--paper); }
.ctl input[type="text"] { width: 8em; font-family: var(--mono); }
.ctl .fine { margin: 0; flex: 1 1 260px; }
.sec-h { font-size: 16px; font-weight: 800; letter-spacing: .04em; margin-top: 24px; padding-top: 10px; border-top: 1.5px solid var(--ink); }
.sec-h small { margin-left: 10px; font-weight: 400; color: var(--muted); letter-spacing: 0; font-size: 12.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.in-big { font-family: var(--mono); font-size: 54px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.in-big small { font-size: 22px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.in-cap { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.in-top, .sp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; margin-top: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.in-score, .sp-rate { display: flex; align-items: center; gap: 14px; }
.in-tally { flex: 1 1 320px; }
.in-tally dd { font-size: 15px; }
.badrow > * { background: #F1EEEB; }
.subrow td { font-size: 13px; color: var(--ink-2); border-bottom: 1.5px solid var(--ink); background: var(--paper); }
.tm { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-all; }
.sep { font-style: normal; color: var(--seal); font-weight: 700; padding: 0 1px; }

/* ── 貳　來件驗算 ── */
.ib-entry { margin-top: 14px; border: 1px solid var(--rule); background: var(--paper); padding: 12px 14px; }
.ib-empty { font-size: 14px; margin-bottom: 10px; }
.ib-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; }
.ib-way h3 { font-size: 14.5px; font-weight: 800; }
.ib-way p { font-size: 13px; color: var(--ink-2); margin: 2px 0 8px; }
.ib-line { display: flex; flex-wrap: wrap; gap: 6px; }
.ib-line input { flex: 1 1 180px; font-family: var(--mono); font-size: 13px; }
.ib-more { margin-top: 12px; }
.ib-more > summary { cursor: pointer; font-size: 13px; font-weight: 700; padding: 6px 0; color: var(--ink-2); }
.ib-more .ib-entry { margin-top: 4px; }
.ib-entry.slim { padding: 10px 14px; }
.ib-entry.slim .ib-way p { display: none; }
.ib-entry.slim .ib-way h3 { margin-bottom: 6px; font-size: 13px; }
.ib-card { margin-top: 16px; border: 1.5px solid var(--ink); padding: 14px 18px; background: #fff; box-shadow: 6px 6px 0 var(--rule-2); }
.ib-kicker { font-size: 12px; font-weight: 800; letter-spacing: .2em; color: var(--muted); }
.ib-claim { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 4px; }
.ib-claim span { font-size: 12.5px; color: var(--muted); }
.ib-label { font-size: 18px; font-weight: 800; }
.ib-value { font-family: var(--mono); font-size: 34px; line-height: 1.15; font-weight: 700; border-bottom: 3px double var(--ink); }
.ib-req { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.ib-steps { table-layout: fixed; }
.ib-steps thead th:nth-child(1) { width: 13em; }
.ib-steps thead th:nth-child(3) { width: 5.5em; }
.ib-steps thead th:nth-child(4) { width: 6em; }
.ib-steps th { font-weight: 700; }
.ib-steps td { font-size: 13.5px; }
.ib-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 8px; border: 1.5px solid var(--ink); font-size: 12px; font-weight: 800; }
.ib-steps small { display: inline !important; }
.ib-verdict { margin-top: 12px; padding: 10px 14px; border: 1.5px solid var(--ink); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ib-verdict.bad { background: var(--ink); color: #fff; }
.ib-verdict .btn { margin-left: auto; }
.ib-refuse { margin-top: 16px; }
.ib-raw { margin-top: 10px; font-size: 13px; }
.ib-raw summary, .slip-raw summary, .ib-refuse summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.report { width: 100%; font-family: var(--mono); font-size: 12px; line-height: 1.5; }

/* ── 參　指標重算：方格帳 ── */
.mk { display: inline-block; width: 13px; height: 13px; vertical-align: middle; }
.mk.ok { background: var(--ink); border-radius: 50%; transform: scale(.72); }
.mk.bad { background: #fff; border: 3px solid var(--ink); position: relative; }
.mk.bad::after { content: "×"; position: absolute; inset: -6px 0 0 0; font-size: 12px; font-weight: 800; line-height: 13px; text-align: center; font-style: normal; }
.mk.na { border: 1.5px dotted var(--muted); border-radius: 50%; transform: scale(.72); }
.in-gridwrap { max-height: 520px; overflow: auto; border: 1px solid var(--rule); margin-top: 8px; }
.in-grid { border-collapse: collapse; font-size: 12.5px; }
.in-grid th, .in-grid td { padding: 0; border-bottom: 1px solid var(--rule-2); text-align: center; }
.in-grid thead th { position: sticky; top: 0; background: var(--paper); border-bottom: 1.5px solid var(--ink); z-index: 2; vertical-align: bottom; padding: 6px 0 4px; font-weight: 700; }
.in-grid thead th span { writing-mode: vertical-rl; letter-spacing: .15em; font-size: 12.5px; }
.in-grid .mcol { text-align: left; padding: 0 12px 0 10px; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 1; }
.in-grid thead .mcol { z-index: 3; background: var(--paper); }
.in-grid .ncol { padding: 0 10px; font-family: var(--mono); color: var(--muted); }
.in-grid tr.on > * { background: var(--seal-tint); }
.in-grid tr.on .mcol { box-shadow: inset 3px 0 0 var(--seal); }
.cellbtn { width: 38px; height: 28px; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cellbtn:hover { background: var(--seal-tint); }
.in-detail .in-raw { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.in-detail th { min-width: 8em; }

/* ── 肆　抽查 ── */
.sp-boxes { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0 0; }
.sp-boxes li { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--rule); font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.sp-boxes li.run { border-color: var(--ink); border-style: dashed; color: var(--ink); }
.sp-boxes li.match { border-color: var(--seal); color: var(--seal); border-radius: 50%; transform: rotate(-9deg); font-weight: 700; }
.sp-boxes li.diff { background: var(--ink); border-color: var(--ink); color: #fff; }
.sp-boxes li.err { border-style: dotted; border-color: var(--muted); }

/* ── 伍　資料覆蓋 ── */
.cv-sum { margin-top: 14px; font-size: 14px; }
.cvk { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--ink); }
.cvk.y { background: var(--ink); }
.cv-grid { margin-top: 10px; border-top: 1.5px solid var(--ink); border-bottom: 3px double var(--ink); }
.cv-row { display: grid; grid-template-columns: 148px minmax(0, 1fr) 68px; align-items: center; gap: 0 10px; border-bottom: 1px solid var(--rule-2); min-height: 26px; }
.cv-head { border-bottom: 1.5px solid var(--ink); font-size: 11.5px; color: var(--muted); font-weight: 700; position: sticky; top: 0; background: #fff; z-index: 2; }
.cv-group { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; color: var(--muted); padding: 8px 0 2px; border-bottom: 1px solid var(--rule); }
.cv-lab { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.cv-lab b { font-family: var(--mono); margin-right: 6px; }
.cv-lab small { color: var(--muted); }
.cv-cells { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 0 3px; min-width: 0; }
.cv-y { font-family: var(--mono); text-align: left; white-space: nowrap; overflow: visible; min-width: 0; }
.cv-yr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; min-width: 0; }
.cv-yr i { background: var(--ink); }
.cv-yr i.n { background: #fff; box-shadow: inset 0 0 0 1px var(--rule); }
.cv-yr:hover, .cv-yr:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.cv-first { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; }

/* ── 陸　決策帳 ── */
.bk-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; margin-top: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.bk-sum-main { display: flex; align-items: center; gap: 14px; flex: 1 1 420px; min-width: 0; }
.bk-sum-main p { font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.bk-sum-main b { color: var(--ink); font-size: 16px; }
.bk-sum .tally-list { flex: 1 1 360px; }
.bk-sum .tally-list dd { font-size: 14px; }
.bk-notes { margin-top: 8px; padding-left: 20px; font-size: 13px; }
.bk td { vertical-align: middle; }
.bk-type { display: inline-block; font-size: 11.5px; font-weight: 800; border: 1px solid var(--ink); padding: 0 6px; margin-right: 8px; white-space: nowrap; }
.bk-type.t-intent-withdrawn { background: var(--ink); color: #fff; }
.bk-type.t-note { border-style: dashed; }
.hashbtn { font-size: 12px; white-space: nowrap; }
.stbtn { background: none; border: 0; padding: 2px; cursor: pointer; }
.bk-empty { margin-top: 16px; border: 1.5px dashed var(--ink); padding: 16px 18px; max-width: 60em; }
.bk-empty h3 { font-size: 17px; }
.bk-empty p { margin-top: 6px; font-size: 14px; }
.bk-empty a, .slip a { color: var(--ink); font-weight: 700; }
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; margin-top: 10px; align-items: start; }
.slip { border: 1.5px solid var(--ink); padding: 12px 14px; background: #fff; min-width: 0; }
.slip.off { border-style: dashed; }
.slip.off h4 { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.slip header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; }
.slip h4 { font-size: 15.5px; font-weight: 800; min-width: 0; }
.slip-st { font-size: 12px; font-weight: 800; border: 1.5px solid var(--ink); padding: 0 8px; white-space: nowrap; }
.slip.off .slip-st { background: var(--ink); color: #fff; }
.slip-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 16px; margin-top: 8px; font-size: 13px; }
.slip-dl dt { font-size: 11.5px; color: var(--muted); }
.slip-dl dd { min-width: 0; }
.slip-conds { margin: 8px 0 0; padding-left: 20px; font-size: 13.5px; }
.slip-warn { margin-top: 8px; font-size: 12.5px; border-left: 3px solid var(--ink); padding-left: 10px; }
.slip-warn b { display: block; }
.slip-fixed { margin-top: 8px; font-size: 12.5px; background: var(--paper); padding: 6px 10px; border: 1px dotted var(--muted); }
.slip-raw { margin-top: 6px; font-size: 13px; }
.slip-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; }
.slip-acts .fine { margin: 0; }
.trial-in { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--ink); }
.trial-head { font-size: 13.5px; font-weight: 600; }
.slip:has(.trial-in) { grid-column: 1 / -1; }

/* ── 柒　驗算證明 ── */
#pf-sheet { margin-top: 16px; }
.pf { max-width: 820px; border: 1.5px solid var(--ink); padding: 28px 34px; background: #fff; box-shadow: 8px 8px 0 var(--rule-2); font-size: 13px; line-height: 1.65; }
.pf-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 3px double var(--ink); padding-bottom: 12px; }
.pf-kicker { font-size: 12px; letter-spacing: .2em; color: var(--muted); font-weight: 700; }
.pf h3 { font-size: 30px; font-weight: 800; letter-spacing: .3em; line-height: 1.3; }
.pf-no { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.pf-seal .stamp.big.ok { width: 74px; height: 74px; font-size: 21px; }
.pf-demo { margin-top: 10px; padding: 6px 10px; border: 1px solid var(--ink); background: repeating-linear-gradient(135deg, #fff 0 6px, var(--rule-2) 6px 12px); font-weight: 700; }
.pf-lead { margin-top: 12px; font-size: 14.5px; }
.pf section { margin-top: 16px; }
.pf h4 { font-size: 13px; font-weight: 800; letter-spacing: .1em; border-bottom: 1.5px solid var(--ink); padding-bottom: 2px; margin-bottom: 6px; }
.pf-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pf-t th, .pf-t td { text-align: left; vertical-align: top; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--rule-2); font-weight: 400; }
.pf-t tbody th { width: 7.5em; color: var(--muted); white-space: nowrap; }
.pf-t.grid { margin-top: 6px; }
.pf-t.grid th { color: var(--muted); font-weight: 700; font-size: 11.5px; border-bottom: 1px solid var(--ink); width: auto; }
.pf-t.grid td { font-family: var(--mono); }
.pf-t.grid td:first-child, .pf-t.grid td:nth-child(2) { font-family: var(--sans); }
.pf-t small { display: block; color: var(--muted); font-size: 11px; }
.pf-json { font-size: 11px; word-break: break-all; }
.pf-mark { display: inline-block; font-weight: 800; font-size: 11.5px; padding: 0 6px; border: 1.5px solid var(--seal); color: var(--seal); font-family: var(--sans); }
.pf-mark.diff { background: var(--ink); color: #fff; border-color: var(--ink); }
.pf-mark.given, .pf-mark.na { border: 1px dashed var(--muted); color: var(--muted); font-weight: 600; }
.pf-p { font-size: 12.5px; }
.pf-ul { padding-left: 18px; font-size: 12.5px; }
.pf-foot { margin-top: 18px; padding-top: 8px; border-top: 3px double var(--ink); font-size: 11px; color: var(--muted); }

/* ── 追溯路徑、碼表、引導、骨架 ── */
.ev-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dotted var(--muted); font-size: 12px; }
.ev-trail i { font-style: normal; color: var(--muted); }
.ev-trail b { font-weight: 700; }
.ev-crumb { background: none; border: 0; padding: 0; cursor: pointer; border-bottom: 1px dashed #8E8782; color: var(--ink-2); font-size: 12px; }
.ev-crumb:hover { background: var(--seal-tint); border-bottom-color: var(--seal); }
.ev-clock { margin-top: 22px; padding: 8px 10px; border-top: 3px double var(--ink); font-size: 12.5px; color: var(--ink-2); }
.ev-clock-n { display: inline-block; font-family: var(--mono); font-weight: 700; color: var(--ink); border: 1px solid var(--ink); padding: 0 6px; margin-right: 6px; }
.ev-clock b { color: var(--ink); }
.howto { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 10px; padding: 7px 10px; background: var(--paper); border: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); }
.howto b { color: var(--ink); letter-spacing: .06em; }
.howto .btn { margin-left: auto; }
.stairs.skel { opacity: .55; }
.stairs.skel .step { cursor: default; }
.skel-bar { display: block; height: 12px; margin: 8px 0 2px; background: repeating-linear-gradient(90deg, var(--rule-2) 0 8px, #fff 8px 12px); }
.bk-seen { margin-top: 10px; padding: 8px 12px; border: 1px solid var(--ink); background: var(--paper); font-size: 13.5px; max-width: 78em; }
.bk-seen b { margin-right: 8px; }
.pf-next { margin: 12px 0 0; padding: 0 0 0 20px; font-size: 13px; color: var(--ink-2); max-width: 70em; }
.pf-next b { color: var(--ink); margin-right: 8px; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.linkbtn:hover { background: var(--seal-tint); }

/* ── 日記帳與頁尾 ── */
.journal { margin: 22px 28px 0; border-top: 1.5px solid var(--ink); }
.journal summary { padding: 8px 0; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.journal summary b { margin-right: 10px; color: var(--ink); letter-spacing: .1em; }
.jt { font-size: 12px; }
.jt .path { max-width: 34em; }
.legal { margin: 10px 28px 0; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); line-height: 1.6; }
.si-legal-main { color: var(--ink-2); font-weight: 600; }

/* ── 寬螢幕：抽屜打開時帳頁往左讓，被點的數字不會被蓋住 ── */
@media (min-width: 1280px) {
  body.drawer-open .shell { margin-right: var(--drawer-w); }
  .scrim { display: none; }
  .drawer { box-shadow: none; }
}

/* ── 手機與窄螢幕 ── */
@media (max-width: 899px) {
  .top { padding: 8px 14px 6px; gap: 6px 16px; }
  .top .btn { min-height: 36px; }
  .brand h1 { font-size: 19px; }
  .brand p { font-size: 12px; }
  .brand-seal { width: 36px; height: 36px; }
  .keynote { padding-left: 14px; padding-right: 14px; }
  .shell { display: block; }
  .tabs { flex-direction: row; width: auto; padding: 8px 10px 0; gap: 4px; overflow-x: auto; background: var(--paper); border-bottom: 1.5px solid var(--ink); scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { writing-mode: horizontal-tb; flex-direction: row; width: auto; min-height: 42px; padding: 4px 10px; border: 1.5px solid var(--ink); border-bottom: 0; border-radius: 5px 5px 0 0; letter-spacing: .04em; white-space: nowrap; flex: none; font-size: 13.5px; gap: 4px; }
  .tabs button[aria-selected="true"] { width: auto; }
  .tabs .dot { top: 3px; right: 3px; }
  main { margin: 0; border-left: 0; border-right: 0; border-top: 0; }
  .page { padding: 14px 14px 4px; }
  .modebar { padding: 6px 14px; }
  .journal, .legal { margin-left: 14px; margin-right: 14px; }
  .cols2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 719px) {
  .lt .opt, .lt .f { display: none; }
  .lt .mob { display: block; }
  .lt th, .lt td { padding: 7px 5px; }
  .lt { font-size: 13px; }
  .subjbox > summary { display: block; padding: 9px 12px; border: 1.5px solid var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; background: #fff; }
  .subjbox[open] > summary { border-bottom: 0; background: var(--paper); }
  .stairs { grid-template-columns: minmax(0, 1fr); border-bottom: 0; margin-top: 14px; }
  .step { min-height: 0 !important; border-bottom: 1.5px solid var(--ink); padding: 10px 12px; }
  .step + .step { margin-left: 0; margin-top: -1.5px; }
  .step.s1 { margin-left: 21%; } .step.s2 { margin-left: 14%; } .step.s3 { margin-left: 7%; } .step.s4 { margin-left: 0; }
  .step-riser::after { content: " ↓"; }
  .step-seal { padding-top: 6px; }
  .stamp.big.ok { width: 50px; height: 50px; font-size: 15px; }
  .tally-n { font-size: 28px; }
  .tally-meta { white-space: normal; }
  .tp-row label { flex: 1 1 40%; }
  .tp-row input, .tp-row select { width: 100%; }
  .field.grow { flex-basis: 100%; }
  .drawer { border-left: 0; }
}

@media (max-width: 719px) {
  .lt.legs thead { display: none; }
  .lt.legs tr { display: block; padding: 2px 0 6px; border-bottom: 1.5px solid var(--ink); }
  .lt.legs td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 2px; border-bottom: 1px dotted var(--rule); white-space: normal; }
  .lt.legs td::before { content: attr(data-l); font-family: var(--sans); font-size: 12px; color: var(--muted); text-align: left; flex: none; }
  .lt.legs td small { text-align: right; }
  .howto .btn { margin-left: 0; }
  .in-big { font-size: 44px; }
  .cellbtn { width: 17px; height: 26px; }
  .mk { width: 11px; height: 11px; }
  .in-grid .mcol { padding: 0 6px 0 4px; font-size: 11.5px; }
  .in-grid .ncol { padding: 0 4px; }
  .in-grid thead th span { font-size: 11.5px; }
  .cv-row { grid-template-columns: 56px minmax(0, 1fr); gap: 0 6px; }
  .cv-first { display: none; }
  .cv-lab small { display: none; }
  .cv-cells { gap: 0 2px; }
  .cv-y { visibility: hidden; font-size: 10.5px; }
  .cv-y.k5 { visibility: visible; }
  .cv-yr { display: block; height: 18px; border: 1px solid var(--rule); background: linear-gradient(90deg, var(--ink) calc(var(--f) * 100%), #fff 0); }
  .cv-yr.none { border-color: var(--rule); }
  .cv-yr i { display: none; }
  .ib-value { font-size: 28px; }
  .ib-steps thead th:nth-child(1) { width: 5.6em; }
  .ib-steps thead th:nth-child(3) { width: 3.4em; }
  .ib-steps thead th:nth-child(4) { width: 3.6em; }
  .ib-steps .btn.sm { padding: 2px 5px; }
  .ib-steps .ib-n { display: flex; margin-bottom: 2px; }
  .ib-n { margin-right: 4px; }
  .pf { padding: 16px 14px; box-shadow: none; }
  .pf h3 { font-size: 24px; letter-spacing: .2em; }
  .pf-t tbody th { width: 5.5em; white-space: normal; }
  .slips { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── 列印：只印驗算證明 ── */
.print-root { display: none; }
.print-only { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  html, body { background: #fff; font-size: 10.5pt; }
  /* 直接用瀏覽器列印（Ctrl+P）：印目前這一個分頁的內容，不是白紙。金鑰列、分頁列、抽屜、按鈕、動手腳測試不印 */
  header .keybar, .keynote, .tabs, .drawer, .scrim, .journal, #si-open-bar, .btn, .linkbtn, .rowbtn::after, .tamper, .subjbox, .ib-more, .ib-entry, .slip-acts, .spin, .tp-row, .pf-tools, .skip-link { display: none !important; }
  .shell { display: block !important; }
  main, #main { padding: 0 !important; border: 0 !important; margin: 0 !important; max-width: none !important; }
  .page[hidden] { display: none !important; }
  .print-only { display: block; font-size: 9pt; margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1px solid #000; }
  .print-root { display: none; }
  .tablewrap { overflow: visible !important; }
  .hero .tally { position: static !important; width: auto !important; }
  .stairs { break-inside: avoid; }
  tr, li, .slip, .ib-card, .diffbox { break-inside: avoid; }
  .stale { opacity: 1; }
  /* 按「列印驗算證明」：只印那一張證明 */
  html.print-proof body > *:not(.print-root) { display: none !important; }
  html.print-proof .print-root { display: block; }
  .print-root .pf, .page .pf { max-width: none; border: 0; padding: 0; box-shadow: none; }
  .pf h4 { break-after: avoid; }
  .pf tr, .pf li, .pf-head { break-inside: avoid; }
  .stamp, .pf-mark, .pf-demo, .tag-demo, .tag-live { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 來件驗算：雜湊規則原文、分開看的兩件事、庫存試算被點的那一列 */
.ib-how { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.ib-how > summary { cursor: pointer; font-weight: 700; }
.ib-how p { margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--ink); background: var(--rule-2); overflow-wrap: anywhere; }
.ev-quote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--ink); background: var(--rule-2); font-size: 13px; overflow-wrap: anywhere; }
.ev-quote > small { display: block; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.ib-two { margin: 8px 0 4px; font-size: 13px; }
.ib-two th[scope="row"] { min-width: 9em; }
.ib-two td, .ib-two th { vertical-align: top; }
.diffbox .ib-two, .diffbox .ib-two th, .diffbox .ib-two td { color: inherit; }
.lt tr.hit > th, .lt tr.hit > td { background: var(--rule-2); box-shadow: inset 3px 0 0 var(--seal); }
.lt th[scope="row"] small code { font-size: 11px; overflow-wrap: anywhere; }
@media (max-width: 719px) { .ib-two thead { display: none; } .ib-two tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--rule); } .ib-two th, .ib-two td { display: block; border: 0; padding: 2px 0; } }

/* 來件驗算：說得出原因的不同（格式改版／行情更新／引擎改版）不蓋不符，另用一種章；逐項比的清單 */
.stamp.note { border: 1.5px solid var(--ink); color: var(--ink); background: var(--sheet); padding: 4px 6px; font-size: 11.5px; letter-spacing: .04em; }
.ib-items { margin: 6px 0 4px; padding-left: 22px; }
.ib-items li { margin: 2px 0; }
.ib-concl { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--ink); background: var(--rule-2); }

/* 來件驗算：沒驗到被點的數字時的結論、名稱對不上的提醒、可收合的逐組明細 */
.ib-verdict.warn { border-style: dashed; border-width: 2px; background: var(--rule-2); }
.ib-warn { margin: 6px 0 2px; padding: 6px 10px; border: 1.5px solid var(--ink); background: var(--sheet); font-size: 13px; }
.ev-fold { border-bottom: 1px solid var(--rule); }
.ev-fold > summary { cursor: pointer; padding: 7px 0; font-size: 13px; }
.ev-fold[open] > summary { border-bottom: 1px solid var(--rule); }

.tally-aux { order: 3; flex-basis: 100%; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* 寬螢幕／窄螢幕各一份的表格（欄數不同，表頭與資料各自對齊） */
.only-narrow { display: none; }
@media (max-width: 719px) { .only-wide { display: none; } .only-narrow { display: block; margin-top: 10px; } }
.lt.rt th[scope="row"] { white-space: nowrap; font-family: var(--mono); font-weight: 600; }
.lt.rt th[scope="row"] small { display: inline; margin-left: 6px; color: var(--muted); font-family: var(--sans); font-weight: 400; }
.lt.rt td, .lt.rt th { padding: 4px 6px; font-size: 12.5px; }
.dh4 small { margin-left: 10px; font-weight: 400; font-size: 12px; color: var(--muted); }

/* 表單填錯時，上一次的結果變淡 */
#lg-body.stale { opacity: .4; }
.err-why { margin: 4px 0; font-size: 13px; }
.pf-no2 { margin-top: 2px; font-size: 11px; color: var(--muted); max-width: 46em; }
/* 指標的驗證等級 */
.in-tiers { margin: 10px 0 4px; }
.in-tiers th[scope="row"] small { display: block; font-weight: 400; color: var(--ink-2); max-width: 44em; }
.in-grid thead tr.grp th { font-size: 11px; font-weight: 700; text-align: center; border-bottom: 1px solid var(--ink); border-left: 1px solid var(--rule); padding: 3px 2px; white-space: nowrap; }
.lt.in-detail small.tier { display: inline-block; margin-top: 2px; padding: 0 5px; border: 1px solid var(--muted); font-size: 11px; color: var(--ink-2); }
.lt.in-detail small.tier.t-P { border-color: var(--ink); color: var(--ink); font-weight: 700; }
.mob { display: none; }
@media (max-width: 719px) { .lt small.mob { display: block; } .in-tiers td:nth-child(2) { font-size: 12px; } }
/* 手機分頁列：右邊還有分頁時的提示 */
.tabs-more { display: none; }
@media (max-width: 899px) {
  .tabs-more { display: block; position: sticky; right: 0; flex: none; align-self: stretch; margin-left: auto; padding: 0 10px 0 22px; border: 0; background: linear-gradient(to right, transparent, var(--paper) 30%); color: var(--ink); font: 700 12.5px/1 var(--sans); white-space: nowrap; cursor: pointer; z-index: 2; }
  .tabs-more[hidden] { display: none; }
}

/* 抽屜裡有逐期明細這種多欄表格時，桌機把抽屜放寬；月份底下的標記另起一行 */
@media (min-width: 900px) { .drawer:has(table.rt) { width: min(620px, 96vw); } }
.lt.rt th[scope="row"] small { display: block; margin-left: 0; font-size: 10.5px; }
.lt.rt td, .lt.rt th { padding: 3px 5px; font-size: 12px; }
