:root {
  --navy-950: #0b1f33;
  --navy-800: #17324d;
  --navy-600: #47647d;
  --emerald-700: #08735f;
  --emerald-600: #088975;
  --emerald-100: #dff5ef;
  --surface: #fff;
  --canvas: #f4f7f6;
  --line: #dce5e2;
  --muted: #607385;
  --danger: #a63232;
  --danger-bg: #fff0f0;
  --warning: #7b5700;
  --warning-bg: #fff6d8;
  --radius-sm: 0.5rem;
  --radius: 0.85rem;
  --shadow: 0 8px 28px rgb(11 31 51 / 8%);
  --focus: 0 0 0 3px rgb(8 137 117 / 25%);
  color: var(--navy-950);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; min-width: 18rem; }
a { color: var(--emerald-700); text-underline-offset: 0.18em; }
a:hover { color: var(--navy-800); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--emerald-600); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: white; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
.site-header { background: var(--navy-950); color: white; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgb(255 255 255 / 12%); }
.header-inner { max-width: 76rem; min-height: 4.25rem; margin: auto; padding: .65rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: white; text-decoration: none; font-size: 1.35rem; font-weight: 760; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem; color: white; background: var(--emerald-600); font-size: 1.1rem; }
.nav-toggle { display: none; margin-left: auto; border: 1px solid #ffffff55; background: transparent; color: white; border-radius: var(--radius-sm); padding: .5rem .7rem; }
.main-nav { display: flex; flex: 1; align-items: center; gap: .2rem; }
.main-nav a { color: #e3ecef; text-decoration: none; padding: .55rem .7rem; border-radius: .45rem; font-size: .94rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: white; background: #ffffff16; }
.nav-account { margin-left: auto; display: flex; align-items: center; gap: .65rem; }
.user-email { max-width: 13rem; overflow: hidden; text-overflow: ellipsis; font-size: .86rem; color: #b9c8d2; }
.page-shell { max-width: 76rem; margin: auto; padding: 2rem 1.25rem 4rem; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1, .hero h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.12; letter-spacing: -.035em; }
.eyebrow { margin: 0 0 .45rem; color: var(--emerald-700); font-weight: 750; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.lede { max-width: 43rem; margin: .65rem 0 0; color: var(--muted); font-size: 1.05rem; }
.breadcrumbs { margin-bottom: .7rem; color: var(--muted); font-size: .86rem; }
.breadcrumbs a { color: var(--muted); }
.stack { display: grid; gap: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: 0 1px 2px rgb(11 31 51 / 3%); }
.card h2, .card h3 { margin: 0 0 .5rem; line-height: 1.25; }
.card p:last-child { margin-bottom: 0; }
.stat { font-size: 1.8rem; font-weight: 750; letter-spacing: -.035em; margin: .15rem 0; }
.muted, .help { color: var(--muted); }
.help { font-size: .88rem; margin-top: .4rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.actions-spaced { margin-top: 1.5rem; }
.full-row { grid-column: 1 / -1; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 2.65rem; border: 1px solid transparent; border-radius: var(--radius-sm); padding: .58rem 1rem; background: var(--emerald-700); color: white; text-decoration: none; font-weight: 700; cursor: pointer; }
.button:hover { background: var(--emerald-600); color: white; }
.button-secondary { color: var(--navy-800); background: white; border-color: #b9c8cf; }
.button-secondary:hover { color: var(--navy-950); background: #f5f8f7; }
.button-danger { color: var(--danger); background: white; border-color: #e4bcbc; }
.button-small { min-height: 2.2rem; padding: .35rem .7rem; font-size: .88rem; }
.button-quiet { background: transparent; color: #e3ecef; border-color: #ffffff55; }
.inline-form { display: inline-flex; margin: 0; }
.form-card { max-width: 38rem; }
.field { margin-bottom: 1rem; }
label, legend { display: block; margin-bottom: .35rem; font-weight: 700; color: var(--navy-800); }
input, select { width: 100%; min-height: 2.8rem; padding: .6rem .75rem; color: var(--navy-950); background: white; border: 1px solid #aebfc5; border-radius: var(--radius-sm); }
input:hover, select:hover { border-color: #799399; }
input:focus, select:focus { border-color: var(--emerald-600); outline: none; box-shadow: var(--focus); }
.filter-bar { display: grid; grid-template-columns: repeat(4, minmax(8rem, 1fr)) auto; align-items: end; gap: .75rem; }
.filter-bar .field { margin: 0; }
.alert { padding: .9rem 1rem; border: 1px solid var(--line); border-left-width: .3rem; border-radius: var(--radius-sm); background: white; margin-bottom: 1rem; }
.alert-error { border-color: #e7bcbc; border-left-color: var(--danger); background: var(--danger-bg); color: #752020; }
.alert-warning { border-color: #ead78b; border-left-color: #b78200; background: var(--warning-bg); color: #684900; }
.alert-success { border-color: #9bd5c6; border-left-color: var(--emerald-700); background: #ecfaf6; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .2rem .58rem; font-size: .78rem; font-weight: 750; background: #edf1f3; color: #465b6d; white-space: nowrap; }
.badge-success { background: var(--emerald-100); color: #075f50; }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); background: #f8faf9; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
th, td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.amount { white-space: nowrap; font-weight: 750; font-variant-numeric: tabular-nums; }
.amount-positive { color: var(--emerald-700); }
.empty { padding: 2.5rem 1.25rem; text-align: center; border: 1px dashed #b9c8cf; border-radius: var(--radius); background: rgb(255 255 255 / 55%); }
.empty h2, .empty h3 { margin: 0 0 .35rem; }
.empty p { max-width: 32rem; margin: .35rem auto 1rem; color: var(--muted); }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-row { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.account-card { display: grid; gap: 1rem; }
.account-card header { display: flex; justify-content: space-between; gap: 1rem; }
.account-row { padding: .9rem; border-radius: .65rem; background: #f7faf9; }
.detail-list { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; margin: 0; }
.detail-list dt, .detail-list dd { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: center; padding: clamp(2rem, 7vw, 5rem) 0; }
.hero-copy { max-width: 43rem; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }
.hero-panel { padding: 1.6rem; background: var(--navy-950); color: white; border-radius: 1.25rem; box-shadow: var(--shadow); }
.hero-panel .muted { color: #c0cdd5; }
.feature-list { display: grid; gap: .8rem; padding: 0; list-style: none; }
.feature-list li { display: flex; gap: .65rem; }
.feature-list li::before { content: "✓"; color: #65d9c0; font-weight: bold; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 28rem) minmax(18rem, 1fr); gap: 2rem; align-items: start; max-width: 62rem; margin: 2rem auto; }
.auth-aside { padding: 1.5rem; }
.file-field { padding: 1.25rem; border: 1px dashed #91aaa9; background: #f7fbfa; }
.pagination { display: flex; justify-content: flex-end; margin-top: 1rem; }
.footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { max-width: 76rem; margin: auto; padding: 1.25rem; font-size: .85rem; }

@media (max-width: 54rem) {
  .nav-toggle { display: inline-flex; }
  .main-nav[hidden] { display: none; }
  .main-nav { position: absolute; top: 4.25rem; left: 0; right: 0; padding: .75rem 1.25rem 1rem; background: var(--navy-950); flex-direction: column; align-items: stretch; border-top: 1px solid #ffffff22; }
  .main-nav a { padding: .7rem; }
  .nav-account { margin: .5rem 0 0; padding-top: .75rem; border-top: 1px solid #ffffff22; justify-content: space-between; }
  .hero, .auth-layout { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: repeat(2, minmax(8rem, 1fr)); }
}

@media (max-width: 38rem) {
  .page-shell { padding: 1.35rem .9rem 3rem; }
  .header-inner { padding-inline: .9rem; }
  .page-header { display: block; }
  .page-header .actions { margin-top: 1rem; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar .button { width: 100%; }
  .list-row, .account-card header { align-items: flex-start; flex-direction: column; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { padding-bottom: 0; border-bottom: 0; }
  .detail-list dd { padding-top: .15rem; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; }
  .responsive-table tr { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
  .responsive-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .28rem 0; border: 0; text-align: right; }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; text-align: left; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
