:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --ink: #1c2430;
  --sub: #66707f;
  --line: #e6e9f0;
  --brand: #e03e2e;
  --accent: #2f6bff;
  --ok: #12b76a;
  --warn: #f79009;
  --danger: #f04438;
  --info: #0e9fd8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% -10%, #2b3f66 0%, #1e2a44 55%, #16203a 100%);
  padding: 24px;
}
.login-card {
  width: 400px; max-width: 100%;
  background: var(--panel); border-radius: 18px; padding: 34px 32px 28px;
  box-shadow: 0 24px 60px rgba(8, 14, 30, 0.45);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand img { width: 44px; height: 44px; }
.login-brand h1 { font-size: 20px; margin: 0; }
.login-brand p { margin: 0; color: var(--sub); font-size: 12px; }
.login-card form { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.login-tip { margin-top: 18px; padding: 10px 12px; background: #f6f8fc; border: 1px dashed var(--line); border-radius: 10px; color: var(--sub); font-size: 12px; line-height: 1.6; }
.login-tip b { color: var(--ink); }

/* ---------- 布局 ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 224px;
  background: #1e2a44; color: #d3daea;
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand img { width: 34px; height: 34px; }
.brand-name { font-weight: 700; font-size: 16px; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #8fa0c4; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: #c6d0e4; font-size: 14px;
}
.nav a .nav-ico { width: 20px; text-align: center; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); }
.nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; padding: 12px 8px 2px; font-size: 11px; color: #7d8db1; line-height: 1.7; border-top: 1px solid rgba(255,255,255,0.08); }
.main { margin-left: 224px; }
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 17px; margin: 0; }
.top-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--sub); font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.content { padding: 20px 24px 40px; max-width: 1280px; }
.bottomnav { display: none; }

/* ---------- 通用组件 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.card-sub { font-size: 12px; color: var(--sub); margin: 0 0 14px; }
.grid { display: grid; gap: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.spacer { flex: 1; }
.input, .select {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px;
  background: #fff; color: var(--ink); outline: none; font-size: 13px;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12); }
.search .input { width: 240px; }
.btn {
  height: 36px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f6cfc9; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: #e7f8ef; }
.pill.warn { color: var(--warn); background: #fef1e2; }
.pill.danger { color: var(--danger); background: #fdecea; }
.pill.info { color: var(--info); background: #e5f5fc; }
.pill.muted { color: var(--sub); background: #eef0f4; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font-size: 13px; color: var(--sub); cursor: pointer;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tabs .tab b { margin-left: 4px; font-weight: 600; }
.empty { padding: 34px; text-align: center; color: var(--sub); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; color: var(--sub); font-size: 13px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th {
  text-align: left; font-size: 12px; color: var(--sub); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd;
}
td { padding: 11px 12px; border-bottom: 1px solid #f0f2f7; font-size: 13px; white-space: nowrap; vertical-align: middle; }
tr:hover td { background: #f8faff; }
td .main-cell { font-weight: 600; }
td .sub-cell { color: var(--sub); font-size: 12px; margin-top: 2px; }
.num { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; }

/* ---------- 看板 ---------- */
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi .k-label { color: var(--sub); font-size: 12px; }
.kpi .k-value { font-size: 22px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .k-foot { font-size: 12px; margin-top: 6px; color: var(--sub); }
.up { color: var(--ok); font-weight: 700; }
.down { color: var(--danger); font-weight: 700; }
.dash-cols { grid-template-columns: 2fr 1fr; align-items: start; }
.chart { width: 100%; height: 190px; display: block; }
.top-list { display: flex; flex-direction: column; gap: 12px; }
.top-item .t-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.top-item .t-head .t-sales { color: var(--sub); font-size: 12px; }
.bar { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #6ea0ff); border-radius: 999px; }
.mini-table table { min-width: 0; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 18, 30, 0.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal { width: 560px; max-width: 100%; max-height: 92vh; overflow-y: auto; padding: 22px 24px; border-radius: 16px; }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 5px; }
.field .input, .field .select { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 99;
  background: #16203a; color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(8, 14, 30, 0.35); opacity: 0; transition: opacity 0.25s, transform 0.25s;
  pointer-events: none; max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(2px); }
.toast.err { background: #8f1d12; }

/* ---------- 设置页 ---------- */
.settings-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.plan-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.plan-name { font-size: 16px; font-weight: 800; }
.plan-desc { color: var(--sub); font-size: 12px; margin: 6px 0 12px; line-height: 1.7; }

/* ---------- 移动端 ---------- */
@media (max-width: 880px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .content { padding: 14px 12px 90px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--sub); font-size: 11px; border-radius: 10px; }
  .bottomnav a.active { color: var(--accent); font-weight: 700; }
  .bottomnav .nav-ico { font-size: 18px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .k-value { font-size: 18px; }
  .dash-cols { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .toolbar { gap: 8px; }
  .toolbar .btn, .toolbar .select { flex: 1 1 auto; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- v0.2.1 购买/收款 ---------- */
.plan-price { font-size: 26px; font-weight: 800; color: var(--ink); margin: 8px 0 2px; }
.plan-unit { font-size: 13px; font-weight: 500; color: var(--sub); margin-left: 4px; }
.pay-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.pay-line span { color: var(--sub); }
.pay-tip { font-size: 13px; color: var(--sub); margin-top: 10px; line-height: 1.7; }
.pay-tip.muted { color: var(--sub); opacity: 0.9; }

/* ---------- v0.3.1 登录/注册切换 ---------- */
.login-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.login-tabs button { flex: 1; height: 38px; border: 1px solid var(--line); background: #fff; color: var(--sub); border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- v0.6 上品流水线 ---------- */
.li-steps { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.li-step { flex: 1 1 190px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font-size: 13px; color: var(--sub); display: flex; align-items: center; }
.li-step.done { border-color: #1a7f37; color: var(--text); }
.li-toolbar .input.sm { height: 34px; padding: 4px 8px; font-size: 13px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.li-table td { vertical-align: middle; }
.li-table .cell-in { min-width: 120px; height: 32px; padding: 4px 8px; font-size: 13px; }
.li-table tr.li-bad td { background: rgba(227, 0, 27, 0.05); }
.modal-mask .modal .field label span { font-size: 11px; }
@media (max-width: 720px) { .li-step { flex: 1 1 100%; } .li-table .cell-in { min-width: 100px; } }
