*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --sidebar-w: 200px;
  --shell-header-h: 52px;
  --content-gap: 0;
  --content-pad-x: 0;
  --content-pad-y: 0;
  --page-bg: #dfe4eb;
  --sidebar-bg: #151b28;
  --sidebar-bg-top: #1a2236;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(96, 165, 250, 0.14);
  --sidebar-active-border: #60a5fa;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --panel-radius: 10px;
  --panel-border: #dde3ec;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
}

html,
body {
  margin: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  color: #16213e;
  background: #f5f6fa;
}

#mount-app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.muted {
  color: #6b7280;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-card .sub {
  margin: 0 0 28px;
  font-size: 14px;
}

.mobile-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.mobile-entry:active {
  background: #dbeafe;
}

.mobile-web-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 13px;
}

.mobile-web-banner a {
  flex-shrink: 0;
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.login-tab {
  flex: 1;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}

.login-tab.active {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #fff;
}

.member-shell .member-sidebar {
  background: linear-gradient(180deg, #1a2744 0%, var(--sidebar-bg) 100%);
}

.member-shell .main {
  flex: 1;
  min-height: 0;
  padding: 0;
}

.member-shell .main > .view-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--content-gap);
  overflow: hidden;
}

.member-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.member-profile-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.member-profile-card .label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

.member-profile-card .value {
  font-size: 22px;
  font-weight: 600;
}

.member-profile-card .value.balance {
  color: #0f766e;
}

.record-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 0;
}

.record-tab {
  height: 34px;
  padding: 0 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.record-tab.active {
  background: var(--sidebar-bg-top);
  border-color: var(--sidebar-bg-top);
  color: #fff;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #6b7280;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus {
  border-color: #16213e;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  background: #16213e;
  color: #fff;
  font-weight: 600;
}

.btn-primary.btn-inline {
  width: auto;
  margin-top: 0;
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.btn-primary.btn-inline:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

.btn-ghost.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: #f8fafc;
}

.btn-ghost.btn-sm:hover:not(:disabled) {
  background: #fff;
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.btn-danger.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.btn-danger.btn-sm:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-success {
  background: #dcfce7;
  color: #15803d;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}

.error-msg {
  margin-top: 12px;
  font-size: 13px;
  color: #b91c1c;
  min-height: 18px;
}

/* Layout */
.app-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  background: var(--page-bg);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(15, 23, 42, 0.06);
  z-index: 2;
}

.nav-divider {
  height: 1px;
  margin: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.brand {
  flex-shrink: 0;
  height: var(--shell-header-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.nav {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.nav-item {
  display: block;
  padding: 9px 12px;
  margin-bottom: 1px;
  border-radius: 7px;
  border-left: 2px solid transparent;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255, 255, 255, 0.92);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
  color: #fff;
  font-weight: 500;
}

.app-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  height: var(--shell-header-h);
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--panel-border);
  z-index: 1;
}

.app-topbar-user {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-all;
  text-align: right;
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  background: var(--page-bg);
}

#shop-views,
.main-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-panel:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
  margin: 0;
}

.view-panel:not(.hidden) > .page-head {
  flex-shrink: 0;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--panel-border);
  border-radius: 0;
  padding: 12px 16px 10px;
  min-height: auto;
  margin-bottom: 0;
  box-shadow: none;
}

.view-panel:not(.hidden) > .page-head + .panel,
.view-panel:not(.hidden) > .page-head + .panel-list,
.view-panel:not(.hidden) > .page-head + .records-panel {
  border-top: none;
  border-radius: 0;
  margin-top: 0;
  border: none;
}

.view-panel:not(.hidden) > .stat-cards {
  flex-shrink: 0;
  padding: 10px 12px 0;
  margin: 0;
  background: #fff;
}

.view-panel:not(.hidden) > .stat-cards + .panel,
.view-panel:not(.hidden) > .stat-cards + .panel-list {
  border-radius: 0;
  margin-top: 0;
}

.view-panel:not(.hidden) > .page-head,
.view-panel:not(.hidden) > .panel,
.view-panel:not(.hidden) > .panel-list,
.view-panel:not(.hidden) > .records-panel {
  box-shadow: none;
}

.view-panel:not(.hidden) > .member-spotlight,
.view-panel:not(.hidden) > .import-steps {
  flex-shrink: 0;
  margin: 0;
  padding: 0 12px 10px;
  background: #fff;
}

.view-panel.view-scroll:not(.hidden) {
  overflow-y: auto;
  gap: 0;
  padding: 12px;
  background: #fff;
}

.view-panel.view-scroll:not(.hidden) > .page-head {
  border-radius: 0;
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.view-panel:not(.hidden) > .panel:not(.panel-list),
.view-panel:not(.hidden) > .records-panel,
.view-panel:not(.hidden) > .panel-list {
  flex: 1;
  min-height: 0;
  background: #fff;
}

.panel-list,
.records-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border: none;
  border-radius: 0;
}

.panel {
  background: #fff;
  border-radius: 0;
  border: none;
  overflow: hidden;
}

.panel-list > .table-wrap,
.records-panel > .table-wrap,
.records-panel > .records-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #fafbfc;
}

