/* Billing Portal & beiyin.cc — Apple HIG Quantitative B2B Financial Design System
 * - Daylight crisp slate palette (#F7F8FA canvas · #FFFFFF solid cards · >= 5.8:1 solid text contrast)
 * - Dual-layer material separation: Liquid Glass strictly on sticky topbars; solid cards in content
 * - Centered elevated modal dialogs (zero right-side slide-over drawers; zero 3-layer box-in-box)
 * - Hit target floor: >= 30x30px desktop controls, >= 44x44px mobile touch targets
 */
:root {
  color-scheme: light;

  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #F1F5F9;

  /* Calibrated solid neutral slate steps — all >= 5.8:1 WCAG AA contrast on #FFFFFF and #F1F5F9 */
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #475569;
  --ink-4: #526071;
  --dot-off: #94A3B8;

  --line: #EEF2F6;
  --line-mid: #E2E8F0;
  --line-card: rgba(15, 23, 42, 0.08);
  --line-strong: #CBD5E1;

  /* Restrained semantic accents — strictly for 6px dots or 5px micro-bars, never candy pills */
  --dot-on: #1F7A5A;
  --amber-bar: #B45309;
  --slate-bar: #334155;

  --radius-lg: 12px;
  --radius: 9px;
  --radius-sm: 7px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.03), 0 6px 20px -6px rgba(15, 23, 42, 0.045);
  --shadow-btn-primary: 0 1px 2px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --shadow-float: 0 24px 52px -12px rgba(15, 23, 42, 0.20), 0 4px 14px -2px rgba(15, 23, 42, 0.07);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font: 13.5px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--ink); text-decoration-color: var(--ink); }

.num {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1;
  text-align: right;
  white-space: nowrap;
}
.num-left {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: 12.5px; line-height: 1.55; }

/* Top thin request progress bar */
.loadbar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--ink); z-index: 120; opacity: 0;
  transition: width 0.25s ease, opacity 0.25s ease;
}
.loadbar.on { opacity: 1; width: 68%; }

/* Shell: solid white sidebar + #F7F8FA canvas + Liquid Glass sticky control bar */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 234px; flex: none;
  background: var(--surface);
  border-right: 1px solid #E2E8F0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.brand {
  padding: 20px 20px 16px;
  display: flex; align-items: center; gap: 11px;
}
.brand-mark { width: 28px; height: 28px; flex: none; display: block; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); line-height: 1.2; }
.brand-tag { font-size: 12px; color: var(--ink-4); margin-top: 2px; display: block; line-height: 1.25; }

.nav-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-group { margin-top: 18px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-title {
  font-size: 12px; font-weight: 600; color: var(--ink-4);
  padding: 0 11px 6px; line-height: 1.35;
}
.nav-item {
  position: relative; width: 100%; min-height: 36px; border: 0; background: transparent;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 2px; border-radius: var(--radius-sm);
  color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 450;
  cursor: pointer; text-align: left; transition: background 0.14s ease, color 0.14s ease;
}
.nav-item svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); transition: color 0.14s ease; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover svg { color: var(--ink); }
.nav-item.active {
  background: var(--surface-3); color: var(--ink); font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 99px; background: var(--ink);
}
.nav-item.active svg { color: var(--ink); }

.sidebar-foot {
  padding: 12px 16px 13px; border-top: 1px solid #E2E8F0;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.user-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.user-meta .u-name { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .u-role { font-size: 12px; color: var(--ink-4); line-height: 1.3; white-space: nowrap; flex: none; }
.foot-links { display: flex; gap: 4px; margin-left: -8px; }

.text-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 30px; min-width: 30px; padding: 0 8px;
  border: 0; border-radius: 6px; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink-3); cursor: pointer; transition: background 0.12s, color 0.12s; white-space: nowrap;
}
.text-btn:hover { background: var(--surface-3); color: var(--ink); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 54px; padding: 0 34px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.55);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.crumb-root { color: var(--ink-4); font-weight: 450; }
.crumb-sep { color: var(--ink-4); font-size: 12px; }
.crumb-cur { color: var(--ink); font-weight: 600; }
.btn.mob-menu-btn { display: none; }

.page-wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding: 26px 34px 64px; }

/* Page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-title { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.3; color: var(--ink); }
.page-sub { margin-top: 4px; font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* KPI cards & hairline ledger strip */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 16px;
  min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between;
}
.kpi-card .k {
  font-size: 12.5px; font-weight: 500; color: var(--ink-3); line-height: 1.4;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.kpi-card .v {
  margin-top: 10px; font-size: 25px; font-weight: 650; letter-spacing: -0.025em;
  line-height: 1.18; font-variant-numeric: tabular-nums lining-nums; color: var(--ink);
}
.kpi-card .v .cur { font-size: 14.5px; font-weight: 500; color: var(--ink-4); margin-right: 3px; }
.kpi-card .sub {
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-4); line-height: 1.4;
}

