/* WhyKaiX 发卡平台 · 商户中心样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #3730A3; --primary-dark: #4338ca; --primary-light: #EEF0FF;
  --bg: #f1f5f9; --card: #ffffff; --border: #e2e8f0;
  --text: #0f172a; --muted: #64748b;
  --green: #10b981; --red: #ef4444; --yellow: #f59e0b; --blue: #3b82f6;
}
body { font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1B1F6B 0%, #3730A3 55%, #22D3EE 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(15,23,42,.25); width: 400px; max-width: 100%; padding: 36px 32px 30px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo { font-size: 42px; display: block; margin-bottom: 10px; }
.auth-title { font-size: 20px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tab { flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 8px; font-size: 14px; color: var(--muted); cursor: pointer; font-weight: 600; }
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.auth-form .field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; transition: border .2s; background: #fff; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.auth-tip { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.auth-tip a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 218px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-logo { font-size: 26px; }
.sidebar-title { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-sub { font-size: 11.5px; color: #94a3b8; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: 13.5px; border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; gap: 2px; }
.logout-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #fca5a5; background: transparent; border: 0; cursor: pointer; font-size: 13.5px; width: 100%; text-align: left; }
.logout-btn:hover { background: rgba(239,68,68,.12); }

.main { flex: 1; margin-left: 218px; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--border); padding: 14px 24px; position: sticky; top: 0; z-index: 10; }
.topbar h2 { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.online-text { color: var(--muted); font-size: 12.5px; }
.content { padding: 22px 24px; }
.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 0; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 概览 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; display: flex; align-items: center; gap: 14px; }
.stat-icon { font-size: 30px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 3px; }
.stat-value.money { color: var(--primary); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--primary-light); color: var(--primary-dark); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.chip.empty { background: var(--bg); color: var(--muted); font-weight: 400; }
.allow-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbff; }
.mono { font-family: Consolas, monospace; font-size: 12.5px; }
.empty td { text-align: center; color: var(--muted); padding: 32px 0; }

/* 操作按钮容器：横排、过长自动整组换行 */
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions .btn { flex-shrink: 0; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f1f5f9; color: #64748b; }

/* ---------- 按钮 ---------- */
.btn { border: 0; border-radius: 8px; padding: 9px 16px; font-size: 13.5px; cursor: pointer; font-weight: 600; transition: filter .15s; font-family: inherit; }
.btn:hover { filter: brightness(1.05); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-qq { background: linear-gradient(135deg, #3b82f6, #06b6d4); color: #fff; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
input[type="text"], input[type="password"], input[type="number"], select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font-size: 13.5px; outline: none; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
input[type="number"] { width: 110px; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.modal-box.wide { width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 700; }
.modal-close { border: 0; background: var(--bg); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-size: 14px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.sku-row { display: block; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: #fafbfe; overflow: hidden; }
.sku-row-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px dashed var(--border); background: #f1f5f9; }
.sku-row-title { font-weight: 700; font-size: 13px; }
.sku-row-stock { flex: 1; font-size: 12px; color: #059669; }
.sku-row .del { color: var(--red); cursor: pointer; font-size: 13px; }
.sku-list { display: flex; flex-direction: column; }
.sku-empty { color: #94a3b8; padding: 12px 0; }
.sku-row-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 12px; }
.sku-row-body label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #64748b; }
.sku-row-body input, .sku-row-body select { flex: none; width: 100%; box-sizing: border-box; }

/* ---------- 提现 ---------- */
.withdraw-box { max-width: 460px; }
.fee-preview { background: var(--primary-light); border-radius: 10px; padding: 12px 14px; margin: 14px 0; font-size: 13px; color: var(--primary-dark); line-height: 1.9; }
.fee-preview b { font-size: 16px; }

/* ---------- Toast ---------- */
#toastContainer { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.14); padding: 11px 16px; font-size: 13.5px; max-width: 340px; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--blue); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; justify-content: flex-end; color: var(--muted); font-size: 13px; }
.pager button { min-width: 60px; }
.agent-sku-list { display: flex; flex-direction: column; gap: 8px; }
.agent-sku-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fafbfe; flex-wrap: wrap; }
.agent-sku-info { flex: 1; min-width: 200px; }
.agent-sku-op { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-sku-op input { width: 110px; }
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-title, .sidebar-sub, .nav-item span, .logout-btn span { display: none; }
  .main { margin-left: 64px; }
  .allow-list { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* 商城链接 / 收款码 */
.mall-link {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: #f8fafc; border: 1px dashed var(--border);
  border-radius: 10px; padding: 10px 14px;
  font-size: 13px; word-break: break-all;
}
.mall-link a { color: var(--primary); text-decoration: none; font-weight: 600; }
.payqr-box { display: flex; align-items: center; min-height: 90px; }
.payqr-box img { box-shadow: 0 4px 14px rgba(15, 23, 42, .12); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.sidebar-logo { display: block; width: 38px; height: 38px; }
.sidebar-logo img { width: 100%; height: 100%; border-radius: 11px; display: block; }
.auth-logo { font-size: 0; }
.auth-logo img { width: 64px; height: 64px; border-radius: 18px; display: block; margin: 0 auto 6px; }