.panel-list > .pagination {
  margin-top: auto;
  flex-shrink: 0;
}

.panel-list > .record-tabs,
.panel-list > .toolbar,
.panel-list > .records-panel-head {
  flex-shrink: 0;
  background: #fff;
}

.panel-list > .record-tabs {
  padding: 10px 16px 0;
}

.panel-list > .toolbar {
  padding: 6px 16px 8px;
}

.panel-list .table-wrap thead th,
.records-panel .table-wrap thead th,
.records-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  box-shadow: 0 1px 0 var(--panel-border);
}

.panel-list > .empty,
.records-panel > .empty-state {
  flex-shrink: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-head > div:first-child {
  min-width: 0;
  flex: 1;
}

.page-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

.page-desc {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-input {
  width: min(280px, 100%);
  min-width: 140px;
  flex: 1 1 160px;
  max-width: 320px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: #f8fafc;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: #93c5fd;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  background: #fff;
}

th,
td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #edf0f4;
  font-size: 13px;
  vertical-align: middle;
}

th {
  background: #f1f5f9;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.01em;
}

tbody tr:nth-child(even) {
  background: #fafbfc;
}

tbody tr:hover {
  background: #f0f7ff;
}

tbody tr:last-child td {
  border-bottom: none;
}

.actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.badge-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-off {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--panel-border);
  font-size: 12px;
  background: #fff;
  color: var(--text-secondary);
}

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  background: #fafbfc;
}

.table-wrap {
  overflow-x: auto;
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  min-width: 240px;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #16213e;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #b91c1c;
}

/* Modal */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  margin: 0 0 20px;
  font-size: 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.hint {
  margin-top: 6px;
  font-size: 12px;
}

.form-panel {
  padding: 28px 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.form-grid.single-col {
  grid-template-columns: 1fr;
  max-width: 420px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.field-select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
}

.date-input {
  width: 160px;
}

.toolbar-wrap {
  flex-wrap: wrap;
}

.pick-list {
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  max-height: 200px;
  overflow-y: auto;
}

.pick-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
}

.pick-item:hover {
  background: #f8fafc;
}

.pick-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: #6b7280;
}

.hint-box {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 13px;
  color: #475569;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.stat-card {
  background: #fff;
  border-radius: var(--panel-radius);
  border: 1px solid var(--panel-border);
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
}

.stat-value.income,
.income-text {
  color: #15803d;
}

.stat-value.expense,
.expense-text {
  color: #b91c1c;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #eef0f4;
  font-size: 13px;
  background: #fafbfc;
}

.import-result {
  margin-top: 0;
  padding: 16px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
  max-height: 360px;
  overflow-y: auto;
}

