:root {
  --bg: #eef1f7;
  --card: #ffffff;
  --line: #e3e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0fe;
  --sidebar: #131c33;
  --sidebar-text: #aeb8d0;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .07);
  --shadow-lg: 0 12px 36px rgba(15, 23, 42, .13);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; height: 100vh; overflow: hidden; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c3cad8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8b2c6; }
::-webkit-scrollbar-track { background: transparent; }

/* 侧边栏 */
#sidebar {
  width: 232px;
  min-width: 232px;
  background: linear-gradient(180deg, #141c34 0%, #17123a 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand .logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(249, 115, 22, .4);
}
.brand h1 { margin: 0; font-size: 16px; color: #fff; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; font-size: 11px; color: #64748b; }
#nav { flex: 1; overflow-y: auto; margin-top: 10px; }
#nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 9px; margin-bottom: 3px;
  cursor: pointer; color: var(--sidebar-text); user-select: none;
  transition: background .15s, color .15s, transform .1s;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item:active { transform: scale(.985); }
.nav-item.active {
  background: linear-gradient(90deg, #4f46e5, #6d5df1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .4);
}
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, .45);
}
.role-box { border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 12px; }
.role-box label { font-size: 11px; color: #64748b; display: block; margin-bottom: 6px; }
.role-box select {
  width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid #334155;
  background: rgba(255, 255, 255, .06); color: #e2e8f0; font-size: 12px;
}

/* 主区域 */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#topbar {
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 22px; display: flex; align-items: center; justify-content: space-between;
}
#topbar h2 { margin: 0; font-size: 18px; letter-spacing: .3px; }
#topbar p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
#topbar .title-wrap { display: flex; align-items: center; gap: 12px; }
#btnBack { flex-shrink: 0; }
.hidden { display: none !important; }
#content { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }

/* 卡片与面板 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.card h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: .2px; }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.stat-card .label { color: var(--muted); font-size: 12px; }
.stat-card .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: .3px; }
.stat-card .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* 数据分析 KPI 卡：顶部彩色条 */
.stat-card.kpi { position: relative; overflow: hidden; padding-top: 18px; }
.stat-card.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--kpi, var(--primary));
}
.stat-card.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.kpi .value { color: var(--kpi, var(--text)); font-size: 22px; }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .grid.two { grid-template-columns: 1fr; } }

/* 工具栏 */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
input, select, textarea {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}
textarea { resize: vertical; min-height: 64px; }

