/* ================= 设计变量 ================= */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e3e8f0;
  --text: #16202e;
  --text-muted: #64748b;
  --brand: #1f5eff;
  --brand-dark: #1747c4;
  --brand-soft: #eef3ff;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --success: #039855;
  --radius: 14px;
  --shadow-lg: 0 24px 60px -20px rgba(16, 32, 64, .28);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ================= 登录页布局 ================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

/* ---- 左侧品牌区 ---- */
.brand-pane {
  position: relative;
  overflow: hidden;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background: linear-gradient(150deg, #12275c 0%, #1a3b8f 45%, #2f6bff 100%);
}

/* 背景装饰光斑 */
.brand-pane::before,
.brand-pane::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
  opacity: .16;
  background: #7fb2ff;
}
.brand-pane::before { width: 460px; height: 460px; top: -160px; right: -140px; }
.brand-pane::after  { width: 320px; height: 320px; bottom: -120px; left: -90px; opacity: .12; }

.brand-inner { position: relative; z-index: 1; }

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .3px;
}
.brand-logo .mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .26);
  font-size: 18px;
}

.brand-title {
  margin: 60px 0 18px;
  font-size: 40px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -.5px;
}
.brand-sub {
  margin: 0;
  max-width: 430px;
  font-size: 15px;
  line-height: 1.85;
  color: rgba(255, 255, 255, .78);
}

/* 流程步骤 */
.flow { margin-top: 46px; display: flex; flex-direction: column; gap: 2px; }
.flow-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 13px 0;
}
.flow-step .idx {
  flex: none;
  width: 27px; height: 27px;
  margin-top: 1px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .17);
  border: 1px solid rgba(255, 255, 255, .24);
}
.flow-step .txt strong { display: block; font-size: 14.5px; font-weight: 600; }
.flow-step .txt span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: rgba(255, 255, 255, .62);
}
.flow-line {
  width: 1px; height: 12px;
  margin-left: 13px;
  background: rgba(255, 255, 255, .22);
}

.brand-foot {
  position: relative; z-index: 1;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .52);
}

/* ---- 右侧表单区 ---- */
.form-pane {
  display: grid;
  place-items: center;
  padding: 40px 32px;
  background: var(--surface);
}

.form-card { width: 100%; max-width: 384px; }

.form-head h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.form-head p {
  margin: 0 0 30px;
  font-size: 14px;
  color: var(--text-muted);
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #33415c;
}

.input-box { position: relative; }

