/* ============================================================================
 * base.css —— 设计系统基座：CSS 变量 / reset / 登录注册页 / 跨页通用组件
 * 移动优先（默认 375px 基准），>=768px 平板增强，>=900px 桌面增强。
 * 布局与导航见 layout.css；页面特定组件（表格卡片化/底部抽屉/二维码等）见 pages.css。
 * ==========================================================================*/
:root {
  /* 全站黑金主题（D-roll）：哑光黑结构色 + 香槟金点睛 + 苹果灰背景，iOS 风 */
  --primary: #1A1A1A;        /* 哑光黑：主按钮/侧栏等结构色 */
  --primary-dark: #000000;
  --gold: #B9975B;           /* 香槟金：链接/选中态/CTA 文字，绝不大面积金底 */
  --gold-bright: #D9C08C;
  --bg: #F5F5F7;             /* 苹果灰页面背景 */
  --card: #ffffff;
  --text: #1A1A1A;           /* 近黑正文 */
  --text-2: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;
  /* 移动端 App 化尺寸：安全区 / 头部 / 底部 Tab / 触控最小高 */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --header-h: 52px;
  --tabbar-h: 54px;
  --tap: 44px;               /* iOS HIG 触控最小尺寸 */
  --radius: 14px;
  --radius-sm: 10px;
}

