:root {
  --ink: #192c30;
  --muted: #536767;
  --line: #d9e5e1;
  --paper: #fff;
  --accent: #075a47;
  --soft: #e3f1ea;
  --bg: #f0f5f2;
  --warn: #87430d;
  --bad: #a12d3b;
  --page-inset: clamp(12px, 3vw, 36px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(25px, 4vw, 34px); letter-spacing: -.025em; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted, .note, footer { color: var(--muted); }
.small, .note, footer { font-size: 13px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.shell { max-width: 1470px; margin-inline: auto; padding-inline: var(--page-inset); }

.site-header { background: var(--paper); }
.header-inner {
  min-height: 64px;
  padding-block: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand strong { display: block; font-size: 16px; line-height: 1.35; }
.mark {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 3px;
  width: 37px;
  height: 37px;
  flex: none;
  padding: 9px;
  border-radius: 10px;
  background: #123b33;
}
.mark i { width: 4px; height: 55%; border-radius: 2px; background: #d2efe0; }
.mark i:nth-child(2) { height: 75%; }
.mark i:nth-child(3) { height: 100%; }
.account-menu { position: relative; min-width: 0; }
.account-menu summary {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  text-align: right;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-2px);
  margin-inline-end: 2px;
  flex: none;
}
#user-badge { overflow-wrap: anywhere; }
.menu-items {
  position: absolute;
  z-index: 4;
  inset: 100% 0 auto auto;
  min-width: 162px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 8px 28px #192c3026;
  padding: 4px;
}
.menu-items :is(a,button) {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  min-height: 44px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 11px;
  text-decoration: none;
  white-space: nowrap;
}
.menu-items :is(a,button):hover { background: var(--soft); }

.navigation {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--paper);
  border-block: 1px solid var(--line);
}
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding-block: 6px; }
.tabs button { border-color: transparent; color: var(--muted); padding-inline: 3px; font-weight: 670; font-size: 14px; }
.tabs button[aria-current="page"] { background: var(--soft); border-color: #bbdacc; color: var(--accent); }
.main { padding-block-start: 14px; }
.scope { font-size: 13px; margin-bottom: 12px; }
.panel { min-width: 0; }
.panelhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}
.panelhead p { margin-top: 3px; color: var(--muted); font-size: 14px; }
.metrics, .paycards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 17px; }
.metric, .paycard { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); }
.metric:first-child { background: #123b33; color: #fff; border-color: #123b33; }
.metric:first-child :is(.gain,.muted) { color: #ccf5df; }
.metric:first-child .loss { color: #ffc1c9; }
.metric span, .metric small { font-size: 13px; }
.metric strong span { font-size: inherit; }
.metric strong { display: block; font-size: clamp(19px, 4.9vw, 27px); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric small, .paycard span, .paycard b { display: block; }
.paycard b { margin-top: 4px; font-variant-numeric: tabular-nums; }
.paycard span { font-size: 13px; color: var(--muted); }

button, select {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid #c2d3cb;
  border-radius: 8px;
  padding: 7px 11px;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
button:hover { border-color: #478675; }
button:disabled { opacity: .55; cursor: wait; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; }
:focus-visible { outline: 2px solid #087963; outline-offset: 2px; }
.plain { background: transparent; border-color: transparent; color: var(--accent); text-decoration: underline; padding-inline: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; flex: none; }
.fees .check + .check { margin-inline-start: 12px; }
.seg, .seg label, .seg-buttons { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg button[aria-pressed="true"], [data-statement][aria-pressed="true"] {
  background: var(--soft);
  color: var(--accent);
  border-color: #b5d4c9;
  font-weight: 700;
}
.gain { color: var(--accent); font-weight: 720; }
.loss { color: var(--bad); font-weight: 720; }
.warn { color: var(--warn); font-weight: 700; }
.notice { white-space: pre-line; overflow-wrap: anywhere; background: var(--soft); color: var(--accent); border: 1px solid #c6dfd3; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; }
.notice.error { background: #fff1e9; color: #873a0f; border-color: #f1cdbc; }
.empty { padding: 18px 14px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.note { margin-top: 12px; }
footer.shell { padding-block: 18px; }

.tablewrap { max-width: 100%; min-width: 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; table-layout: auto; }
th, td { text-align: left; vertical-align: middle; }
.mobile-label { display: none; }
.statement-source { white-space: normal; overflow-wrap: anywhere; }
.statement-preview { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); scroll-margin-top: 120px; }
.statement-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(119px,100%),1fr)); gap: 8px; margin: 0; }
.statement-facts div { padding: 8px 10px; background: var(--bg); border-radius: 7px; }
.statement-facts dt { color: var(--muted); font-size: 13px; }
.statement-facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.eyebrow { color: var(--accent); font-weight: 750; font-size: 13px; }
.loginbox { width: min(440px, calc(100% - 24px)); margin: clamp(25px, 10vh, 110px) auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: clamp(16px, 5vw, 28px); }
.loginbox form, .user-form { display: grid; gap: 12px; }
.loginbox form { margin-top: 18px; }
.loginbox form > label:not(.check), .user-form label { display: grid; gap: 4px; font-weight: 650; }
.loginbox input:not([type=checkbox]), .user-form input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid #c2d3cb;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}
.loginbox .notice { margin-block: 10px 0; }
.user-form { margin-bottom: 14px; }
.user-form :is(input,select) { width: 100%; }

@media (max-width: 899px) {
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody { display: grid; gap: 9px; }
  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 8px 12px;
    padding: 10px 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 11px;
  }
  td { display: block; min-width: 0; overflow-wrap: anywhere; }
  .mobile-label { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted); }
  .mobile-wide, .row-title { grid-column: 1 / -1; }
  .row-title { border-bottom: 1px solid var(--line); padding-block: 4px 7px; font-size: 16px; font-weight: 700; }
  .row-title:has(button) { padding-block: 0 2px; }
  .row-title .mobile-label, .mobile-actions .mobile-label { display: none; }
  .mobile-actions button { width: 100%; }
  .mobile-actions button + button { margin-top: 4px; }
  .mobile-highlight { font-size: 17px; font-weight: 720; }
}
@media (min-width: 640px) {
  .tabs { display: flex; gap: 7px; }
  .tabs button { padding-inline: 14px; }
  .user-form { grid-template-columns: repeat(2, minmax(0,1fr)); align-items: end; }
}
@media (min-width: 900px) {
  .header-inner { min-height: 68px; }
  .main { padding-block-start: 20px; }
  .metrics, .paycards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .metric, .paycard { padding: 13px 16px; }
  .panel { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
  .tablewrap { overflow-x: auto; }
  table { white-space: nowrap; }
  th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
  th { font-size: 13px; color: #405855; background: var(--bg); }
  tbody tr:hover { background: #f7fbf9; }
  .num { text-align: right; }
  .center { text-align: center; }
  .user-form { grid-template-columns: repeat(3, minmax(0,1fr)) max-content; }
}
