:root {
  --bg: #f4f6fa; --card: #fff; --line: #e5e9f2; --txt: #1f2937; --sub: #6b7280;
  --pri: #2563eb; --pri-d: #1d4ed8; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --side: #0f1b35; --side-txt: #b6c2db;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--txt); font-size: 14px; }
a { color: var(--pri); text-decoration: none; }
.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f1b35 0%, #1e3a8a 60%, #2563eb 100%); }
.auth-card { width: 400px; background: #fff; border-radius: 14px; padding: 36px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .sub { color: var(--sub); font-size: 13px; margin-bottom: 24px; }
.auth-card .demo { margin-top: 18px; padding: 12px; background: #f0f7ff; border-radius: 8px; font-size: 12px; color: var(--sub); line-height: 1.9; }
.auth-wrap { flex-direction: column; }
.icp-footer { color: rgba(255,255,255,.6); font-size: 12px; text-align: center; margin-top: 18px; }
.icp-footer a { color: rgba(255,255,255,.8); text-decoration: none; }
.icp-footer a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--side); color: var(--side-txt); flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 20px 18px; font-size: 17px; font-weight: 700; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo span { color: #60a5fa; }
.sidebar nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar nav a { display: block; padding: 10px 18px; color: var(--side-txt); font-size: 13.5px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(37,99,235,.25); color: #fff; border-left-color: #60a5fa; }
.sidebar .foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar .foot b { color: #fff; display: block; margin-bottom: 2px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 54px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.topbar .crumb { color: var(--sub); font-size: 13px; }
.content { padding: 22px; flex: 1; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: 10px; border: 1px solid var(--line); padding: 18px; margin-bottom: 18px; }
.card h3 { font-size: 14px; margin-bottom: 14px; color: var(--txt); }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid.c4, .grid.c5 { grid-template-columns: repeat(2, 1fr); } .grid.c2 { grid-template-columns: 1fr; } }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.kpi .label { color: var(--sub); font-size: 12.5px; margin-bottom: 6px; }
.kpi .value { font-size: 22px; font-weight: 700; }
.kpi .value small { font-size: 12px; color: var(--sub); font-weight: 400; }
.kpi .delta { font-size: 12px; margin-top: 4px; color: var(--ok); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--sub); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f4f9; white-space: nowrap; }
.tbl tr:hover td { background: #f8faff; }

.btn { display: inline-block; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--txt); font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--pri); color: var(--pri); }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.pri:hover { background: var(--pri-d); }
.btn.mini { padding: 3px 9px; font-size: 12px; border-radius: 5px; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.ok { color: var(--ok); border-color: #bbf7d0; }

input, select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-family: inherit; outline: none; background: #fff; color: var(--txt); }
input:focus, select:focus { border-color: var(--pri); }
label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 5px; }
label.f input, label.f select, label.f textarea { width: 100%; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.tag.b { background: #dbeafe; color: #1d4ed8; } .tag.g { background: #dcfce7; color: #15803d; }
.tag.y { background: #fef3c7; color: #b45309; } .tag.r { background: #fee2e2; color: #b91c1c; }
.tag.gr { background: #f1f5f9; color: #475569; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .sp { flex: 1; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--sub); }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(15,27,53,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 94vw; max-height: 88vh; overflow: auto; padding: 22px; }
.modal h3 { margin-bottom: 16px; font-size: 15px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* toast */
#toast { position: fixed; top: 18px; right: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: tin .2s; }
.toast.err { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* 图表 */
.chart-line { width: 100%; height: 220px; }
.chart-line svg { width: 100%; height: 100%; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 200px; padding-top: 10px; }
.bars .bar { flex: 1; min-width: 4px; border-radius: 3px 3px 0 0; position: relative; background: var(--pri); }
.bars .bar .tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 3px 8px; border-radius: 5px; font-size: 11px; white-space: nowrap; z-index: 5; }
.bars .bar:hover .tip { display: block; }
.hbar { margin-bottom: 10px; }
.hbar .row { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 3px; color: var(--sub); }
.hbar .track { height: 10px; background: #eef2f9; border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #2563eb, #60a5fa); }
.pie-wrap { display: flex; align-items: center; gap: 22px; }
.legend { font-size: 12.5px; }
.legend div { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; color: var(--sub); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.progress { height: 16px; background: #e8edf5; border-radius: 8px; overflow: hidden; }
.progress .pf { height: 100%; background: linear-gradient(90deg, #2563eb, #22c55e); border-radius: 8px; }

pre.code { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 10px; font-size: 12.5px; line-height: 1.7; overflow: auto; font-family: Consolas, Menlo, monospace; }
.mall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.mall-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: #fff; display: flex; flex-direction: column; }
.mall-card h4 { font-size: 14.5px; margin-bottom: 8px; }
.mall-card .price { font-size: 24px; font-weight: 700; color: var(--pri); margin: 10px 0; }
.mall-card .price small { font-size: 12px; color: var(--sub); font-weight: 400; text-decoration: line-through; margin-left: 8px; }
.mall-card ul { list-style: none; color: var(--sub); font-size: 12.5px; line-height: 2; flex: 1; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--sub); } .kv dd { word-break: break-all; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 8px 16px; font-size: 13.5px; color: var(--sub); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--pri); border-bottom-color: var(--pri); font-weight: 600; }
.empty { text-align: center; color: var(--sub); padding: 40px 0; }
.mono { font-family: Consolas, Menlo, monospace; }
