:root {
  --ink: #152033;
  --muted: #728099;
  --line: #e4e9f1;
  --surface: #fff;
  --canvas: #f4f7fb;
  --navy: #111d31;
  --blue: #377cf6;
  --lime: #82c84b;
  --yellow: #f0c84c;
  --red: #ec6671;
  --shadow: 0 12px 34px rgba(28, 48, 79, .07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(55, 124, 246, .22); outline-offset: 2px; }
.app-shell { display: grid; grid-template-columns: 238px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 20; display: flex; flex-direction: column; height: 100vh; padding: 28px 20px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-size: 13px; line-height: 1.05; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(145deg, var(--blue), #5e9bff); box-shadow: 0 8px 20px rgba(55, 124, 246, .3); font-size: 20px; font-weight: 900; }
.side-nav { display: grid; gap: 8px; margin-top: 64px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 0; border-radius: 10px; background: transparent; color: #9ba8bc; text-align: left; cursor: pointer; }
.nav-item span { color: #627087; font-size: 10px; }
.nav-item.active, .nav-item:hover { background: #1e2c44; color: #fff; }
.nav-item.active span { color: #67a0ff; }
.sidebar-footer { margin-top: auto; padding: 15px; border: 1px solid #293750; border-radius: 12px; color: #c7d2e4; font-size: 12px; }
.sidebar-footer small { display: block; margin: 5px 0 0 14px; color: #697a93; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(130, 200, 75, .12); }
.main-content { min-width: 0; padding: 28px 38px 60px; }
.topbar, .section-heading, .panel-heading, .top-actions, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin-bottom: 0; font-size: 27px; letter-spacing: -.03em; }
.eyebrow { margin-bottom: 6px; color: #71809a; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.top-actions { justify-content: flex-end; }
.data-range, .ghost-button, .filter-button, .section-note { padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #526078; font-size: 12px; }
.ghost-button, .filter-button { cursor: pointer; }
.toolbar { position: sticky; top: 0; z-index: 15; justify-content: flex-end; margin: 18px -8px 0; padding: 8px; border: 1px solid rgba(228, 233, 241, .9); border-radius: 12px; background: rgba(244, 247, 251, .92); backdrop-filter: blur(10px); }
.range-switch, .segment-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #edf1f6; }
.range-switch { margin-right: auto; }
.range-switch button, .segment-switch button { padding: 7px 13px; border: 0; border-radius: 6px; background: transparent; color: #6e7b90; font-size: 11px; cursor: pointer; }
.range-switch button.active, .segment-switch button.active { background: #fff; color: #243248; box-shadow: 0 2px 7px rgba(34, 50, 73, .09); }
.date-control { display: flex; align-items: center; gap: 9px; color: #748096; font-size: 11px; }
.date-control input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #3b4960; }
.filter-menu { position: relative; }
.filter-popover { position: absolute; top: calc(100% + 9px); right: 0; z-index: 30; width: min(480px, calc(100vw - 48px)); max-height: 70vh; overflow: auto; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 24px 60px rgba(24, 39, 65, .18); }
.filter-popover-head { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.filter-popover-head strong, .filter-popover-head small { display: block; }
.filter-popover-head small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 11px; cursor: pointer; }
.provider-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.provider-filter { border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; }
.provider-filter summary { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 7px; padding: 10px; list-style: none; cursor: pointer; }
.provider-filter summary::-webkit-details-marker { display: none; }
.provider-filter summary strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.provider-filter summary small { color: #919bad; font-size: 9px; }
.method-list { display: grid; gap: 8px; max-height: 170px; overflow: auto; padding: 3px 10px 11px 35px; }
.method-list label { display: flex; gap: 7px; color: #667389; font-size: 10px; cursor: pointer; }
.primary-button { width: 100%; margin-top: 13px; padding: 10px 14px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.page-alert { margin-top: 16px; padding: 12px 14px; border: 1px solid #f3d7a5; border-radius: 9px; background: #fff8e7; color: #795513; font-size: 12px; }
.section-heading { margin: 28px 0 18px; }
.section-heading h2 { margin: 0; font-size: 22px; }
.section-note { color: #778399; background: #f8fafc; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card { position: relative; overflow: hidden; min-height: 128px; padding: 20px; }
.metric-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: #cbd3df; content: ""; }
.metric-card.accent-blue::before { background: var(--blue); }
.metric-card.accent-lime::before { background: var(--lime); }
.metric-card.accent-yellow::before { background: var(--yellow); }
.metric-card span, .metric-card small { display: block; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; overflow-wrap: anywhere; margin: 11px 0 7px; font-size: clamp(20px, 2vw, 27px); letter-spacing: -.04em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(240px, .75fr); gap: 14px; margin-top: 14px; }
.dashboard-grid.single { grid-template-columns: 1fr; }
.panel { min-width: 0; padding: 22px; }
.panel-heading h3, .insight-panel h3 { margin-bottom: 4px; font-size: 16px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.chart-unit { padding: 6px 9px; border-radius: 7px; background: #f1f4f8; color: #7c889b; font-size: 9px; text-transform: uppercase; }
.chart-canvas { display: grid; place-items: stretch; min-height: 310px; margin-top: 16px; }
.chart-canvas.compact { min-height: 260px; }
.chart-canvas.large { min-height: 360px; }
.chart-loading, .chart-empty { display: grid; place-items: center; height: 100%; min-height: inherit; border: 1px dashed #dce2eb; border-radius: 10px; color: #8995a8; font-size: 11px; }
.chart-loading span { width: 16px; height: 16px; margin-bottom: 8px; border: 2px solid #dce5f2; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.analytics-svg { display: block; width: 100%; height: 100%; min-height: inherit; overflow: visible; }
.svg-grid { stroke: #e8ecf2; stroke-width: 1; stroke-dasharray: 3 4; }
.svg-axis { fill: #8c98aa; font-size: 9px; }
.svg-series { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.svg-series.dashed { stroke-dasharray: 7 5; }
.svg-point { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.balance-line { stroke: #24334b; stroke-width: 3; }
.cash-bar { opacity: .92; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 9px; color: #67758a; font-size: 10px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; }
.legend-dot.deposit { background: var(--lime); }
.legend-dot.withdrawal { background: var(--yellow); }
.legend-line { display: inline-block; width: 16px; margin: 0 6px 3px 0; border-top: 2px solid #24334b; }
.rule-list { display: grid; gap: 12px; margin: 20px 0 0; padding-left: 18px; color: #67758a; font-size: 11px; line-height: 1.5; }
.withdrawal-time-panel, .section-panel { margin-top: 14px; }
.donut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.donut-layout { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 24px; min-height: 240px; }
.donut { position: relative; display: grid; place-items: center; width: 180px; aspect-ratio: 1; border-radius: 50%; }
.donut::before { position: absolute; width: 58%; aspect-ratio: 1; border-radius: 50%; background: #fff; content: ""; }
.donut > span { position: relative; display: grid; gap: 4px; text-align: center; }
.donut > span b { font-size: 17px; }
.donut > span small { color: var(--muted); font-size: 9px; }
.donut.donut-empty { border: 1px dashed #dce2eb; background: transparent !important; color: var(--muted); font-size: 11px; }
.donut.donut-empty::before { display: none; }
.donut-legend { display: grid; gap: 10px; }
.donut-legend > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #657287; font-size: 10px; }
.donut-legend span { display: flex; align-items: center; min-width: 0; }
.donut-legend i { flex: 0 0 auto; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; }
.donut-legend b { font-size: 10px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.login-page { min-height: 100vh; background: var(--navy); }
.login-shell { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 9vw; width: min(1100px, calc(100% - 48px)); min-height: 100vh; margin: auto; }
.login-brand { color: #fff; }
.login-brand .brand-mark { margin-bottom: 34px; }
.login-brand h1 { margin-bottom: 16px; font-size: 58px; letter-spacing: -.05em; }
.login-brand > p:last-child { max-width: 480px; color: #9aa9bf; font-size: 18px; line-height: 1.6; }
.login-card { padding: 38px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 20px; background: #fff; box-shadow: 0 28px 70px rgba(0, 0, 0, .25); }
.login-card h2 { margin-bottom: 8px; }
.login-form { display: grid; gap: 16px; margin-top: 24px; }
.login-form label { color: #59677c; font-size: 12px; }
.login-form input { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid #dce2ea; border-radius: 9px; outline: none; }
.login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(55, 124, 246, .12); }
.login-form button { padding: 13px; border: 0; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 750; cursor: pointer; }
.alert { margin-top: 18px; padding: 11px 12px; border-radius: 9px; background: #eef4ff; color: #315d9a; font-size: 12px; }
.alert.error { background: #fff0f0; color: #a43b3b; }
.alert.warning { background: #fff7dd; color: #805f08; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 78px 1fr; }
  .sidebar { padding: 24px 13px; }
  .brand > span:last-child, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-item span { font-size: 10px; }
  .sidebar-footer { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .donut-layout { grid-template-columns: 150px 1fr; }
  .donut { width: 145px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 13px 16px; }
  .side-nav { display: flex; margin: 0 0 0 auto; }
  .nav-item { width: auto; padding: 10px; }
  .main-content { padding: 22px 16px; }
  .topbar, .section-heading, .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar { position: static; margin: 14px 0 0; }
  .range-switch { margin-right: 0; }
  .filter-menu, .filter-button { width: 100%; }
  .filter-popover { right: auto; left: 0; width: min(480px, calc(100vw - 32px)); }
  .provider-filters { grid-template-columns: 1fr; }
  .metric-grid, .donut-grid { grid-template-columns: 1fr; }
  .donut-layout { grid-template-columns: 130px 1fr; }
  .donut { width: 125px; }
  .login-shell { grid-template-columns: 1fr; padding: 40px 0; }
  .login-brand h1 { font-size: 42px; }
  .login-brand > p:last-child { font-size: 15px; }
}
