body { background: #f3f6fb; color: #182230; font-size: 15px; }
.public-main { min-height: 100vh; padding: 24px; }
.app-main { margin-left: 236px; padding: 24px; max-width: 1480px; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  background: #101828;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 1000;
}
.brand {
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  padding: 10px 12px 18px;
  letter-spacing: 0;
}
.side-nav { display: grid; gap: 5px; }
.side-nav a {
  color: #d0d5dd;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
}
.side-nav a:hover { background: #1d2939; color: white; }
.side-user { margin-top: auto; display: grid; gap: 10px; padding: 12px; color: #d1d5db; font-size: 13px; overflow-wrap: anywhere; }
.auth-panel { max-width: 420px; margin: 8vh auto; background: white; padding: 28px; border: 1px solid #dbe3ef; border-radius: 8px; }
.auth-panel h1, .page-head h1 { font-size: 24px; margin-bottom: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 16px; }
.page-head h1 { margin-bottom: 4px; font-weight: 750; }
.page-subtitle { margin: 0; color: #667085; }
.panel { background: white; border: 1px solid #d7e0ec; border-radius: 8px; padding: 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.panel h2 { font-size: 18px; margin-bottom: 14px; }
.section-head { display: flex; align-items: center; justify-content: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { margin-bottom: 0; }
.asset-ledger-filter { display: flex; align-items: center; gap: 8px; }
.asset-ledger-filter .form-select { min-width: 220px; width: auto; }
.asset-ledger-filter .direction-select { min-width: 130px; }
.asset-ledger-filter .btn { min-width: 64px; white-space: nowrap; flex: 0 0 auto; }
.asset-ledger-summary { display: flex; align-items: center; gap: 14px; color: #475467; white-space: nowrap; }
.asset-ledger-summary strong { color: #182230; }
.ledger-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tool-panel { display: flex; flex-direction: column; }
.ledger-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ledger-form-grid .span-2 { grid-column: span 2; }
.inline-trade-fields { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.9fr) minmax(100px, 0.9fr) minmax(120px, 1fr); gap: 10px; }
.account-create-form { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.9fr) minmax(150px, 0.9fr) minmax(150px, 0.8fr) 110px; gap: 10px; }
.account-create-v2 { align-items: end; }
.account-create-form .span-2 { grid-column: span 2; }
.api-check { align-self: end; min-height: 40px; display: flex; align-items: center; }
.api-grid { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 8px; min-width: 360px; }
.api-grid small { grid-column: span 2; }
.sync-error { grid-column: span 2; color: #b42318; font-size: 12px; }
.sync-error pre { margin: 6px 0 0; max-height: 120px; overflow: auto; white-space: pre-wrap; background: #fff5f5; border: 1px solid #fecdca; border-radius: 8px; padding: 8px; }
.api-inline { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.compact-control { min-width: 0; }
.account-card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.account-card { min-height: 0; }
.account-card-grid { display: grid; gap: 14px; align-items: start; }
.account-main-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; }
.account-api-box { display: grid; gap: 12px; }
.account-actions { white-space: nowrap; }
.account-actions-stack { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.account-actions .btn { min-width: 54px; }
.sync-token-editor { display: grid; gap: 8px; }
.token-input-row { display: grid; grid-template-columns: minmax(0, 1fr) 74px; gap: 8px; }
.token-list { display: flex; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.token-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #b2ddff; background: #eff8ff; color: #175cd3; border-radius: 999px; padding: 5px 9px; font-weight: 700; line-height: 1; }
.token-chip button { border: 0; background: transparent; color: #175cd3; padding: 0; line-height: 1; font-weight: 800; }
.mini-config-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 160px 180px 120px; gap: 12px; align-items: end; }
.mini-config-panel code { user-select: all; }
.form-control, .form-select, .btn { border-radius: 8px; }
.form-label { color: #344054; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: white; border: 1px solid #d7e0ec; border-radius: 8px; padding: 14px; min-height: 86px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.stat span { display: block; color: #667085; font-size: 13px; }
.stat strong { display: block; font-size: 22px; margin-top: 8px; overflow-wrap: anywhere; }
.pos { color: #087443 !important; }
.neg { color: #b42318 !important; }
.chart { height: 320px; }
.table { margin-bottom: 0; }
.table thead th { color: #475467; font-weight: 700; background: #f8fafc; }
.table tbody tr:hover { background: #fbfdff; }
.asset-ledger-table { min-width: 1120px; table-layout: auto; }
.asset-ledger-table th,
.asset-ledger-table td { vertical-align: middle; }
.asset-ledger-table .col-time { min-width: 148px; }
.asset-ledger-table .col-account { min-width: 120px; white-space: nowrap; }
.asset-ledger-table .col-type { min-width: 58px; white-space: nowrap; }
.asset-ledger-table .col-number { min-width: 92px; white-space: nowrap; }
.asset-ledger-table .col-policy { min-width: 96px; white-space: nowrap; }
.asset-ledger-table .col-source { min-width: 128px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; color: #667085; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; min-height: auto; }
  .side-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .side-user { margin-top: 12px; }
  .app-main { margin-left: 0; padding: 16px; }
  .ledger-tools { grid-template-columns: 1fr; }
  .ledger-form-grid { grid-template-columns: 1fr; }
  .ledger-form-grid .span-2 { grid-column: span 1; }
  .inline-trade-fields { grid-template-columns: 1fr; }
  .account-create-form { grid-template-columns: 1fr; }
  .account-create-form .span-2 { grid-column: span 1; }
  .account-card-list { grid-template-columns: 1fr; }
  .account-card-grid { grid-template-columns: 1fr; }
  .account-main-fields { grid-template-columns: 1fr; }
  .api-grid { min-width: 0; grid-template-columns: 1fr; }
  .api-grid small, .sync-error { grid-column: span 1; }
  .account-actions-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-config-form { grid-template-columns: 1fr; }
  .section-head { align-items: stretch; flex-direction: column; }
  .asset-ledger-filter { flex-wrap: wrap; }
  .asset-ledger-filter .form-select { min-width: 0; flex: 1 1 180px; }
  .asset-ledger-summary { flex-wrap: wrap; white-space: normal; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: flex-start; flex-direction: column; gap: 8px; }
}