.hidden-file {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.import-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.import-card {
  display: flex;
  gap: 16px;
  background: #fff;
  border-radius: var(--panel-radius);
  border: 1px solid var(--panel-border);
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.import-step {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #16213e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

.import-card-body {
  flex: 1;
  min-width: 0;
}

.import-card-body h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.import-card-body p {
  margin: 0 0 6px;
  font-size: 14px;
}

.import-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.import-filename {
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn.is-loading .btn-label::after {
  content: '…';
  animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  33% { content: '.'; }
  66% { content: '..'; }
  100% { content: '...'; }
}

.modal-lg {
  max-width: 640px;
}

.modal-wide {
  max-width: 820px;
}

.detail-panel {
  margin-top: 20px;
}

.detail-panel-head {
  margin-bottom: 12px;
}

.detail-panel-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.detail-summary {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 14px;
}

.detail-panel .empty:not(.hidden) {
  display: block;
  padding: 24px;
  text-align: center;
}

/* 储值/消费查询与记录 */
.txn-query-toolbar {
  align-items: flex-start;
  gap: 10px;
}

.txn-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.member-spotlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f0f7ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}

.member-spotlight-compact {
  margin-bottom: 16px;
}

.member-spotlight-name {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.member-spotlight-meta {
  font-size: 13px;
  color: #64748b;
}

.member-spotlight-balance {
  text-align: right;
  flex-shrink: 0;
}

.member-spotlight-balance .label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 2px;
}

.member-spotlight-balance .value {
  font-size: 22px;
  font-weight: 700;
  color: #2563eb;
}

.records-panel {
  padding: 0;
  overflow: hidden;
}

.records-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafbfc;
}

.records-panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.records-count {
  font-size: 13px;
}

.records-table-wrap {
  max-height: none;
  overflow: auto;
}

.records-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.records-table tbody tr:hover {
  background: #f0f7ff;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

.empty-state.hidden {
  display: none;
}

.txn-modal {
  max-width: 440px;
}

.txn-form-grid {
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.txn-form-grid .modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 4px;
}

@media (max-width: 1100px) {
  .page-head {
    flex-wrap: wrap;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .search-input {
    flex: 1 1 100%;
    max-width: none;
  }
}

@media (max-width: 900px) {
  :root {
    --m-bottom-nav-h: 56px;
    --m-safe-b: env(safe-area-inset-bottom, 0px);
  }

  .app-shell {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: calc(var(--m-bottom-nav-h) + var(--m-safe-b));
  }

  /* 窄屏：侧栏收成底部横滑菜单，不再占顶部大半屏 */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: 100%;
    max-height: none;
    height: calc(var(--m-bottom-nav-h) + var(--m-safe-b));
    padding-bottom: var(--m-safe-b);
    flex-direction: row;
    align-items: stretch;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.12);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar .brand {
    display: none;
  }

  .nav {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-divider {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5em;
    margin: 0;
    padding: 0 12px;
    border-radius: 0;
    border-left: none;
    border-top: 2px solid transparent;
    font-size: 12px;
    white-space: nowrap;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-top-color: var(--sidebar-active-border);
    background: var(--sidebar-active-bg);
  }

  .main {
    padding: 0;
    overflow: visible;
    width: 100%;
  }

  #shop-views,
  .main-body,
  .view-panel:not(.hidden) {
    overflow: visible;
  }

  .app-topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-input {
    width: 100%;
    min-width: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .txn-form-grid {
    grid-template-columns: 1fr;
  }

  .member-spotlight {
    flex-direction: column;
    align-items: flex-start;
  }

  .member-spotlight-balance {
    text-align: left;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-web-banner {
    display: flex;
  }
}

/* Layout loader */
.layout-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.layout-loading-text {
  font-size: 15px;
}

.layout-error {
  max-width: 480px;
  margin: 4rem auto;
  padding: 2rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

