:root {
  color-scheme: light;
  --ink: #172c3c;
  --muted: #546877;
  --navy: #143451;
  --accent: #17645a;
  --border: #dce4e9;
  --paper: #fff;
  --background: #f3f6f8;
  font: 16px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid #256db0; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.2rem; line-height: 1.25; letter-spacing: -.015em; }
small { color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; clip-path: inset(50%); overflow: hidden; }
.nowrap { white-space: nowrap; }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
.overline { color: var(--accent); font-size: .88rem; font-weight: 650; margin-bottom: .45rem; }
.mark { display: inline-grid; place-items: center; width: 2.8rem; aspect-ratio: 1; border-radius: .7rem; background: var(--navy); color: #fff; font-weight: 750; letter-spacing: -.02em; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem; padding: .52rem .87rem; border: 1px solid var(--border); border-radius: .5rem; background: #fff; color: var(--navy); font: inherit; font-size: .9rem; font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { background: #edf3f8; }
.button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.button.primary:hover { background: #234d73; }
.button.quiet { border-color: transparent; background: #edf2f5; }
.button.small { min-height: 2.15rem; padding: .3rem .65rem; }
.topbar { min-height: 4.9rem; background: var(--paper); border-bottom: 1px solid var(--border); padding: .9rem max(1.2rem, calc((100vw - 1160px)/2)); display: flex; align-items: center; gap: clamp(1rem, 4vw, 3.5rem); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand strong, .brand small { display: block; }
.topbar nav { display: flex; gap: .25rem; align-items: center; }
.topbar nav a { padding: .55rem .75rem; border-radius: .5rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.topbar nav [aria-current] { background: #e6eff6; color: var(--navy); }
.account { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.username { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .9rem; }
.workspace { max-width: 1200px; margin: 0 auto; padding: 2.3rem 1.25rem 3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.55rem; flex-wrap: wrap; }
.period-picker { display: inline-flex; align-items: center; gap: .25rem; background: var(--paper); padding: .28rem; border-radius: .6rem; border: 1px solid var(--border); }
.period-picker a { display: block; min-width: 2.5rem; padding: .34rem .55rem; border-radius: .35rem; text-align: center; text-decoration: none; color: var(--muted); font-weight: 700; }
.period-picker [aria-current] { background: var(--navy); color: #fff; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.metrics section, .card { border: 1px solid var(--border); border-radius: .75rem; background: var(--paper); }
.metrics section { padding: 1.1rem 1.2rem; }
.metrics p { color: var(--muted); margin-bottom: .45rem; }
.metrics strong { display: block; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.15; margin-bottom: .25rem; font-variant-numeric: tabular-nums; }
.card { margin-bottom: 1rem; }
.export, .inline-form { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1.3rem; }
.export p, .section-heading p { color: var(--muted); margin-top: .35rem; }
.export-actions { display: flex; gap: .45rem; flex-wrap: wrap; }
.section-heading { padding: 1.15rem 1.3rem; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th, td { padding: .65rem .85rem; border-bottom: 1px solid #e9edf0; }
thead th { background: #eef3f6; color: #3b5162; white-space: nowrap; }
tbody th { font-weight: 625; }
tbody tr:last-child > * { border-bottom: none; }
tbody th small { display: block; font-size: .82rem; font-weight: 500; }
.documents td:nth-child(3), .documents td:nth-child(5) { min-width: 8rem; }
.pill { display: inline-flex; border-radius: 2rem; padding: .25rem .58rem; font-size: .8rem; line-height: 1.3; background: #eef3f6; color: #445b6b; }
.pill.pending { color: #6c4714; background: #fbefda; }
.pill.matched, .status-ok { color: #0b574c; background: #e5f4ef; }
summary { padding: .95rem 1.3rem; cursor: pointer; font-weight: 650; }
.audit ul { color: var(--muted); margin: 0 1rem 1rem; }
.audit summary span { margin-left: .5rem; color: var(--muted); }
.empty { margin: 0 1.3rem 1.3rem; color: var(--muted); }
.notice { padding: .75rem 1rem; margin-bottom: 1rem; border-radius: .6rem; border: 1px solid #add9c6; color: #0b5443; background: #e7f5ed; }
.notice.error { border-color: #e1bbb7; background: #fff0ee; color: #7e2a23; }
.login-shell { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 1.25rem; background: linear-gradient(150deg, #e4edf4, #f7fafb 67%); }
.login-card { width: min(100%, 29rem); background: #fff; border: 1px solid var(--border); padding: clamp(1.5rem, 6vw, 2.4rem); border-radius: 1rem; box-shadow: 0 14px 55px #20384e18; }
.login-card .mark { margin-bottom: 1.3rem; }
.login-card h1 { font-size: clamp(1.8rem, 5vw, 2.3rem); margin-bottom: 1.7rem; }
.login-form, .form-grid { display: grid; gap: .9rem; }
.form-grid { grid-template-columns: 1fr 1fr 1fr; padding: 0 1.3rem 1.25rem; }
.inline-form { align-items: flex-end; justify-content: flex-start; }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: .32rem; color: #314a5d; font-size: .9rem; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 2.5rem; border: 1px solid #c4d1da; border-radius: .43rem; padding: .45rem .55rem; color: var(--ink); background: #fff; font: inherit; }
select { min-width: 7rem; }
textarea { resize: vertical; }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: .65rem 1rem; gap: .55rem; }
  .topbar nav { order: 3; width: 100%; margin-top: .3rem; }
  .username { display: none; }
  .workspace { padding: 1.4rem 1rem 2rem; }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .metrics section { padding: .85rem 1rem; }
  .export-actions { width: 100%; }
}