/* ---------- reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  overscroll-behavior-y: none; /* 阻止整页下拉回弹与浏览器刷新冲突 */
}
a { color: var(--gold); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
/* 输入类统一 16px：iOS Safari 聚焦 <16px 输入会自动放大页面，统一 16px 可根除 */
input, textarea, select, button { font-size: 16px; }
img { max-width: 100%; }
::selection { background: rgba(185,151,91,.28); }

/* ---------- 登录/注册页 · 黑金主题 ----------
   scoped：以下 --变量仅覆盖 .auth-wrap 子树，其余页面仍用 :root 浅色主题 */
.auth-wrap {
  --card: #17171A; --field-bg: #232328;
  --text: #F5F5F7; --text-2: #9B9BA3;
  --border: rgba(255,255,255,.10);
  --primary: #B9975B; --primary-dark: #A5824A; --gold-bright: #D9C08C;
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 20px; padding-top: max(20px, var(--safe-t)); padding-bottom: max(20px, var(--safe-b));
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(0,0,0,.045), transparent 62%),
    linear-gradient(160deg, #F7F7F9 0%, #EDEDEF 52%, #E6E6E9 100%);
}
.auth-card {
  width: 380px; max-width: 100%; background: var(--card); color: var(--text);
  border: 1px solid rgba(185,151,91,.28); border-radius: 22px; padding: 32px 22px 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.06);
}
@media (min-width: 768px) { .auth-card { padding: 40px 34px 34px; } }
.auth-card .logo {
  width: 58px; height: 58px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
  font-size: 28px; border-radius: 17px;
  background: radial-gradient(circle at 32% 22%, rgba(185,151,91,.26), rgba(185,151,91,.05));
  border: 1px solid rgba(185,151,91,.30);
}
.auth-card h1 { font-size: 22px; font-weight: 700; letter-spacing: .3px; margin-bottom: 6px; text-align: center; color: #fff; }
.auth-card .sub { color: var(--text-2); margin-bottom: 22px; font-size: 13px; letter-spacing: .2px; text-align: center; }
.auth-card .field label { color: var(--text-2); }
.auth-card .field input, .auth-card .field textarea {
  background: var(--field-bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 12px 14px; transition: border-color .2s, box-shadow .2s;
}
.auth-card .field input::placeholder { color: #6A6A72; }
.auth-card .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(185,151,91,.16); }
.auth-card .btn-plain { background: transparent; border: 1px solid var(--border); color: var(--text-2); border-radius: 12px; }
.auth-card .btn-plain:hover:not(:disabled) { border-color: var(--primary); color: var(--gold-bright); }
.auth-card .btn-plain:disabled { opacity: .45; cursor: not-allowed; }
.auth-card .seg { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-card .seg .btn-sm { flex: 1; padding: 10px 12px; }
.auth-card .seg-active { background: rgba(185,151,91,.14); border-color: var(--primary); color: var(--gold-bright); }
.auth-card .btn {
  width: 100%; background: linear-gradient(180deg, #17171B, #0B0B0C);
  color: var(--gold-bright); border: 1px solid rgba(185,151,91,.55); border-radius: 14px;
  padding: 14px 22px; font-weight: 600; letter-spacing: .5px; min-height: 48px;
  box-shadow: 0 8px 22px rgba(0,0,0,.42); transition: box-shadow .25s, border-color .25s, transform .06s;
}
.auth-card .btn:hover:not(:disabled) { border-color: var(--primary); box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 20px rgba(185,151,91,.22); }
.auth-card .btn:active:not(:disabled) { transform: translateY(1px); }
.auth-card .btn:disabled { background: #141416; color: #6A6A72; border-color: var(--border); box-shadow: none; cursor: not-allowed; }
.auth-card a { color: var(--gold-bright); }
.auth-card a:hover { color: #EBD9AE; text-decoration: underline; }
.auth-card .agree { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); margin: 6px 0 16px; cursor: pointer; line-height: 1.65; }
.auth-card .agree input { margin-top: 3px; accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.auth-card .err { color: #FF7A7A; }
.auth-card .ok { color: #5AD98A; }
.auth-card .muted { color: var(--text-2); }

/* ---------- 通用组件：卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; border: 1px solid var(--border); }
.card h3 { font-size: 16px; margin-bottom: 12px; font-weight: 700; }
.card h4 { font-size: 14px; margin: 14px 0 8px; }
@media (min-width: 768px) {
  .card { padding: 20px; margin-bottom: 16px; border-radius: var(--radius-sm); }
  .card h3 { font-size: 15px; margin-bottom: 14px; }
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .card { flex: 1 1 100%; min-width: 0; }   /* 移动端单列堆叠 */
@media (min-width: 768px) { .row { gap: 16px; } .row > .card { flex: 1; min-width: 260px; } }

/* ---------- 通用组件：按钮（触控 >=44px）---------- */
.btn {
  background: var(--primary); color: var(--gold-bright); border: 1px solid rgba(185,151,91,.45);
  border-radius: var(--radius-sm); padding: 12px 22px; font-weight: 600; min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s;
}
.btn:hover { background: #000; border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: #e5e7eb; color: #9ca3af; border-color: transparent; cursor: not-allowed; transform: none; }
.btn-block { display: flex; width: 100%; }   /* 移动端主操作通栏 */
.btn-plain {
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 18px; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-plain:hover { border-color: var(--gold); color: var(--gold); }
.btn-plain:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 8px; min-height: 38px; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #fecaca; border-radius: 8px; padding: 8px 14px; font-size: 14px; min-height: 38px; }
@media (min-width: 768px) {
  .btn { padding: 10px 22px; }
  .btn-plain { padding: 9px 18px; }
  .btn-sm { padding: 5px 12px; font-size: 13px; min-height: 0; }
  .btn-danger { padding: 5px 12px; font-size: 13px; min-height: 0; }
}

/* ---------- 通用组件：表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 16px; outline: none; background: #fff; color: var(--text); min-height: var(--tap);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,151,91,.12); }
.field textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.field input[type=date], .field input[type=time] { color: var(--text); }
.field .with-btn { display: flex; gap: 8px; }
.field .with-btn input { flex: 1; min-width: 0; }
.field .with-btn .btn-plain { flex: none; white-space: nowrap; }
/* 裸输入（未包 .field 的内联 input/select，如管理后台筛选、兑换码）：统一触控高度与圆角 */
.input-inline {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 16px;
  background: #fff; color: var(--text); outline: none; min-height: 42px;
}
.input-inline:focus { border-color: var(--gold); }

/* ---------- 通用组件：文本状态 ---------- */
.err { color: var(--red); font-size: 13px; margin: 8px 0; min-height: 0; }
.ok { color: var(--green); font-size: 13px; margin: 8px 0; }
.muted { color: var(--text-2); font-size: 13px; line-height: 1.6; }
.tag { display: inline-block; border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-green { background: #ecfdf3; color: var(--green); }
.tag-orange { background: #fff7ed; color: var(--orange); }
.tag-red { background: #fef2f2; color: var(--red); }
.tag-gray { background: #f3f4f6; color: var(--text-2); }

/* ---------- 通用组件：开关（触控区放大）---------- */
.switch-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.switch-item:last-child { border-bottom: none; }
.switch-item .name { font-weight: 600; font-size: 15px; }
.switch-item .desc { color: var(--text-2); font-size: 12.5px; margin-top: 3px; line-height: 1.5; }
.toggle { position: relative; width: 50px; height: 30px; flex-shrink: 0; display: inline-block; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.toggle span { position: absolute; inset: 0; background: #d1d5db; border-radius: 15px; transition: .2s; }
.toggle span::before { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--gold); }
.toggle input:checked + span::before { left: 23px; }
/* 恒关开关（老板/运营/外部只读账号不绑定主播）：整块置灰、光标禁止，但仍保留 hover 提示 */
.toggle.is-disabled { opacity: .45; }
.toggle.is-disabled input { cursor: not-allowed; }

/* ---------- 通用组件：通知条目 / 提示条 ---------- */
.notice { padding: 14px 0; border-bottom: 1px solid var(--border); }
.notice:last-child { border-bottom: none; }
.notice .time { color: var(--text-2); font-size: 12px; margin-top: 5px; }
.notice.unread { border-left: 3px solid var(--gold); padding-left: 10px; }
.banner { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; font-size: 13px; line-height: 1.6; }
/* 管理员代登提示条：红底常驻，与普通 .banner（橙色运营提示）区分等级 */
.imp-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-left: 4px solid var(--red);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px;
  font-size: 13px; line-height: 1.6; font-weight: 600;
}
.imp-banner .btn-plain { margin-left: auto; flex: none; }

/* ---------- 通用交互反馈：点击态（仅触摸设备）---------- */
@media (hover: none) {
  .btn:active, .btn-plain:active { opacity: .82; }
  .tap-active:active { background: rgba(0,0,0,.04); }
}