/* 按钮 */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, #5457ee, #4f46e5);
  border-color: transparent; color: #fff;
  box-shadow: 0 3px 10px rgba(79, 70, 229, .3);
}
.btn.primary:hover { background: linear-gradient(135deg, #4f46e5, #4338ca); color: #fff; box-shadow: 0 5px 14px rgba(79, 70, 229, .4); }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.icon-btn {
  border: none; background: transparent; font-size: 20px; cursor: pointer;
  color: var(--muted); line-height: 1; padding: 4px 8px; border-radius: 6px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* 表格 */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  background: #f7f9fc; color: var(--muted); font-weight: 600; font-size: 12px;
  letter-spacing: .3px;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f6f8fd; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
/* 操作列固定在右侧，列宽超出时可横向滚动且按钮始终可见 */
table.has-actions th:last-child, table.has-actions td:last-child {
  position: sticky; right: 0; background: #fff; box-shadow: -6px 0 8px rgba(15, 23, 42, .06);
}
table.has-actions thead th:last-child { background: #f7f9fc; }
table.has-actions tbody tr:hover td:last-child { background: #f6f8fd; }
td .row-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity .15s; }
tr:hover td .row-actions { opacity: 1; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .2px; }
.badge.S { background: #fee2e2; color: #b91c1c; }
.badge.A { background: #dbeafe; color: #1d4ed8; }
.badge.B { background: #dcfce7; color: #15803d; }
.badge.C { background: #f1f5f9; color: #475569; }
.badge.blue { background: #e0e7ff; color: #4338ca; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.purple { background: #ede9fe; color: #6d28d9; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .48);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  animation: fadeIn .18s ease;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 14px; width: min(680px, 94vw); max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: popIn .2s ease;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-body .field.full { grid-column: 1 / -1; }
.modal-body .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.modal-body .field input, .modal-body .field select, .modal-body .field textarea { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* 登录层 */
.login-overlay {
  position: fixed; inset: 0; z-index: 300;
  background:
    radial-gradient(ellipse 60% 50% at 20% 15%, rgba(99, 102, 241, .35), transparent),
    radial-gradient(ellipse 50% 45% at 85% 80%, rgba(249, 115, 22, .22), transparent),
    linear-gradient(140deg, #101731, #1b1440 65%, #101731);
  display: flex; align-items: center; justify-content: center;
}
.login-overlay.hidden { display: none; }
.login-box {
  width: min(370px, 92vw); background: #fff; border-radius: 16px;
  padding: 30px 28px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  animation: popIn .25s ease;
}
.login-box .brand { border-bottom: none; padding: 0 0 18px; }
.login-box .brand h1 { color: var(--text); }
.login-box .brand p { color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-form .btn { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-powered { margin-top: 14px; text-align: center; font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.app-footer { padding: 8px 22px 14px; text-align: center; font-size: 11px; color: var(--muted); letter-spacing: .3px; }

/* 彩蛋：上帝视角 */
.god-overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(15, 23, 42, .72);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  animation: godFade .25s ease;
}
.god-box {
  background: linear-gradient(160deg, #1e1b4b, #312e81 60%, #0f172a);
  border: 1px solid rgba(139, 92, 246, .45); border-radius: 18px;
  padding: 34px 40px; text-align: center; color: #e2e8f0; max-width: 460px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), 0 0 60px rgba(139, 92, 246, .25);
}
.god-eye { font-size: 54px; line-height: 1; animation: godBlink 2.4s infinite; }
.god-box h2 { margin: 12px 0 6px; font-size: 20px; letter-spacing: 5px; color: #fff; }
.god-line { color: #c7d2fe; font-size: 14px; margin: 8px 0 16px; }
.god-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.god-stats span {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; color: #c7d2fe;
}
.god-stats b { color: #fff; }
.god-sub { font-size: 11px; color: #64748b; margin: 10px 0 14px; letter-spacing: .5px; }
@keyframes godFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes godBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #131c33; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13px; z-index: 200; box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  animation: toastIn .2s ease;
}
.toast.hidden { display: none; }
.toast.err { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 条形图 */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { width: 90px; font-size: 12px; color: var(--muted); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; background: #eef1f7; border-radius: 6px; height: 18px; overflow: hidden; }
.bar-fill {
  height: 100%; background: linear-gradient(90deg, #818cf8, #4f46e5);
  border-radius: 6px; transition: width .4s ease;
}
.bar-val { width: 90px; font-size: 12px; font-weight: 600; }

/* 详情 / 时间线 */
.detail-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.detail-head h3 { font-size: 17px; }
.kv { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.kv span { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 12px; }
.kv b { color: var(--text); font-weight: 600; }
.kv .k { color: var(--muted); margin-right: 4px; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 4px 0 12px; }
.tl-item::before {
  content: ""; position: absolute; left: -17px; top: 8px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--line);
}
.tl-item .tl-title { font-weight: 600; }
.tl-item .tl-date { font-size: 12px; color: var(--muted); }
.tl-item .tl-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 部门树 */
.tree { font-size: 13px; max-height: 220px; overflow-y: auto; }
.tree label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
.tree input { accent-color: var(--primary); }

/* 工作台下钻 */
.dash-link { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.stat-card.dash-link:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(79, 70, 229, .16); }
.bar-row.dash-link:hover .bar-fill { filter: brightness(1.08); }
.dash-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px;
  transition: background .12s;
}
.dash-row:hover { background: #f6f8fd; }

/* 导航分组 */
.nav-group-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px 4px; font-size: 11px; letter-spacing: 2px;
  color: rgba(255, 255, 255, .45); cursor: pointer; user-select: none;
}
.nav-group-head:hover { color: rgba(255, 255, 255, .75); }
.nav-group-head .nav-arrow { font-size: 10px; transition: transform .15s; }
.nav-group-head.collapsed .nav-arrow { transform: rotate(-90deg); }

/* 下拉菜单 */
.dd-wrap { position: relative; display: inline-block; }
.dd-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .14); min-width: 230px; padding: 4px;
}
.dd-item { padding: 8px 12px; font-size: 13px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.dd-item:hover { background: #f1f5ff; }

/* 可折叠筛选面板 */
.filter-panel {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 12px; margin: 0 0 12px; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 8px;
}

/* 页内 Tab */
.page-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.page-tab {
  padding: 8px 18px; font-size: 13.5px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.page-tab:hover { color: var(--brand, #4f46e5); }
.page-tab.active { color: var(--brand, #4f46e5); border-bottom-color: var(--brand, #4f46e5); font-weight: 600; }

/* 品牌-门店-设备 三层树 */
.seg-store { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; overflow: hidden; }
.seg-store-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: #f8fafc; cursor: pointer; user-select: none;
}
.seg-store-head:hover { background: #eef2fb; }
.seg-arrow { width: 14px; color: #64748b; }
.seg-store-name { font-weight: 600; color: var(--brand, #4f46e5); }
.seg-store-name:hover { text-decoration: underline; }
.seg-store-stat { margin-left: auto; font-size: 12px; color: #64748b; }
.seg-devs { padding: 4px 12px 10px 34px; }
.seg-devs table { font-size: 12.5px; }
.seg-dev-row { cursor: pointer; }
.seg-dev-row:hover td { background: #f6f8fd; }

/* 数据分析图表 */
.chart-flex { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.chart-donut { position: relative; flex-shrink: 0; }
.chart-donut svg, .chart-ring svg { display: block; }
.chart-donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.chart-donut-center b { font-size: 20px; }
.chart-donut-center span { font-size: 11px; color: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 10px; max-width: 240px; }
.legend-item {
  cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  transition: border-color .15s, color .15s;
}
.legend-item:hover { border-color: var(--primary); color: var(--primary); }
.legend-item i, .vlegend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-item b { color: var(--text); }
.funnel { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 14px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-block {
  margin: 0 auto; padding: 8px 12px; border-radius: 8px; color: #fff;
  display: flex; justify-content: space-between; gap: 24px; font-size: 13px; min-width: 130px;
  box-shadow: var(--shadow-sm);
}
.funnel-pct { width: 52px; text-align: right; font-size: 12px; font-weight: 600; color: var(--text); }
.funnel-pct.muted { color: var(--muted); }
.chart-ring { position: relative; flex-shrink: 0; }
.chart-ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; text-align: center;
}
.chart-ring-center b { font-size: 17px; }
.chart-ring-center span { font-size: 11px; color: var(--muted); }
.chart-ring-center small { font-size: 10px; color: var(--muted); }
.vchart { display: flex; align-items: flex-end; gap: 6px; padding: 12px 4px 0; min-height: 145px; overflow-x: auto; }
.vcol { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 30px; flex-shrink: 0; }
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 102px; }
.vbar { width: 8px; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s ease; }
.vlab { font-size: 10px; color: var(--muted); }
.vlegend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.vlegend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
.card h4 { margin: 0 0 8px; font-size: 13px; color: var(--text); }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.hint { font-size: 12px; color: var(--muted); }
.search-box {
  display: flex; gap: 8px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 4px 4px 4px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.search-box input { border: none; outline: none; width: 220px; }
.search-box input:focus { box-shadow: none; }

/* 可搜索下拉 */
.search-select { position: relative; }
.search-select .ss-input { width: 100%; }
.ss-list {
  position: absolute; top: 100%; left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; max-height: 240px;
  overflow-y: auto; z-index: 50; box-shadow: var(--shadow-lg);
  margin-top: 4px;
}
.ss-list.hidden { display: none; }
.ss-item { padding: 8px 10px; cursor: pointer; font-size: 13px; transition: background .12s; }
.ss-item:hover { background: var(--primary-soft); }

/* 客户地图 */
.map-box {
  position: relative; height: 560px; background:
    radial-gradient(circle at 30% 20%, #e0e7ff 0, transparent 40%),
    radial-gradient(circle at 75% 55%, #dcfce7 0, transparent 45%),
    #f8fafc;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.prov-block { position: absolute; transform: translate(-50%, -50%); text-align: center; cursor: pointer; }
.prov-bubble {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: 13px; margin: 0 auto;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .4);
  border: 2px solid #fff;
  transition: transform .15s;
}
.prov-block:hover .prov-bubble { transform: scale(1.12); }
.prov-name { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.result-group { margin-bottom: 20px; }
.result-group h4 { margin: 0 0 8px; font-size: 14px; }
.mini-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mini-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.mini-card:hover { box-shadow: var(--shadow-md); border-color: #c7cdf0; }
.mini-card.clickable { cursor: pointer; }
.mini-card.clickable:hover { transform: translateY(-2px); border-color: var(--primary); }

/* 检索结果强化 */
.search-summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search-summary .sum-pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; box-shadow: var(--shadow-sm); }
.search-summary .sum-pill b { color: var(--primary); font-size: 15px; margin: 0 2px; }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 2px; }
.mini-card .kvline { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; font-size: 12.5px; color: var(--muted); }
.mini-card .kvline b { color: var(--ink); font-weight: 600; }
.hist-toggle { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12.5px; padding: 4px 0 0; }
.hist-toggle:hover { text-decoration: underline; }

/* 客户详情：设备按门店分组 */
.store-group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.store-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #f8f9ff; cursor: pointer; user-select: none; }
.store-head:hover { background: #eef1ff; }
.store-head .hint { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-arrow { color: var(--muted); font-size: 12px; }
.store-body { padding: 8px 10px; }

/* 智能助手聊天 */
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 4px; }
.chat-msg { display: flex; margin: 10px 0; }
.chat-msg.user { justify-content: flex-end; }
.chat-bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; box-shadow: var(--shadow-sm); }
.chat-msg.user .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot .chat-bubble { background: #f4f6fd; color: var(--ink); border-bottom-left-radius: 4px; }
.chat-result-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.crc-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.crc-lines { font-size: 12.5px; color: var(--muted); line-height: 1.8; max-height: 260px; overflow-y: auto; }
.crc-action { margin-top: 8px; font-size: 12.5px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 2px; }
.chat-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; color: var(--primary); transition: all .15s; }
.chat-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-input-row { display: flex; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-input-row input { flex: 1; }

/* 设备详情右侧抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 40; animation: fadeIn .18s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 92vw);
  background: #fff; border-left: 1px solid var(--line); z-index: 41;
  display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(15, 23, 42, .16);
  animation: drawerIn .22s ease;
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer-body { padding: 16px 18px; overflow-y: auto; }
.drawer-body .kv { display: flex; flex-wrap: wrap; gap: 8px; }

/* 管理驾驶舱：异常预警横条 + 趋势迷你图 */
.alert-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.alert-strip.ok { border-color: #bbf7d0; background: #f0fdf4; }
.alert-strip-label { font-size: 12px; font-weight: 700; color: var(--red); letter-spacing: 1px; }
.alert-badge { padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.alert-badge.red { background: #fee2e2; color: #b91c1c; }
.alert-badge.amber { background: #fef3c7; color: #b45309; }
.alert-badge:hover { filter: brightness(.96); }
.alert-ok { font-size: 12.5px; font-weight: 600; color: var(--green); }
.mini-chart { display: flex; gap: 8px; align-items: flex-end; height: 96px; }
.mini-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.mini-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.mini-bar { width: 70%; max-width: 30px; background: #c7d2fe; border-radius: 4px 4px 0 0; transition: height .3s ease; }
.mini-bar.cur { background: var(--primary); }
.mini-ym { font-size: 11px; color: var(--muted); }

/* 设备生命周期时间线：圆点颜色按事件类型区分（装机绿/维修红/备用机琥珀/回访蓝） */
.timeline.lc .tl-item.lc-installations::before { background: var(--green); }
.timeline.lc .tl-item.lc-repairs::before { background: var(--red); }
.timeline.lc .tl-item.lc-loaners::before { background: var(--amber); }
.timeline.lc .tl-item.lc-visits::before { background: var(--primary); }

/* AI 经营周报：居中卡片 */
.report-card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(640px, 94vw); max-height: 86vh;
  background: #fff; border-radius: var(--radius); z-index: 41;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: fadeIn .18s ease;
}
.report-card .drawer-body { overflow-y: auto; }
.report-text {
  font-size: 13.5px; line-height: 1.8;
  background: #f8f9ff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}

/* AI 录单：抽取结果字段 */
.pt-field { display: flex; gap: 8px; align-items: baseline; }
.pt-field .k { color: var(--muted); font-size: 12px; min-width: 56px; }

/* 维修知识库：分类卡片 */
.kn-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.kn-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kn-ratio { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.kn-sols { margin-top: 8px; }
.kn-sol { font-size: 13px; line-height: 1.7; color: var(--muted); }
.kn-sop { margin-top: 8px; }
