:root {
  --ledger-paper: #f2efe7;
  --voucher-sheet: #fffdf8;
  --receipt-inset: #ebe8df;
  --ink: #202721;
  --ink-secondary: #596159;
  --ink-muted: #8a9089;
  --bank-green: #155b43;
  --bank-green-soft: #e0ece5;
  --stamp-red: #a54238;
  --stamp-red-soft: #f5e5e1;
  --amber: #9a681c;
  --amber-soft: #f6ecd7;
  --rule: rgba(32, 39, 33, .12);
  --rule-soft: rgba(32, 39, 33, .07);
  --surface-shadow: 0 0 0 1px rgba(32,39,33,.045), 0 8px 24px rgba(32,39,33,.045);
  --radius-control: 7px;
  --radius-panel: 13px;
  --radius-sheet: 18px;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ledger-paper); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--ledger-paper); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(21,91,67,.18); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { margin: 0 0 7px; color: var(--bank-green); font-size: 9px; font-weight: 750; letter-spacing: .14em; }
.brand-seal { display: grid; width: 38px; height: 38px; place-items: center; flex: 0 0 auto; border-radius: 9px; color: #fff; background: var(--bank-green); font-family: "Songti SC", serif; font-size: 20px; font-weight: 700; }
.button { min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--radius-control); color: var(--ink-secondary); background: transparent; cursor: pointer; transition: color 150ms, background-color 150ms, box-shadow 150ms, transform 120ms; }
.button:hover { color: var(--bank-green); background: var(--voucher-sheet); box-shadow: 0 0 0 1px var(--rule); }
.button:active, .icon-button:active { transform: scale(.97); }
.button.primary { color: #fff; background: var(--bank-green); box-shadow: none; }
.button.primary:hover { background: #0f4a35; }
.button.danger { color: var(--stamp-red); background: var(--stamp-red-soft); }
.button:disabled { color: var(--ink-muted); background: var(--receipt-inset); cursor: not-allowed; box-shadow: none; opacity: .7; }
.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--rule-soft); background: rgba(242,239,231,.94); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 2px; color: var(--ink-muted); font-size: 9px; letter-spacing: .08em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.sync-state, .actor { color: var(--ink-muted); font-size: 10px; }
.actor { padding-left: 12px; border-left: 1px solid var(--rule); color: var(--ink-secondary); }
main { width: min(1760px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 44px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.page-heading h1 { margin: 0; font-family: "Songti SC", serif; font-size: clamp(34px, 4vw, 50px); letter-spacing: -.04em; line-height: 1.05; }
.page-heading > div:first-child > p:last-child { margin: 13px 0 0; color: var(--ink-secondary); font-size: 12px; line-height: 1.65; }
.period-stamp { display: grid; min-width: 170px; padding: 13px 16px; border: 1px solid rgba(165,66,56,.26); border-radius: 9px; color: var(--stamp-red); transform: rotate(-1deg); }
.period-stamp span, .period-stamp small { font-size: 8px; letter-spacing: .1em; }
.period-stamp strong { margin: 3px 0; font-family: "Songti SC", serif; font-size: 17px; }
.summary-rail { display: grid; grid-template-columns: 1.25fr repeat(5, 1fr); margin-top: 28px; overflow: hidden; border-radius: var(--radius-panel); background: var(--voucher-sheet); box-shadow: var(--surface-shadow); }
.summary-rail > div { min-height: 86px; padding: 17px 20px; border-left: 1px solid var(--rule-soft); }
.summary-rail > div:first-child { border-left: 0; }
.summary-rail span, .summary-rail strong { display: block; }
.summary-rail span { color: var(--ink-muted); font-size: 9px; }
.summary-rail strong { margin-top: 8px; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-variant-numeric: tabular-nums; }
.summary-main { color: #fff; background: var(--bank-green); }
.summary-main span { color: rgba(255,255,255,.62); }
.summary-approved strong { color: var(--bank-green); }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; }
.filter-tabs { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 10px; background: rgba(255,253,248,.62); box-shadow: 0 0 0 1px var(--rule-soft); }
.filter-tab { min-height: 36px; padding: 0 13px; border: 0; border-radius: 7px; color: var(--ink-muted); background: transparent; font-size: 10px; cursor: pointer; }
.filter-tab:hover { color: var(--ink); }
.filter-tab.is-active { color: var(--bank-green); background: var(--voucher-sheet); box-shadow: 0 1px 3px rgba(32,39,33,.08); font-weight: 700; }
.search-field input { width: min(320px, 38vw); min-height: 42px; padding: 0 14px; border: 1px solid var(--rule); border-radius: var(--radius-control); color: var(--ink); background: #e9e6dc; }
.search-field input::placeholder { color: var(--ink-muted); }
.workbench { display: grid; grid-template-columns: 310px minmax(560px, 1fr) 300px; align-items: start; gap: 16px; margin-top: 16px; }
.voucher-queue, .voucher-sheet, .issue-drawer { min-height: 680px; border-radius: var(--radius-sheet); background: var(--voucher-sheet); box-shadow: var(--surface-shadow); }
.voucher-queue, .issue-drawer { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow: hidden; }
.voucher-queue > header, .issue-drawer > header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--rule-soft); }
.voucher-queue > header strong, .issue-drawer > header strong { font-size: 12px; }
.voucher-queue > header span, .issue-drawer > header > span { display: grid; min-width: 24px; height: 24px; place-items: center; padding: 0 7px; border-radius: 99px; color: var(--ink-muted); background: var(--receipt-inset); font-size: 9px; font-variant-numeric: tabular-nums; }
.queue-list, .todo-list { max-height: calc(100vh - 166px); overflow-y: auto; overscroll-behavior: contain; }
.queue-item { display: block; width: 100%; padding: 15px 17px; border: 0; border-bottom: 1px solid var(--rule-soft); color: var(--ink); background: transparent; text-align: left; cursor: pointer; transition: background-color 150ms, box-shadow 150ms; }
.queue-item:hover { background: #faf8f2; }
.queue-item.is-selected { position: relative; background: var(--bank-green-soft); box-shadow: inset 3px 0 var(--bank-green); }
.queue-item-top, .queue-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.queue-item-top strong { font-family: Georgia, "Songti SC", serif; font-size: 12px; font-variant-numeric: tabular-nums; }
.queue-item time { color: var(--ink-muted); font-size: 8px; font-variant-numeric: tabular-nums; }
.queue-item p { margin: 8px 0; overflow: hidden; color: var(--ink-secondary); font-size: 10px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-bottom b { font-family: Georgia, serif; font-size: 11px; font-variant-numeric: tabular-nums; }
.queue-item-bottom span { color: var(--stamp-red); font-size: 8px; }
.status-pill { display: inline-flex; min-height: 22px; align-items: center; padding: 0 8px; border-radius: 99px; color: var(--amber); background: var(--amber-soft); font-size: 8px; font-weight: 700; }
.status-pill.approved { color: var(--bank-green); background: var(--bank-green-soft); }
.status-pill.blocked { color: var(--stamp-red); background: var(--stamp-red-soft); }
.loading-state, .empty-side { display: grid; min-height: 180px; place-items: center; padding: 24px; color: var(--ink-muted); font-size: 10px; text-align: center; }
.voucher-sheet { padding: 0 30px 34px; }
.empty-detail { display: grid; min-height: 680px; place-content: center; justify-items: center; color: var(--ink-muted); text-align: center; }
.empty-detail > span { display: grid; width: 62px; height: 62px; place-items: center; border: 1px solid var(--rule); border-radius: 50%; font-family: "Songti SC", serif; font-size: 25px; }
.empty-detail h2 { margin: 18px 0 6px; color: var(--ink); font-family: "Songti SC", serif; font-size: 23px; }
.empty-detail p { margin: 0; font-size: 10px; }
.voucher-head { display: grid; grid-template-columns: 1fr auto; gap: 24px; padding: 28px 0 22px; border-bottom: 1px solid var(--rule); }
.voucher-code { color: var(--bank-green); font-family: Georgia, serif; font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.voucher-head h2 { margin: 7px 0 10px; font-family: "Songti SC", serif; font-size: 28px; letter-spacing: -.03em; line-height: 1.22; text-wrap: balance; }
.voucher-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--ink-muted); font-size: 9px; }
.voucher-actions { display: flex; align-items: flex-start; gap: 7px; }
.balance-rail { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; margin: 18px 0; overflow: hidden; border-radius: 10px; background: var(--receipt-inset); }
.balance-side { padding: 15px 18px; }
.balance-side:last-child { text-align: right; }
.balance-side span, .balance-side strong { display: block; }
.balance-side span { color: var(--ink-muted); font-size: 8px; }
.balance-side strong { margin-top: 5px; font-family: Georgia, serif; font-size: 19px; font-variant-numeric: tabular-nums; }
.balance-seal { display: grid; width: 70px; place-items: center; color: var(--bank-green); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); font-family: "Songti SC", serif; font-size: 12px; font-weight: 700; }
.balance-seal.unbalanced { color: var(--stamp-red); }
.section-block { margin-top: 26px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 11px; }
.section-title h3 { margin: 0; font-family: "Songti SC", serif; font-size: 18px; }
.section-title span, .section-title a { color: var(--ink-muted); font-size: 8px; }
.section-title a { color: var(--bank-green); text-decoration: none; }
.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border-radius: 9px; background: var(--rule-soft); }
.fact { min-height: 70px; padding: 13px 14px; background: #faf8f2; }
.fact span, .fact strong { display: block; }
.fact span { color: var(--ink-muted); font-size: 8px; }
.fact strong { margin-top: 7px; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.entry-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.entry-table th { padding: 9px 7px; border-bottom: 1px solid var(--rule); color: var(--ink-muted); font-size: 8px; font-weight: 600; text-align: left; }
.entry-table td { padding: 12px 7px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.entry-table .money { text-align: right; font-family: Georgia, serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-table .entry-account strong { display: block; font-size: 10px; }
.entry-table .entry-account small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 8px; }
.entry-edit { min-height: 30px; padding: 0 9px; border: 1px solid var(--rule); border-radius: 6px; color: var(--bank-green); background: transparent; font-size: 8px; cursor: pointer; }
.match-list, .attachment-list, .asset-list { display: grid; gap: 8px; }
.match-item, .attachment-item, .asset-item { padding: 13px 14px; border-radius: 9px; background: #faf8f2; box-shadow: inset 0 0 0 1px var(--rule-soft); }
.match-item header, .attachment-item, .asset-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.match-item header strong, .attachment-item strong, .asset-item strong { font-size: 10px; overflow-wrap: anywhere; }
.match-score { color: var(--bank-green); font-family: Georgia, serif; font-size: 12px; }
.match-item p { margin: 8px 0 0; color: var(--ink-secondary); font-size: 9px; line-height: 1.5; }
.match-actions { display: flex; gap: 6px; margin-top: 10px; }
.mini-button { min-height: 30px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink-secondary); background: var(--voucher-sheet); font-size: 8px; cursor: pointer; }
.mini-button.confirm { color: var(--bank-green); }
.mini-button.reject { color: var(--stamp-red); }
.match-confirmed { color: var(--bank-green); font-size: 8px; font-weight: 700; }
.attachment-item span, .asset-item span { color: var(--ink-muted); font-size: 8px; }
.issue-drawer > header .eyebrow { margin-bottom: 3px; }
.todo-list { padding-bottom: 12px; }
.todo-item { margin: 10px; padding: 13px; border-radius: 9px; background: #faf8f2; box-shadow: inset 0 0 0 1px var(--rule-soft); }
.todo-item.blocking { background: var(--stamp-red-soft); box-shadow: inset 0 0 0 1px rgba(165,66,56,.14); }
.todo-item header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.todo-item header strong { font-size: 9px; }
.todo-item header span { color: var(--stamp-red); font-size: 8px; }
.todo-item p { margin: 8px 0 10px; color: var(--ink-secondary); font-size: 9px; line-height: 1.55; }
.todo-item footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.todo-item footer small { color: var(--ink-muted); font-size: 8px; }
.policy-note { margin-top: 18px; padding: 13px 15px; border-radius: 9px; color: var(--stamp-red); background: var(--stamp-red-soft); font-size: 9px; line-height: 1.6; }
.policy-note.success { color: var(--bank-green); background: var(--bank-green-soft); }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 22px 28px; border-top: 1px solid var(--rule-soft); color: var(--ink-muted); font-size: 8px; }
.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-sheet { width: min(440px, 100%); padding: 42px; border-radius: var(--radius-sheet); background: var(--voucher-sheet); box-shadow: var(--surface-shadow); }
.login-sheet .brand-seal { margin-bottom: 30px; }
.login-sheet h1 { margin: 0; font-family: "Songti SC", serif; font-size: 34px; letter-spacing: -.04em; }
.login-sheet > p:last-of-type { margin: 15px 0 26px; color: var(--ink-secondary); font-size: 12px; line-height: 1.7; }
.login-sheet .button { width: 100%; }
.login-sheet small { display: block; margin-top: 13px; color: var(--ink-muted); font-size: 9px; text-align: center; }
.action-dialog { width: min(680px, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--radius-sheet); color: var(--ink); background: var(--voucher-sheet); box-shadow: 0 24px 80px rgba(32,39,33,.18); }
.action-dialog.compact { width: min(480px, calc(100% - 32px)); }
.action-dialog::backdrop { background: rgba(32,39,33,.35); backdrop-filter: blur(3px); }
.action-dialog form { padding: 24px; }
.action-dialog header, .action-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.action-dialog h2 { margin: 0; font-family: "Songti SC", serif; font-size: 23px; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 0; border-radius: 50%; color: var(--ink-muted); background: var(--receipt-inset); font-size: 20px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.form-grid .wide { grid-column: 1 / -1; }
.action-dialog label { display: grid; gap: 7px; color: var(--ink-secondary); font-size: 9px; }
.action-dialog input, .action-dialog select, .action-dialog textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--rule); border-radius: var(--radius-control); color: var(--ink); background: #edeae1; }
.action-dialog textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.action-dialog > form > p { margin: 18px 0; color: var(--ink-secondary); font-size: 11px; line-height: 1.65; }
.action-dialog footer { margin-top: 22px; justify-content: flex-end; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 380px; padding: 12px 16px; border-radius: 8px; color: #fff; background: var(--ink); box-shadow: 0 10px 30px rgba(32,39,33,.2); font-size: 10px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 180ms, transform 180ms; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
@media (max-width: 1280px) {
  .workbench { grid-template-columns: 280px minmax(520px, 1fr); }
  .issue-drawer { position: static; grid-column: 1 / -1; min-height: 0; max-height: none; }
  .issue-drawer .todo-list { display: grid; max-height: none; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}
@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .sync-state, .actor { display: none; }
  main { width: min(100% - 24px, 760px); padding-top: 24px; }
  .page-heading { align-items: flex-start; }
  .period-stamp { display: none; }
  .summary-rail { grid-template-columns: repeat(3, 1fr); }
  .summary-rail > div:nth-child(4) { border-left: 0; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-tabs { overflow-x: auto; }
  .filter-tab { flex: 0 0 auto; }
  .search-field input { width: 100%; }
  .workbench { grid-template-columns: 1fr; }
  .voucher-queue { position: static; min-height: 320px; max-height: 440px; }
  .queue-list { max-height: 378px; }
  .voucher-sheet { min-height: 480px; padding-inline: 18px; }
  .voucher-head { grid-template-columns: 1fr; }
  .voucher-actions { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .brand small, #refresh-button, #logout-button { display: none; }
  .page-heading h1 { font-size: 36px; }
  .summary-rail { grid-template-columns: repeat(2, 1fr); }
  .summary-rail > div:nth-child(odd) { border-left: 0; }
  .summary-rail > div:nth-child(4) { border-left: 1px solid var(--rule-soft); }
  .fact-grid { grid-template-columns: 1fr 1fr; }
  .entry-table { display: block; overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .site-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
