:root {
  --bg: #070d18;
  --bg-2: #0b1424;
  --panel: #101b2c;
  --panel-2: #16233a;
  --panel-3: #1b2a44;
  --line: rgba(94, 132, 196, 0.20);
  --line-strong: rgba(94, 132, 196, 0.40);
  --text: #e9f0fc;
  --muted: #8ba0c2;
  --dim: #64789a;
  --green: #3fd6a8;
  --blue: #5b8cff;
  --amber: #f0b64a;
  --pink: #ff7a9c;
  --danger: #ff6a6a;
  --violet: #a58bff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(3, 8, 18, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; overflow-x: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0.2px; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }

/* ---------- 低多边形背景 ---------- */
.bg-shapes { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-shapes .shape { position: absolute; display: block; opacity: 0.5; }
.bg-shapes .s1 {
  width: 520px; height: 520px; top: -230px; right: -130px;
  background: linear-gradient(150deg, rgba(63, 214, 168, 0.15), rgba(91, 140, 255, 0.04));
  clip-path: polygon(50% 0, 100% 38%, 78% 100%, 18% 88%, 0 30%);
}
.bg-shapes .s2 {
  width: 440px; height: 440px; bottom: -190px; left: -150px;
  background: linear-gradient(40deg, rgba(91, 140, 255, 0.16), rgba(63, 214, 168, 0.03));
  clip-path: polygon(20% 0, 90% 12%, 100% 70%, 46% 100%, 0 66%);
}
.bg-shapes .s3 {
  width: 250px; height: 250px; top: 44%; left: 47%;
  background: rgba(240, 182, 74, 0.05);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.app { position: relative; z-index: 1; max-width: 1600px; margin: 0 auto; padding: 16px 20px 26px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 18px;
  background: linear-gradient(120deg, rgba(22, 35, 58, 0.92), rgba(16, 27, 44, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.logo {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  background: rgba(91, 140, 255, 0.10);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.logo svg { width: 26px; height: 26px; }
.brand-text h1 { font-size: 16px; }
.brand-text p { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 3px; background: rgba(7, 13, 24, 0.6); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13px;
  transition: background 0.16s ease, color 0.16s ease;
}
.tab:hover { color: var(--text); background: rgba(91, 140, 255, 0.10); }
.tab.active { color: #071019; background: linear-gradient(135deg, var(--green), #57e8c0); font-weight: 600; }

.top-status { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(63, 214, 168, 0.14); color: var(--green);
  border: 1px solid rgba(63, 214, 168, 0.34);
  white-space: nowrap;
}
.badge.soft { background: rgba(91, 140, 255, 0.12); color: #9dbbff; border-color: rgba(91, 140, 255, 0.32); }
.badge.warn { background: rgba(240, 182, 74, 0.14); color: var(--amber); border-color: rgba(240, 182, 74, 0.34); }
.clock { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- 视图容器 ---------- */
.workspace { margin-top: 14px; }
.view { display: none; }
.view.active { display: block; animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: 4px 2px 14px; flex-wrap: wrap;
}
.view-head h2 { font-size: 18px; }
.view-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel {
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { font-size: 13.5px; }
.panel-head-right { display: flex; gap: 8px; align-items: center; }
.panel-tip { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.7; }
.hint { font-size: 11.5px; color: var(--dim); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi {
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 64px; height: 64px;
  background: rgba(63, 214, 168, 0.07); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 23px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: 11.5px; color: var(--dim); margin-top: 3px; }
.kpi-foot .up { color: var(--green); }
.kpi-foot .warn { color: var(--amber); }

.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* ---------- 趋势图 ---------- */
.trend-chart { display: flex; gap: 10px; align-items: flex-end; height: 176px; padding-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.trend-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; min-height: 0; }
.trend-bar { display: block; width: 34%; max-width: 16px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--blue), rgba(91, 140, 255, 0.3)); min-height: 3px; }
.trend-bar.gmv { background: linear-gradient(180deg, var(--green), rgba(63, 214, 168, 0.3)); }
.trend-label { font-size: 11px; color: var(--dim); }
.trend-value { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 条形 / 排行 ---------- */
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 92px; gap: 9px; align-items: center; font-size: 12px; }
.bar-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; height: 8px; border-radius: 999px; background: rgba(7, 13, 24, 0.8); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.bar-num { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; font-size: 11px; line-height: 1.35; }

.rank-list { display: flex; flex-direction: column; gap: 10px; counter-reset: rank; }
.rank-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 12.5px; }
.rank-list li::before {
  counter-increment: rank; content: counter(rank);
  width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center;
  font-size: 10.5px; background: rgba(91, 140, 255, 0.14); color: #9dbbff;
}
.rank-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-title small { display: block; font-size: 11px; color: var(--dim); }
.rank-hits { color: var(--green); font-variant-numeric: tabular-nums; font-size: 12px; }

/* ---------- 环形图 ---------- */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 132px; height: 132px; border-radius: 50%; flex: 0 0 132px; position: relative; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--panel); }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; min-width: 0; flex: 1; }
.legend li { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.legend b { color: var(--text); font-weight: 600; margin-left: auto; }

/* ---------- 库存预警 ---------- */
.stock-list { display: flex; flex-direction: column; gap: 9px; }
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 12.5px; }
.stock-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-name small { color: var(--dim); font-size: 11px; margin-left: 6px; }
.stock-bar { height: 6px; border-radius: 999px; background: rgba(7, 13, 24, 0.8); overflow: hidden; margin-top: 4px; }
.stock-bar i { display: block; height: 100%; border-radius: 999px; background: var(--amber); }
.stock-bar i.out { background: var(--danger); }
.stock-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--amber); }
.stock-num.out { color: var(--danger); }

/* ---------- 迷你列表 ---------- */
.mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 6px; border-radius: 9px; font-size: 12.5px;
  border-bottom: 1px solid rgba(94, 132, 196, 0.10);
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: rgba(91, 140, 255, 0.06); }
.mini-main { min-width: 0; }
.mini-title { display: flex; align-items: center; gap: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: 11px; color: var(--dim); margin-top: 1px; }
.mini-side { text-align: right; font-variant-numeric: tabular-nums; }
.mini-amount { font-size: 12.5px; }
.mini-time { font-size: 10.5px; color: var(--dim); }

/* ---------- 日志 ---------- */
.log-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.log-item { display: grid; grid-template-columns: 74px 44px minmax(0, 1fr); gap: 8px; font-size: 11.5px; align-items: baseline; }
.log-time { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-src { color: #9dbbff; }
.log-text { color: var(--muted); line-height: 1.55; word-break: break-word; }
.log-item.warn .log-text { color: var(--amber); }
.log-item.error .log-text { color: var(--danger); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] {
  flex: 1; min-width: 200px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text); outline: none;
}
.toolbar input[type="search"]:focus { border-color: rgba(63, 214, 168, 0.5); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px;
  background: rgba(91, 140, 255, 0.08); color: var(--muted);
  border: 1px solid var(--line);
}
.filter-chip:hover { color: var(--text); border-color: var(--line-strong); }
.filter-chip.active { background: rgba(63, 214, 168, 0.16); color: var(--green); border-color: rgba(63, 214, 168, 0.4); }
.filter-chip .n { opacity: 0.75; margin-left: 4px; font-variant-numeric: tabular-nums; }

.select, .search-inline {
  padding: 7px 11px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text); outline: none;
  font-size: 12.5px;
}
.select.small { padding: 5px 9px; font-size: 12px; }
.search-inline { width: 170px; }
.select:focus, .search-inline:focus { border-color: rgba(63, 214, 168, 0.5); }

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow);
}
.table-wrap.flat { border: 0; box-shadow: none; background: transparent; border-radius: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; padding: 11px 12px; color: var(--muted); font-weight: 500;
  background: rgba(27, 42, 68, 0.5); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid rgba(94, 132, 196, 0.12); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgba(91, 140, 255, 0.05); }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table .act { text-align: right; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

.product-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hue-chip {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #08131f;
  clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%);
}
.product-name { font-weight: 600; font-size: 12.8px; line-height: 1.4; }
.product-sku { font-size: 11px; color: var(--dim); margin-top: 2px; }
.cell-sub { font-size: 11px; color: var(--dim); }
.tag-row { display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px; padding: 1px 7px; border-radius: 6px;
  background: rgba(91, 140, 255, 0.12); color: #9dbbff; border: 1px solid rgba(91, 140, 255, 0.24);
  white-space: nowrap;
}
.tag.green { background: rgba(63, 214, 168, 0.12); color: var(--green); border-color: rgba(63, 214, 168, 0.26); }
.tag.amber { background: rgba(240, 182, 74, 0.14); color: var(--amber); border-color: rgba(240, 182, 74, 0.28); }
.tag.red { background: rgba(255, 106, 106, 0.14); color: var(--danger); border-color: rgba(255, 106, 106, 0.3); }
.tag.violet { background: rgba(165, 139, 255, 0.14); color: var(--violet); border-color: rgba(165, 139, 255, 0.28); }
.tag.dim { background: rgba(139, 160, 194, 0.12); color: var(--muted); border-color: var(--line); }

.pill {
  font-size: 11px; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent; display: inline-block;
}
.pill.wait { background: rgba(240, 182, 74, 0.16); color: var(--amber); border-color: rgba(240, 182, 74, 0.3); }
.pill.paid { background: rgba(91, 140, 255, 0.16); color: #9dbbff; border-color: rgba(91, 140, 255, 0.32); }
.pill.ship { background: rgba(165, 139, 255, 0.16); color: var(--violet); border-color: rgba(165, 139, 255, 0.3); }
.pill.done { background: rgba(63, 214, 168, 0.14); color: var(--green); border-color: rgba(63, 214, 168, 0.3); }
.pill.refund { background: rgba(255, 106, 106, 0.14); color: var(--danger); border-color: rgba(255, 106, 106, 0.3); }
.pill.closed { background: rgba(139, 160, 194, 0.14); color: var(--muted); border-color: var(--line); }
.pill.ai { background: rgba(91, 140, 255, 0.14); color: #9dbbff; border-color: rgba(91, 140, 255, 0.3); }
.pill.rule { background: rgba(240, 182, 74, 0.14); color: var(--amber); border-color: rgba(240, 182, 74, 0.3); }

/* ---------- 按钮 ---------- */
.primary-btn {
  padding: 8px 16px; border: 0; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--green), #57e8c0);
  color: #071019; font-weight: 600; font-size: 13px;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  background: rgba(91, 140, 255, 0.08); border: 1px solid var(--line);
  color: var(--text); font-size: 12.5px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover { background: rgba(91, 140, 255, 0.16); border-color: var(--line-strong); }
.ghost-btn.small { padding: 4px 9px; font-size: 11.5px; }
.ghost-btn.tiny { padding: 3px 8px; font-size: 11px; }
.ghost-btn.danger { color: var(--danger); border-color: rgba(255, 106, 106, 0.3); background: rgba(255, 106, 106, 0.08); }
.ghost-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 会员营销 ---------- */
.growth-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.camp-list { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.camp-card {
  padding: 12px 13px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.42); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 7px;
  border-left: 3px solid var(--blue);
}
.camp-card.running { border-left-color: var(--green); }
.camp-card.planned { border-left-color: var(--amber); }
.camp-card.ended { border-left-color: var(--dim); }
.camp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.camp-top h4 { font-size: 13px; line-height: 1.4; }
.camp-rule { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.camp-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--dim); }
.camp-meta b { color: var(--text); font-weight: 600; }
.camp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.roi-good { color: var(--green); }
.roi-bad { color: var(--danger); }

.seg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.seg-card { padding: 13px 14px; border-radius: var(--radius-sm); background: rgba(7, 13, 24, 0.42); border: 1px solid var(--line); }
.seg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.seg-head h4 { font-size: 13px; }
.seg-size { font-size: 20px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.seg-size small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.seg-line { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.seg-line b { color: var(--text); font-weight: 500; }

/* ---------- AI 助手 ---------- */
.assistant-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px;
  height: calc(100vh - 186px); min-height: 560px;
}
.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(27, 42, 68, 0.5), transparent);
}
.chat-title h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-title p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.chat-body::-webkit-scrollbar, .side-pane::-webkit-scrollbar, .camp-list::-webkit-scrollbar, .log-list::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb, .side-pane::-webkit-scrollbar-thumb, .camp-list::-webkit-scrollbar-thumb, .log-list::-webkit-scrollbar-thumb {
  background: rgba(94, 132, 196, 0.3); border-radius: 3px;
}

.msg { display: flex; gap: 8px; max-width: 88%; }
.msg.role-user { align-self: flex-end; flex-direction: row-reverse; }
.msg.role-assistant { align-self: flex-start; }
.msg.role-system { align-self: center; max-width: 94%; }
.msg-avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.msg.role-assistant .msg-avatar { background: rgba(63, 214, 168, 0.14); color: var(--green); border-color: rgba(63, 214, 168, 0.3); }
.msg.role-user .msg-avatar { background: rgba(91, 140, 255, 0.16); color: #9dbbff; border-color: rgba(91, 140, 255, 0.3); }
.msg-wrap { min-width: 0; }
.msg-bubble {
  padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  background: var(--panel-2); border: 1px solid var(--line);
}
.msg.role-user .msg-bubble { border-top-right-radius: 4px; background: rgba(91, 140, 255, 0.12); border-color: rgba(91, 140, 255, 0.3); }
.msg.role-assistant .msg-bubble {
  background: linear-gradient(135deg, rgba(63, 214, 168, 0.12), rgba(91, 140, 255, 0.08));
  border-color: rgba(63, 214, 168, 0.3); border-top-left-radius: 4px;
}
.msg-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 10.5px; color: var(--dim); margin-top: 4px; }
.msg.role-user .msg-meta { justify-content: flex-end; }
.msg-system-text {
  font-size: 11.5px; color: var(--dim); background: rgba(7, 13, 24, 0.6);
  border: 1px dashed var(--line); border-radius: 999px; padding: 3px 12px; text-align: center;
}

.composer { border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.chip {
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px;
  background: rgba(91, 140, 255, 0.08); border: 1px solid var(--line); color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); background: rgba(91, 140, 255, 0.16); }
.composer-row { display: flex; gap: 9px; align-items: flex-end; }
.composer-row textarea {
  flex: 1; min-height: 42px; max-height: 140px; resize: none;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text);
  outline: none; line-height: 1.5;
}
.composer-row textarea:focus { border-color: rgba(63, 214, 168, 0.5); }

