/* =====================================================================
   升学圳选 · 运营后台 设计系统
   设计基准：art-design-pro（Daymychen）开源模板
   主色 #5D87FF · 深色侧栏 #191A23 · 明暗双主题 · 圆角 12px 弹窗
   ===================================================================== */

:root {
  /* 品牌 */
  --primary: #5D87FF;
  --primary-hover: #4c6fe8;
  --primary-soft: rgba(93, 135, 255, .1);
  /* 亮色主题（默认） */
  --bg-page: #F5F7FA;
  --bg-card: #FFFFFF;
  --bg-hover: #F6F8FB;
  --bg-input: #FFFFFF;
  --text-1: #1D2129;
  --text-2: #4E5969;
  --text-3: #86909C;
  --border: #E5E6EB;
  --border-light: #F0F1F5;
  /* 状态 */
  --ok: #13DEB9;
  --ok-text: #0AA786;
  --ok-soft: rgba(19, 222, 185, .12);
  --warn: #FFAE1F;
  --warn-text: #B7791A;
  --warn-soft: rgba(255, 174, 31, .14);
  --danger: #FF4D4F;
  --danger-text: #D6363B;
  --danger-soft: rgba(255, 77, 79, .1);
  --info-soft: rgba(93, 135, 255, .12);
  /* 侧栏 */
  --side-bg: #191A23;
  --side-bg-hover: #23252F;
  --side-active: #5D87FF;
  --side-text: #BABBBD;
  --side-title: #D9DADB;
  /* 阴影 */
  --shadow-card: 0 1px 2px rgba(30, 40, 70, .04), 0 4px 16px rgba(30, 40, 70, .05);
  --shadow-pop: 0 8px 32px rgba(30, 40, 70, .14);
  --radius: 12px;
  --radius-s: 8px;
  --sidebar-w: 224px;
  --header-h: 60px;
}

html[data-theme="dark"] {
  --bg-page: #101014;
  --bg-card: #1A1B20;
  --bg-hover: #22242B;
  --bg-input: #1A1B20;
  --text-1: #ECECF0;
  --text-2: #A6A9B3;
  --text-3: #6E7280;
  --border: #2A2C34;
  --border-light: #23242B;
  --ok-text: #13DEB9;
  --warn-text: #FFAE1F;
  --danger-text: #FF7B7D;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-pop: 0 8px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--primary-soft); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(134, 144, 156, .35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(134, 144, 156, .55); }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 登录门 ==================== */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #E8EEFF 0%, #F5F7FA 55%, #EDE9FF 100%);
}
html[data-theme="dark"] .gate { background: linear-gradient(135deg, #14161D 0%, #101014 55%, #181827 100%); }
.gate-panel {
  display: flex; width: 880px; max-width: 92vw; min-height: 520px;
  background: var(--bg-card); border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 80px rgba(30, 40, 90, .18);
}
.gate-art {
  flex: 1.15; background: url("login-illust.jpg") center / cover no-repeat, linear-gradient(160deg, #5D87FF, #2B4AC2);
  min-height: 420px;
}
.gate-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 56px 52px; }
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 40px; }
.gate-brand img { width: 38px; height: 38px; border-radius: 10px; }
.gate-brand span { font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: .5px; }
.gate-title { font-size: 24px; font-weight: 700; color: var(--text-1); margin-bottom: 8px; }
.gate-sub { font-size: 13px; color: var(--text-3); margin-bottom: 32px; }
.gate label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.gate input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--bg-input); color: var(--text-1); font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.gate input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gate-btn {
  width: 100%; height: 44px; margin-top: 20px;
  border: 0; border-radius: var(--radius-s);
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600;
  letter-spacing: 4px; cursor: pointer; transition: background .15s;
}
.gate-btn:hover { background: var(--primary-hover); }
.gate-err { color: var(--danger-text); font-size: 13px; margin-top: 12px; min-height: 18px; }
@media (max-width: 760px) {
  .gate-art { display: none; }
  .gate-panel { min-height: 0; }
}

/* ==================== 应用布局 ==================== */
#app { display: none; }
.layout { display: flex; min-height: 100vh; }

