:root {
  color-scheme: dark;
  --bg: #18191a;
  --header: #121415;
  --surface: #202223;
  --field: #1c1e1f;
  --hover: #252728;
  --line: #3b3d3e;
  --soft-line: #303233;
  --ink: #f1eee7;
  --muted: #c0c0b9;
  --dim: #a2a59f;
  --mint: #a5e7c2;
  --number: "Inter", "Segoe UI", "Microsoft YaHei UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, "SFMono-Regular", monospace;
  --width: 1064px;
  --gutter: clamp(20px, 4.5vw, 64px);
  font: 15px/1.55 "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  scrollbar-color: #595b59 var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-width: 280px; }
h1, h2, p, dl, dt, dd, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { color: inherit; font: inherit; }
button, select, summary { cursor: pointer; }
button, select, a, summary { -webkit-tap-highlight-color: transparent; }
button { background: transparent; }
button:disabled { cursor: default; }
button, a, input, select, summary { scroll-margin-block: 10px; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
input { caret-color: var(--mint); }
::selection { color: #101713; background: #acd9bf; }
[hidden] { display: none !important; }
svg { display: block; flex: 0 0 auto; }
.sprite { position: absolute; width: 0; height: 0; pointer-events: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 8; top: 8px; left: 12px; padding: 8px 12px; background: var(--ink); color: var(--bg); }

.topbar { width: 100%; background: var(--header); border-bottom: 1px solid var(--line); }
.topbar-inner, main { width: min(calc(100% - 2 * var(--gutter)), var(--width)); margin-inline: auto; }
.topbar-inner { min-height: 70px; display: flex; align-items: stretch; gap: clamp(28px, 5vw, 80px); }
.brand, .login-brand { display: inline-flex; align-items: center; gap: 10px; }
.brand { flex-shrink: 0; white-space: nowrap; align-self: center; }
.brand-mark {
  flex: none;
  width: 36px;
  aspect-ratio: 72 / 48;
  /* Show the 72 × 48 px logo at (17, 12) in the 274 × 80 px sign. */
  background: url("black-ant-sign.png") 8.416% 37.5% / 380.556% auto no-repeat;
  filter: grayscale(1) contrast(3.35);
  mix-blend-mode: screen;
}
.login-brand .brand-mark { width: 42px; }
.brand strong, .login-brand strong { font-size: 16px; letter-spacing: .045em; font-weight: 675; }
.member-nav { display: flex; align-items: stretch; gap: 27px; }
.member-nav a[data-route] { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--dim); font-size: 14px; white-space: nowrap; }
.member-nav a[data-route] > .icon { width: 15px; height: 15px; }
.member-nav a[data-route]:hover { color: var(--ink); }
.member-nav a[data-route][aria-current="page"] { color: var(--mint); font-weight: 600; }
.member-nav a[data-route][aria-current="page"]::after { position: absolute; bottom: -1px; inset-inline: 0; height: 2px; background: var(--mint); content: ""; }
.identity { display: inline-flex; align-items: center; gap: 16px; margin-left: auto; white-space: nowrap; }
.icon-button, .logout-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; }
.icon-button { width: 36px; height: 36px; padding: 0; }
.logout-button { min-height: 34px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.logout-button .icon { width: 15px; height: 15px; }
.icon-button:hover:enabled, .logout-button:hover { background: var(--hover); border-color: #62645f; color: var(--ink); }
.icon-button:disabled { color: #686c68; border-color: #303232; }

main { padding-block: 38px 28px; }
main:focus { outline: none; }
.heading-row { margin-bottom: 21px; }
h1 { font-size: clamp(29px, 2.7vw, 41px); letter-spacing: -.035em; font-weight: 650; line-height: 1.18; }
h2 { font-size: 20px; line-height: 1.35; font-weight: 625; letter-spacing: -.02em; }
#page-summary { margin-top: 8px; color: var(--dim); font-size: 14px; }
#overview { margin-bottom: 35px; }
.account-band { display: grid; grid-template-columns: minmax(210px, .88fr) minmax(330px, 1.12fr); align-items: center; column-gap: 24px; padding: 26px 0 24px; border-block: 1px solid var(--line); }
.balance-label, .metric dt { font-size: 13px; line-height: 1.45; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.balance-value { display: flex; gap: 11px; align-items: baseline; margin: 4px 0 8px; }
.balance-value strong { font: 610 clamp(53px, 5.2vw, 76px)/1.06 var(--number); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.balance-value small { font-size: 14px; color: var(--muted); }
.account-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 0; row-gap: 1px; color: var(--dim); font-size: 12px; }
.account-meta > :not(:first-child)::before { content: "·"; margin: 0 7px; color: #777b75; }
#member-id { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { min-width: 0; padding-left: clamp(15px, 2.2vw, 36px); border-left: 1px solid var(--line); }
.metric dd { display: flex; align-items: baseline; gap: 6px; margin-top: 5px; }
.metric strong { font: 550 clamp(24px, 2.2vw, 32px)/1.25 var(--number); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.metric small { font-size: 12px; color: var(--dim); }

.ledger { min-width: 0; }
.ledger-head, .ledger-foot, .dialog-top, .trend-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ledger-head { margin-bottom: 18px; }
.ledger-heading { display: flex; align-items: center; gap: 8px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 11px; margin-bottom: 14px; }
.tabs, .query { display: flex; align-items: center; gap: 5px; }
.tabs button { min-height: 34px; border-radius: 4px; border: 1px solid transparent; padding: 5px 12px; color: var(--muted); font-size: 13px; }
.tabs button:first-child { margin-left: 0; }
.tabs button[aria-pressed="true"] { color: var(--mint); background: #26372e; border-color: #3d5446; font-weight: 585; }
.tabs button:hover:not([aria-pressed="true"]) { background: var(--hover); color: var(--ink); }
.query { gap: 8px; }
.search-box, .week-select { display: flex; align-items: center; gap: 8px; height: 35px; min-width: 0; padding: 0 9px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; background: var(--field); }
.search-box:focus-within, .week-select:focus-within { outline: 2px solid var(--mint); outline-offset: 2px; }
.search-box .icon, .week-select .icon { width: 15px; height: 15px; }
.search-box input, .week-select select { min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 12px; }
.search-box input { width: 132px; }
.search-box input::placeholder, .login-form input::placeholder { color: var(--dim); opacity: 1; }
.week-select { position: relative; }
.week-select select { color: var(--muted); align-self: stretch; padding: 0 15px 0 0; appearance: none; }
.week-select option { color: var(--ink); background: var(--field); }
.week-select > .icon:last-child { width: 10px; height: 10px; pointer-events: none; position: absolute; right: 8px; }
.ledger-table { width: 100%; table-layout: fixed; border-spacing: 0; text-align: left; }
.ledger-table th { padding: 8px 10px; border-block: 1px solid var(--line); color: var(--dim); background: #1e2021; font-size: 12px; font-weight: 475; }
.ledger-table td { height: 54px; padding: 8px 10px; border-bottom: 1px solid var(--soft-line); vertical-align: middle; font-size: 14px; }
.ledger-table th:first-child, .ledger-table td:first-child { width: 35%; padding-left: 13px; }
.type-col { width: 14%; }
.week-col { width: 19%; }
.numeric { text-align: right; font-family: var(--number); font-variant-numeric: tabular-nums; }
.go-col { width: 34px; }
.summary-ledger .go-col { display: none; }
.ledger-table.summary-ledger :is(th, td):first-child { width: 28%; }
.summary-ledger .week-col { width: 20%; }
.summary-ledger td.numeric { white-space: nowrap; }
.go-col .icon { width: 13px; height: 13px; margin-left: auto; color: var(--dim); }
.ledger-table tbody tr[data-id] { cursor: pointer; }
.ledger-table tbody tr:hover td, .ledger-table tbody tr:focus-within td { background: var(--hover); }
.project-button { display: flex; align-items: center; gap: 11px; max-width: 100%; padding: 0; border: 0; border-radius: 3px; text-align: left; }
.row-mark { display: flex; justify-content: center; align-items: center; flex: 0 0 29px; height: 30px; border: 1px solid #383b3b; border-radius: 4px; color: #bbbcb6; }
.row-mark .icon { width: 15px; height: 15px; }
.row-info { display: grid; gap: 2px; min-width: 0; }
.row-info strong { color: var(--ink); font-size: 14px; line-height: 1.4; font-weight: 565; overflow-wrap: anywhere; }
.row-info small { color: var(--dim); font: 11px/1.35 var(--mono); }
.row-reference, .row-period { white-space: nowrap; }
.row-period { display: none; font-family: var(--number); }
.type-pill, .ledger-table td.week-col, .after-col { color: var(--muted); }
.type-pill, .ledger-table td.week-col { font-size: 13px; }
.delta { color: var(--ink); font-weight: 600; }
.delta.credit, .detail-amount.credit { color: var(--mint); }
.ledger-foot { margin-top: 13px; color: var(--dim); font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 11px; }
.pagination .icon-button { width: 31px; height: 31px; }
.pagination .icon { width: 14px; height: 14px; }
#page-state { font: 12px var(--mono); font-variant-numeric: tabular-nums; }
.empty-state { display: grid; place-items: center; gap: 9px; padding: 35px 12px; border-bottom: 1px solid var(--soft-line); color: var(--muted); }
.empty-state strong { font-size: 15px; color: var(--ink); font-weight: 550; }
.text-button { border: 0; padding: 5px 8px; color: var(--mint); }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.recent-link { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; color: var(--mint); font-size: 13px; font-weight: 550; }
.recent-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.recent-link .icon { width: 15px; height: 15px; }

#trend-panel { margin-top: 33px; border-block: 1px solid var(--line); }
.trend-summary { min-height: 55px; cursor: pointer; list-style: none; color: var(--muted); font-weight: 550; }
.trend-summary::-webkit-details-marker { display: none; }
.trend-summary .icon { width: 16px; height: 16px; color: var(--dim); }
.trend-summary:hover { color: var(--ink); }
#trend-panel[open] .trend-summary .icon { transform: rotate(180deg); }
.trend-content { display: grid; grid-template-columns: 1fr auto; row-gap: 8px; padding: 6px 0 18px; }
.legend { display: flex; align-items: center; gap: 17px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 8px; height: 8px; border-radius: 1px; }
.legend-session::before, .bar-session { background: #d4d5cd; }
.legend-pos::before, .bar-pos { background: #777f88; }
.legend, .chart-unit { color: var(--dim); font-size: 12px; }
.chart { grid-column: 1 / -1; display: grid; grid-template-columns: 26px minmax(0,1fr); gap: 9px; height: 130px; min-width: 0; }
.chart-scale { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; color: var(--dim); font: 11px/1 var(--mono); text-align: right; }
.chart-plot { position: relative; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); isolation: isolate; }
.chart-plot::before { content: ""; position: absolute; z-index: -1; top: 2px; bottom: 23px; width: 100%; border-block: 1px dashed #414343; background: linear-gradient(to bottom,transparent calc(50% - .5px),#393b3b calc(50% - .5px),#393b3b calc(50% + .5px),transparent calc(50% + .5px)); }
.chart-week { display: grid; grid-template-rows: minmax(0,1fr) 23px; min-width: 0; padding: 0; border: 0; border-radius: 3px; color: var(--dim); }
.chart-week:hover, .chart-week:focus-visible { color: var(--ink); background: #ffffff0a; }
.bar-pair { display: flex; align-items: end; justify-content: center; gap: 5px; min-height: 0; }
.bar-pair i { display: block; width: min(20%,20px); border-radius: 2px 2px 0 0; }
.week-name { align-self: end; font-size: 12px; white-space: nowrap; }
.page-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; color: var(--dim); font-size: 11px; }
.page-foot .icon { width: 13px; height: 13px; }
.page-foot > span { display: inline-flex; align-items: center; gap: 6px; }

dialog { position: fixed; inset: 0; width: min(435px,calc(100% - 28px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 1px solid #545653; border-radius: 7px; background: var(--surface); color: var(--ink); overflow-y: auto; }
dialog::backdrop { background: #080909b8; }
.dialog-body { padding: 21px 24px 24px; }
.dialog-top { margin-bottom: 15px; }
#detail-close { margin-left: auto; }
#dialog-title { font-size: 22px; overflow-wrap: anywhere; }
.detail-amount { margin-top: 7px; color: var(--ink); font: 600 40px/1.2 var(--number); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.detail-amount small { margin-left: 6px; color: var(--muted); font: 12px var(--number); }
.balance-change { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin: 11px 0 8px; color: var(--muted); font-size: 13px; }
.balance-change strong { color: var(--ink); font-family: var(--number); font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums; }
.detail-meta { margin: 6px 0 15px; color: var(--dim); font-size: 12px; }
.detail-list > div { display: flex; justify-content: space-between; gap: 18px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.detail-list dt { color: var(--muted); flex: 0 0 auto; }
.detail-list dd { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.login-view { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: clamp(16px,5vw,70px); background: var(--bg); }
.login-card { position: relative; isolation: isolate; width: min(100%,808px); overflow: hidden; padding: clamp(28px,5vw,61px); padding-right: calc(40% + 24px); border: 1px solid var(--line); border-radius: 7px; background: #202223; }
.login-card::after { content: ""; position: absolute; z-index: -1; inset: 0 0 0 62%; background: #111815 url("aurora.webp") 76% center / auto 100% no-repeat; border-left: 1px solid var(--line); }
.login-brand { margin-bottom: 30px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand small { margin-top: 1px; color: var(--dim); font: 9px var(--mono); letter-spacing: .13em; }
.login-card h1 { margin-bottom: 7px; font-size: 31px; }
.login-description { color: var(--muted); font-size: 14px; }
.login-form { display: grid; gap: 14px; margin: 25px 0 0; }
.login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--ink); }
.login-form input { width: 100%; min-width: 0; min-height: 42px; border: 1px solid #4a4d49; border-radius: 4px; background: #181a1a; padding: 8px 11px; }
.login-form input[aria-invalid="true"] { border-color: #e19587; }
.login-submit { display: flex; align-items: center; justify-content: center; min-height: 43px; margin-top: 3px; padding: 9px 13px; border: 0; border-radius: 4px; background: var(--mint); color: #15251b; font-weight: 650; }
.login-submit:hover { background: #c2f3d8; }
.login-error { color: #ffc0b3; font-size: 13px; }
.login-error:empty { display: none; }

@media (min-width: 701px) {
  .login-card { padding-right: min(44%,350px); }
}
@media (max-width: 760px) {
  .topbar-inner { gap: 26px; }
  .member-nav { gap: 19px; }
  .account-band { grid-template-columns: minmax(190px,.84fr) minmax(270px,1.16fr); gap: 12px; }
  .metric { padding-left: 13px; }
  .ledger-table td, .ledger-table th { padding-inline: 7px; }
  .ledger-table:not(.summary-ledger) .type-col { display: none; }
  .ledger-table th:first-child, .ledger-table td:first-child { width: 40%; }
  .week-col { width: 24%; }
}
@media (max-width: 620px) {
  :root { --gutter: 17px; }
  .topbar-inner { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: 52px 40px; column-gap: 12px; row-gap: 0; }
  .brand { grid-area: 1 / 1; }
  .identity { grid-area: 1 / 2; gap: 10px; }
  .member-nav { grid-area: 2 / 1 / 3 / -1; align-self: stretch; gap: 24px; }
  .member-nav a[data-route] { font-size: 13px; }
  main { padding-block: 25px 18px; }
  .heading-row { margin-bottom: 17px; }
  h1 { font-size: 30px; }
  h2 { font-size: 18px; }
  #overview { margin-bottom: 25px; }
  .account-band { display: block; padding-block: 19px 16px; }
  .balance-value strong { font-size: 54px; }
  .metrics { margin-top: 20px; }
  .metric { padding-left: 13px; }
  .metric:first-child { border: 0; padding-left: 0; }
  .metric strong { font-size: 24px; }
  .metric dt { font-size: 12px; }
  .ledger-head { margin-bottom: 12px; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tabs { gap: 2px; }
  .tabs button { padding-inline: 9px; }
  .query { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .search-box input { width: 100%; }
  .week-select { min-width: 94px; }
  .ledger-table th, .ledger-table td { padding-inline: 4px; }
  .ledger-table th:first-child, .ledger-table td:first-child { width: 50%; padding-left: 4px; }
  .ledger-table:not(.summary-ledger) .week-col { display: none; }
  .row-period { display: inline; }
  .row-mark { display: none; }
  .row-info small { line-height: 1.5; }
  .row-info strong { font-size: 13px; }
  .go-col { width: 18px; }
  .ledger-table th { font-size: 11px; }
  .ledger-table td { font-size: 13px; }
  .ledger-foot { gap: 5px; }
  .pagination { gap: 7px; }
  .login-card { max-width: 395px; padding: 28px 24px 27px; }
  .login-card::after { inset: 0 0 auto; height: 71px; background-size: cover; background-position: center 47%; border: 0; border-bottom: 1px solid var(--line); }
  .login-brand { min-height: 38px; margin-bottom: 24px; }
  .login-brand strong, .login-brand small { text-shadow: 0 1px 3px #070a08; }
  .login-brand small { color: #d7dfd7; }
}
@media (min-width: 621px) and (max-width: 700px) {
  .login-card { padding-inline: 32px; padding-right: 39%; }
  .login-card::after { left: 67%; }
}
@media (max-width: 370px) {
  :root { --gutter: 13px; }
  .topbar-inner { column-gap: 5px; }
  .identity { gap: 6px; }
  .logout-button { font-size: 11px; }
  .logout-button { padding-inline: 6px; }
  .ledger-table th:first-child, .ledger-table td:first-child { width: 51%; }
  .ledger-foot { font-size: 11px; }
  .pagination .icon-button { width: 29px; }
  .row-info small { font-size: 10px; }
  .tabs button { padding-inline: 8px; font-size: 12px; }
  .login-card { padding-inline: 18px; }
}
@media (prefers-reduced-motion: no-preference) {
  .member-nav a[data-route], .tabs button, .icon-button { transition: color .14s ease, background-color .14s ease; }
  .trend-summary .icon { transition: transform .18s ease; }
}
