/* ============================================================
 * 私域用户运营管理系统V1.0（Z字信号站） —— 全局样式表
 * 视觉规范：蓝绿科技风 / 深色导航 + 浅色工作区
 * ============================================================ */

:root {
  --brand-blue: #2F6BFF;
  --brand-teal: #12B3A8;
  --brand-deep: #0E2438;
  --brand-deep-2: #14344E;
  --bg-page: #F2F5F9;
  --bg-card: #FFFFFF;
  --line: #E4EAF2;
  --text-1: #17263A;
  --text-2: #566A85;
  --text-3: #8A9CB5;
  --ok: #12B76A;
  --warn: #F79009;
  --danger: #F04438;
  --info: #2F6BFF;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 68, .06), 0 6px 18px rgba(16, 40, 68, .06);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

body { display: flex; overflow: hidden; }

/* ---------------- 侧边导航 ---------------- */
.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: linear-gradient(180deg, #0E2438 0%, #123049 100%);
  display: flex;
  flex-direction: column;
  color: #C7D6E7;
  transition: width .22s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; flex-basis: 64px; }

.brand {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #12B3A8, #2F6BFF);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; letter-spacing: .5px;
}
.brand-text { line-height: 1.25; overflow: hidden; white-space: nowrap; }
.brand-text h1 { font-size: 14px; color: #fff; font-weight: 600; letter-spacing: .3px; }
.brand-text p { font-size: 10px; color: #6E8AA6; margin-top: 3px; letter-spacing: 1.2px; }
.sidebar.collapsed .brand-text { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 10px 8px 20px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 2px; }
.nav-group-title {
  font-size: 10px; letter-spacing: 1.5px; color: #5B7896;
  padding: 14px 10px 6px; white-space: nowrap;
}
.sidebar.collapsed .nav-group-title { opacity: 0; height: 12px; padding: 4px 0 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 1px 0;
  border-radius: 8px; cursor: pointer;
  font-size: 13px; color: #B9CBDE; white-space: nowrap;
  transition: background .16s, color .16s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(18,179,168,.22), rgba(47,107,255,.12));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--brand-teal);
}
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; flex: 0 0 18px; opacity: .9; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .nav-item .label { display: none; }
.nav-item .badge-dot {
  min-width: 18px; height: 16px; padding: 0 5px; border-radius: 8px;
  background: rgba(240, 68, 56, .9); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center;
}
.sidebar.collapsed .badge-dot { display: none; }

.sidebar-foot {
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: #5B7896; line-height: 1.6;
}
.sidebar-foot .ver { color: #7E97B0; }

/* ---------------- 主工作区 ---------------- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 56px; flex: 0 0 56px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
}
.collapse-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; color: var(--text-2); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.collapse-btn:hover { background: #F5F8FC; }
.crumb { font-size: 13px; color: var(--text-3); }
.crumb strong { color: var(--text-1); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.role-switch {
  display: flex; background: #F2F5F9; border-radius: 8px; padding: 3px;
}
.role-switch button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; color: var(--text-2); padding: 5px 12px; border-radius: 6px;
  font-family: var(--font);
}
.role-switch button.on { background: #fff; color: var(--brand-blue); font-weight: 600; box-shadow: 0 1px 3px rgba(16,40,68,.12); }

.search-box {
  display: flex; align-items: center; gap: 6px;
  background: #F2F5F9; border-radius: 8px; padding: 6px 10px; width: 220px;
}
.search-box input { border: 0; background: transparent; outline: none; font-size: 12px; width: 100%; font-family: var(--font); color: var(--text-1); }
.search-box input::placeholder { color: var(--text-3); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #12B3A8, #2F6BFF);
  color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.user-meta { line-height: 1.2; }
.user-meta .n { font-size: 12px; font-weight: 600; }
.user-meta .r { font-size: 10px; color: var(--text-3); }

.content { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: #D3DDE9; border-radius: 4px; }

/* ---------------- 页头 ---------------- */
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; font-weight: 600; letter-spacing: .4px; }
.page-head p { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text-1);
  padding: 7px 14px; border-radius: 8px; font-size: 12px; cursor: pointer;
  font-family: var(--font); display: inline-flex; align-items: center; gap: 5px;
  transition: all .15s;
}
.btn:hover { border-color: #C6D3E3; background: #FAFCFF; }
.btn.primary { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }
.btn.primary:hover { background: #1B58F0; }
.btn.teal { background: var(--brand-teal); border-color: var(--brand-teal); color: #fff; }
.btn.teal:hover { background: #0E9E94; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 11px; color: var(--text-3); }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 14px 16px; }

.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1280px) {
  .g-5, .g-6 { grid-template-columns: repeat(3, 1fr); }
  .g-4 { grid-template-columns: repeat(2, 1fr); }
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* ---------------- KPI 指标卡 ---------------- */
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -22px; top: -22px;
  width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle, rgba(47,107,255,.10), transparent 70%);
}
.kpi .k-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .k-value .unit { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.kpi .k-foot { margin-top: 8px; font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.delta-up { color: var(--ok); font-weight: 600; }
.delta-down { color: var(--danger); font-weight: 600; }
.kpi.teal .k-value { color: var(--brand-teal); }
.kpi.blue .k-value { color: var(--brand-blue); }
.kpi.warn .k-value { color: var(--warn); }
.kpi.danger .k-value { color: var(--danger); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
}
table.data thead th {
  text-align: left; font-weight: 600; color: var(--text-2);
  background: #F7F9FC; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 12px;
}
table.data tbody td {
  padding: 10px 12px; border-bottom: 1px solid #EFF3F8; color: var(--text-1);
  vertical-align: middle;
}
table.data tbody tr:hover { background: #F8FBFF; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { font-variant-numeric: tabular-nums; text-align: right; }
table.data .muted { color: var(--text-3); }
table.data .link { color: var(--brand-blue); cursor: pointer; }
table.data .link:hover { text-decoration: underline; }
table.data .strong { font-weight: 600; }

/* ---------------- 标签 / 状态 ---------------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 11px; line-height: 18px; white-space: nowrap;
}
.tag.gray { background: #F0F3F8; color: #63758E; }
.tag.blue { background: rgba(47,107,255,.10); color: #2F6BFF; }
.tag.teal { background: rgba(18,179,168,.12); color: #0E9E94; }
.tag.green { background: rgba(18,183,106,.12); color: #0E9C5B; }
.tag.orange { background: rgba(247,144,9,.13); color: #C77700; }
.tag.red { background: rgba(240,68,56,.11); color: #D32A1F; }
.tag.purple { background: rgba(124,88,255,.12); color: #6B45E8; }

.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.dot.gray { background: #B8C4D4; }

/* ---------------- 进度条 ---------------- */
.bar { height: 6px; border-radius: 3px; background: #EDF1F6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--brand-teal), var(--brand-blue)); }
.bar.warn > i { background: linear-gradient(90deg, #FDB022, #F79009); }
.bar.danger > i { background: linear-gradient(90deg, #F97066, #F04438); }

/* ---------------- 图表容器 ---------------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ---------------- 漏斗 ---------------- */
.funnel-step {
  display: flex; align-items: center; gap: 12px; margin-bottom: 2px;
}
.funnel-step .lbl { width: 76px; font-size: 12px; color: var(--text-2); flex: 0 0 76px; }
.funnel-step .track { flex: 1; position: relative; height: 30px; }
.funnel-step .fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, rgba(18,179,168,.85), rgba(47,107,255,.75));
  transition: width .3s;
}
.funnel-step .val { width: 90px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; flex: 0 0 90px; }
.funnel-step .rate { width: 62px; text-align: right; font-size: 11px; color: var(--text-3); flex: 0 0 62px; }

/* ---------------- 列表 / 待办 ---------------- */
.list { list-style: none; }
.list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed #EDF1F6; font-size: 12.5px;
}
.list li:last-child { border-bottom: 0; }
.list li .txt { flex: 1; line-height: 1.5; }
.list li .txt small { display: block; color: var(--text-3); font-size: 11px; margin-top: 2px; }
.list li .r { color: var(--text-3); font-size: 11px; white-space: nowrap; }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(14, 36, 56, .42);
  display: flex; align-items: center; justify-content: center; z-index: 900;
  padding: 24px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 760px;
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(9, 24, 40, .28);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--text-3); font-size: 18px; line-height: 1; padding: 0 4px; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 9px 12px; font-size: 12.5px; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text-1); line-height: 1.6; }

/* ---------------- 空态 ---------------- */
.empty { padding: 40px 0; text-align: center; color: var(--text-3); font-size: 12px; }

/* ---------------- 日历 ---------------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-cell { background: #fff; min-height: 92px; padding: 6px 7px; font-size: 11px; }
.cal-cell .d { color: var(--text-3); font-size: 11px; margin-bottom: 4px; }
.cal-cell.today .d { color: #fff; background: var(--brand-blue); border-radius: 4px; padding: 1px 5px; display: inline-block; }
.cal-item { display: block; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; font-size: 10.5px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-item.c1 { background: rgba(47,107,255,.10); color: #2454C8; }
.cal-item.c2 { background: rgba(18,179,168,.13); color: #0B8378; }
.cal-item.c3 { background: rgba(247,144,9,.14); color: #A96500; }
.cal-item.c4 { background: rgba(124,88,255,.12); color: #5A37D6; }
.cal-week-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; overflow: hidden; }
.cal-week-head div { background: #F7F9FC; text-align: center; font-size: 11px; color: var(--text-2); padding: 7px 0; }

/* ---------------- 筛选条 ---------------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select, .filters input {
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 6px 10px; font-size: 12px; color: var(--text-1); font-family: var(--font);
  outline: none;
}
.filters select:focus, .filters input:focus { border-color: var(--brand-blue); }
.filters .spacer { flex: 1; }

/* ---------------- 提示条 ---------------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: 8px; font-size: 12px; line-height: 1.6;
  background: rgba(47,107,255,.06); border: 1px solid rgba(47,107,255,.16); color: #20489E;
  margin-bottom: 14px;
}
.notice.warn { background: rgba(247,144,9,.07); border-color: rgba(247,144,9,.22); color: #8A5300; }
.notice.danger { background: rgba(240,68,56,.06); border-color: rgba(240,68,56,.2); color: #A8251B; }
.notice .i { font-size: 14px; }

/* ---------------- 步骤条 ---------------- */
.steps { display: flex; gap: 0; margin: 6px 0 18px; }
.step { flex: 1; position: relative; text-align: center; font-size: 11px; color: var(--text-3); }
.step::before {
  content: ""; display: block; width: 10px; height: 10px; border-radius: 50%;
  background: #DFE7F1; margin: 0 auto 6px;
}
.step.on { color: var(--brand-blue); font-weight: 600; }
.step.on::before { background: var(--brand-blue); box-shadow: 0 0 0 3px rgba(47,107,255,.16); }
.step::after {
  content: ""; position: absolute; top: 4px; left: calc(50% + 10px); right: -50%;
  height: 2px; background: #DFE7F1;
}
.step:last-child::after { display: none; }

/* ---------------- 上报/输出 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%);
  background: #14344E; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 12.5px; z-index: 999; box-shadow: 0 10px 30px rgba(9,24,40,.3);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.code-box {
  background: #0E2438; color: #C9E1F2; border-radius: 8px; padding: 12px 14px;
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 11.5px;
  line-height: 1.7; white-space: pre-wrap; word-break: break-all;
}

.mini-note { font-size: 11px; color: var(--text-3); line-height: 1.7; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.f-12 { font-size: 12px; }
.f-11 { font-size: 11px; }
.c-3 { color: var(--text-3); }
.c-2 { color: var(--text-2); }
.b-600 { font-weight: 600; }
.w-100 { width: 100%; }

/* 内容流水线看板：六环节在制，已发布单独成区，避免长列把整页撑高 */
.pub-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.pub-grid .k-card { display: flex; flex-direction: column; }
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; align-items: stretch; }
.kanban-col { min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; }
.kanban-col .k-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 0 2px; }
.kanban-col .k-body { flex: 1 1 auto; min-height: 116px; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 7px;
  background: #F6F8FC; border: 1px solid #E8EEF7; border-radius: 10px; padding: 8px; }
.kanban-col .k-body::-webkit-scrollbar { width: 6px; }
.kanban-col .k-body::-webkit-scrollbar-thumb { background: #D3DDE9; border-radius: 3px; }
.kanban-col .k-body::-webkit-scrollbar-track { background: transparent; }
.k-card { box-shadow: none !important; padding: 9px 10px !important; cursor: pointer; }
.k-card:hover { border-color: #C9DAF5; }
.k-empty { padding: 16px 4px; text-align: center; color: #B8C4D4; }

/* 明细表限高内滚，配合固定表头，避免明细过长把页面拉高 */
.scroll-body { max-height: 396px; overflow-y: auto; }
.scroll-body table.data thead th { position: sticky; top: 0; z-index: 2; }