/* ---- 侧栏 ---- */
.side {
  width: var(--sidebar-w); flex: none;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  background: var(--side-bg);
  display: flex; flex-direction: column;
  transition: width .2s ease;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--header-h); padding: 0 18px; flex: none;
}
.side-brand img { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.side-brand span {
  font-size: 15px; font-weight: 700; color: var(--side-title);
  white-space: nowrap; overflow: hidden; letter-spacing: .5px;
}
.side-menu { flex: 1; padding: 10px 12px; overflow-y: auto; }
.side-sec {
  font-size: 11px; color: #6E7080; letter-spacing: 1.5px;
  padding: 14px 10px 6px; white-space: nowrap;
}
.side-item {
  display: flex; align-items: center; gap: 11px;
  height: 44px; padding: 0 12px; margin-bottom: 4px;
  border-radius: var(--radius-s); color: var(--side-text);
  font-size: 14px; cursor: pointer; user-select: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.side-item svg { width: 18px; height: 18px; flex: none; }
.side-item:hover { background: var(--side-bg-hover); color: var(--side-title); }
.side-item.on { background: var(--side-active); color: #fff; font-weight: 600; }
.side-foot { padding: 14px 12px; flex: none; }
.side-theme {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; border-radius: var(--radius-s); cursor: pointer;
  color: var(--side-text); font-size: 13px;
  background: var(--side-bg-hover); border: 0; width: 100%;
  transition: background .15s;
}
.side-theme:hover { background: #2B2D38; }
.side-theme svg { width: 15px; height: 15px; }

/* ---- 主区 ---- */
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.header {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: var(--bg-card); border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 40;
}
.header-title { font-size: 16px; font-weight: 700; color: var(--text-1); }
.header-sub { font-size: 12px; color: var(--text-3); }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2);
  cursor: pointer; transition: all .15s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn svg { width: 16px; height: 16px; }
.chip-ok {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok-text); font-size: 12px; font-weight: 600;
}
.chip-ok i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.logout-btn {
  height: 34px; padding: 0 14px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2);
  font-size: 13px; cursor: pointer; transition: all .15s;
}
.logout-btn:hover { color: var(--danger-text); border-color: var(--danger); }

.content { flex: 1; padding: 20px 24px 40px; max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 18px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text-1); }
.page-sub { margin-top: 4px; font-size: 13px; color: var(--text-3); line-height: 1.6; }

/* ==================== 卡片 ==================== */
.card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-card); margin-bottom: 16px;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.card-t { font-size: 15px; font-weight: 700; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.card-t::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }
.card-note { font-size: 12px; color: var(--text-3); }
.card-note.warn { color: var(--warn-text); font-weight: 600; }
.card-note.ok { color: var(--ok-text); }

/* 系统状态网格 */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.sys-item .k { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.sys-item .v { font-size: 19px; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.sys-item .v.danger { color: var(--danger-text); }
.sys-item .v.warn { color: var(--warn-text); }

/* 指标卡 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -18px; top: -18px;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-soft);
}
.stat .num { font-size: 26px; font-weight: 800; color: var(--text-1); font-variant-numeric: tabular-nums; position: relative; }
.stat .label { font-size: 12px; color: var(--text-3); margin-top: 2px; position: relative; }
.stat.accent .num { color: var(--primary); }

/* ==================== 表格 ==================== */
.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-card);
}
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td {
  padding: 11px 14px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border-light); color: var(--text-2);
}
table.list th { background: var(--bg-hover); font-size: 12px; font-weight: 600; color: var(--text-3); position: sticky; top: 0; }
table.list tbody tr { transition: background .12s; }
table.list tbody tr:hover { background: var(--bg-hover); }
table.list tbody tr:last-child td { border-bottom: none; }
table.list .empty { text-align: center; color: var(--text-3); padding: 36px 0; }
table.list .num-cell { font-variant-numeric: tabular-nums; color: var(--text-1); font-weight: 600; }
table.list td .phone { color: var(--text-1); font-weight: 600; letter-spacing: .5px; }
.note-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/* 分布表 */
.dist { width: 100%; border-collapse: collapse; }
.dist td { padding: 7px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; color: var(--text-2); }
.dist tr:last-child td { border-bottom: none; }
.dist td:last-child { text-align: right; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }

/* ==================== 表单控件 ==================== */
.input, select.input, textarea.input {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--bg-input); color: var(--text-1); font-size: 13px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: var(--text-3); }

.btn {
  height: 36px; padding: 0 18px; border-radius: var(--radius-s);
  border: 1px solid transparent; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: var(--bg-card); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 6px; }

