/* 小百灵获客宝 · 系统总后台（/ops）
   与用户端管理台（/app）刻意做出视觉区分：
   深色侧边栏 + 冷灰内容区，一眼能看出"这是平台方的地方"。 */
:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --border: #e3e6ec;
  --text: #161a22;
  --muted: #6b7383;
  --primary: #1f4fd8;
  --primary-soft: #e9efff;
  --nav: #131826;
  --nav-hover: #1e2639;
  --green: #0c8a55;
  --green-soft: #e4f5ec;
  --red: #d13438;
  --red-soft: #fdeaea;
  --orange: #c46a00;
  --orange-soft: #fff2e2;
  --purple: #6b3fd4;
  --purple-soft: #f0eaff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }

/* ============ 登录 ============ */
#auth {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(700px 380px at 70% 0%, #23305a 0%, rgba(19,24,38,0) 65%), #131826;
  padding: 20px; overflow: auto;
}
#auth .box {
  width: 380px; max-width: 100%; background: #fff; border-radius: 16px; padding: 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.auth-brand i {
  width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #1f4fd8, #4b7bff);
  color: #fff; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 17px;
}
.auth-brand b { font-size: 16px; display: block; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-note {
  margin: 14px 0 18px; padding: 9px 11px; border-radius: 8px; background: #f5f7fb;
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
#auth .err { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ============ 布局 ============ */
#app { display: none; min-height: 100vh; }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 214px; flex-shrink: 0; background: var(--nav); color: #cfd6e4;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 20px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #1f4fd8, #4b7bff);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.brand b { font-size: 14px; color: #fff; display: block; letter-spacing: .3px; }
.brand small { color: #7d8798; font-size: 11px; }
.nav-group { color: #5f6a7d; font-size: 10.5px; letter-spacing: 1px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; font-size: 13.5px; color: #c3cbd9; user-select: none;
}
.nav-item:hover { background: var(--nav-hover); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item .ic { width: 16px; text-align: center; opacity: .9; }
.sidebar .foot { margin-top: auto; padding: 10px 8px; font-size: 11px; color: #6b7688; }
.sidebar .foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #35c07a; margin-right: 5px; }
.sidebar .foot .dot.off { background: #566072; }

.mainwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.tb-title { font-size: 15px; font-weight: 600; }
.tb-sub { font-size: 12px; color: var(--muted); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.who { text-align: right; line-height: 1.3; }
.who b { display: block; font-size: 12.5px; }
.who small { color: var(--muted); font-size: 11px; }
.main { padding: 20px 22px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 18px; }
.page-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ============ 卡片 / KPI ============ */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card > h3 {
  font-size: 13.5px; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card > h3 .hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .num { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; }
.kpi .num small { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi .delta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid #f1f3f7; vertical-align: top; font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 13px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.tblwrap { overflow-x: auto; }

/* ============ 徽标 / 按钮 ============ */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px;
  line-height: 18px; white-space: nowrap;
}
.b-blue { background: var(--primary-soft); color: var(--primary); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-orange { background: var(--orange-soft); color: var(--orange); }
.b-purple { background: var(--purple-soft); color: var(--purple); }
.b-gray { background: #eef0f4; color: #5b6270; }

button {
  font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); padding: 7px 13px; transition: .12s;
}
button:hover { border-color: #c6cddb; background: #fbfcfe; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: #1a44bd; }
button.danger { color: var(--red); border-color: #f0c9c9; }
button.danger:hover { background: var(--red-soft); }
button.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
button.block { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary); padding: 4px 6px; font-size: 12px; }

input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #9db6ff; box-shadow: 0 0 0 3px rgba(31, 79, 216, .1); }
textarea { resize: vertical; min-height: 74px; line-height: 1.7; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field .tip { font-size: 11px; color: var(--muted); margin-top: 4px; }
.search { max-width: 240px; }

/* ============ 弹窗 ============ */
.mask {
  position: fixed; inset: 0; background: rgba(12, 16, 26, .48); display: none;
  align-items: center; justify-content: center; padding: 24px; z-index: 100;
}
.mask.show { display: flex; }
.modal {
  width: 640px; max-width: 100%; max-height: 90vh; background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
}
.modal header {
  padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between; font-weight: 600; font-size: 14.5px;
}
.modal .body { padding: 18px; overflow: auto; }
.modal footer {
  padding: 12px 18px; border-top: 1px solid var(--border); display: flex;
  justify-content: flex-end; gap: 8px; background: #fcfcfd;
}
.modal .x { cursor: pointer; color: var(--muted); font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 16px);
  background: #1c2333; color: #fff; padding: 10px 18px; border-radius: 9px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 300; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b3252a; }

/* ============ 图表（纯 CSS 柱状） ============ */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 132px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.chart .bar {
  width: 100%; max-width: 46px; background: linear-gradient(180deg, #4b7bff, #1f4fd8);
  border-radius: 5px 5px 2px 2px; min-height: 2px; transition: .3s;
}
.chart .bar.zero { background: #e6e9f0; }
.chart .cap { font-size: 11px; color: var(--muted); }
.chart .val { font-size: 11px; color: var(--text); font-weight: 600; }

/* ============ 标签页 / 胶囊 ============ */
.tabs { display: inline-flex; gap: 3px; background: #eef1f6; padding: 3px; border-radius: 9px; }
.tabs .tab { padding: 5px 14px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.tabs .tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 4px 11px; border-radius: 99px; border: 1px solid var(--border);
  font-size: 12.5px; cursor: pointer; background: #fff; color: #4a5262;
}
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 行业包卡片 */
.pack {
  border: 1px solid var(--border); border-radius: 11px; padding: 14px 15px; background: #fff;
  display: flex; flex-direction: column; gap: 8px;
}
.pack.hidden { opacity: .62; }
.pack h4 { font-size: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pack .kw { display: flex; gap: 5px; flex-wrap: wrap; }
.pack .kw span { background: #f2f5fa; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; color: #46506a; }
.pack .acts { display: flex; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.pack .meta { font-size: 11.5px; color: var(--muted); }

/* AI 通道卡片 */
.prov { border: 1px solid var(--border); border-radius: 11px; padding: 14px 15px; background: #fff; }
.prov.default { border-color: #b9caff; box-shadow: 0 0 0 3px rgba(31, 79, 216, .07); }
.prov h4 { font-size: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.prov .kv { display: grid; grid-template-columns: 78px 1fr; gap: 2px 8px; font-size: 12.5px; margin-top: 8px; }
.prov .kv b { color: var(--muted); font-weight: 400; }
.prov .acts { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.test-out {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f6f8fc;
  font-size: 12px; color: #39445c; word-break: break-all;
}
.test-out.bad { background: var(--red-soft); color: #8e1d21; }

@media (max-width: 1080px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px; }
  .brand, .nav-group, .sidebar .foot { display: none; }
  .nav-item { white-space: nowrap; padding: 7px 11px; }
  .main { padding: 14px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
}