.ledger-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px; background: #E2E8F0;
  border: 1px solid #E2E8F0; border-radius: var(--radius);
  overflow: hidden; margin-bottom: 18px;
}
.ledger-cell { background: var(--surface); padding: 15px 18px 14px; min-width: 0; }
.ledger-cell .k {
  font-size: 12px; font-weight: 500; color: var(--ink-3); line-height: 1.4;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ledger-cell .v {
  margin-top: 7px; font-size: 21px; font-weight: 650; letter-spacing: -0.02em;
  line-height: 1.2; font-variant-numeric: tabular-nums lining-nums; color: var(--ink);
}
.ledger-cell .v .cur { font-size: 13.5px; font-weight: 500; color: var(--ink-4); margin-right: 3px; }
.ledger-cell .sub { margin-top: 6px; font-size: 12px; color: var(--ink-4); line-height: 1.4; }

/* Solid content cards (zero backdrop-filter, zero 3-layer box-in-box) */
.panel {
  background: var(--surface); border: 1px solid var(--line-card);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 20px 24px; margin-bottom: 18px; min-width: 0;
}
.subcard {
  background: var(--surface-2); border: 1px solid #E2E8F0;
  border-radius: var(--radius); padding: 16px 18px; min-width: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid #E2E8F0;
}
.panel-head.no-rule { border-bottom: 0; padding-bottom: 0; margin-bottom: 14px; }
.panel-title { margin: 0; font-size: 14.5px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.panel-note { font-size: 12px; color: var(--ink-4); margin-left: 8px; font-weight: 400; }
.panel-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 table.tbl { font-size: 13px; }
.grid-2 table.tbl th, .grid-2 table.tbl td { padding-left: 8px; padding-right: 8px; }
.grid-2 table.tbl td:first-child { white-space: nowrap; }
.split-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 16px; align-items: start; }
.split-layout > .panel { margin-bottom: 0; }

/* Tables: crisp #E2E8F0 rules + tabular numbers */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 12px; font-weight: 550; color: var(--ink-3);
  background: var(--surface-2);
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
  padding: 10px 14px; white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl th:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
table.tbl th:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
table.tbl th.num { text-align: right; }
table.tbl td {
  padding: 13px 14px; border-bottom: 1px solid #E2E8F0;
  vertical-align: middle; line-height: 1.55; color: var(--ink);
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background 0.12s ease; }
table.tbl tbody tr:hover td { background: #FAFBFD; }
table.tbl tr.clickable { cursor: pointer; }
.cell-sub { font-size: 12px; color: var(--ink-4); margin-top: 3px; line-height: 1.4; }

/* Neutral chips + 6px status dots + 46px micro-progress meters */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; line-height: 22px; padding: 0 8.5px;
  border-radius: 6px; white-space: nowrap; font-weight: 500;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid #E2E8F0;
}
.chip-dark {
  color: #FFFFFF; background: var(--ink); border-color: var(--ink);
}
.status-inline {
  display: inline-flex; align-items: center; gap: 6.5px;
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.status-inline .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--dot-off); flex: none;
}
.status-inline.on .dot { background: var(--dot-on); }

.cap-cell {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
}
.cap-bar {
  width: 46px; height: 5px; border-radius: 99px;
  background: #E2E8F0; overflow: hidden; flex: none;
}
.cap-bar > i {
  display: block; height: 100%; border-radius: 99px; background: var(--slate-bar);
}
.cap-bar.low > i { background: var(--amber-bar); }
.cap-txt {
  font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.cap-txt.low { color: var(--ink); font-weight: 600; }

/* Callout cards */
.callout {
  background: var(--surface);
  border: 1px solid #E2E8F0;
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 12px 16px; margin-bottom: 18px; font-size: 13.5px; line-height: 1.6;
  color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.callout.subtle {
  background: var(--surface-2);
  border-color: #E2E8F0;
  border-left-color: var(--ink-3);
  box-shadow: none;
}

/* Tactile button system — desktop hit box >= 30x30px */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-height: 34px; min-width: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid #E2E8F0; background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background-color: #0F172A;
  background-image: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border-color: #0F172A; color: #FFFFFF;
  box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover {
  background-color: #1E293B;
  background-image: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  border-color: #1E293B;
}
.btn-sm { height: 30px; min-height: 30px; min-width: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }

.input, select.input, textarea.input {
  height: 34px; min-height: 34px; padding: 0 11px;
  border: 1px solid #E2E8F0; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.02);
  outline: none; transition: border-color 0.14s, box-shadow 0.14s;
}
select.input {
  padding-right: 28px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
textarea.input { height: auto; padding: 8px 11px; line-height: 1.55; }
.input:focus { border-color: #475569; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.07); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px; align-items: end;
}
.filter-grid .field { margin-bottom: 0; }
.col-date { white-space: nowrap; }
.show-xs { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); line-height: 1.4; }
.check-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); padding-top: 2px; }
.check-row label { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 2px 4px; cursor: pointer; }
.check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }

