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

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e6eaf0;
  --text: #1d2129;
  --text-secondary: #86909c;
  --primary: #1677ff;
  --primary-hover: #4096ff;
  --primary-light: #e8f3ff;
  --success: #00b42a;
  --danger: #f53f3f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.5;
}

.hidden { display: none !important; }

.client-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4096ff, #1677ff);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}

.nav-item:hover { color: var(--primary); background: var(--primary-light); }
.nav-item.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-badge {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-login-btn {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-light);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.header-login-btn:hover { background: #d6e8ff; }

/* Main */
.main {
  padding: 20px 16px 24px;
}

.page { display: none; }
.page.active { display: block; }

.page-head { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-desc { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card.highlight {
  background: linear-gradient(135deg, #f0f7ff, #fff);
  border-color: #c9e0ff;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-num.online { color: var(--success); }
.stat-num.offline { color: var(--danger); }
.stat-num.balance { font-size: 17px; }

/* Profit page */
.profit-summary-card {
  background: linear-gradient(135deg, #fff7e6, #fff);
  border: 1px solid #ffd591;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.profit-summary-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

.profit-summary-item { text-align: center; }

.profit-summary-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.profit-summary-num.profit { color: #fa8c16; }

.profit-summary-num.red-packet { color: #cf1322; }

.profit-summary-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.profit-summary-divider {
  width: 1px;
  height: 48px;
  background: #ffd591;
}

.profit-guest {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.profit-guest p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.profit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  cursor: pointer;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: all .15s;
}

.profit-item:hover { border-color: #ffd591; background: #fffbf0; }

.profit-item-body { flex: 1; min-width: 0; }

.profit-item-title { font-size: 15px; font-weight: 600; word-break: break-all; }

.profit-item-side {
  flex-shrink: 0;
  text-align: center;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fff7e6, #fff);
  border: 1px solid #ffd591;
  border-radius: 10px;
  min-width: 88px;
}

.profit-item-side.red-side {
  background: linear-gradient(135deg, #fff1f0, #fff);
  border-color: #ffccc7;
}

.profit-side-value.red-value { color: #cf1322; }

.profit-side-label { font-size: 12px; color: #999; margin-bottom: 4px; }

.profit-side-value {
  font-size: 20px;
  font-weight: 800;
  color: #fa8c16;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.profit-item-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.6;
}

.profit-back {
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
  margin-bottom: 12px;
  display: inline-block;
}

.profit-detail-meta {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fafbfc;
  border-radius: 10px;
}

.profit-detail-wrap {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.profit-detail-wrap table { font-size: 11px; border-collapse: collapse; }
.profit-detail-wrap td, .profit-detail-wrap th { border: 1px solid #ddd; padding: 3px 5px; }

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Panels */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
}

.panel-tip {
  font-size: 12px;
  color: var(--text-secondary);
}

.panel .qr-area,
.panel .account-list-wrap {
  padding: 20px;
}

.qr-area {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.qr-frame {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #fafbfc;
  transition: border-color .2s;
}

.qr-frame:has(img) {
  border-style: solid;
  border-color: var(--border);
  background: #fff;
}

.qr-frame img { width: 180px; height: 180px; object-fit: contain; }
.qr-loading { color: var(--text-secondary); font-size: 14px; }

.qr-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 14px;
  max-width: 280px;
}

.qr-status.ok { color: var(--success); }
.qr-status.err { color: var(--danger); }
.qr-hint { font-size: 12px; color: #b0b8c4; margin-top: 6px; }

.account-list-wrap { min-height: 120px; }

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fafbfc;
  border: 1px solid transparent;
  transition: all .15s;
}

.account-item:last-child { margin-bottom: 0; }
.account-item:hover { border-color: var(--border); background: #fff; }

.acct-project-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  min-width: 140px;
}

.account-manage-list { min-height: 120px; }

.account-manage-notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff7e6 0%, #fffbe6 100%);
  border: 1px solid #ffe58f;
}

.account-manage-notice.hidden { display: none; }

.account-manage-notice .notice-label {
  font-size: 12px;
  font-weight: 700;
  color: #d48806;
  margin-bottom: 6px;
}

.account-manage-notice .notice-body {
  font-size: 14px;
  line-height: 1.6;
  color: #614700;
  white-space: pre-wrap;
  word-break: break-word;
}

.acct-manage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
}

.acct-manage-search {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.acct-manage-search:focus {
  outline: none;
  border-color: #91caff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.12);
}

.acct-manage-search-tip {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.home-account-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}

.home-account-toolbar .acct-manage-search {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

.home-account-filter {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  min-width: 100px;
}

.home-account-filter:focus {
  outline: none;
  border-color: #91caff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.12);
}

.acct-manage-remark {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  word-break: break-all;
}

.acct-manage-remark-label {
  color: #94a3b8;
  margin-right: 4px;
}

.acct-manage-remark-text {
  color: #334155;
  font-weight: 500;
}

.acct-manage-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fafbfc;
  border: 1px solid #eef0f3;
}

.acct-manage-item:last-child { margin-bottom: 0; }

.acct-manage-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.acct-manage-meta {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

.acct-manage-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.acct-status-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  min-width: 100px;
}

.sync-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.sync-badge.ok { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.sync-badge.pending { background: #fff7e6; color: #d46b08; border: 1px solid #ffd591; }
.sync-badge.none { background: #fafafa; color: #bbb; border: 1px solid #eee; }

.scanner-status-tag {
  font-size: 12px;
  color: #666;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 6px;
}

.account-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #91caff, #1677ff);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-name {
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  margin-top: 2px;
}

.account-status.online { color: var(--success); }
.account-status.offline { color: var(--danger); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.account-remark-input {
  flex: 1;
  min-width: 0;
  max-width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
}

.account-remark-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
}

.account-remark-input::placeholder { color: #b0b8c4; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
  font-family: inherit;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; width: 100%; padding: 11px; font-size: 15px; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; padding: 10px 24px; }
.btn-success:hover:not(:disabled) { filter: brightness(1.05); }
.btn-refresh { background: #fff; color: var(--primary); border: 1px solid #91caff; padding: 8px 20px; font-size: 13px; margin-top: 4px; }
.btn-refresh:hover:not(:disabled) { background: var(--primary-light); }
.btn-remove { background: #fff; color: var(--danger); border: 1px solid #ffccc7; padding: 5px 12px; font-size: 12px; border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.btn-remove:hover { background: #fff2f0; }
.btn-logout { width: 100%; background: #fff; color: var(--text-secondary); border: 1px solid var(--border); padding: 11px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn-logout:hover { color: var(--danger); border-color: #ffccc7; }

.guest-tip { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }
.guest-skip { color: var(--text-secondary); font-size: 13px; margin-top: 14px; cursor: pointer; }
.guest-skip:hover { color: var(--primary); }

.empty { text-align: center; padding: 32px 16px; color: #c2c8d0; font-size: 13px; }
.err-msg { color: var(--danger); font-size: 12px; margin-top: 8px; text-align: center; }

/* Mine */
.mine-guest {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 24px 0;
}

.guest-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.guest-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.guest-icon svg { width: 28px; height: 28px; }

.guest-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.guest-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }
.guest-features { text-align: left; background: #f7f9fc; border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; font-size: 13px; color: #4e5969; }
.guest-features li { list-style: none; margin-bottom: 8px; padding-left: 14px; position: relative; }
.guest-features li::before { content: ''; position: absolute; left: 0; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.guest-features li:last-child { margin-bottom: 0; }

.login-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-family: inherit;
}

.login-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,119,255,0.1); }

.mine-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mine-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: stretch;
}

.user-card {
  background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(22,119,255,0.25);
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-name { font-size: 17px; font-weight: 600; }
.user-meta { font-size: 12px; opacity: 0.85; margin-top: 4px; }

.key-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  min-width: 200px;
  box-shadow: var(--shadow);
}

.key-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.key-value { font-size: 15px; font-weight: 600; color: var(--primary); letter-spacing: 0.5px; word-break: break-all; }

.mine-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mine-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-header .section-title { margin-bottom: 0; }
.section-more { font-size: 13px; color: var(--primary); cursor: pointer; }
.section-more:hover { color: var(--primary-hover); }

.mine-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.project-tip { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
.project-tip-sub { color: #d48806; }
.project-save-bar {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #f7f8fa;
  border: 1px solid #eef0f3;
}
.project-save-bar.dirty {
  background: #fff7e6;
  border: 1px solid #ffd591;
}
.project-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f2f3f5; }
.project-dirty-tip { font-size: 13px; color: #d46b08; font-weight: 600; margin-bottom: 10px; }
.project-action-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.project-save-btn {
  flex: 1;
  min-width: 160px;
  min-height: 44px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.28);
}
.project-save-btn.disabled,
.project-save-btn:disabled {
  background: #c9cdd4;
  cursor: not-allowed;
}
.project-reset-btn {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}
.project-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #f2f3f5;
}

.project-item-tap {
  cursor: pointer;
}

.project-item-tap:active {
  opacity: 0.85;
}

.project-check-box {
  width: 20px;
  height: 20px;
  border: 2px solid #bfbfbf;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-sizing: border-box;
}

.project-check-box.on {
  background: #1890ff;
  border-color: #1890ff;
}

.project-check-mark {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.project-item:last-child { border-bottom: none; }
.project-item.disabled { opacity: 0.55; }
.project-info { flex: 1; min-width: 0; }
.project-name { font-size: 15px; font-weight: 600; color: var(--text); }
.project-meta { margin-top: 6px; line-height: 1.45; }
.project-price { font-size: 13px; color: var(--text-secondary); }
.project-req { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.project-amt { color: var(--primary); font-weight: 600; }
.project-tag { font-size: 12px; padding: 3px 10px; border-radius: 4px; flex-shrink: 0; margin-top: 2px; }
.project-tag.ok { background: #e8ffea; color: var(--success); }
.project-tag.no { background: #fff2f0; color: var(--danger); }
.project-tag.warn { background: #fff7e6; color: #d48806; }

.recharge-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  font-family: inherit;
}

.mine-stat-card.clickable {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mine-stat-card.clickable:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.12);
}

.mine-stat-card.clickable:active { transform: scale(0.98); }

.mine-announcement {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: #ad6800;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.home-announcement {
  margin-bottom: 16px;
}

.home-announcement.hidden {
  display: none;
}

.announcement-card {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  padding: 14px 16px;
  box-sizing: border-box;
}

.announcement-text {
  font-size: 13px;
  color: #ad6800;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.project-more {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 14px 0 4px;
  border-top: 1px dashed #e8e8e8;
  margin-top: 8px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay.hidden { display: none; }

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 0 20px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  animation: sheetUp 0.22s ease;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-head {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sheet-cancel {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.sheet-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.sheet-spacer { width: 40px; }
.sheet-balance { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; text-align: center; }
.recharge-buy-link { text-align: center; margin-bottom: 12px; }
.recharge-buy-link a { font-size: 13px; color: var(--primary); text-decoration: none; }
.recharge-buy-link a:hover { text-decoration: underline; }

.sheet-submit { width: 100%; margin-top: 4px; }

@media (min-width: 768px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 16px; max-width: 420px; }
}

.recharge-input:focus { outline: none; border-color: var(--primary); }

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f2f3f5;
}

.log-item:last-child { border-bottom: none; }
.log-type { font-size: 14px; }
.log-remark { font-size: 12px; color: var(--primary); margin-top: 2px; }
.log-time { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.log-amount { font-size: 15px; font-weight: 600; }
.log-amount.plus { color: var(--success); }
.log-amount.minus { color: var(--danger); }

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  max-width: min(85%, 360px);
  text-align: center;
  pointer-events: none;
}

/* Mobile bottom nav */
@media (max-width: 767px) {
  .site-nav { display: none; }

  .client-shell { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

  .site-header-inner::after {
    content: '';
    flex: 1;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
  }

  .mobile-nav-item {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 0 8px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .mobile-nav-item.active { color: var(--primary); font-weight: 600; }
  .mobile-nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-nav-icon svg { width: 22px; height: 22px; }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid .stat-card:nth-child(4) { grid-column: 1; }
  .stats-grid .stat-card:nth-child(5) { grid-column: 2 / span 2; }

  .page-title { font-size: 18px; }
  .mine-top { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  .mobile-nav { display: none; }

  .main { padding: 28px 24px 32px; }

  .home-grid {
    grid-template-columns: 380px 1fr;
    align-items: start;
  }

  .panel-accounts .account-list-wrap {
    max-height: 400px;
    overflow-y: auto;
  }

  .panel-accounts .account-list-wrap::-webkit-scrollbar { width: 5px; }
  .panel-accounts .account-list-wrap::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 3px; }

  .qr-frame { width: 220px; height: 220px; }
  .qr-frame img { width: 200px; height: 200px; }

  .mine-grid-2 { grid-template-columns: 1fr 1fr; }

  .btn-primary { max-width: 320px; }
}

@media (min-width: 1024px) {
  .stats-grid { gap: 16px; }
  .stat-num { font-size: 24px; }
}

@media (max-width: 400px) {
  .stat-num { font-size: 16px; }
  .stat-card { padding: 12px 8px; }
}

/* Profit update popup */
.profit-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.profit-popup {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 20px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.profit-popup-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.profit-popup-sub {
  font-size: 14px;
  color: var(--danger);
  text-align: center;
  margin-top: 4px;
  margin-bottom: 16px;
}

.profit-popup-body {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  max-height: 240px;
  overflow-y: auto;
}

.profit-popup-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.profit-popup-item:last-child {
  border-bottom: none;
}

.profit-popup-item-name {
  flex: 1;
  font-weight: 500;
}

.profit-popup-item-meta {
  text-align: right;
  white-space: nowrap;
  color: var(--success);
  font-weight: 600;
}

.profit-popup-summary {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.profit-popup-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.profit-popup-btn:hover {
  background: var(--primary-hover);
}
