:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #677384;
  --line: #dfe5ec;
  --panel: #ffffff;
  --page: #f5f7fa;
  --accent: #2457a6;
  --accent-dark: #173e7a;
  --danger: #a33131;
  --success: #1d704a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { background: #172033; color: #fff; }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 14px 24px; display: flex; gap: 24px; align-items: center; }
.brand { color: #fff; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; flex: 1; }
.nav a { color: #dbe7fa; }
.link-button { border: 0; background: transparent; color: #dbe7fa; cursor: pointer; font: inherit; padding: 0; }
.container { max-width: 1440px; margin: 0 auto; padding: 28px 24px 56px; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 22px; }
h1, h2 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
.eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 5px; text-transform: uppercase; letter-spacing: .08em; }
.muted, .note { color: var(--muted); }
.note { margin-top: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin: 16px 0 22px; }
.card, .form-card, .detail-card, .empty { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; box-shadow: 0 2px 8px rgba(29, 45, 70, .04); }
.summary-cards .card { display: flex; flex-direction: column; gap: 4px; }
.summary-cards strong { font-size: 20px; }
.account-card { display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.account-card strong { font-size: 18px; }
.positive { color: var(--success); }
.negative { color: var(--danger); }
.actions, .form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.button, button { display: inline-block; border: 1px solid #bac5d4; border-radius: 7px; background: #fff; color: var(--ink); cursor: pointer; padding: 9px 14px; font: inherit; text-decoration: none; }
.button:hover, button:hover { background: #f0f4f9; text-decoration: none; }
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover, button.primary:hover { background: var(--accent-dark); }
.button.danger, button.danger { border-color: #d9a5a5; color: var(--danger); }
.pagination { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin: 16px 0 4px; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.matrix-navigation { display: flex; align-items: center; gap: 10px; margin: -6px 0 12px; }
.matrix-navigation .button { min-width: 42px; padding: 7px 11px; text-align: center; font-size: 20px; line-height: 1.2; }
.flash { border-radius: 7px; padding: 11px 14px; margin: 0 0 14px; background: #eef3fa; border: 1px solid #c8d8ee; }
.flash.error { background: #fff1f1; border-color: #ecc4c4; color: #842b2b; }
.flash.success { background: #eefaf3; border-color: #bfe4cc; color: #185b3c; }
.filters { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 18px; display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 5px; color: #3f4b5b; font-weight: 600; }
input, select, textarea { min-width: 0; border: 1px solid #c8d1dd; border-radius: 6px; background: #fff; color: var(--ink); padding: 9px 10px; font: inherit; font-weight: 400; }
input:focus, select:focus, textarea:focus, button:focus, a:focus { outline: 3px solid rgba(36, 87, 166, .25); outline-offset: 1px; }
.check { flex-direction: row; align-items: center; font-weight: 400; padding: 10px 0; }
.check input { min-width: auto; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.matrix-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
thead th { background: #edf2f8; color: #334154; font-size: 13px; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.number { text-align: right; }
.empty-cell { color: var(--muted); text-align: center; padding: 32px; }
.matrix { min-width: 760px; }
.matrix th, .matrix td { text-align: right; }
.matrix th:not(.sticky-left):not(.matrix-total), .matrix td:not(.sticky-left):not(.matrix-total) { min-width: 140px; overflow: hidden; }
.matrix thead th { position: sticky; top: 0; z-index: 3; background: #edf2f8; }
.matrix .sticky-left { position: sticky; left: 0; z-index: 1; text-align: left; min-width: 210px; background: #fff; box-shadow: 4px 0 8px rgba(25, 40, 65, .06); }
.matrix thead .sticky-left { background: #edf2f8; z-index: 4; }
.matrix .matrix-total { position: sticky; right: 0; z-index: 2; min-width: 140px; background: #fff; box-shadow: -4px 0 8px rgba(25, 40, 65, .06); }
.matrix thead .matrix-total { background: #edf2f8; z-index: 5; }
.matrix tfoot .matrix-total { background: #f7f9fc; }
.matrix-section-row .matrix-total { background: #e8eef7; }
.matrix-cell { cursor: pointer; transition: background-color .12s ease, box-shadow .12s ease; }
.matrix-cell:hover { background: #f0f7f2; }
.matrix-cell:focus-visible { outline: 3px solid rgba(36, 87, 166, .35); outline-offset: -3px; }
.matrix-cell.is-highlighted { background: #d9f4df; box-shadow: inset 0 0 0 2px #4aa866; }
.matrix-cell.is-highlighted:hover { background: #c9edd3; }
.matrix-cell.is-saving { cursor: progress; opacity: .55; }
.matrix-cell[data-error] { background: #fff1f1; box-shadow: inset 0 0 0 2px #c56a6a; }
.matrix-add-cell { cursor: text; min-height: 42px; }
.matrix-add-cell:hover { background: #f7fafc; }
.matrix-add-cell.is-editing { padding: 5px; background: #fff; }
.matrix-inline-input { width: 100%; min-width: 0 !important; text-align: right; padding: 7px 8px; }
.matrix-inline-error { display: block; margin-top: 4px; color: var(--danger); white-space: normal; text-align: left; font-size: 12px; font-weight: 400; }
.matrix-separator td { height: 16px; padding: 0; border-bottom: 1px solid var(--line); background: var(--page); }
.matrix-section-row th, .matrix-section-row td { background: #e8eef7; border-bottom-color: #c9d5e5; font-weight: 700; }
.matrix-section-row .sticky-left { background: #e8eef7; }
.matrix-payment-row .sticky-left { background: #fff; }
.matrix tfoot th, .matrix tfoot td { font-weight: 700; background: #f7f9fc; }
.sheet-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.excel-wrap { max-height: 72vh; }
.excel-grid { width: auto; min-width: max-content; }
.excel-grid th, .excel-grid td { min-width: 82px; padding: 7px 9px; font-size: 13px; }
.excel-grid thead th { position: sticky; top: 0; z-index: 2; text-align: center; }
.excel-grid .excel-row-number { position: sticky; left: 0; z-index: 3; min-width: 44px; width: 44px; text-align: right; background: #edf2f8; }
.excel-grid td { text-align: right; }
.excel-grid td:first-of-type { text-align: left; }
.excel-grid .excel-date { background: #f7f9fc; }
.badge { display: inline-block; margin-left: 7px; padding: 2px 7px; border-radius: 20px; background: #e8edf4; color: #536273; font-size: 12px; }
.badge.posted { background: #eaf7ef; color: #1c6945; }
.badge.cancelled { background: #fbeaea; color: #8d3535; }
.form-card { max-width: 620px; display: grid; gap: 16px; }
.form-card label input, .form-card label select, .form-card label textarea { width: 100%; }
.warning { margin: 0; padding: 11px 13px; border-radius: 6px; background: #fff7e5; border: 1px solid #eed79a; color: #745b1c; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.row-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-form input:not(.small-input) { min-width: 240px; }
.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; }
.inline-create { display: flex; gap: 10px; align-items: end; margin-bottom: 18px; }
.inline-create input { min-width: 280px; }
.small-input { width: 90px; }
.detail-card { max-width: 860px; margin-bottom: 18px; }
dl { display: grid; grid-template-columns: 190px 1fr; gap: 10px 18px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
pre { overflow-x: auto; padding: 12px; background: #f5f7fa; border-radius: 6px; font-size: 12px; }
.section { margin-top: 26px; }
.auth-card { max-width: 420px; margin: 8vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 28px; box-shadow: 0 4px 18px rgba(29, 45, 70, .08); }
.auth-card form { display: grid; gap: 16px; }
.empty { text-align: center; padding: 42px 24px; }
@media (max-width: 720px) {
  .topbar-inner, .container { padding-left: 14px; padding-right: 14px; }
  .topbar-inner { gap: 10px 16px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 15px; padding-bottom: 2px; }
  .nav a, .link-button { white-space: nowrap; }
  .page-heading { align-items: start; flex-direction: column; }
  .page-heading .actions { width: 100%; }
  .page-heading .actions .button { flex: 1 1 150px; text-align: center; }
  h1 { font-size: 26px; }
  dl { grid-template-columns: 1fr; gap: 3px; }
  dd { margin-bottom: 8px; }
  .inline-create { align-items: stretch; flex-direction: column; }
  .inline-create input { min-width: 0; }
  .filters { align-items: stretch; }
  .filters label:not(.check), .filters > .button, .filters > button { width: 100%; }
  .filters .check { align-self: flex-start; }
  .matrix-wrap { max-height: 65vh; -webkit-overflow-scrolling: touch; }
  .matrix { min-width: 660px; }
  .matrix .sticky-left { min-width: 150px; max-width: 180px; white-space: normal; }
  .matrix th, .matrix td { padding: 9px 8px; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form input, .inline-form button { width: 100%; }
}
