:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --ok: #047857;
  --ok-bg: #d1fae5;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 218px;
  flex: 0 0 218px;
  background: #0f172a;
  color: #cbd5e1;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-weight: 700; font-size: 15px;
  padding: 4px 8px 18px;
  letter-spacing: .3px;
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  display: grid; place-items: center; font-size: 13px; color: #fff;
}

.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #cbd5e1; padding: 9px 12px; border-radius: 8px;
  margin-bottom: 3px; font-size: 13.5px;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.active { background: #1d4ed8; color: #fff; }
.nav .ico { width: 16px; text-align: center; opacity: .9; }

.sidebar-foot {
  position: absolute; bottom: 16px; left: 14px; right: 14px;
  font-size: 12px; color: #64748b; border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 12px;
}

.main { flex: 1; min-width: 0; padding: 22px 30px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

/* ---------- 顶栏右侧：模板中心 / 使用教程 / 最新客户端 / 客服 / 账号 ---------- */
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.topnav > a {
  font-size: 13px; color: #475569; padding: 7px 11px; border-radius: 8px; white-space: nowrap;
}
.topnav > a:hover { background: #eef3fd; color: var(--brand); text-decoration: none; }

.kf {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid #cfe0ff; background: #f2f7ff; color: #1e4fb8;
  font: inherit; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; margin: 0 4px;
}
.kf:hover { background: #e5efff; border-color: #a9c7ff; }
.kf i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #d7f7e3; }
.kf b { font-weight: 500; font-size: 11px; color: #7f97c9; margin-left: 2px; }
.kf:hover b { color: #1e4fb8; }

.acct { position: relative; }
.acct > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 6px; border-radius: 999px; font-size: 13px; color: #334155;
}
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover { background: #eef3fd; }
.acct .ava {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #38bdf8); color: #fff; font-size: 12px; font-weight: 700;
}
.acct .caret { font-size: 10px; color: var(--muted); margin-left: 2px; }
.acct[open] > summary { background: #eef3fd; }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 186px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .14); padding: 6px; overflow: hidden;
}
.acct-head {
  font-size: 13px; font-weight: 700; padding: 9px 12px 7px; color: var(--ink);
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.acct-head small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.acct-menu a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 13px; color: #334155; }
.acct-menu a:hover { background: #f3f6fc; text-decoration: none; color: var(--brand); }
.acct-menu a.out { color: #b91c1c; }
.acct-menu a.out:hover { background: #fef2f2; color: #b91c1c; }

/* ---------- 个人中心 ---------- */
.me-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.me-grid .card { margin-bottom: 0; }
.card-note { color: var(--muted); font-size: 12.5px; margin: -6px 0 14px; }

.kv { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kv-row { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv-row:nth-child(odd) { background: #fbfcff; }
.kv-row > span { width: 96px; flex: 0 0 96px; color: var(--muted); font-size: 12.5px; }
.kv-row > b { font-size: 13.5px; font-weight: 600; }
.kv-row b i { font-style: normal; font-weight: 400; }
.kv-title { font-size: 13px; font-weight: 700; margin: 18px 0 10px; color: #334155; }

.pill {
  display: inline-block; font-style: normal; font-size: 11.5px; padding: 2px 8px;
  border-radius: 6px; background: #eef2f7; color: #475569; margin-left: 6px; font-weight: 500;
}
.pill.blue { background: #e6efff; color: #1d4ed8; }
.pill.green { background: #dcfce7; color: #047857; }
.muted { color: var(--muted); }

.store-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.store-chip {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: #fff;
}
.store-chip i { font-style: normal; font-size: 11px; color: var(--warn); }
.store-chip.on { border-color: #bbf7d0; background: #f0fdf4; }
.store-chip.on i { color: var(--ok); }

.me-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.me-form.col { flex-direction: column; align-items: stretch; }
.me-form.inline3 .field { flex: 1 1 160px; }
.me-form .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.me-form label { font-size: 12.5px; color: var(--muted); }
.me-form input, .me-form select {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; background: #fff;
}
.me-form input:focus, .me-form select:focus { outline: none; border-color: #93b4f7; box-shadow: 0 0 0 3px #e8f0ff; }
.me-form .tip { color: #94a3b8; font-size: 11.5px; }

.kf-box {
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* ---------- 用户管理 ---------- */
.pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.pill-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: baseline; justify-content: space-between;
}
.pill-card span { color: var(--muted); font-size: 12.5px; }
.pill-card b { font-size: 20px; }
.pill-card b.blue { color: var(--info); }
.pill-card b.green { color: var(--ok); }

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.user-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.user-card:hover { border-color: #c7d7f5; box-shadow: 0 10px 24px rgba(15, 23, 42, .06); }
.uc-head { display: flex; align-items: center; gap: 10px; }
.uc-ava {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #38bdf8); color: #fff; font-weight: 700; font-size: 14px;
}
.uc-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.uc-name b { font-size: 14px; }
.uc-name .pill { margin-left: 0; }
.uc-self { font-size: 11px; color: var(--ok); background: var(--ok-bg); border-radius: 6px; padding: 2px 7px; }

.uc-rows { margin: 12px 0 4px; }
.uc-rows > div { display: flex; gap: 12px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed #eef2f8; }
.uc-rows > div:last-child { border-bottom: 0; }
.uc-rows span { width: 74px; flex: 0 0 74px; color: var(--muted); }
.uc-rows i { font-style: normal; color: #334155; word-break: break-all; }

.uc-actions { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.uc-pw { display: flex; gap: 6px; flex: 1; }
.uc-pw input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 12.5px;
}
.uc-pw input:focus { outline: none; border-color: #93b4f7; box-shadow: 0 0 0 3px #e8f0ff; }

@media (max-width: 1100px) {
  .me-grid { grid-template-columns: 1fr; }
  .pills { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; font-weight: 700; }
.card h2 .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: .5px; }
.stat .value.ok { color: var(--ok); }
.stat .value.err { color: var(--err); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
tr:hover td { background: #fbfdff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; line-height: 18px; white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: #eef2f7; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; line-height: 1; text-decoration: none;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--err); border-color: #fecaca; background: #fff7f7; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.field label { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #dbeafe; border-color: #93c5fd; }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.section-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; text-transform: uppercase; letter-spacing: .6px; }

.progress { height: 10px; background: #e8eefb; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #38bdf8); width: 0; transition: width .4s; }

.log {
  background: #0b1220; color: #cbd5e1; border-radius: 8px; padding: 14px 16px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
  height: 280px; overflow: auto; white-space: pre-wrap; line-height: 1.7;
}

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

details.issues summary { cursor: pointer; color: var(--brand); font-size: 12.5px; }
details.issues ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
details.issues li.warn { color: var(--warn); }
details.issues li.error { color: var(--err); }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(900px 500px at 50% -10%, #dbeafe, #f5f7fb 60%);
}
.auth-card {
  width: 360px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; box-shadow: 0 18px 40px rgba(15,23,42,.08);
}
.auth-card h1 { font-size: 18px; margin: 0 0 4px; }
.auth-card p.sub { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
.empty { text-align: center; color: var(--muted); padding: 34px 0; }
.pill-note { background: #f1f5f9; border-radius: 8px; padding: 10px 14px; color: var(--muted); font-size: 12.5px; }

/* 页内标签页 */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 9px 16px; font-size: 13.5px; color: var(--muted); text-decoration: none;
  border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.on { background: #fff; border-color: var(--line); color: var(--brand); font-weight: 600; }

/* 站点选择小卡片 */
.site-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px;
  font-size: 13px; background: #fff;
}
.chip:hover { background: #f8fafc; }
.chip:has(input:checked) { border-color: #93c5fd; background: #eff6ff; color: var(--brand); }
.chip input { margin: 0; }
.chip-all { border: 1px dashed var(--line); border-radius: 7px; padding: 5px 10px; background: #fff; }
.btn.primary.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.primary.danger:hover { background: #b91c1c; }
/* 权限与店铺分配 */
.perm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; font-size: 12.5px; color: #374151; }
.perm-row label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.perm-row input[type=checkbox] { width: 14px; height: 14px; accent-color: #2563eb; }
.perm-lb { color: #6b7280; font-size: 12.5px; }
.uc-panels { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 12px; }
.uc-panel-t { font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.uc-perm .perm-row, .uc-store .perm-row { margin-top: 0; }
.muted.small, .small.muted { font-size: 12px; margin: 0 0 6px; }