/* 工具行 */
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tools .input { width: 240px; }
.tools select.input { width: 150px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.pager button {
  height: 30px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2);
  font-size: 12px; cursor: pointer;
}
.pager button:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ==================== 徽章 ==================== */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge.ok, .badge.converted, .badge.done { background: var(--ok-soft); color: var(--ok-text); }
.badge.pending, .badge.gold { background: var(--warn-soft); color: var(--warn-text); }
.badge.danger, .badge.rejected, .badge.off { background: var(--danger-soft); color: var(--danger-text); }
.badge.info, .badge.contacted, .badge.on { background: var(--info-soft); color: var(--primary); }
.badge.muted { background: var(--bg-hover); color: var(--text-3); }

/* 消息条 */
.msg { font-size: 13px; min-height: 18px; margin: 8px 0; }
.msg.err { color: var(--danger-text); }
.msg.ok { color: var(--ok-text); }
.msg.warn { color: var(--warn-text); }

/* ==================== 图表 ==================== */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-box { height: 260px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }

/* 漏斗 */
.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; }
.funnel-row .name { width: 80px; color: var(--text-2); flex: none; }
.funnel-row .track { flex: 1; background: var(--bg-hover); border-radius: 6px; height: 26px; position: relative; overflow: hidden; }
.funnel-row .fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), #7E9EFF);
  border-radius: 6px; min-width: 4px; display: flex; align-items: center;
}
.funnel-row .val { position: absolute; left: 10px; color: #fff; font-size: 12px; font-weight: 700; }
.funnel-row .rate { width: 52px; text-align: right; color: var(--text-3); font-size: 12px; flex: none; }

/* 告警列表 */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-s); font-size: 13px;
}
.alert-item.warn { background: var(--warn-soft); color: var(--warn-text); }
.alert-item.info { background: var(--info-soft); color: var(--primary); }
.alert-item svg { width: 15px; height: 15px; flex: none; }

/* ==================== 详情抽屉 ==================== */
.chip-ok.offline { color: var(--danger-text); }
.chip-ok.offline i { background: currentColor; }

.drawer-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 20, 34, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: -560px; bottom: 0; z-index: 95;
  width: 540px; max-width: 94vw;
  background: var(--bg-card); box-shadow: var(--shadow-pop);
  transition: right .25s cubic-bezier(.4, 0, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.show { right: 0; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border-light); flex: none;
}
.drawer-head .t { font-size: 15px; font-weight: 700; color: var(--text-1); }
.drawer-close {
  width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: var(--bg-hover); color: var(--text-2); font-size: 15px; cursor: pointer;
}
.drawer-close:hover { color: var(--danger-text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; }
.drawer-body h4 {
  font-size: 13px; color: var(--text-3); font-weight: 600;
  margin: 18px 0 8px; padding-left: 8px; border-left: 3px solid var(--primary);
}
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.kv > div { display: flex; justify-content: space-between; padding: 6px 10px; background: var(--bg-hover); border-radius: 6px; }
.kv b { color: var(--text-3); font-weight: 500; flex: none; }
.kv span { color: var(--text-1); font-weight: 600; text-align: right; }
.line-list { list-style: none; font-size: 13px; }
.line-list li { padding: 7px 10px; border-bottom: 1px dashed var(--border-light); color: var(--text-2); }
.line-list li:last-child { border-bottom: none; }
.line-list .muted, .muted { color: var(--text-3); }
.drawer-head-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.d-name { font-size: 16px; font-weight: 700; color: var(--text-1); }
.d-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ==================== 模态框 ==================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 20, 34, .5);
  display: none; align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  width: 440px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 22px 24px;
}
.modal-t { font-size: 16px; font-weight: 700; color: var(--text-1); margin-bottom: 16px; }
.modal-row { margin-bottom: 14px; }
.modal-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.modal-row .input, .modal-row textarea.input { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ==================== 空态与加载 ==================== */
.empty-block { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 13px; }
.spin {
  width: 26px; height: 26px; margin: 30px auto;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: var(--radius-s); font-size: 13px; font-weight: 500;
  background: var(--bg-card); color: var(--text-1); border: 1px solid var(--border);
  box-shadow: var(--shadow-pop); animation: toast-in .25s ease;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 900px) {
  .side { width: 64px; }
  .side-brand span, .side-item span, .side-sec, .side-theme span { display: none; }
  .side-item { justify-content: center; padding: 0; }
  .side-theme { padding: 0; }
  .main { margin-left: 64px; }
  .content { padding: 16px 14px 32px; }
}
