:root {
  color-scheme: light;
  --canvas: #f3f5f2;
  --surface: #fcfdfb;
  --surface-quiet: #f6f8f4;
  --ink: #1e2b25;
  --muted: #637168;
  --line: #dce3da;
  --line-strong: #c5d0c3;
  --green: #256447;
  --green-hover: #1b5239;
  --green-soft: #eaf2e8;
  --red: #a34234;
  --red-soft: #fcf0ed;
  --amber: #855b18;
  --amber-soft: #faf4e6;
  --radius: 12px;
  --focus: 0 0 0 3px #c3d9bf;
  --merchant-surface: #20493b;
  --merchant-ink: #f6faf6;
  --merchant-muted: #c8dbd0;
  --merchant-line: #4b7060;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-synthesis: none;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button, select, summary { cursor: pointer; }
input, textarea { caret-color: var(--green); }
input, select, textarea { min-width: 0; }
button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: .5;
}
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: var(--focus);
}
::selection { color: #123b26; background: #cfe3c7; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bcc9ba; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #95aa92; }
* { scrollbar-width: thin; scrollbar-color: #bcc9ba transparent; }
svg { flex-shrink: 0; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h1 { font-size: 26px; line-height: 1.3; letter-spacing: -.025em; font-weight: 650; }
h2 { font-size: 16px; line-height: 1.5; font-weight: 650; }
h3 { font-size: 15px; line-height: 1.5; font-weight: 650; }
a { color: var(--green); text-underline-offset: 3px; }
small { font-size: 12px; }
[hidden], .hidden { display: none !important; }
.muted, .subtle { color: var(--muted); }
.subtle { font-size: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  width: 220px;
  height: 100vh;
  height: 100dvh;
  padding: 30px 16px 22px;
  border-right: 1px solid var(--line);
  background: #eef2eb;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
.sidebar > * { flex-shrink: 0; }
.brand { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 12px; color: var(--ink); text-decoration: none; }
.brand > svg { width: 32px; height: 32px; color: var(--green); }
.brand-name { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.brand-note { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); letter-spacing: .025em; }
.book-control { display: grid; gap: 6px; margin: 22px 12px 0; min-width: 0; }
.book-control label { color: var(--muted); font-size: 12px; }
.book-control select { width: 100%; min-width: 0; height: 38px; padding: 6px 10px; text-overflow: ellipsis; }
.sidebar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 12px 0; }
.sidebar-actions .button { min-width: 0; min-height: 36px; padding: 7px 8px; gap: 4px; font-size: 12px; }
.sidebar-actions .button svg { width: 15px; height: 15px; }
.sidebar-actions [data-action="enable-reserves"] { grid-column: 1 / -1; }
.nav-list { display: grid; gap: 5px; margin-top: 20px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #56655a;
  font-weight: 500;
  text-align: left;
}
.nav-item:hover { color: var(--green); background: #e4ebe0; }
.nav-item[aria-current="page"] { color: #205638; background: #dce8d6; font-weight: 650; }
.nav-item svg { width: 19px; height: 19px; }
.sidebar-foot { margin-top: auto; padding: 24px 12px 0; }
.save-state { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--green); }
.save-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #548d43; }
.save-state.error { color: var(--red); }
.save-state.error::before { background: var(--red); }
.storage-note { margin-top: 8px; font-size: 12px; line-height: 1.8; color: var(--muted); }
.sidebar-foot > .button { margin-top: 14px; }
.main { width: 100%; max-width: 1420px; min-width: 0; margin: 0 auto; padding: 32px 36px 48px; }
.preset-entry-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 16px; }
.preset-entry-notice > div:first-child { min-width: 0; }
.preset-entry-notice p { margin: 4px 0 0; }
.preset-entry-notice .section-actions, .raw-backup-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-title { min-width: 0; }
.page-title > p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; flex-shrink: 0; align-items: center; gap: 12px; }
.date-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.date-chip svg { width: 16px; height: 16px; }
.page { display: grid; gap: 24px; min-width: 0; }
.opening-data > p { margin-bottom: 20px; }
.opening-data dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; max-width: 640px; margin: 0; }
.opening-data dt { color: var(--muted); }
.opening-data dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-heading > div > p, .section-heading > p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.section-actions .subtle { margin-right: 4px; }
.panel, .entry-panel, .wallet-panel, .table-panel, .settings-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel, .entry-panel, .wallet-panel, .settings-card { padding: 24px; }
.panel > p + p { margin-top: 8px; }
.panel > .muted { font-size: 13px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.button:hover:not(:disabled) { border-color: #a9bca5; background: #f1f5ee; }
.button.primary { border-color: var(--green); background: var(--green); color: #fff; }
.button.primary:hover:not(:disabled) { border-color: var(--green-hover); background: var(--green-hover); }
.button.secondary { background: var(--surface-quiet); }
.button.text { min-height: 30px; padding: 4px 6px; border-color: transparent; background: transparent; color: var(--green); }
.button.text:hover:not(:disabled) { border-color: transparent; background: var(--green-soft); }
.button.danger { color: var(--red); border-color: #e5c7bf; }
.button.danger:hover:not(:disabled) { border-color: #d3a89c; background: var(--red-soft); }
.button.text.danger { border-color: transparent; }
.button.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.button svg { width: 17px; height: 17px; }
.button.icon-only { width: 36px; padding: 7px; }

.dashboard-source-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }
.dashboard-source-bar .field { width: min(100%, 280px); }
.dashboard-source-caption { margin-top: 8px; max-width: 80ch; color: var(--muted); font-size: 12px; line-height: 1.8; }
.statement-panel { margin-top: 16px; }
.statement-panel > .section-heading { flex-wrap: wrap; }
.statement-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; margin-top: 20px; }
.statement-grid > div { min-width: 0; }
.statement-grid h3 { margin-bottom: 12px; font-size: 14px; }
.statement-time-note { margin-top: 12px; line-height: 1.8; }
.statement-account-fields { margin-top: 20px; margin-bottom: 16px; }
.statement-grid .game-equation td { white-space: nowrap; }
.statement-grid .game-equation th { font-weight: 400; }
.statement-grid .ledger-table { min-width: 0; table-layout: fixed; }
.statement-grid .ledger-table th, .statement-grid .ledger-table td { padding: 10px 6px; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.statement-grid .ledger-table .numeric { white-space: nowrap; }
@media (max-width: 1050px) { .statement-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; } }
.merchant-board {
  --merchant-ink: #f1f2ed;
  --merchant-muted: #aeb6b2;
  --merchant-line: #74673e;
  --merchant-wheat: #8cda61;
  --merchant-receipt: #59cedb;
  --merchant-buyback: #f2d574;
  --merchant-profit: #ff8b82;
  min-width: 0;
  margin-top: 16px;
  padding: 24px 28px 28px;
  border-radius: var(--radius);
  background: #202128;
  color: var(--merchant-ink);
}
.merchant-board-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 20px; }
.merchant-board-header h2, .merchant-board-header h3 { font-size: 17px; }
.merchant-board-header > p, .merchant-board-header > span { color: var(--merchant-muted); font-size: 12px; }
.merchant-balance-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; margin: 20px 0 24px; padding: 0 0 22px; border-bottom: 1px solid var(--merchant-line); }
.merchant-balance-strip dl { margin: 0; }
.merchant-balance-strip > div, .merchant-balance-strip dl > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; min-width: 0; }
.merchant-balance-strip dt { font-size: 13px; }
.merchant-balance-strip dd { margin: 0; font-size: 26px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.merchant-balance-strip small { margin-left: 5px; color: var(--merchant-muted); font-size: 12px; font-weight: 400; }
.merchant-metrics-group h3 { margin-bottom: 16px; color: var(--merchant-muted); font-size: 13px; font-weight: 500; }
.merchant-metrics-group + .merchant-metrics-group { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--merchant-line); }
.merchant-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
.merchant-metric { min-width: 0; }
.merchant-metric-label { display: block; font-size: 12px; font-weight: 500; line-height: 1.6; }
.merchant-metric strong.money { display: block; margin-top: 11px; font-size: 26px; font-weight: 650; line-height: 1.3; letter-spacing: -.02em; white-space: normal; overflow-wrap: anywhere; }
.merchant-metric .metric-unit { display: block; margin-top: 4px; color: var(--merchant-muted); font-size: 12px; }
.merchant-board .is-wheat { color: var(--merchant-wheat); }
.merchant-board .is-receipt { color: var(--merchant-receipt); }
.merchant-board .is-buyback { color: var(--merchant-buyback); }
.merchant-board .is-profit { color: var(--merchant-profit); }
.merchant-board > .dashboard-source-note { margin-top: 24px; color: var(--merchant-muted); }
.dashboard-wallet-strip { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px 32px; min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.dashboard-wallet-strip > .dashboard-source-caption { grid-column: 1 / -1; margin-top: -12px; }
.dashboard-wallet-heading { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; }
.dashboard-wallet-heading > p, .dashboard-wallet-heading > span { color: var(--muted); font-size: 12px; }
.dashboard-wallets { grid-column: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; min-width: 0; }
.dashboard-wallet { min-width: 0; }
.dashboard-wallet > span, .dashboard-wallet > p, .dashboard-wallet > dt { display: block; color: var(--muted); font-size: 12px; }
.dashboard-wallet > strong { display: block; margin-top: 7px; font-size: 22px; font-weight: 650; line-height: 1.3; letter-spacing: -.02em; white-space: normal; overflow-wrap: anywhere; }
.dashboard-wallet > small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.dashboard-wallet-total { grid-column: 1; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 13px; }
.dashboard-wallet-total > strong { font-size: 22px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.dashboard-remainder { grid-column: 2; grid-row: 3 / span 2; min-width: 0; padding-left: 32px; border-left: 1px solid var(--line); }
.dashboard-remainder h3 { font-size: 13px; }
.dashboard-remainder > div > span { color: var(--muted); font-size: 12px; }
.dashboard-remainder > strong, .dashboard-remainder > div > strong { display: block; margin-top: 7px; font-size: 22px; font-weight: 650; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.dashboard-remainder > p { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.dashboard-remainder > .button { margin-top: 16px; }
.dashboard-remainder .badge, .dashboard-remainder .tag { margin-top: 12px; white-space: normal; }
.dashboard-source-note { grid-column: 1 / -1; max-width: 90ch; color: var(--muted); font-size: 12px; line-height: 1.8; }
.ledger-details { min-width: 0; border-top: 1px solid var(--line); }
.ledger-details > summary { width: fit-content; padding: 16px 0; color: var(--green); font-size: 13px; font-weight: 600; }
.ledger-details[open] > summary { margin-bottom: 4px; }
.ledger-details[open] > :not(summary) { margin-top: 24px; }
.ledger-details > summary > .subtle { margin-left: 8px; font-weight: 400; }
.ledger-details .dashboard-ledger-summary { margin-bottom: 24px; }
@media (max-width: 1050px) {
  .merchant-board { padding: 22px; }
  .merchant-metrics { gap: 16px; }
  .merchant-metric strong.money { font-size: 23px; }
  .dashboard-wallet-strip { gap: 20px 24px; padding: 20px; }
  .dashboard-wallet, .dashboard-wallet-total > strong, .dashboard-remainder > strong { font-size: 20px; }
  .dashboard-remainder { padding-left: 24px; }
}
@media (min-width: 721px) and (max-width: 900px) {
  .merchant-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .merchant-metric:last-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .dashboard-source-bar { align-items: flex-start; gap: 12px; }
  .dashboard-source-bar .field { width: 100%; }
  .dashboard-source-caption { margin-top: 7px; }
  .merchant-board { padding: 20px; }
  .merchant-board-header { align-items: flex-start; }
  .merchant-board-header h2, .merchant-board-header h3 { font-size: 16px; }
  .merchant-balance-strip { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; margin-bottom: 20px; padding-bottom: 20px; }
  .merchant-balance-strip > div, .merchant-balance-strip dl > div { justify-content: space-between; gap: 6px 12px; }
  .merchant-balance-strip dd { font-size: 22px; }
  .merchant-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; }
  .merchant-metric strong.money { margin-top: 8px; font-size: 22px; }
  .merchant-metric:last-child { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid #4f4938; }
  .merchant-metrics-group h3 { margin-bottom: 14px; }
  .merchant-metrics-group + .merchant-metrics-group { margin-top: 20px; padding-top: 20px; }
  .dashboard-wallet-strip { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px; }
  .dashboard-wallets { gap: 16px; }
  .dashboard-wallet > strong, .dashboard-wallet-total > strong, .dashboard-remainder > strong { font-size: 22px; }
  .dashboard-remainder { grid-column: 1; grid-row: auto; padding: 18px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .dashboard-source-note { font-size: 12px; }
  .ledger-details > summary > .subtle { display: block; margin: 5px 0 0; }
}
.overview-summary { display: flex; align-items: center; gap: 40px; padding: 28px 0 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.balance-block { flex: 0 0 31%; min-width: 0; }
.balance-block > .muted { font-size: 13px; }
.balance-number { margin-top: 8px; font-size: clamp(30px, 2.8vw, 40px); line-height: 1.2; font-weight: 650; letter-spacing: -.035em; white-space: nowrap; }
.balance-number small { margin-right: 4px; font-size: 23px; font-weight: 450; }
.balance-sub { margin-top: 9px; color: var(--muted); font-size: 12px; }
.metric-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 1; gap: 24px; padding-left: 32px; border-left: 1px solid var(--line); }
.metric { min-width: 0; }
.metric-label { display: block; color: var(--muted); font-size: 12px; }
.metric-value { display: block; margin-top: 8px; font-size: 22px; font-weight: 650; line-height: 1.35; letter-spacing: -.02em; white-space: nowrap; }
.metric-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.setup-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border: 1px solid #cfdec8; border-radius: 10px; background: #edf4e8; }
.setup-banner p { color: #365736; font-size: 13px; }
.setup-banner p strong { display: block; margin-bottom: 3px; font-size: 14px; color: #254829; }
.setup-banner .button { flex-shrink: 0; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.entry-panel .section-heading, .wallet-panel .section-heading { margin-bottom: 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.span-2, .field.wide { grid-column: 1 / -1; }
.field > label, .field > .field-label { display: block; color: #45554a; font-size: 12px; font-weight: 600; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%;
  height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  line-height: 20px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field textarea { height: 76px; min-height: 76px; resize: vertical; }
.field select { padding-right: 28px; }
.field input[type="checkbox"], .field input[type="radio"] { width: 16px; height: 16px; accent-color: var(--green); }
.field input[type="file"] { height: auto !important; padding: 10px !important; }
.field input[type="file"]::file-selector-button { margin-right: 12px; border: 0; border-radius: 4px; padding: 5px 8px; background: var(--green-soft); color: var(--green); cursor: pointer; }
.field input[readonly] { background: #f1f4ef; color: var(--muted); }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.6; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--red); background: #fffaf8; }
.form-error { margin-top: 14px; padding: 10px 12px; border-radius: 7px; background: var(--red-soft); color: var(--red); font-size: 12px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.live-effect { color: var(--muted); font-size: 12px; }
.live-effect strong { font-weight: 600; color: var(--green); }
.wallet-row { display: flex; align-items: center; gap: 11px; padding: 17px 0; border-top: 1px solid var(--line); }
.wallet-row:first-child { border-top: 0; padding-top: 0; }
.wallet-row:last-child { padding-bottom: 0; }
.wallet-symbol { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 37px; height: 37px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-weight: 700; }
.wallet-symbol.wechat { color: #32713c; background: #e9f2e4; }
.wallet-symbol.alipay { color: #386c81; background: #e9f1f3; }
.wallet-symbol.other { color: #69725c; background: #eef0e6; }
.wallet-symbol svg { width: 21px; height: 21px; }
.wallet-info { flex: 1; min-width: 0; }
.wallet-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.wallet-meta { margin-top: 3px; color: var(--muted); font-size: 12px; }
.wallet-amount { flex-shrink: 0; text-align: right; }
.wallet-amount > .money { font-size: 16px; font-weight: 600; }
.wallet-amount .button { display: block; margin: 2px -6px -3px auto; font-size: 12px; }
.wallet-note { margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }

.table-panel { overflow: hidden; }
.panel.table-panel { padding: 0; }
.table-panel > .section-heading { padding: 20px 24px 0; }
.toolbar { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.toolbar > .section-heading { margin-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(180px, 1.3fr); gap: 12px; align-items: end; }
.filter-grid .field input, .filter-grid .field select { height: 38px; padding-top: 8px; padding-bottom: 8px; font-size: 12px; }
.filter-grid .field > label { font-size: 12px; }
.filter-grid .button { height: 38px; min-height: 38px; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.ledger-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.ledger-table th { height: 40px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-quiet); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 20px; text-align: left; white-space: nowrap; }
.ledger-table td { height: 54px; padding: 12px 16px; border-bottom: 1px solid #e7ece4; vertical-align: middle; }
.ledger-table th:first-child, .ledger-table td:first-child { padding-left: 24px; }
.ledger-table th:last-child, .ledger-table td:last-child { padding-right: 24px; }
.ledger-table tbody tr:last-child td { border-bottom: 0; }
.ledger-table tbody tr:hover { background: #f7faf4; }
.ledger-table tbody tr.voided { color: #808a80; background: #f7f8f5; }
.ledger-table tbody tr.voided .money { color: #808a80; text-decoration: line-through; }
.ledger-table td > .subtle { display: block; margin-top: 3px; font-size: 12px; }
.ledger-table .numeric, .ledger-table .amount, .ledger-table th[data-align="right"], .ledger-table td[data-align="right"] { text-align: right; white-space: nowrap; }
.ledger-table .description { max-width: 250px; overflow-wrap: anywhere; }
.tag, .badge { display: inline-flex; align-items: center; width: fit-content; min-height: 22px; padding: 2px 7px; border-radius: 5px; background: #edf0e9; color: #52604f; font-size: 12px; line-height: 18px; white-space: nowrap; }
.tag.income { color: #35693b; background: #eaf3e6; }
.tag.expense { color: #965242; background: #faeee8; }
.tag.neutral { color: #5c6873; background: #edf0f3; }
.tag.void { color: #737a72; background: #eceee9; }
.tag.excluded { color: var(--amber); background: var(--amber-soft); }
.excluded-row .money { color: var(--muted); }
.excluded-label { color: var(--amber); }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money.positive { color: var(--green); }
.money.negative { color: var(--red); }
.numeric { text-align: right; }
.nowrap { white-space: nowrap; }
.balance-number.negative { color: var(--red); }
.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.ledger-table .note-cell { min-width: 150px; max-width: 260px; white-space: normal; overflow-wrap: anywhere; }
.ledger-table .note-cell > strong { font-size: 12px; font-weight: 600; }
.ledger-table tr.void-row { background: #f7f8f5; color: #7a8278; }
.ledger-table tr.void-row .money { color: #7a8278; text-decoration: line-through; }
.ledger-table tr.void-row:hover { background: #f1f4ee; }
.zone-empty { font-size: 12px; line-height: 1.8; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.row-actions .button { font-size: 12px; }
.more-fields { margin-top: 16px; color: var(--muted); font-size: 12px; }
.more-fields summary { width: fit-content; padding: 4px 0; }
.more-fields summary:hover { color: var(--green); }
.more-fields[open] summary { margin-bottom: 12px; }
.wallet-explanation { display: flex; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.wallet-explanation svg { width: 17px; height: 17px; margin-top: 2px; color: #6d8668; }
.inventory-heading { margin-top: 28px; margin-bottom: 12px !important; }
.filter-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.checkbox-label input { width: 15px; height: 15px; margin: 0; accent-color: var(--green); }
.rules-list { display: grid; gap: 10px; color: var(--muted); font-size: 12px; }
.rules-list strong { color: #445a47; font-weight: 600; }
.section-icon { width: 25px; height: 25px; color: var(--green); }
.backup-meta { font-size: 12px !important; }
.file-button { cursor: pointer; }
.dialog-error { margin: 0 24px 20px; }
.main-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#global-alert { margin-bottom: 20px; }
#filtered-stats { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-quiet); }
#filtered-stats .report-item { padding-top: 16px; padding-bottom: 16px; }
#filtered-stats .report-item > strong, #filtered-stats .report-item > .money { font-size: 20px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 245px; gap: 9px; padding: 36px 20px; text-align: center; }
.empty-state > svg { width: 31px; height: 31px; margin-bottom: 3px; color: #80947b; stroke-width: 1.5; }
.empty-state > h3 { font-size: 14px; }
.empty-state > p { max-width: 360px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.empty-state > .button { margin-top: 7px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 12px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; align-items: center; gap: 10px; }

.report-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.report-item { min-width: 0; padding: 22px 24px; }
.report-item + .report-item { border-left: 1px solid var(--line); }
.report-item > span, .report-item > p:first-child, .report-item > .muted { display: block; color: var(--muted); font-size: 12px; }
.report-item > strong, .report-item > .money { display: block; margin-top: 8px; font-size: 25px; font-weight: 650; letter-spacing: -.025em; }
.report-item > small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.reconcile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.reconcile-grid > .panel > .field-grid { margin-top: 20px; }
.reconcile-grid .form-footer { flex-wrap: wrap; }
.reconcile-result { margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-quiet); }
.reconcile-result > p + p { margin-top: 7px; }
.reconcile-result .money { font-size: 20px; font-weight: 650; }
.reconcile-result > .status-pill { margin-bottom: 10px; }
.reconcile-account { display: grid; gap: 10px; padding: 18px 0; border-top: 1px solid var(--line); }
.reconcile-account:first-child { padding-top: 0; border-top: 0; }
.reconcile-account:last-child { padding-bottom: 0; }
.reconcile-account > .list-row { padding: 0; border-top: 0; }
.reconcile-account > .list-row > .money { padding-top: 1px; font-size: 18px; font-weight: 600; }
.reconcile-account > .section-actions { justify-content: space-between; gap: 10px; }
.reconcile-changed { margin-top: 7px; color: var(--amber); font-size: 12px; line-height: 1.7; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 5px; background: #edf0e9; color: #52604f; font-size: 12px; font-weight: 600; }
.status-pill.ok { background: #e8f2e4; color: #32643a; }
.status-pill.diff { background: #fcf0df; color: #855b18; }
.history-list { margin-top: 16px; }
.list-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.list-row > div { min-width: 0; }
.list-row > div:last-child { flex-shrink: 0; text-align: right; }
.list-row p { font-size: 13px; }
.list-row .muted, .list-row .subtle { display: block; margin-top: 3px; font-size: 12px; }
.list-row .money { font-weight: 600; }

.settings-layout { display: grid; gap: 28px; }
.settings-layout > section > .section-heading { margin-bottom: 16px; }
.account-grid, .zone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-heading > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.card-heading h3 { overflow-wrap: anywhere; }
.settings-card .field-grid { gap: 12px; }
.opening-info { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.opening-info strong { color: var(--ink); font-size: 16px; font-weight: 600; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.backup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
.backup-grid .panel { display: flex; flex-direction: column; gap: 16px; }
.backup-grid .panel > p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.backup-grid .panel > .button, .backup-grid .panel > .card-actions { align-self: flex-start; margin-top: auto; }
.backup-grid .field { margin: 0; }
.callout { display: flex; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-quiet); color: #52604f; font-size: 12px; line-height: 1.8; }
.callout svg { width: 17px; height: 17px; margin-top: 3px; }
.callout.warning, .callout .warning { color: var(--amber); }
.callout.warning { border-color: #e9dbb9; background: var(--amber-soft); }
.callout.success, .callout .success { color: var(--green); }
.callout.success { border-color: #cfdec8; background: #edf4e8; }
.callout strong { font-weight: 650; }
.callout.stacked { display: block; }
.callout.stacked > p + p { margin-top: 8px; }
.callout.stacked > .button { margin-top: 10px; }
.wechat-replace-panel { align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; }
.wechat-replace-panel > div:first-child { flex: 1 1 540px; min-width: 0; overflow-wrap: anywhere; }
.wechat-replace-panel p { margin: 4px 0 0; }
.wechat-replace-panel > .section-actions { flex: 0 1 auto; max-width: 100%; }
.game-match-overview { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin: -4px 0 24px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.game-match-overview p { color: var(--muted); font-size: 12px; }
.game-match-panel { margin-top: 24px; }
.game-wallet-heading { margin-top: 24px; flex-wrap: wrap; }
.game-match-note { margin-top: 18px; }
.game-match-help { margin-top: 16px; max-width: 90ch; line-height: 1.8; }
.game-report-message { padding: 18px 0; margin-top: 18px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }
.game-report-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; margin-top: 24px; padding: 18px 0; border-top: 1px solid var(--line); }
.game-report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 22px; }
.app-dialog .game-report-grid { grid-template-columns: minmax(0, 1fr); }
.game-equation { width: 100%; border-collapse: collapse; font-size: 13px; }
.game-equation th, .game-equation td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.game-equation th { text-align: left; font-weight: 400; padding-right: 16px; }
.game-equation td { text-align: right; white-space: nowrap; }
.game-equation .equation-total th, .game-equation .equation-total td { font-weight: 650; border-top: 1px solid var(--line-strong); }
.game-match-check { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.game-match-check p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.game-match-check > strong { flex-shrink: 0; white-space: nowrap; }
.game-report-account-note { margin-bottom: 10px; }
#view-game-match > .table-panel { margin-top: 24px; }
.game-wallet-history { padding: 16px 24px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .game-report-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
@media (max-width: 720px) {
  .game-match-overview { align-items: flex-start; }
  .game-match-panel > .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .game-wallet-heading { align-items: flex-start; }
  .game-equation { font-size: 12px; }
  .game-match-check { flex-wrap: wrap; gap: 7px; }
}
.tabs { display: inline-flex; max-width: 100%; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #edf1e9; overflow-x: auto; }
.tab { min-height: 32px; padding: 6px 13px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--green); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--green); box-shadow: 0 1px 3px #1e2b2510; }

dialog.app-dialog { width: 620px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); padding: 0; overflow-y: auto; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 70px #1e2b2530; }
dialog.app-dialog::backdrop { background: #17251d66; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 18px; }
.dialog-header .button { margin: -4px -8px -4px 0; }
.dialog-body { padding: 24px; }
.dialog-body > p { margin-bottom: 18px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.dialog-body > .callout { margin-bottom: 20px; }
.dialog-body > .field-grid + .field { margin-top: 16px; }
.new-book-help { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.new-book-preview { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); line-height: 1.8; }
.entry-day { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
.entry-day input { width: 142px; min-width: 0; height: 34px; min-height: 34px; padding: 4px 8px; font-size: 12px; }
.simple-start-line > .import-entry { margin-left: auto; padding: 3px 0; min-height: 28px; }
dialog.app-dialog[data-mode="wechat-import"] { width: 1120px; }
.app-dialog[data-mode="wechat-import"] .dialog-header { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.app-dialog[data-mode="wechat-import"] .dialog-footer { position: sticky; bottom: 0; z-index: 2; }
.wechat-import-intro p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.wechat-import-intro strong { color: var(--ink); font-weight: 600; }
.wechat-import-tools { display: flex; align-items: end; gap: 24px; margin: 20px 0 14px; }
.wechat-import-tools > .field { flex: 0 0 210px; }
.wechat-import-tools > p { max-width: 56ch; margin: 0 0 8px; font-size: 12px; }
.wechat-import-summary { margin-bottom: 14px; font-size: 13px; line-height: 1.8; }
.wechat-import-summary p { margin: 0; }
.wechat-import-table { max-height: 43dvh; border-block: 1px solid var(--line); }
.wechat-import-table table { min-width: 940px; }
.wechat-import-table thead { position: sticky; top: 0; z-index: 1; background: var(--surface-quiet); }
.wechat-import-table td, .wechat-import-table th { padding: 12px 10px; vertical-align: top; }
.wechat-import-table td:first-child { min-width: 120px; }
.wechat-import-table .import-party { min-width: 140px; max-width: 200px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wechat-import-table td:nth-child(4) { min-width: 180px; }
.wechat-import-table td:last-child { min-width: 250px; }
.wechat-import-table select { width: 100%; height: 36px; min-height: 36px; padding: 6px 8px; font-size: 12px; }
.import-reference { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.import-row-status { margin: 6px 0; font-size: 11px; }
.import-original { color: var(--muted); font-size: 12px; }
.import-original dl { display: grid; gap: 4px; margin: 10px 0 0; }
.import-original dt { font-size: 11px; }
.import-original dd { margin: 0 0 6px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.external-row { background: var(--surface-quiet); }
dialog.app-dialog[data-mode="points-backfill"] { width: 900px; }
.app-dialog[data-mode="points-backfill"] .dialog-header { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.app-dialog[data-mode="points-backfill"] .dialog-footer { position: sticky; bottom: 0; z-index: 2; }
.backfill-search-field { max-width: 420px; }
.backfill-tools { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 20px; }
.backfill-tools .backfill-search-field { flex: 1 1 260px; }
.backfill-rate-rule { margin: 8px 0 16px; font-size: 12px; }
.backfill-fill-result { margin-top: 8px; font-size: 12px; }
.points-backfill-summary { margin: 12px 0 16px; font-size: 12px; }
.points-backfill-columns, .points-backfill-row { display: grid; grid-template-columns: minmax(0, 1fr) 125px 132px; align-items: center; gap: 16px; }
.points-backfill-columns { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.points-backfill-columns > span:nth-child(2) { text-align: right; }
.points-backfill-list { max-height: 46dvh; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.points-backfill-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.points-backfill-row:last-child { border-bottom: 0; }
.backfill-record-info { min-width: 0; }
.backfill-record-info > strong { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.backfill-record-info > p { margin-top: 4px; font-size: 12px; }
.backfill-record-note { margin-top: 6px; color: var(--muted); font-size: 11px; }
.backfill-record-note p { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.backfill-cash { text-align: right; font-size: 14px; }
.backfill-point-field input { width: 100%; min-width: 0; }
.backfill-point-hint { margin-top: 6px; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.backfill-point-choices { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.backfill-point-choices .backfill-choice { min-width: 0; min-height: 32px; padding: 4px 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.backfill-search-empty { margin-top: 16px; font-size: 13px; }
@media (max-width: 720px) {
  .wechat-import-tools { display: block; margin: 16px 0 12px; }
  .wechat-import-tools > p { margin: 10px 0 0; }
  .wechat-import-table { max-height: 42dvh; }
  .wechat-import-intro p { font-size: 12px; }
  .points-backfill-columns { display: none; }
  .points-backfill-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 16px 0; }
  .backfill-point-field { grid-column: 1 / -1; }
  .points-backfill-list { max-height: 45dvh; }
}
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-quiet); }
.app-dialog[data-read-only="true"] .dialog-header { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.transaction-detail { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 13px; }
.transaction-detail dt { color: var(--muted); }
.transaction-detail dd { min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.transaction-note { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.transaction-note h3 { margin-bottom: 8px; font-size: 13px; }
.transaction-note p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.7; }
.toast { position: fixed; z-index: 100; bottom: 28px; left: calc(50% + 110px); transform: translateX(-50%); width: max-content; max-width: min(540px, calc(100vw - 40px)); padding: 13px 20px; border-radius: 9px; background: #24432f; color: #fff; box-shadow: 0 8px 25px #17251d26; font-size: 13px; text-align: center; }
.toast.error { background: #873f33; }

@media (min-width: 1700px) {
  .main { padding-top: 40px; }
  .topbar { margin-bottom: 32px; }
  .overview-summary { padding-top: 32px; padding-bottom: 32px; }
}
@media (max-width: 1250px) {
  .main { padding-right: 24px; padding-left: 24px; }
  .overview-summary { gap: 24px; }
  .balance-block { flex-basis: 30%; }
  .metric-strip { gap: 16px; padding-left: 24px; }
  .metric-value { font-size: 20px; }
  .work-grid { grid-template-columns: minmax(0, 1.35fr) minmax(270px, 1fr); gap: 20px; }
  .panel, .entry-panel, .wallet-panel, .settings-card { padding: 20px; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-item { padding: 20px; }
  .report-item > strong, .report-item > .money { font-size: 22px; }
}
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { width: 190px; padding-right: 12px; padding-left: 12px; }
  .brand { padding-right: 8px; padding-left: 8px; gap: 7px; }
  .brand-name { font-size: 16px; }
  .brand > svg { width: 28px; height: 28px; }
  .topbar { align-items: flex-start; gap: 16px; }
  .top-actions { gap: 8px; }
  .date-chip { display: none; }
  .overview-summary { flex-direction: column; align-items: stretch; gap: 22px; padding: 24px 0; }
  .balance-block { flex-basis: auto; }
  .balance-number { font-size: 36px; }
  .metric-strip { padding-top: 20px; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .work-grid { grid-template-columns: minmax(0, 1fr); }
  #walletList, #wallet-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
  .wallet-row:nth-child(2) { border-top: 0; padding-top: 0; }
  .wallet-row:nth-last-child(2) { padding-bottom: 0; }
  .reconcile-grid, .backup-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .report-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-item:nth-child(2n+1) { border-left: 0; }
  .report-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .report-item:nth-child(n+3) { border-top: 1px solid var(--line); }
  .account-grid, .zone-grid { grid-template-columns: minmax(0, 1fr); }
  .toast { left: calc(50% + 95px); }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 20; top: 0; display: block; width: 100%; height: auto; padding: 14px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); background: #eef2eb; overflow: visible; }
  .brand { flex-wrap: nowrap; padding: 0; gap: 9px; }
  .brand > svg { width: 28px; height: 28px; }
  .brand-name { font-size: 16px; }
  .brand-note { margin-top: 1px; font-size: 12px; }
  .book-control { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin: 12px 0 0; }
  .book-control select { height: 34px; min-height: 34px; }
  .sidebar-actions { margin: 12px 0 0; }
  .nav-list { display: flex; gap: 8px; margin: 12px -16px 0; padding: 0 16px 9px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { flex-shrink: 0; justify-content: center; gap: 6px; width: auto; min-height: 37px; padding: 7px 11px; font-size: 12px; }
  .nav-item svg { width: 16px; height: 16px; }
  .sidebar-foot { display: none; }
  .main { padding: 22px 16px 32px; }
  .topbar { align-items: center; gap: 12px; margin-bottom: 22px; }
  h1 { font-size: 23px; }
  .page-title > p { max-width: 250px; margin-top: 5px; font-size: 12px; }
  .top-actions .button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
  .top-actions .button svg { width: 15px; height: 15px; }
  .page { gap: 20px; }
  .overview-summary { gap: 20px; padding: 20px 0; }
  .balance-number { font-size: 36px; }
  .balance-sub { font-size: 12px; }
  .metric-strip { gap: 12px; padding-top: 18px; }
  .metric-label { font-size: 12px; }
  .metric-value { margin-top: 6px; font-size: clamp(17px, 4.5vw, 21px); }
  .metric-hint { font-size: 12px; }
  .setup-banner { align-items: flex-start; gap: 12px; padding: 14px; }
  .setup-banner p { font-size: 12px; }
  .setup-banner p strong { font-size: 12px; }
  .setup-banner .button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
  .panel, .entry-panel, .wallet-panel, .settings-card { padding: 18px; }
  .section-heading { gap: 10px; margin-bottom: 16px; }
  .section-heading h2 { font-size: 15px; }
  .section-actions { gap: 6px; }
  .section-actions .button { font-size: 12px; }
  .work-grid { gap: 20px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .field.span-2, .field.wide { grid-column: auto; }
  .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { font-size: 16px; }
  .field > label, .field > .field-label { font-size: 12px; }
  .field-help { font-size: 12px; }
  .form-footer { align-items: flex-start; gap: 14px; margin-top: 20px; padding-top: 16px; }
  .form-footer > .button { flex-shrink: 0; }
  .live-effect { font-size: 12px; line-height: 1.7; }
  #walletList, #wallet-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wallet-row { padding: 15px 0; }
  .wallet-row:nth-child(2) { border-top: 1px solid var(--line); padding-top: 15px; }
  .wallet-row:nth-last-child(2) { padding-bottom: 15px; }
  .wallet-row:last-child { padding-bottom: 0; }
  .wallet-amount > .money { font-size: 17px; }
  .toolbar { padding: 16px; }
  .table-panel > .section-heading { padding: 16px 16px 0; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .filter-grid .field.wide { grid-column: 1 / -1; }
  .filter-grid .field input, .filter-grid .field select { height: 40px; font-size: 14px; }
  .ledger-table { min-width: 860px; font-size: 12px; }
  .ledger-table th, .ledger-table td { padding-right: 12px; padding-left: 12px; }
  .ledger-table th:first-child, .ledger-table td:first-child { padding-left: 16px; }
  .ledger-table th:last-child, .ledger-table td:last-child { padding-right: 16px; }
  .pagination { flex-wrap: wrap; gap: 10px; padding: 12px 16px; font-size: 12px; }
  .pagination > div { gap: 8px; }
  .pagination .button { min-height: 32px; font-size: 12px; }
  .empty-state { min-height: 220px; padding: 30px 18px; }
  .report-item { padding: 17px 16px; }
  .report-item > strong, .report-item > .money { font-size: 22px; }
  .report-item > span, .report-item > p:first-child, .report-item > .muted { font-size: 12px; }
  .reconcile-result { padding: 14px; }
  .settings-layout { gap: 24px; }
  .card-heading { gap: 8px; }
  .opening-info { flex-wrap: wrap; gap: 6px; }
  .card-actions .button { flex: 1; }
  .callout { padding: 12px; font-size: 12px; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding-right: 10px; padding-left: 10px; }
  dialog.app-dialog { max-height: calc(100dvh - 32px); border-radius: 12px; }
  .dialog-header { padding: 17px 18px; }
  .dialog-header h2 { font-size: 17px; }
  .dialog-body { padding: 18px; }
  .dialog-error { margin: 0 18px 16px; }
  .dialog-footer { padding: 14px 18px; }
  .dialog-footer .button { flex: 1; }
  .toast { bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; padding: 12px 16px; font-size: 12px; }
  .main-footer { display: grid; gap: 5px; margin-top: 26px; font-size: 12px; }
}
@media (max-width: 370px) {
  .main { padding-right: 12px; padding-left: 12px; }
  .topbar { align-items: flex-start; }
  .page-title > p { max-width: 175px; }
  .top-actions .button { padding-right: 8px; padding-left: 8px; }
  .top-actions .button svg { display: none; }
  .metric-value { font-size: 16px; }
  .setup-banner { flex-direction: column; }
  .panel, .entry-panel, .wallet-panel, .settings-card { padding: 16px; }
  .form-footer { flex-direction: column; }
  .form-footer > .button { width: 100%; }
  .report-strip { grid-template-columns: minmax(0, 1fr); }
  .report-item + .report-item { border-top: 1px solid var(--line); border-left: 0; }
  .report-item:last-child:nth-child(odd) { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}
@media print {
  body { background: #fff; }
  .app-shell { display: block; }
  .sidebar, .top-actions, .entry-panel, .toolbar, .row-actions, .pagination, .toast, .card-actions { display: none !important; }
  .main { max-width: none; padding: 0; }
  .page { gap: 18px; }
  .table-scroll { overflow: visible; }
  .ledger-table { min-width: 0; font-size: 12px; }
  .ledger-table th, .ledger-table td { padding: 7px; }
  .panel, .table-panel, .wallet-panel, .settings-card { break-inside: avoid; }
}

/* Daily ledger: one starting point, current balances, and a short entry form. */
.simple-start-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 13px; }
.simple-start-line > p { margin: 0; }
.simple-start-line strong { color: var(--ink); font-weight: 600; }
.simple-start-details { min-width: 0; }
.simple-start-details > summary { width: fit-content; margin-left: auto; color: var(--green); padding: 4px 0; }
.simple-start-details[open] { flex-basis: 100%; }
.simple-start-details dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; max-width: 560px; margin: 10px 0 0 auto; padding: 16px 0; border-top: 1px solid var(--line); }
.simple-start-details dt, .simple-start-details dd { margin: 0; }
.simple-start-details dd { color: var(--ink); text-align: right; }
.simple-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.simple-stat { min-width: 0; padding: 0 24px; }
.simple-stat:first-child { padding-left: 0; }
.simple-stat + .simple-stat { border-left: 1px solid var(--line); }
.simple-stat > span { display: block; color: var(--muted); font-size: 13px; }
.simple-stat > strong { display: block; margin-top: 8px; font-size: clamp(22px, 2.1vw, 28px); font-weight: 650; line-height: 1.3; letter-spacing: -.025em; overflow-wrap: anywhere; }
.simple-stat > small { display: block; margin-top: 6px; color: var(--muted); }
.simple-own-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; }
.simple-own-line > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
.simple-own-line span { color: var(--ink); font-size: 14px; font-weight: 600; }
.simple-own-line strong { font-size: 22px; font-weight: 650; line-height: 1.3; letter-spacing: -.025em; }
.simple-own-line > p { margin: 0; color: var(--muted); font-size: 12px; }
.simple-own-line .own-line-actions { margin-left: auto; gap: 12px; }
.own-current { display: block; margin-bottom: 24px; font-size: 30px; line-height: 1.3; font-weight: 650; letter-spacing: -.025em; overflow-wrap: anywhere; }
.own-funds-panel > .section-heading p { margin-top: 5px; }
.own-breakdown { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; max-width: 680px; margin: 0 0 20px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.own-breakdown dt, .own-breakdown dd { margin: 0; }
.own-breakdown dt { color: var(--muted); }
.own-breakdown dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.own-business-note { margin-top: 10px; }
.own-cash-row:last-child { padding-bottom: 0; }
.own-cash-note { grid-column: 1 / -1; overflow-wrap: anywhere; }
.own-adjust-row { display: grid; gap: 8px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.own-adjust-row:first-child { padding-top: 0; }
.own-adjust-row:last-child { padding-bottom: 0; border-bottom: 0; }
.own-adjust-row .list-row { flex-wrap: wrap; gap: 8px 20px; padding: 0; border: 0; }
.own-adjust-row > .button { justify-self: start; min-height: 36px; }
.own-record-note { overflow-wrap: anywhere; font-size: 13px; }
#view-own-funds .empty-state { min-height: 160px; padding: 24px 16px; }
.own-split-status { margin-bottom: 16px; max-width: 75ch; }
.own-total-details { margin: 0 0 16px; }
.own-total-details > summary, .own-wallet-classification > summary { width: fit-content; padding: 4px 0; color: var(--green); font-size: 13px; }
.own-total-details .own-breakdown { margin-top: 12px; }
.own-wallet-heading { margin-bottom: -8px; }
.own-wallet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.own-wallet-value { display: block; font-size: 26px; font-weight: 650; line-height: 1.3; letter-spacing: -.025em; overflow-wrap: anywhere; }
.own-wallet-status { margin-top: 6px; }
.own-opening-source { margin-top: 20px; }
.own-opening-source > h3 { font-size: 13px; }
.own-opening-source .own-wallet-summary { margin-top: 12px; margin-bottom: 10px; padding-top: 12px; }
#own-source-notice > .button { align-self: flex-start; }
.own-wallet-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; margin: 20px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; }
.own-wallet-summary dt, .own-wallet-summary dd { margin: 0; }
.own-wallet-summary dt { color: var(--muted); }
.own-wallet-summary dd { text-align: right; overflow-wrap: anywhere; }
.own-wallet-classification .own-breakdown { margin: 8px 0 0; padding: 16px 0; font-size: 12px; gap: 10px 16px; }
.own-wallet-cash-heading { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; }
.own-history-wallets { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; }
.own-history-wallets strong { margin-left: 6px; font-weight: 600; }
.own-confirm-total { margin: 18px 0 12px; font-size: 13px; }
.own-confirm-total strong { margin-left: 12px; font-size: 18px; }
.simple-flow { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 28px; color: var(--muted); font-size: 13px; }
.simple-flow > span { white-space: nowrap; }
.simple-flow strong { margin-left: 7px; color: var(--ink); font-weight: 600; }
.simple-check-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: 12px; }
.simple-check-line p { line-height: 1.7; }
.simple-work-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: start; gap: 24px; }
.simple-entry-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.simple-entry-fields > .field.span-2, .simple-entry-fields > .field.wide { grid-column: 1 / -1; }
.simple-entry-fields #tx-amount { height: 48px; font-size: 20px; font-weight: 600; }
.simple-work-grid .entry-panel > .section-heading { margin-bottom: 18px; }
.simple-work-grid .form-footer { align-items: center; margin-top: 20px; }
.simple-work-grid .form-footer .section-actions { flex-shrink: 0; }
.simple-work-grid .more-fields { margin-top: 18px; }
.simple-work-grid .stock-options { padding-top: 14px; margin-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.simple-work-grid .stock-options > summary { width: fit-content; padding: 4px 0; }
.simple-work-grid .stock-options[open] > summary { margin-bottom: 12px; }
.simple-recent-panel > .section-heading { padding: 0; margin-bottom: 6px; }
.simple-recent-panel > .recent-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.recent-heading > h2 { white-space: nowrap; }
.recent-wallet-filter { display: inline-flex; justify-self: start; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-quiet); }
.recent-wallet-filter > button { min-height: 28px; padding: 4px 8px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.recent-wallet-filter > button:hover { color: var(--green); background: var(--green-soft); }
.recent-wallet-filter > button[aria-pressed="true"] { background: var(--green); color: var(--surface); }
.recent-heading > .recent-sort, .recent-heading > .recent-all { justify-self: end; }
.simple-recent-panel > .recent-heading.multi-wallets { grid-template-columns: minmax(0, 1fr) auto auto; }
.recent-heading.multi-wallets > h2 { grid-column: 1; grid-row: 1; }
.recent-heading.multi-wallets > .recent-sort { grid-column: 2; grid-row: 1; }
.recent-heading.multi-wallets > .recent-all { grid-column: 3; grid-row: 1; }
.recent-heading.multi-wallets > .recent-wallet-filter { grid-column: 1 / -1; grid-row: 2; max-width: 100%; flex-wrap: wrap; }
.recent-heading.multi-wallets > .recent-wallet-filter > button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.button.text.recent-sort { border-color: var(--line); background: var(--surface-quiet); gap: 4px; }
.button.text.recent-sort:hover { border-color: var(--line-strong); background: var(--green-soft); }
@media (max-width: 1250px) {
  .simple-recent-panel > .recent-heading { grid-template-columns: minmax(0, 1fr) auto; }
  .recent-heading > h2 { grid-column: 1; grid-row: 1; }
  .recent-heading > .recent-all { grid-column: 2; grid-row: 1; }
  .recent-heading > .recent-wallet-filter { grid-column: 1; grid-row: 2; }
  .recent-heading > .recent-sort { grid-column: 2; grid-row: 2; }
}
.simple-recent-list { min-width: 0; }
.simple-recent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.simple-recent-row:last-child { padding-bottom: 0; border-bottom: 0; }
.simple-recent-row > div { min-width: 0; }
.simple-recent-row > div > strong { font-size: 13px; font-weight: 600; }
.record-open { display: block; min-width: 0; min-height: 32px; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; }
.record-open > strong { font-size: 13px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.record-open:hover > strong { color: var(--green); text-decoration-color: currentColor; }
.simple-recent-row small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.simple-recent-row > strong { font-size: 15px; font-weight: 600; white-space: nowrap; }
.simple-recent-row .button { min-height: 32px; }
.simple-recent-list > .empty-state { min-height: 180px; padding: 32px 0; }
.recent-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; }
.recent-pagination .section-actions { gap: 8px; }
.recent-pagination #recent-page-info { white-space: nowrap; }
.nav-more { min-width: 0; }
.nav-more > summary { min-height: 44px; padding: 10px 12px; border-radius: 8px; color: #56655a; font-weight: 500; list-style-position: inside; }
.nav-more > summary:hover { color: var(--green); background: #e4ebe0; }
.nav-more[open] > summary { margin-bottom: 4px; }
.nav-more .nav-item { padding-left: 30px; }

@media (max-width: 1050px) {
  .simple-stat { padding-right: 16px; padding-left: 16px; }
  .simple-stat > strong { font-size: 22px; }
  .simple-work-grid { gap: 20px; }
}
@media (max-width: 900px) {
  .simple-work-grid { grid-template-columns: minmax(0, 1fr); }
  .own-wallet-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .simple-start-line { gap: 6px 16px; font-size: 12px; }
  .simple-start-details dl { margin-top: 8px; padding: 12px 0; gap: 8px 16px; }
  .simple-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .simple-stat { padding: 18px 0 18px 18px; }
  .simple-stat:nth-child(odd) { padding-left: 0; border-left: 0; }
  .simple-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .simple-stat > span { font-size: 12px; }
  .simple-stat > strong { margin-top: 6px; font-size: clamp(22px, 6vw, 26px); }
  .simple-stat > small { margin-top: 4px; }
  .simple-flow { gap: 7px 20px; font-size: 12px; }
  .simple-own-line .own-line-actions { margin-left: 0; }
  .own-current { font-size: 26px; }
  .own-breakdown { gap: 12px 16px; font-size: 13px; }
  .simple-flow strong { margin-left: 5px; }
  .simple-entry-fields { gap: 14px 12px; }
  .simple-work-grid .form-footer { align-items: flex-start; }
  .simple-recent-row { gap: 8px; padding: 14px 0; }
  .simple-recent-row > strong { font-size: 14px; }
  .nav-more { flex-shrink: 0; }
  .nav-more > summary { min-height: 37px; padding: 7px 11px; font-size: 12px; }
  .nav-more .nav-item { padding: 7px 11px; }
  .nav-more[open] > summary { margin-bottom: 6px; }
}
@media print {
  .simple-check-line .button, .nav-more { display: none !important; }
  .simple-work-grid { display: block; }
}

/* The daily view keeps wallet cash, personal funds and game cash on one page. */
body[data-page="overview"] .main { padding-top: 22px; padding-bottom: 24px; }
body[data-page="overview"] .topbar { display: none; }
#view-overview { gap: 12px; }
#view-overview .simple-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 16px 0; }
#view-overview .simple-stat { padding: 0 20px; border-top: 0; }
#view-overview .simple-stat:first-child { padding-left: 0; border-left: 0; }
#view-overview .simple-stat + .simple-stat { border-left: 1px solid var(--line); }
#view-overview .simple-stat > strong { margin-top: 5px; font-size: 27px; }
#view-overview .simple-stat > small { margin-top: 4px; }
.overview-stat-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; min-height: 32px; }
.overview-stat-heading > span { color: var(--ink); font-size: 14px; font-weight: 600; }
.overview-stat-heading .button { padding-right: 0; padding-left: 6px; }
.overview-total-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }
.overview-total-line > span { color: var(--muted); font-size: 13px; }
.overview-total-line > strong { font-size: 19px; font-weight: 650; line-height: 1.4; }
.overview-source { min-height: 38px; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.overview-personal-flow { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.overview-total .overview-personal-flow { margin-top: 10px; }
.overview-flow-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.overview-trade-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 24px; }
.overview-trade-summary > div { min-width: 0; }
.trade-points-line { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-height: 21px; font-size: 13px; }
.trade-points-line > strong { font-size: 14px; font-weight: 650; }
.trade-missing { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 4px; border: 0; border-radius: 3px; background: transparent; color: var(--amber); font-size: 12px; line-height: 1.3; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.trade-missing:hover { background: #f6edda; color: #73480e; }
.trade-missing:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.trade-missing:disabled { text-decoration: none; cursor: default; }
.overview-trade-summary p { margin: 0; color: var(--muted); font-size: 12px; }
.overview-trade-summary p > strong { margin-left: 5px; color: var(--ink); font-weight: 600; }
.overview-review { margin: 0; color: var(--amber); }
#view-overview .simple-work-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 20px; }
#view-overview .panel { padding: 16px 18px; }
#view-overview .entry-panel > .section-heading { margin-bottom: 12px; }
#view-overview .entry-panel { container: ledger-entry / inline-size; }
#view-overview .simple-entry-fields { gap: 12px; }
#view-overview .simple-entry-fields input, #view-overview .simple-entry-fields select { height: 40px; }
#view-overview .simple-entry-fields #tx-amount { height: 42px; }
#view-overview .entry-reserve-action { align-self: flex-start; min-height: 30px; padding: 2px 0; font-size: 12px; }
.sale-conversion-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; min-height: 24px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.sale-conversion-row .button { padding: 3px 0; min-height: 24px; flex-shrink: 0; }
.trade-conversion-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.trade-point-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.trade-point-choices .button { min-height: 36px; font-variant-numeric: tabular-nums; }
#view-overview .simple-entry-fields.sale-entry > #amount-field { grid-column: auto; }
#view-overview .simple-work-grid .more-fields { margin-top: 12px; }
#view-overview .tx-excluded-control { display: flex; width: fit-content; min-height: 32px; margin-top: 8px; }
#view-overview .tx-excluded-control input { accent-color: var(--amber); }
#view-overview .tx-excluded-control + .more-fields { margin-top: 4px; }
#view-overview .simple-work-grid .form-footer { margin-top: 12px; padding-top: 12px; }
#view-overview .simple-recent-row { padding-top: 8px; padding-bottom: 8px; }
#view-overview .simple-recent-row:last-child { padding-bottom: 0; }
@media (min-width: 1200px) {
  #view-overview .simple-recent-row > div, #view-overview .simple-recent-row > .record-open { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; }
  #view-overview .simple-recent-row small { margin-top: 0; }
}
@media screen and (min-width: 1051px) {
  body[data-page="overview"] .main-footer { display: none; }
  body[data-pending-classification="true"] #view-overview { row-gap: 10px; }
}
@media (max-width: 1050px) and (min-width: 721px) {
  #view-overview .simple-stat { padding-right: 14px; padding-left: 14px; }
  #view-overview .simple-stat > strong { font-size: 24px; }
  .overview-total-line > strong { font-size: 17px; }
}
@media (max-width: 900px) {
  #view-overview .simple-work-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  #view-overview { gap: 18px; }
  #view-overview .simple-summary { grid-template-columns: minmax(0, 1fr); padding: 0; }
  #view-overview .simple-stat { padding: 16px 0; }
  #view-overview .simple-stat + .simple-stat { border-top: 1px solid var(--line); border-left: 0; }
  #view-overview .simple-stat > strong { font-size: 26px; }
  .overview-source { min-height: 0; }
  .overview-total-line > strong { font-size: 20px; }
  .overview-flow-line { gap: 12px; }
}

.funds-summary { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 12px; }
.funds-group { min-width: 0; }
.funds-summary > .funds-group, .personal-flow-summary { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.funds-summary > .merchant-funds { grid-column: span 8; grid-row: span 2; display: flex; flex-direction: column; justify-content: space-between; padding: 20px 24px; border-color: var(--merchant-surface); color: var(--merchant-ink); background: var(--merchant-surface); }
.funds-summary > .own-funds { grid-column: span 4; padding: 12px 16px; }
.personal-flow-summary { grid-column: span 4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.personal-flow-summary > .funds-group { padding: 10px 14px; }
.personal-flow-summary > .funds-group + .funds-group { border-left: 1px solid var(--line); }
.funds-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 6px; min-height: 28px; }
.funds-heading > h2 { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.funds-heading svg { width: 19px; height: 19px; }
.funds-heading > .button { min-height: 28px; padding: 2px 0 2px 4px; font-size: 11px; }
.merchant-funds .funds-heading svg { color: var(--merchant-muted); }
.personal-income .funds-heading svg { color: var(--green); }
.personal-spending .funds-heading svg { color: var(--red); }
.personal-flow-summary .funds-heading > h2 { gap: 5px; font-size: 12px; }
.personal-flow-summary .funds-heading svg { width: 16px; height: 16px; }
.funds-value { display: block; margin-top: 2px; font-size: 23px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; }
.funds-wallets { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; margin: 6px 0 0; font-size: 12px; }
.funds-wallets dt, .funds-wallets dd { margin: 0; }
.funds-wallets dt { color: var(--muted); }
.funds-wallets dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.funds-note { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.merchant-balance-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: center; gap: 16px 28px; margin: 8px 0 20px; }
.merchant-funds .funds-value { margin: 0; font-size: 46px; line-height: 1.15; letter-spacing: -.025em; }
.merchant-funds .funds-note, .merchant-funds .funds-wallets dt { color: var(--merchant-muted); }
.merchant-funds .funds-wallets { margin: 0; gap: 8px 16px; font-size: 13px; }
.merchant-funds .funds-wallets dd { font-size: 15px; font-weight: 550; }
.merchant-funds .overview-trade-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 20px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--merchant-line); }
.merchant-funds .trade-points-line { gap: 2px 6px; }
.merchant-funds .trade-points-line > span { flex-basis: 100%; color: var(--merchant-muted); font-size: 12px; }
.merchant-funds .trade-points-line > strong { font-size: 20px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.merchant-funds .overview-trade-summary p { margin-top: 3px; color: var(--merchant-muted); font-size: 11px; }
.merchant-funds .overview-trade-summary p > strong { color: var(--merchant-ink); font-size: 12px; font-weight: 500; }
.merchant-funds .trade-missing { color: #f3dc9c; }
.merchant-funds .trade-missing:hover { color: #fff1bd; background: #365d4d; }
.merchant-funds .trade-missing:focus-visible { outline-color: var(--merchant-ink); }
.own-balance-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; margin-top: 4px; }
.own-balance-row .funds-value, .own-balance-row .funds-wallets { margin: 0; }
.own-balance-row .funds-value { font-size: 24px; }
.funds-source-details { margin-top: 7px; color: var(--muted); font-size: 11px; }
.funds-source-details > summary { width: fit-content; padding: 2px 0; }
.funds-source-details .funds-note { margin-top: 6px; }
.personal-flow-summary .funds-value { font-size: 22px; }
.overview-ledger-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.overview-ledger-totals > div { min-width: 0; padding: 8px 18px 12px; }
.overview-ledger-totals > div + div { border-left: 1px solid var(--line); }
.overview-ledger-totals .overview-stat-heading { min-height: 28px; }
.overview-ledger-totals .overview-stat-heading > span { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 400; color: var(--muted); }
.overview-ledger-totals .overview-stat-heading svg { width: 15px; height: 15px; }
.overview-ledger-totals .overview-stat-heading > .button { min-height: 28px; font-size: 11px; }
.overview-ledger-totals > div > strong { display: block; font-size: 22px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.overview-ledger-totals > .wallet-total-module { display: flex; flex-direction: column; justify-content: center; }
.ledger-combined { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.ledger-combined dt { color: var(--muted); font-size: 11px; }
.ledger-combined dd { margin: 4px 0 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.overview-cash-notes { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; margin-top: -6px; color: var(--muted); font-size: 11px; }
.wallet-breakdown > summary { width: fit-content; min-height: 28px; color: var(--green); font-size: 12px; }
.wallet-breakdown-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.wallet-breakdown-item { min-width: 0; padding: 10px 16px; }
.wallet-breakdown-item + .wallet-breakdown-item { border-left: 1px solid var(--line); }
.wallet-breakdown-item .list-row { gap: 4px; font-size: 13px; }
.wallet-breakdown-item .button { padding-right: 0; }
.wallet-breakdown-cash { display: block; font-size: 20px; font-weight: 600; }
@media (max-width: 720px) {
  .wallet-breakdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallet-breakdown-item:nth-child(odd) { border-left: 0; }
  .wallet-breakdown-item:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.overview-fund-extra { margin: 0; }
.overview-fund-extra > span + span { margin-left: 24px; }
#view-overview .simple-work-grid { gap: 16px; }
#entry-panel { scroll-margin-top: 20px; }
body[data-page="overview"] .page-title > p { font-size: 12px; }
@media (min-width: 901px) {
  #view-overview .simple-recent-row { padding-top: 7px; padding-bottom: 7px; }
  #view-overview .simple-recent-row:last-child { padding-bottom: 0; }
  #view-overview .simple-recent-row > .record-open { display: block; }
  #view-overview .record-open > strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.3; }
  #view-overview .simple-recent-row small { margin-top: 2px; font-size: 11px; line-height: 1.3; }
}
@media (min-width: 1051px) {
  #view-overview .simple-entry-fields { grid-template-columns: minmax(0, 1.15fr) minmax(120px, .85fr) minmax(0, 1.05fr); }
  #view-overview .simple-entry-fields.sale-entry { grid-template-columns: minmax(0, 1.05fr) minmax(120px, 1fr) minmax(0, 1.05fr) minmax(0, 1.2fr); }
  #view-overview .simple-entry-fields > #amount-field { grid-column: auto; }
  #view-overview .simple-entry-fields > #to-account-field { grid-column: 1 / -1; }
  #view-overview #amount-help { display: none; }
}
@container ledger-entry (max-width: 500px) {
  #view-overview .simple-entry-fields.sale-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1250px) and (min-width: 901px) {
  .funds-summary > .merchant-funds { padding: 18px; }
  .merchant-balance-row { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 18px; }
  .merchant-funds .funds-wallets { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 12px; }
  .merchant-funds .funds-value { font-size: 40px; }
  .merchant-funds .overview-trade-summary { gap: 8px 12px; }
  .merchant-funds .trade-points-line > strong { font-size: 17px; }
  .own-balance-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .personal-flow-summary > .funds-group { padding: 10px; }
  .personal-flow-summary .funds-heading svg { display: none; }
  .ledger-combined { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ledger-combined > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; }
  .ledger-combined dd { margin-top: 0; }
}
@media (max-width: 900px) {
  .funds-summary > .merchant-funds { grid-column: 1 / -1; grid-row: auto; min-height: 224px; }
  .funds-summary > .own-funds, .personal-flow-summary { grid-column: span 6; }
  .own-balance-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .personal-flow-summary .funds-heading svg { display: none; }
  .personal-flow-summary .funds-heading { align-content: start; }
  .overview-ledger-totals > div { padding-right: 12px; padding-left: 12px; }
  .ledger-combined { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .ledger-combined > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; }
  .ledger-combined dd { margin-top: 0; }
}
@media (max-width: 720px) {
  body[data-page="overview"] .sidebar { position: static; }
  #view-overview { gap: 12px; }
  .funds-summary { gap: 12px; }
  .funds-summary > .merchant-funds { min-height: 0; padding: 20px; }
  .merchant-balance-row { grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 8px 0 20px; }
  .merchant-funds .funds-value { font-size: 38px; }
  .merchant-funds .funds-wallets { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px 10px; font-size: 12px; }
  .merchant-funds .funds-wallets dd { font-size: 12px; }
  .merchant-funds .overview-trade-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 14px; }
  .merchant-funds .trade-points-line > strong { font-size: 19px; }
  .merchant-funds .overview-trade-summary > div:last-child { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
  .merchant-funds .overview-trade-summary > div:last-child .trade-points-line { gap: 4px 12px; }
  .merchant-funds .overview-trade-summary > div:last-child .trade-points-line > span { flex-basis: auto; }
  .funds-summary > .own-funds, .personal-flow-summary { grid-column: 1 / -1; }
  .funds-summary > .own-funds { padding: 12px 16px; }
  .own-balance-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .personal-flow-summary .funds-heading svg { display: inline; }
  .personal-flow-summary > .funds-group { padding: 12px 16px; }
  .overview-ledger-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-ledger-totals > div > strong { font-size: 21px; }
  .overview-ledger-totals > .wallet-total-module { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; padding-top: 10px; padding-bottom: 10px; }
  .ledger-combined { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ledger-combined > div { display: block; }
  .ledger-combined dd { margin-top: 3px; }
  .overview-cash-notes { gap: 4px; }
  .overview-fund-extra > span { display: block; }
  .overview-fund-extra > span + span { margin-top: 4px; margin-left: 0; }
}
@media (min-width: 1051px) and (max-height: 820px) {
  body[data-page="overview"] .main { padding-top: 14px; padding-bottom: 16px; }
  body[data-page="overview"] .topbar { margin-bottom: 8px; }
  body[data-page="overview"] h1 { font-size: 24px; }
  body[data-page="overview"] .page-title > p { margin-top: 3px; }
  #view-overview { gap: 8px; }
  .funds-summary > .merchant-funds { padding: 16px 22px; }
  .merchant-balance-row { margin-top: 6px; margin-bottom: 10px; }
  .merchant-funds .funds-value { font-size: 42px; }
  .merchant-funds .overview-trade-summary { padding-top: 12px; }
  .funds-summary > .own-funds { padding: 8px 14px; }
  .funds-heading, .funds-heading > .button { min-height: 24px; }
  .own-balance-row .funds-wallets { line-height: 1.3; }
  .funds-source-details { margin-top: 4px; }
  .funds-source-details > summary { padding: 0; }
  .personal-flow-summary > .funds-group { padding: 8px 12px; }
  .personal-flow-summary .funds-value { margin-top: 0; font-size: 21px; line-height: 1.2; }
  .personal-flow-summary .funds-wallets { margin-top: 4px; line-height: 1.25; }
  .personal-flow-summary .funds-note { margin-top: 3px; font-size: 10px; line-height: 1.3; }
  .overview-ledger-totals > div { padding: 4px 16px 8px; }
  .overview-ledger-totals .overview-stat-heading, .overview-ledger-totals .overview-stat-heading > .button { min-height: 24px; }
  .overview-ledger-totals > div > strong { font-size: 21px; }
  .overview-cash-notes { margin-top: -4px; }
  #view-overview .panel { padding: 14px 16px; }
  #view-overview .entry-panel > .section-heading { margin-bottom: 10px; }
  #view-overview .simple-recent-row { padding-top: 6px; padding-bottom: 6px; }
  #view-overview .simple-recent-row:last-child { padding-bottom: 0; }
  #view-overview .tx-excluded-control { min-height: 28px; margin-top: 6px; }
  #view-overview .simple-work-grid .form-footer { margin-top: 10px; padding-top: 10px; }
}
@media print {
  .funds-summary > .merchant-funds { color: var(--ink); border-color: var(--line); background: transparent; }
  .merchant-funds .funds-note, .merchant-funds .funds-wallets dt, .merchant-funds .trade-points-line > span, .merchant-funds .overview-trade-summary p { color: var(--muted); }
  .merchant-funds .overview-trade-summary p > strong { color: var(--ink); }
}