.input-box input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input-box input::placeholder { color: #9aa7ba; }
.input-box input:hover:not(:disabled) { border-color: #ccd6e6; }
.input-box input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(31, 94, 255, .13);
}
.input-box input:disabled { background: #f2f4f8; cursor: not-allowed; }
.input-box.has-toggle input { padding-right: 46px; }

.toggle-pw {
  position: absolute;
  top: 50%; right: 6px;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: transparent;
  color: #8d9bb0;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.toggle-pw:hover { background: #eef1f6; color: var(--brand); }
.toggle-pw svg { width: 18px; height: 18px; }

/* 记住我 */
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 24px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: #475569;
  cursor: pointer;
  user-select: none;
}
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.link {
  font-size: 13.5px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}
.link:hover { color: var(--brand-dark); text-decoration: underline; }

/* 主按钮 */
.btn-primary {
  width: 100%;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background .16s, transform .08s, box-shadow .16s;
  box-shadow: 0 6px 16px -6px rgba(31, 94, 255, .6);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .62; cursor: not-allowed; box-shadow: none; }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 提示条 */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 20px;
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: 10px;
  border: 1px solid;
  animation: slide-in .2s ease;
}
.alert.error { color: #912018; background: var(--danger-soft); border-color: #fecdc9; }
.alert.info  { color: #175cd3; background: var(--brand-soft); border-color: #cddcff; }
.alert svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

.form-foot {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.7;
  color: #94a3b8;
}

/* ---- 响应式 ---- */
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .brand-pane { padding: 34px 26px; }
  .brand-title { margin: 30px 0 14px; font-size: 27px; }
  .flow, .brand-foot { display: none; }
  .form-pane { padding: 36px 24px 56px; }
}

/* ==================================================================
   控制台
   ================================================================== */
.layout { display: grid; grid-template-columns: 218px 1fr; min-height: 100vh; }

/* ---------- 左侧导航 ---------- */
.sidebar {
  background: #0f1b33;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 19px 18px;
  font-size: 15px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .sb-logo .mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px;
  background: linear-gradient(140deg, #2f6bff, #6aa0ff);
}
.nav { padding: 14px 10px; flex: 1; }
.nav-title {
  padding: 12px 10px 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .9px;
  color: #64748b; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 11px; margin-bottom: 2px;
  font-size: 14px; color: #cbd5e1;
  border-radius: 9px; cursor: pointer; user-select: none;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item .dot {
  margin-left: auto; width: 7px; height: 7px; border-radius: 50%;
  background: #475569;
}
.nav-item .dot.ok { background: #22c55e; }
.nav-item .dot.err { background: #f97316; }
.sb-foot { padding: 14px 18px; font-size: 11.5px; color: #475569;
           border-top: 1px solid rgba(255,255,255,.08); }

/* ---------- 主区 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; padding: 0 24px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .crumb { font-size: 15px; font-weight: 650; }
.topbar .right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }

.content { padding: 24px; flex: 1; }
.panel { display: none; }
.panel.active { display: block; animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 16px; flex-wrap: wrap;
}
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.sec-head .desc { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.sec-head .actions { display: flex; gap: 8px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.card > h3 {
  margin: 0 0 14px; font-size: 14.5px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
}
.card > h3 .hint { font-weight: 400; font-size: 12.5px; color: var(--text-muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  padding: 15px 16px; border-radius: 11px;
  background: #f8fafc; border: 1px solid var(--border);
}
.stat .k { font-size: 12.5px; color: var(--text-muted); }
.stat .v { margin-top: 5px; font-size: 23px; font-weight: 700; letter-spacing: -.4px; }
.stat .v.sm { font-size: 17px; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok   { color: var(--success); background: #ecfdf3; }
.badge.warn { color: #b54708;        background: #fffaeb; }
.badge.err  { color: var(--danger);  background: var(--danger-soft); }
.badge.info { color: var(--brand);   background: var(--brand-soft); }
.badge.mute { color: #64748b;        background: #f1f5f9; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.2px; min-width: 640px; }
table.tb th {
  padding: 11px 14px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 650; color: #475569;
  background: #f8fafc; border-bottom: 1px solid var(--border);
}
table.tb td { padding: 11px 14px; border-bottom: 1px solid #f0f3f8; vertical-align: middle; }
table.tb tr:last-child td { border-bottom: 0; }
table.tb tbody tr:hover { background: #fafbfd; }
table.tb td.num, table.tb th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--success); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 13px; }
.fg label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: #33415c; }
.fg label .u { font-weight: 400; color: var(--text-muted); }
.fg input, .fg select {
  width: 100%; height: 38px; padding: 0 11px;
  font-size: 13.5px; font-family: inherit; color: var(--text);
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 8px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.fg input:focus, .fg select:focus {
  background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,94,255,.12);
}

/* ---------- 按钮 ---------- */
.btn {
  height: 36px; padding: 0 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  white-space: nowrap;
}
.btn.primary { color: #fff; background: var(--brand); }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn.ghost { color: #475569; background: #fff; border-color: var(--border); }
.btn.ghost:hover:not(:disabled) { background: #f8fafc; border-color: #ccd6e6; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 空态 / 提示 ---------- */
.empty { padding: 42px 20px; text-align: center; color: #94a3b8; font-size: 13.5px; }
.empty .big { display: block; font-size: 30px; margin-bottom: 10px; opacity: .55; }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 16px;
  font-size: 13.2px; line-height: 1.65; border-radius: 10px; border: 1px solid;
}
.notice.warn { color: #93370d; background: #fffaeb; border-color: #fedf89; }
.notice.info { color: #175cd3; background: var(--brand-soft); border-color: #cddcff; }
.notice code {
  padding: 1px 5px; border-radius: 4px; font-size: 12.2px;
  background: rgba(0,0,0,.06); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- 明细列表 ---------- */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 16px; font-size: 13.2px; }
.kv .k { color: var(--text-muted); }
.kv .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.kv .sep { grid-column: 1 / -1; height: 1px; background: var(--border); margin: 5px 0; }
.kv .total { font-size: 14.5px; }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 999;
  max-width: 380px; padding: 12px 16px;
  font-size: 13.5px; line-height: 1.55; color: #fff;
  background: #16202e; border-radius: 10px; box-shadow: var(--shadow-lg);
  animation: slide-in .2s ease;
}
.toast.err { background: #b42318; }
.toast.ok  { background: #067647; }

.cols-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; align-items: start; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .nav-title { display: none; }
  .nav-item { margin: 0; }
  .sb-foot { display: none; }
  .cols-2 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ---------- 子标签页 ---------- */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 5px; margin-bottom: 16px;
  background: #eef1f6; border-radius: 11px;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  font-size: 13.5px; font-weight: 600; color: #475569;
  border-radius: 8px; cursor: pointer; user-select: none;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--text); background: #fff; box-shadow: 0 1px 3px rgba(16,32,64,.1); }
.tab .cnt {
  min-width: 20px; padding: 1px 6px;
  font-size: 11.5px; font-weight: 700; text-align: center;
  color: #64748b; background: #dde3ec; border-radius: 999px;
}
.tab.active .cnt { color: #fff; background: var(--brand); }
.tab .cnt.zero { opacity: .5; }

.tabpane { display: none; }
.tabpane.active { display: block; animation: fade-in .16s ease; }

.pane-desc {
  margin: 0 0 14px; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pane-desc code {
  padding: 1px 6px; border-radius: 4px; font-size: 12px;
  background: #eef1f6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- 品牌筹码 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  font-size: 13px; font-weight: 600; color: #475569;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: #ccd6e6; background: #f8fafc; }
.chip.on { color: #fff; background: var(--brand); border-color: var(--brand); }
.chip .n { font-size: 11.5px; font-weight: 700; opacity: .72; }
.chip-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 16px; flex-wrap: wrap;
}
.pager .info { font-size: 13px; color: var(--text-muted); margin: 0 6px; }
.pager input {
  width: 62px; height: 32px; padding: 0 8px; text-align: center;
  font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 7px; background: #fbfcfe; outline: none;
}
.pager input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,94,255,.12); }

/* 商品缩略图 */
.thumb {
  width: 34px; height: 26px; object-fit: contain;
  border-radius: 5px; background: #f4f6fb;
  display: block;
}

/* ---------- 勾选工具条 ---------- */
.sel-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 13px; margin-bottom: 13px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
}
.sel-count { font-size: 13.5px; font-weight: 650; color: #475569; }
.sel-count.on { color: var(--brand); }
.sel-hint { margin-left: auto; font-size: 12.5px; color: #94a3b8; }

/* 表格内的勾选框 */
table.tb td.pick, table.tb th.pick { width: 38px; text-align: center; padding-left: 12px; padding-right: 4px; }
table.tb input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
table.tb tr.picked { background: #eff5ff; }
table.tb tr.picked:hover { background: #e6efff; }

/* 勾选前 N 条 */
.sel-top {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #475569;
  padding-left: 10px; margin-left: 2px;
  border-left: 1px solid var(--border);
}
.sel-top input {
  width: 68px; height: 30px; padding: 0 8px; text-align: center;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--border); border-radius: 7px; outline: none;
}
.sel-top input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,94,255,.12); }
