:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #172033;
  background: #f5f7fb;
}

* { box-sizing: border-box; }
body { margin: 0; }

.login-card {
  width: min(420px, calc(100% - 32px));
  margin: 10vh auto;
  background: #fff;
  padding: 32px;
  border-radius: 14px;
  box-shadow: 0 15px 50px #24334c1c;
}
.login-card h1 { margin-bottom: 6px; }
.login-card p { color: #667085; }
.login-card label { display: block; margin: 18px 0 6px; }

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(280px, 390px);
  gap: 0;
  width: min(920px, calc(100% - 32px));
  min-height: 560px;
  margin: 8vh auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px #24334c1a;
}
.login-panel {
  min-width: 0;
  padding: 48px 52px 36px;
  background: #fff;
}
.login-brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
}
.login-brand strong { display: block; color: #172033; font-size: 15px; }
.login-brand small { display: block; margin-top: 2px; color: #98a2b3; font-size: 11px; letter-spacing: .04em; }
.login-heading { margin: 62px 0 28px; }
.eyebrow { margin: 0 0 9px; color: #1d4ed8; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.login-heading h1 { margin: 0; color: #101828; font-size: 32px; line-height: 1.2; }
.login-heading p:last-child { margin: 9px 0 0; color: #667085; font-size: 14px; }
.login-field { display: block; margin: 0 0 18px !important; color: #344054; font-size: 13px; font-weight: 600; }
.login-field input { margin-top: 8px; padding: 12px 13px; border-color: #d0d5dd; border-radius: 7px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.login-field input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px #2563eb1c; outline: 0; }
.password-control { position: relative; display: block; }
.password-control input { padding-right: 60px; }
.password-toggle { position: absolute; top: 8px; right: 7px; padding: 7px 8px; border-radius: 5px; background: transparent; color: #475467; font-size: 12px; }
.password-toggle:hover { background: #f2f4f7; }
.login-options { display: flex; min-height: 21px; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 22px; }
.checkbox-label { display: inline-flex !important; align-items: center; gap: 7px; margin: 0 !important; color: #667085; font-size: 13px; font-weight: 400; }
.checkbox-label input { width: 15px; height: 15px; margin: 0; accent-color: #2563eb; }
.login-hint { color: #b54708; font-size: 12px; }
.login-submit { width: 100%; padding: 12px 16px; border-radius: 7px; background: #1d4ed8; font-weight: 700; }
.login-submit:hover { background: #1e40af; }
.login-submit:focus-visible, .link-button:focus-visible, .dialog-close:focus-visible, .password-toggle:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.login-error { min-height: 20px; margin: 11px 0 0; font-size: 13px; line-height: 1.5; }
.login-footnote { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 30px; padding-top: 18px; border-top: 1px solid #eaecf0; color: #98a2b3; font-size: 12px; line-height: 1.5; }
.link-button { padding: 0; background: transparent; color: #1d4ed8; font-size: 12px; }
.link-button:hover { color: #1e40af; text-decoration: underline; }
.login-aside { display: flex; flex-direction: column; justify-content: flex-end; gap: 0; min-width: 0; padding: 48px 42px; background: #111b2e; color: #fff; }
.login-aside .eyebrow { color: #93c5fd; }
.login-aside h2 { margin: 0; color: #fff; font-size: 29px; line-height: 1.35; letter-spacing: -.02em; }
.login-aside > p:not(.eyebrow) { margin: 18px 0 0; color: #c9d3e6; font-size: 14px; line-height: 1.75; }
.login-aside-list { display: grid; gap: 0; margin-top: 42px; border-top: 1px solid #34435f; }
.login-aside-list div { display: flex; align-items: baseline; gap: 14px; padding: 15px 0; border-bottom: 1px solid #34435f; }
.login-aside-list strong { color: #93c5fd; font-size: 12px; letter-spacing: .08em; }
.login-aside-list span { color: #e4e7ec; font-size: 13px; }
.access-dialog { width: min(500px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 24px 70px #10182838; }
.access-dialog::backdrop { background: #10182899; }
.access-dialog-content { position: relative; padding: 30px; }
.access-dialog-content h2 { margin: 0 0 10px; color: #101828; font-size: 23px; }
.access-dialog-content > p:not(.eyebrow) { margin: 0; color: #475467; font-size: 14px; line-height: 1.7; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 30px; height: 30px; padding: 0; border-radius: 5px; background: transparent; color: #667085; font-size: 22px; line-height: 1; }
.dialog-close:hover { background: #f2f4f7; }
.access-steps { display: grid; gap: 0; margin: 24px 0; border-top: 1px solid #eaecf0; }
.access-steps div { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 11px; padding: 13px 0; border-bottom: 1px solid #eaecf0; }
.access-steps strong { grid-row: span 2; color: #1d4ed8; font-size: 12px; }
.access-steps span { color: #344054; font-size: 13px; font-weight: 700; }
.access-steps small { margin-top: 3px; color: #667085; line-height: 1.5; }
.access-dialog-content > .secondary { width: 100%; }

input, select, textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  margin-top: 6px;
  font: inherit;
}

textarea { min-height: 92px; resize: vertical; }

button {
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
}
button:disabled { opacity: .5; cursor: not-allowed; }
.secondary { background: #475467; }
.danger { background: #b42318; }
.error { color: #c62828; margin-top: 14px; }
.success { color: #067647; }
.muted { color: #667085; }
.app-feedback {
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid #a6f4c5;
  border-radius: 6px;
  background: #ecfdf3;
  color: #067647;
}
.app-feedback.error {
  margin-top: 0;
  border-color: #fecdca;
  background: #fef3f2;
  color: #b42318;
}
.page-state { padding: 22px 4px; }
.page-state p { margin: 0 0 12px; }
.empty-cell { padding: 28px 12px; color: #667085; text-align: center; }

#app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
#app[hidden] { display: none !important; }
aside {
  background: #111b2e;
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
nav { display: grid; gap: 8px; }
nav button { background: transparent; text-align: left; color: #c9d3e6; }
nav button.active { background: #263653; color: #fff; }
.ghost { margin-top: auto; background: #263653; }

section { min-width: 0; padding: 24px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
header h2 { margin: 0; }
#identity { text-align: right; overflow-wrap: anywhere; }
.header-account { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.header-account button { padding: 7px 11px; }
.panel { background: #fff; border-radius: 12px; padding: 22px; min-height: 260px; overflow: auto; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cards-compact { grid-template-columns: minmax(220px, 360px); }
.cards-two { grid-template-columns: repeat(2, minmax(220px, 360px)); }
.card { border: 1px solid #e4e7ec; border-radius: 10px; padding: 18px; }
.card strong { display: block; font-size: 26px; margin-top: 8px; }
.dashboard-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-wide { grid-column: 1 / -1; }
.dashboard-section { min-width: 0; padding: 18px; border: 1px solid #e4e7ec; border-radius: 8px; }
.dashboard-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dashboard-heading h3 { margin: 0; }
.dashboard-heading p { margin: 6px 0 0; line-height: 1.55; }
.metric-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 18px 0 0; border-top: 1px solid #eaecf0; border-bottom: 1px solid #eaecf0; }
.metric-strip > div { min-width: 0; padding: 14px 12px; border-left: 1px solid #eaecf0; }
.metric-strip > div:first-child { border-left: 0; }
.metric-strip dt, .summary-list dt { color: #667085; font-size: 13px; }
.metric-strip dd { margin: 6px 0 0; color: #172033; font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.metric-strip-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-strip-compact > div:nth-child(4) { border-left: 0; }
.summary-list { margin: 16px 0 0; }
.summary-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #eaecf0; }
.summary-list dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.dashboard-action-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid #eaecf0; }
.dashboard-action-row div { display: grid; gap: 3px; }
.dashboard-action-row strong { font-size: 22px; }
.dashboard-action-row span { color: #667085; }
.dashboard-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.detail-toolbar > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0 0 22px; }
.detail-grid > div { min-width: 0; padding: 11px 0; border-bottom: 1px solid #eaecf0; }
.detail-grid dt { color: #667085; font-size: 13px; }
.detail-grid dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.detail-sections { margin-bottom: 24px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid #eaecf0; white-space: nowrap; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wrap { white-space: normal; overflow-wrap: anywhere; }
.trace-id { color: #475467; font-size: 12px; }
.table-subline { display: block; margin-top: 4px; color: #667085; }
.tag { display: inline-block; padding: 3px 7px; border-radius: 4px; background: #f2f4f7; color: #344054; font-size: 13px; }
.tag-success { background: #ecfdf3; color: #067647; }
.tag-warning { background: #fffaeb; color: #b54708; }
.tag-danger { background: #fef3f2; color: #b42318; }
.tag-neutral { background: #f2f4f7; color: #475467; }
.code-box { white-space: pre-wrap; word-break: break-all; background: #101828; color: #e6edf7; padding: 16px; border-radius: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.form-grid label { display: block; }
.form-grid button { align-self: end; }
.form-actions { display: flex; align-items: center; align-self: end; flex-wrap: wrap; gap: 10px; }
.form-actions button { flex: 1 1 120px; }
.form-inline { display: flex; gap: 10px; align-items: end; margin-bottom: 22px; }
.form-inline > label { flex: 1 1 170px; min-width: 0; color: #475467; font-size: 13px; }
.form-inline input { margin: 0; min-width: 0; }
.form-inline select { min-width: 0; }
.form-inline > label input, .form-inline > label select { margin-top: 6px; }
.form-inline button { flex: 0 0 auto; }
.section-actions { display: flex; justify-content: flex-end; margin: 16px 0; }
.dimension-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.dimension-switch button { background: #e4e7ec; color: #344054; }
.dimension-switch button.active { background: #344054; color: #fff; }
.earnings-mode-switch { padding-bottom: 14px; border-bottom: 1px solid #eaecf0; }
.reconciliation-filter { max-width: 520px; }
.reconciliation-return {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 10px 12px;
  border-left: 3px solid #667085;
  background: #f8fafc;
}
.reconciliation-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 7px;
}
.reconciliation-status strong { display: block; font-size: 17px; }
.reconciliation-status p { margin: 5px 0 0; line-height: 1.5; }
.reconciliation-status small { white-space: nowrap; }
.reconciliation-status.is-ok { border-color: #a6f4c5; background: #ecfdf3; color: #067647; }
.reconciliation-status.has-issues { border-color: #fecdca; background: #fef3f2; color: #b42318; }
.reconciliation-comparison { margin-bottom: 10px; }
.reconciliation-comparison table { min-width: 620px; }
.reconciliation-comparison th:first-child,
.reconciliation-comparison td:first-child { font-weight: 700; }
.reconciliation-note { margin: 10px 0 22px; line-height: 1.6; }
.reconciliation-issues,
.reconciliation-detail {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eaecf0;
}
.reconciliation-issue-list { margin-top: 12px; border-top: 1px solid #eaecf0; }
.reconciliation-issue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 10px;
  border-bottom: 1px solid #eaecf0;
}
.reconciliation-issue-row.active { background: #f8fafc; }
.reconciliation-issue-row strong { display: block; }
.reconciliation-issue-row p { margin: 4px 0 0; color: #667085; line-height: 1.45; }
.reconciliation-issue-action { display: flex; align-items: center; gap: 12px; }
.reconciliation-issue-action span { min-width: 58px; font-weight: 700; text-align: right; }
.reconciliation-empty { margin: 16px 0 0; color: #067647; }
.reconciliation-detail .dashboard-heading { margin-bottom: 12px; }
.wallet-composition { min-width: 220px; margin: 0; }
.wallet-composition div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.wallet-composition dt { color: #667085; }
.wallet-composition dd { margin: 0; font-variant-numeric: tabular-nums; }
.reconciliation-trace-actions { display: grid; gap: 7px; min-width: 126px; }
.stats-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 12px 0 18px; }
.stats-meta p { margin: 0; line-height: 1.55; }
.audit-filter { flex-wrap: wrap; }
.audit-filter > label { flex: 1 1 150px; min-width: 0; color: #475467; font-size: 13px; }
.audit-code { display: block; margin-top: 4px; color: #667085; }
.audit-details { min-width: 220px; margin: 0; padding: 0; border: 0; }
.audit-details pre {
  max-width: 460px;
  max-height: 220px;
  margin: 10px 0 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 7px;
  background: #f8fafc;
  color: #344054;
}

details { border: 1px solid #e4e7ec; border-radius: 9px; padding: 14px; margin-bottom: 20px; }
summary { font-weight: 700; cursor: pointer; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; }

.review-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 24px 70px #10182838;
  overflow: auto;
}
.review-dialog::backdrop { background: #10182899; }
.action-confirm-dialog { width: min(460px, calc(100% - 32px)); }
.action-confirm-dialog p { line-height: 1.65; color: #475467; }
.review-form { padding: 24px; }
.review-form h3 { margin: 0 0 18px; }
.review-form > label { display: block; margin-top: 14px; }
.review-summary { margin: 0 0 18px; padding: 14px; border-radius: 8px; background: #f8fafc; }
.review-summary div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 5px 0; }
.review-summary dt { color: #667085; }
.review-summary dd { margin: 0; overflow-wrap: anywhere; }
.review-record { display: grid; gap: 4px; min-width: 180px; }
.review-record small { color: #667085; }
.withdrawal-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 720px) {
  .login-screen { display: block; width: min(460px, calc(100% - 24px)); min-height: 0; margin: 24px auto; border-radius: 12px; }
  .login-panel { padding: 30px 24px 24px; }
  .login-heading { margin: 42px 0 24px; }
  .login-heading h1 { font-size: 28px; }
  .login-aside { padding: 28px 24px; }
  .login-aside h2 { font-size: 24px; }
  .login-aside-list { margin-top: 28px; }
  .login-footnote { align-items: flex-start; flex-direction: column; gap: 7px; }
  #app { grid-template-columns: minmax(0, 1fr); width: 100%; }
  aside { min-width: 0; padding: 14px; }
  nav { display: flex; min-width: 0; max-width: 100%; overflow: auto; }
  nav button { flex: 0 0 auto; }
  .ghost { margin: 0; }
  section { padding: 14px; }
  header { align-items: flex-start; flex-wrap: wrap; }
  #identity { text-align: left; }
  .header-account { width: 100%; justify-content: space-between; }
  .cards { grid-template-columns: 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-wide { grid-column: auto; }
  .dashboard-heading { display: grid; }
  .dashboard-heading button { width: 100%; }
  .metric-strip, .metric-strip-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip > div:nth-child(odd) { border-left: 0; }
  .metric-strip-compact > div:nth-child(4) { border-left: 1px solid #eaecf0; }
  .dashboard-action-row { align-items: stretch; flex-direction: column; }
  .dashboard-action-row button, .dashboard-buttons button { width: 100%; }
  .detail-toolbar { align-items: stretch; flex-direction: column; }
  .detail-toolbar > div { display: grid; grid-template-columns: 1fr; }
  .detail-toolbar button { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-inline { display: grid; }
  .form-inline button { width: 100%; }
  .dimension-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dimension-switch button { width: 100%; }
  .reconciliation-return,
  .reconciliation-status,
  .reconciliation-issue-row { align-items: stretch; flex-direction: column; }
  .reconciliation-return button,
  .reconciliation-detail .dashboard-heading button { width: 100%; }
  .reconciliation-status small { white-space: normal; }
  .reconciliation-issue-action { justify-content: space-between; }
  .reconciliation-issue-action button { width: auto; }
  .reconciliation-issue-action span { text-align: left; }
  .reconciliation-trace-actions button { width: 100%; }
  .stats-meta { display: grid; }
  .panel { padding: 14px; }
  .pager { flex-wrap: wrap; gap: 10px; }
  .review-dialog { width: calc(100% - 24px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .review-form { padding: 18px; }
  .review-summary div { grid-template-columns: 1fr; gap: 2px; }
  .withdrawal-actions { flex-direction: column; }
  .withdrawal-actions button { width: 100%; }
  .dialog-actions button { flex: 1 1 0; }
}
