/* ===== 优选供货平台 - 全局样式 ===== */
:root {
  --brand: #f97316;            /* 主品牌橙 */
  --brand-dark: #ea580c;
  --brand-light: #fff7ed;
  --brand-gradient: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --sidebar-gradient: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --ink: #0f172a;
  --text: #334155;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --blue: #2563eb;
  --sky: #0ea5e9;
  --green: #16a34a;
  --red: #dc2626;
  --gold: #f59e0b;
  --purple: #7c3aed;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, .14);
  --radius: 12px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  background: var(--sidebar-gradient);
  color: #fff;
  padding: 22px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar .logo {
  padding: 0 20px 22px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar .logo .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--brand-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(249, 115, 22, .4);
}
.sidebar .info {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .info .label { font-size: 11px; color: #94a3b8; }
.sidebar .info .code {
  font-size: 19px; font-weight: 700; letter-spacing: 2px;
  color: #fdba74; margin-top: 3px; display: block;
  font-family: 'SF Mono', Consolas, monospace;
}
.sidebar nav { flex: 1; padding: 14px 12px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; color: #cbd5e1; text-decoration: none;
  font-size: 13.5px; border-radius: 9px; transition: all .18s;
  margin-bottom: 3px; position: relative;
}
.sidebar nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar nav a.active {
  color: #fff;
  background: rgba(249, 115, 22, .18);
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 600;
}
.sidebar nav a .ico { font-size: 15px; width: 20px; text-align: center; }

.main { flex: 1; margin-left: 216px; padding: 26px 30px; min-width: 0; }

.header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.header h1 { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
.header .actions { display: flex; align-items: center; gap: 10px; }
.header .who { color: var(--muted); font-size: 13px; }

/* ===== 按钮 ===== */
.btn {
  padding: 8px 16px; border: none; border-radius: 9px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .18s; display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-xs { padding: 4px 10px; font-size: 11.5px; border-radius: 7px; }
.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 3px 10px rgba(249, 115, 22, .3); }
.btn-primary:hover { box-shadow: 0 5px 16px rgba(249, 115, 22, .4); filter: brightness(1.04); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--gold); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--sky); color: #fff; }
.btn-info:hover { background: #0284c7; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: #475569; }
.btn-outline:hover { background: #f1f5f9; }

/* ===== 统计卡片 ===== */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: all .2s; position: relative; overflow: hidden;
  border: 1px solid #f1f5f9;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand-gradient); opacity: 0; transition: opacity .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #e2e8f0; }
.stat-card:hover::before { opacity: 1; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.4px; }
.stat-card .value.red { color: var(--red); }
.stat-card .value.blue { color: var(--blue); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.orange { color: var(--gold); }
.stat-card .value.purple { color: var(--purple); }

/* ===== 面板 ===== */
.panel {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
  border: 1px solid #f1f5f9; overflow: hidden;
}
.panel-header {
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 15px; font-weight: 700; color: var(--ink); gap: 10px; flex-wrap: wrap;
}
.panel-header h2 { font-size: 15px; font-weight: 700; color: var(--ink); }
.panel-body { padding: 18px 20px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  background: #f8fafc; padding: 10px 8px; text-align: left;
  font-weight: 600; color: #64748b; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 12px;
}
tbody td { padding: 10px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbfc; }

/* ===== 标签/Badge ===== */
.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 11px; font-weight: 600; line-height: 1.5; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #b91c1c; }

/* ===== 筛选器 ===== */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--text); background: #fff; transition: all .15s;
}
.filters select:focus, .filters input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 115, 22, .12); }
select.mini { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination button {
  padding: 6px 13px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; cursor: pointer; font-size: 12.5px; color: #475569; transition: all .15s;
}
.pagination button:hover { border-color: var(--brand); color: var(--brand); }
.pagination button.active { background: var(--brand-gradient); color: #fff; border-color: transparent; }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 品牌卡片 ===== */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.brand-card {
  background: #fff; border: 1px solid #e8edf3; border-radius: 12px;
  padding: 18px; transition: all .2s;
}
.brand-card:hover { border-color: #fdba74; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.brand-card .bn { font-size: 15.5px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.brand-card .bcn { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.brand-card .info { font-size: 12px; color: #64748b; line-height: 1.9; }
.brand-card .rate {
  font-size: 22px; font-weight: 800; color: var(--green); margin-bottom: 8px;
  display: inline-block; background: #f0fdf4; padding: 2px 12px; border-radius: 20px;
}

/* ===== 其他 ===== */
.comm-highlight { font-weight: 700; color: var(--green); font-size: 14px; }
.copy-btn { cursor: pointer; padding: 3px 10px; background: #f1f5f9; border-radius: 6px; font-size: 11.5px; border: none; transition: all .15s; }
.copy-btn:hover { background: #e2e8f0; }
code {
  background: #f1f5f9; padding: 2px 7px; border-radius: 5px;
  font-size: 11px; font-family: 'SF Mono', Consolas, monospace; color: #334155;
}

/* Toast */
.toast {
  position: fixed; top: 22px; right: 22px; padding: 12px 20px;
  border-radius: 10px; color: #fff; font-size: 13px; z-index: 2000;
  animation: slideIn .3s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg);
}
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

/* ===== 登录/注册页 ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 10% -10%, #1e293b 0%, transparent 55%),
              radial-gradient(900px 500px at 110% 110%, #f97316 0%, transparent 50%),
              linear-gradient(135deg, #0f172a, #1e293b 60%, #334155);
}
.auth-page::before, .auth-page::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .35;
}
.auth-page::before { width: 380px; height: 380px; background: #fb923c; top: -120px; right: -80px; }
.auth-page::after { width: 320px; height: 320px; background: #3b82f6; bottom: -120px; left: -60px; }

.auth-box {
  position: relative; z-index: 1; background: #fff; border-radius: 20px;
  padding: 44px 42px; width: 440px; max-width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.auth-brand { text-align: center; margin-bottom: 8px; }
.auth-brand .logo-badge {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 14px;
  background: var(--brand-gradient); display: flex; align-items: center; justify-content: center;
  font-size: 28px; box-shadow: 0 8px 24px rgba(249, 115, 22, .4);
}
.auth-box h1 { font-size: 24px; color: var(--ink); text-align: center; font-weight: 800; }
.auth-box .sub { color: var(--muted); font-size: 13.5px; text-align: center; margin-bottom: 26px; }

.auth-footer { position: relative; z-index: 1; text-align: center; color: rgba(255, 255, 255, .55); font-size: 12.5px; padding: 22px 16px; max-width: 520px; line-height: 1.6; }
.site-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 16px 24px; border-top: 1px solid var(--line); margin-top: 8px; }

.auth-tabs { display: flex; margin-bottom: 26px; background: #f1f5f9; border-radius: 11px; padding: 4px; }
.auth-tabs button {
  flex: 1; padding: 10px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; color: #64748b; font-weight: 600; border-radius: 8px; transition: all .18s;
}
.auth-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }

.fg { margin-bottom: 16px; }
.fg label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: #475569; }
.fg input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 14.5px; transition: all .15s; background: #fff; color: var(--ink);
}
.fg input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 115, 22, .12); }
.fg input::placeholder { color: #cbd5e1; }

.btn-block { width: 100%; padding: 12px; font-size: 15px; justify-content: center; border-radius: 10px; }

.auth-error { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; display: none; }
.auth-hint { text-align: center; margin-top: 16px; font-size: 12px; color: #cbd5e1; }
.auth-hint a { color: var(--brand); }

.referral-badge {
  margin-top: 16px; padding: 14px; background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; text-align: center; font-size: 13px; color: #166534; display: none;
}
.referral-badge code { font-size: 20px; font-weight: 800; letter-spacing: 3px; display: block; margin-top: 5px; background: transparent; color: #15803d; }

/* ===== 响应式 ===== */
html { -webkit-tap-highlight-color: transparent; }

/* 平板/窄屏：侧边栏收窄为纯图标栏（隐藏文字、保留图标） */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar .logo { font-size: 0; padding: 0 4px 16px; justify-content: center; }
  .sidebar .logo .mark { font-size: 16px; }
  .sidebar .info { display: none; }
  .sidebar nav { padding: 12px 8px; }
  .sidebar nav a { font-size: 0; justify-content: center; padding: 12px 0; gap: 0; }
  .sidebar nav a .ico { font-size: 17px; width: auto; }
  .main { margin-left: 64px; padding: 20px 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* 手机端：侧边栏变为顶部横向导航，内容全宽自适应 */
@media (max-width: 640px) {
  .layout { display: block; }
  .sidebar {
    position: sticky; top: 0; left: 0; right: 0;
    width: 100%; height: auto; padding: 0;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  }
  .sidebar .logo {
    font-size: 16px; padding: 10px 14px;
    justify-content: flex-start; gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }
  .sidebar .logo .mark { font-size: 14px; width: 28px; height: 28px; }
  .sidebar .info { display: none; }
  .sidebar nav {
    display: flex; flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; padding: 6px 8px; gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a {
    font-size: 12.5px; padding: 8px 12px;
    flex: 0 0 auto; white-space: nowrap; gap: 5px; margin-bottom: 0;
  }
  .sidebar nav a .ico { font-size: 13px; width: auto; }
  .sidebar nav a.active { box-shadow: inset 0 -2px 0 var(--brand); }

  .main { margin-left: 0; padding: 14px 12px 26px; }
  .header { margin-bottom: 16px; }
  .header h1 { font-size: 19px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 21px; }
  .panel-header { padding: 13px 14px; font-size: 14px; }
  .panel-header h2 { font-size: 14px; }
  .panel-body { padding: 14px 12px; }
  .filters { gap: 8px; }
  .filters select, .filters input { flex: 1 1 100%; width: 100%; }
  .pagination button { padding: 6px 11px; font-size: 12px; }
  .brand-grid { grid-template-columns: 1fr; gap: 10px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; }

  .auth-box { padding: 28px 20px; border-radius: 16px; }
  .auth-box h1 { font-size: 21px; }
  .auth-tabs { margin-bottom: 20px; }
  .toast { left: 14px; right: 14px; top: 14px; text-align: center; }
}