.side-pane { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.side-card { padding: 13px 15px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.side-card h3 { font-size: 13px; margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 5px 8px; font-size: 12px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; font-variant-numeric: tabular-nums; }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-grid .span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.field input, .field select, .field textarea {
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text);
  outline: none; font-size: 13px; line-height: 1.6;
}
.field textarea { resize: vertical; min-height: 40px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(63, 214, 168, 0.5); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); padding: 8px 0; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--green); }
.panel-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 36px 20px; color: var(--dim); text-align: center; font-size: 12.5px;
}
.empty-state strong { color: var(--text); font-size: 14px; }
.empty-state.small { padding: 18px 14px; }

/* ---------- 弹窗 ---------- */
.modal {
  border: 1px solid var(--line-strong); border-radius: 16px; padding: 0;
  background: var(--panel); color: var(--text); box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  width: min(520px, calc(100vw - 40px)); max-height: calc(100vh - 60px);
}
.modal.wide { width: min(760px, calc(100vw - 40px)); }
.modal::backdrop { background: rgba(4, 8, 16, 0.66); backdrop-filter: blur(2px); }
.modal-body { padding: 18px 20px 16px; overflow-y: auto; max-height: calc(100vh - 62px); }
.modal-body h3 { font-size: 15px; margin-bottom: 4px; }
.modal-tip { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }

.ai-block {
  background: rgba(7, 13, 24, 0.55); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; font-size: 12.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow-y: auto;
}
.ai-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.ai-list { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.ai-list li { display: flex; gap: 8px; line-height: 1.65; }
.ai-list li::before { content: "·"; color: var(--green); }
.ai-kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 6px 10px; font-size: 12.5px; }
.ai-kv dt { color: var(--dim); }
.ai-kv dd { margin: 0; }
.risk-badge { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.risk-badge.high { background: rgba(255, 106, 106, 0.16); color: var(--danger); border: 1px solid rgba(255, 106, 106, 0.34); }
.risk-badge.medium { background: rgba(240, 182, 74, 0.16); color: var(--amber); border: 1px solid rgba(240, 182, 74, 0.34); }
.risk-badge.low { background: rgba(63, 214, 168, 0.16); color: var(--green); border: 1px solid rgba(63, 214, 168, 0.34); }

.order-items { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.order-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12.5px; }
.order-item .hue-chip { width: 32px; height: 32px; flex-basis: 32px; font-size: 11px; border-radius: 9px; }
.timeline { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.timeline li { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; }
.timeline b { color: var(--text); font-weight: 500; }

/* ---------- 页脚 / 提示 ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 0 4px; font-size: 11.5px; color: var(--dim);
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  padding: 9px 18px; border-radius: 999px; font-size: 12.5px;
  background: rgba(16, 27, 44, 0.96); border: 1px solid var(--line-strong);
  color: var(--text); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; z-index: 99;
  box-shadow: var(--shadow); max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 106, 106, 0.5); color: #ffb3b3; }

.loading { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(63, 214, 168, 0.3); border-top-color: var(--green); animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .growth-grid { grid-template-columns: 1fr; }
  .assistant-grid { grid-template-columns: 1fr; height: auto; }
  .side-pane { flex-direction: row; flex-wrap: wrap; }
  .side-pane .side-card { flex: 1 1 240px; }
  .chat-pane { min-height: 520px; }
}
@media (max-width: 900px) {
  .board-grid, .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .span2 { grid-column: auto; }
  .field-row { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 760px) {
  .app { padding: 12px 12px 20px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { order: 3; width: 100%; }
  .brand { min-width: 0; }
  .top-status { margin-left: 0; }
  .brand-text h1 { font-size: 14px; }
  .data-table th, .data-table td { padding: 9px 10px; }
}
