:root {
  --bg-page: #f0f4ff;
  --bg-surface: rgba(255, 255, 255, 0.85);
  --blue-primary: #2563eb;
  --blue-soft: #eff6ff;
  --blue-ring: rgba(37, 99, 235, 0.2);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-subtle: #e5e7eb;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -1px rgba(0,0,0,.03);
  --shadow-float: 0 10px 25px -5px rgba(0,0,0,.1);
  --tab-height: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #f0f4ff 0%, #e0eaff 100%);
  color: var(--text-primary); overflow: hidden;
}

/* 玻璃拟态卡片 */
.card {
  background: var(--bg-surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* 登录页 */
#login-page {
  height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  transition: opacity 0.3s ease;
}
.login-box { width: 100%; max-width: 360px; padding: 32px 24px; }
.login-header { text-align: center; margin-bottom: 24px; }
.brand-logo {
  width: 48px; height: 48px; background: var(--blue-primary); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.login-header h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.login-header p { margin: 0; font-size: 13px; color: var(--text-secondary); }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.input-with-icon { position: relative; width: 100%; }
.input-with-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.input-with-icon .input { padding-left: 40px; }

.input {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); background: #fff; font-size: 15px;
  transition: all .2s; outline: none;
}
.input:focus { border-color: var(--blue-primary); box-shadow: 0 0 0 3px var(--blue-ring); }

.input-group { display: flex; gap: 12px; width: 100%; }
.captcha-box {
  width: 100px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--blue-soft); color: var(--blue-primary); font-weight: 700; font-size: 18px; letter-spacing: 4px;
  border-radius: var(--radius-md); cursor: pointer; user-select: none;
}
.login-options { margin: 20px 0; font-size: 13px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--blue-primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px;
  border-radius: var(--radius-md); border: none; font-size: 15px; font-weight: 600; cursor: pointer; transition: .2s;
}
.btn-primary { background: var(--blue-primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }
.btn-primary:active { transform: scale(0.98); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }

/* 后台框架 */
.admin-shell { display: flex; height: 100vh; }
.admin-sidebar {
  width: 220px; background: var(--bg-surface); backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle); padding: 20px 12px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 10px 10px 24px; }
.brand-mark { width: 24px; height: 24px; border-radius: 8px; background: var(--blue-primary); }
.brand-text { font-size: 16px; font-weight: 700; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-md);
  color: var(--text-secondary); text-decoration: none; font-size: 14px; font-weight: 500; transition: .2s;
}
.nav-item.active { background: var(--blue-primary); color: #fff; box-shadow: 0 4px 10px rgba(37,99,235,0.2); }
.nav-icon { display: flex; }

.admin-main {
  flex: 1; height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain; padding: 24px;
}
.sub-page { display: none; animation: fade-in .3s ease-out; }
.sub-page.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 数据大盘网格 */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 8px; }
.stat-title { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.text-primary { color: var(--blue-primary); }

/* 空状态 */
.empty { text-align: center; padding: 40px 0; color: var(--text-tertiary); font-size: 14px; }

/* 手机端底部 Tab */
@media (max-width: 768px) {
  .admin-shell { flex-direction: column; padding-bottom: var(--tab-height); }
  .admin-sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: var(--tab-height);
    padding: 0; border-right: none; border-top: 1px solid var(--border-subtle);
    z-index: 100; background: #fff;
  }
  .sidebar-brand { display: none; }
  .sidebar-nav { flex-direction: row; height: 100%; }
  .nav-item { flex: 1; flex-direction: column; justify-content: center; gap: 4px; padding: 0; border-radius: 0; font-size: 11px; }
  .nav-item.active { background: transparent; color: var(--blue-primary); box-shadow: none; }
  .admin-main { padding: 16px; height: calc(100vh - var(--tab-height)); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .stat-card:first-child { grid-column: span 2; }
}

/* ===== 彻底告别 emoji 的极简高级 Toast ===== */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translate(-50%, -20px);
  background: #111827; color: #fff; padding: 12px 24px; border-radius: 30px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-float);
  opacity: 0; pointer-events: none; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999; display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: #10b981; display: inline-block;
}
.toast.is-error::before { background: #ef4444; }
.toast.is-warning::before { background: #f59e0b; }

/* ===== 补充内部架构样式 ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-title { font-size: 18px; font-weight: 700; margin: 0; color: var(--text-primary); letter-spacing: -0.02em; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--blue-primary); border: 1px solid var(--border-subtle); }
.btn-ghost:active { background: var(--blue-soft); }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 100%; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-tertiary); padding: 10px 8px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.table td { padding: 12px 8px; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); }
.table tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.badge-success { background: #f0fdf4; color: #16a34a; }
.badge-warning { background: #fffbeb; color: #d97706; }

/* 修复表格按钮折行，强制不换行 */
.table td .btn, .table th:last-child {
  white-space: nowrap;
}
/* 优化手机端表格列宽，防止名称太长挤压价格 */
.table td:first-child {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