/* Segmented control — >= 30px hit box */
.seg {
  display: inline-flex; background: var(--surface-3);
  border: 1px solid #E2E8F0; padding: 2px; border-radius: 8px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; height: 30px; min-height: 30px; padding: 0 12px;
  border-radius: 6px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--surface); color: var(--ink); font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Account tree */
.tree-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 36px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  margin-bottom: 2px; color: var(--ink-2); transition: background 0.12s;
}
.tree-row:hover { background: var(--surface-2); color: var(--ink); }
.tree-row.active {
  background: var(--surface-3); color: var(--ink); font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.tree-branch { color: var(--ink-4); margin-right: 4px; }

/* Underline tabs — >= 36px hit box */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid #E2E8F0; margin-bottom: 16px; }
.tab-btn {
  border: 0; background: none; min-height: 38px; padding: 8px 4px 9px; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* Upload dropzone */
.dropzone {
  border: 1.5px dashed #CBD5E1; border-radius: var(--radius-lg);
  background: var(--surface-2); padding: 36px 24px; text-align: center;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--ink); background: var(--surface-3); }
.dropzone svg { width: 26px; height: 26px; color: var(--ink-3); margin-bottom: 8px; }

/* Balance meter */
.meter { height: 6px; background: #E2E8F0; border-radius: 99px; overflow: hidden; margin-top: 16px; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--ink); transition: width 0.3s ease; }

/* Centered elevated modals (replaces right-side slide-over drawers globally) */
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.drawer-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px;
}
.drawer-mask.open { display: flex; }
.drawer {
  width: min(580px, 95vw); max-height: min(86vh, 760px); background: var(--surface);
  border: 1px solid #E2E8F0; border-radius: 14px;
  box-shadow: var(--shadow-float); display: flex; flex-direction: column; overflow: hidden;
  animation: modalFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-head {
  padding: 16px 22px; border-bottom: 1px solid #E2E8F0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot {
  padding: 13px 22px; border-top: 1px solid #E2E8F0;
  display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2);
}
.drawer-foot:empty { display: none; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 80; display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-mask.open { display: flex; }
.modal-box {
  background: var(--surface); border: 1px solid #E2E8F0;
  border-radius: 14px; box-shadow: var(--shadow-float);
  width: min(410px, 100%); padding: 22px 24px;
  animation: modalFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast {
  position: fixed; bottom: 22px; right: 24px; z-index: 100;
  background: var(--ink); color: #FFFFFF; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; line-height: 1.5; box-shadow: var(--shadow-float);
  display: none; max-width: 420px;
}
.toast.show { display: block; }

/* Login & Client Portal (Liquid Glass topbar + solid statement card) */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card {
  width: min(384px, 100%); background: var(--surface);
  border: 1px solid var(--line-card); border-radius: 14px;
  padding: 32px 30px; box-shadow: var(--shadow-card);
}

.portal-bar {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.55);
  position: sticky; top: 0; z-index: 20;
}
.portal-bar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.portal-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 24px 64px; }

.statement-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.statement-bal {
  font-size: 32px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums lining-nums; margin-top: 6px; color: var(--ink);
}
.statement-bal .cur { font-size: 17px; font-weight: 500; color: var(--ink-4); margin-right: 3px; }
.statement-meta { display: flex; gap: 28px; flex-wrap: wrap; }
.statement-meta .m-k { font-size: 12px; color: var(--ink-4); }
.statement-meta .m-v { font-size: 14.5px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; color: var(--ink); }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 14px; margin-top: 6px; border-top: 1px solid #E2E8F0;
  font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap;
}
.pager-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager-jump {
  width: 54px; height: 30px; min-height: 30px; padding: 0 6px; text-align: center;
  border: 1px solid #E2E8F0; border-radius: 6px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-float);
  }
  .sidebar.open { transform: none; }
  .btn.mob-menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page-wrap { padding: 18px 14px 48px; }
  .portal-bar-inner { padding: 12px 14px; }
  .portal-wrap { padding: 16px 14px 44px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .split-layout, .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .ledger-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-strip > .ledger-cell:last-child:nth-child(odd) { grid-column: span 2; }
  .panel { padding: 16px 14px; }
  table.tbl { font-size: 12.5px; }
  table.tbl th, table.tbl td { padding: 11px 8px; }
}
@media (max-width: 640px) {
  .hide-xs { display: none !important; }
  .show-xs { display: block !important; }
  /* Apple HIG mobile touch target >= 44x44px */
  .btn, .btn-sm, .text-btn, .input, select.input, .nav-item, .tab-btn, .pager-jump {
    min-height: 44px; min-width: 44px;
  }
  .seg { padding: 3px; }
  .seg button { min-height: 38px; padding: 0 10px; font-size: 12.5px; }
  .drawer-mask { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
