/* 定制游员工工作台 · 响应式样式（电脑 / 手机同一套） */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e4e8f0;
  --text: #1b2437;
  --text-2: #5a6780;
  --muted: #93a0b8;
  --brand: #2f5bea;
  --brand-soft: #eaf0ff;
  --ok: #12a15c;
  --ok-soft: #e6f7ee;
  --warn: #d98014;
  --warn-soft: #fdf3e3;
  --danger: #d94040;
  --danger-soft: #fdeaea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 6px 18px rgba(20, 30, 60, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --panel: #171e2c;
    --panel-2: #1d2534;
    --line: #2a3446;
    --text: #e8edf7;
    --text-2: #a3b0c8;
    --muted: #7a879e;
    --brand: #6d8dff;
    --brand-soft: #1e2a49;
    --ok: #37d38a;
    --ok-soft: #14301f;
    --warn: #f0a63c;
    --warn-soft: #33260f;
    --danger: #ff7a7a;
    --danger-soft: #3a1c1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }

/* ---------- 第 12 批需求 4：后台配色方案手动可选（浅色 / 深色） ----------
   默认跟随系统（上面的 :root + prefers-color-scheme）；用户点右上角「配色」按钮后
   在 <html> 上写 data-theme，显式选择优先级更高（html[data-theme] 特异性 > :root） */
html[data-theme='light'] {
  --bg: #f4f6fa; --panel: #ffffff; --panel-2: #f8fafc; --line: #e4e8f0;
  --text: #1b2437; --text-2: #5a6780; --muted: #93a0b8;
  --brand: #2f5bea; --brand-soft: #eaf0ff;
  --ok: #12a15c; --ok-soft: #e6f7ee; --warn: #d98014; --warn-soft: #fdf3e3;
  --danger: #d94040; --danger-soft: #fdeaea;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 6px 18px rgba(20, 30, 60, .06);
}
html[data-theme='dark'] {
  --bg: #0f1420; --panel: #171e2c; --panel-2: #1d2534; --line: #2a3446;
  --text: #e8edf7; --text-2: #a3b0c8; --muted: #7a879e;
  --brand: #6d8dff; --brand-soft: #1e2a49;
  --ok: #37d38a; --ok-soft: #14301f; --warn: #f0a63c; --warn-soft: #33260f;
  --danger: #ff7a7a; --danger-soft: #3a1c1c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

/* ---------- 第 12 批需求 3：供应商结算状态按钮（点一下切换，未结算红 / 已结算绿） ---------- */
.settle-btn { min-width: 86px; font-weight: 600; border: 1px solid transparent; transition: all .15s; }
.settle-btn.unsettled { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.settle-btn.unsettled:hover { background: var(--danger); color: #fff; }
.settle-btn.settled { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); cursor: pointer; }
.settle-btn.settled:hover { background: var(--ok); color: #fff; }

/* ---------- 第 12 批需求 5：统计财务卡 hover 变色（点开看模块明细，不再放放大镜图标） ---------- */
.drill-card { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.drill-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(47, 91, 234, .18); transform: translateY(-1px); }


body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--panel);
  border-right: 1px solid var(--line); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
  background: linear-gradient(135deg, #2f5bea, #6a8dff); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text b { font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; min-height: 0; padding-right: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; color: var(--text-2); cursor: pointer; font-weight: 500;
}
.nav-item i { font-style: normal; font-size: 16px; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
/* 第 6 批需求 9：一级 / 二级目录 */
.nav-group { font-size: 10.5px; color: var(--muted); letter-spacing: .08em; padding: 10px 14px 2px; user-select: none; flex: 0 0 auto; }
.nav-group.toggle { cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.nav-group.toggle:hover { color: var(--text-2); }
.fold-arrow { transition: transform .15s; font-size: 10px; }
.fold-arrow.closed { transform: rotate(-90deg); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; }
.nav-sub.closed { display: none; }
.nav-item.sub { padding: 7px 12px 7px 20px; font-size: 13px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }
.content { padding: 20px; flex: 1; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

/* ---------- 通用组件 ---------- */
.btn {
  border: 1px solid transparent; background: var(--brand); color: #fff;
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row.tight { gap: 8px; }
.grow { flex: 1; min-width: 160px; }

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 72px; resize: vertical; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.tag.blue { background: var(--brand-soft); color: var(--brand); }
.tag.green { background: var(--ok-soft); color: var(--ok); }
.tag.amber { background: var(--warn-soft); color: var(--warn); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.gray { background: var(--panel-2); color: var(--muted); border-color: var(--line); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--panel-2); }
tbody tr:hover { background: var(--panel-2); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.big-num { font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 看板 ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 14px; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 160px; }
.col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.col-head .count { background: var(--panel-2); color: var(--text-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.qcard {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.qcard:hover { border-color: var(--brand); }
.qcard b { display: block; font-size: 13px; margin-bottom: 4px; }
.qcard .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.qcard .amount { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 线路 ---------- */
.itin { display: flex; flex-direction: column; gap: 8px; }
.day {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.day .dnum { font-weight: 700; color: var(--brand); font-size: 13px; }
.day .city { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.day .acts { color: var(--text-2); font-size: 12.5px; }
.day .htl { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- 取价 ---------- */
.mods { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.mod {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.mod.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.offer { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); }
.offer.best { border-color: var(--ok); background: var(--ok-soft); }
.offer-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.offer .price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.offer .src { font-size: 11px; color: var(--muted); }
.manual-task {
  border: 1px dashed var(--warn); background: var(--warn-soft); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px;
}
.manual-task b { font-size: 13px; }

/* ---------- 履约 ---------- */
.fgroup { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.fgroup-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--panel-2); font-weight: 600; font-size: 13px;
}
.frow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.frow .fname { flex: 1; min-width: 180px; font-size: 13px; }
.frow input.sm { width: 150px; }

/* ---------- 供应商目录 ---------- */
.prov { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel-2); }
.prov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.prov b { font-size: 13.5px; }
.prov p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-2); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

/* ---------- toast / modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: #1b2437; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 99; max-width: 88vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 16, 30, .5); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--panel); border-radius: 14px; padding: 18px; width: 100%; max-width: 680px;
  max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal h3 { margin-bottom: 12px; font-size: 15px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.notice {
  border-left: 3px solid var(--brand); background: var(--panel-2); padding: 10px 12px;
  border-radius: 8px; font-size: 12.5px; color: var(--text-2); margin-bottom: 12px;
}
.notice.warn { border-color: var(--warn); background: var(--warn-soft); }

/* ---------- 履约桥：一键交接 ---------- */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  flex: 1; min-width: 130px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.stat .k { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.handoff-step { margin-bottom: 14px; }
.handoff-step > b { display: block; font-size: 13px; margin-bottom: 8px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row-btns .btn { text-decoration: none; display: inline-flex; align-items: center; }
textarea.clip {
  width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.6; padding: 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  resize: vertical; margin-bottom: 8px;
}
ul.checklist { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }

/* ---------- 手机适配 ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: fixed; bottom: 0; left: 0; right: 0;
    top: auto; border-right: none; border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    z-index: 30; box-shadow: 0 -4px 20px rgba(20, 30, 60, .08);
  }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-between; gap: 0; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; flex: 1; text-align: center; font-size: 11px; border-radius: 8px; }
  .nav-item i { font-size: 18px; }
  .main { padding-bottom: 76px; }
  .topbar { height: 52px; padding: 0 14px; }
  .content { padding: 12px; }
  .board { grid-template-columns: 1fr; gap: 10px; }
  .col { min-height: auto; }
  .day { grid-template-columns: 44px 1fr; }
  .card { padding: 13px; }
  .grid-2 { grid-template-columns: 1fr; }
  th, td { padding: 8px 8px; font-size: 12.5px; }
  .frow input.sm { width: 100%; }
  .toast { bottom: 96px; }
}

/* ---------- 价格与产品目录维护 ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  border: 1px solid var(--line); background: var(--panel); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.tab:hover { background: var(--panel-2); }
.tab.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

input.mini, select.mini, textarea.mini {
  padding: 6px 8px; font-size: 13px; border-radius: 8px; min-width: 84px;
}
input.mini.num, select.mini { text-align: right; }
textarea.mini { width: 100%; min-height: 68px; text-align: left; }
td .mini { width: 100%; }

.save-bar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-top: 14px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.num.neg { color: var(--danger); }

@media (max-width: 860px) {
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .save-bar { bottom: 68px; }
  input.mini, select.mini { min-width: 68px; }
}

/* ---------- 合同 / 分销商 / 发送记录 / 公司信息 ---------- */
/* 第 7 批需求 2：含/不含清单可编辑样式 */
.inc-h { font-weight: 700; margin: 12px 0 6px; display: flex; align-items: center; gap: 8px; }
.inc-h.no { color: var(--danger); }
.inc-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.inc-row input { flex: 1 1 auto; min-width: 0; }
.cards4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 14px; }
.cards4 .stat { margin: 0; }
.act { white-space: nowrap; }
.act .btn { margin-right: 4px; }
.field { display: block; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; }

/* ---------- 带单位符号的输入框（需求：比例固定 %、固定加价固定 ¥，员工只填数值） ----------
   第 6 批需求 1：符号放在数字【后面】（20%、¥600），方式 + 数值 + 保存按钮保持一行不换行 */
.unit-box {
  display: inline-flex; flex-wrap: nowrap; flex: 0 0 auto;
  align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; background: var(--panel); white-space: nowrap;
}
.unit-box .u, .unit-box [id$='Unit'] { font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 18px; text-align: center; flex: 0 0 auto; }
.unit-box input { border: none; outline: none; background: transparent; font-size: 13px; width: 76px; min-width: 56px; flex: 1 1 auto; text-align: right; }
.unit-box input:focus { outline: none; }
.unit-box:focus-within { border-color: var(--brand, #1a6b4a); }
/* 第 7 批修复：.field span { display:block } 特异性 (0,1,1) 高于 .unit-box (0,1,0)，
   会把 unit-box 的 flex 容器打回 block，导致「数字在上、单位在下」竖排 —— 此处显式抢回 */
.field span.unit-box { display: inline-flex; flex-wrap: nowrap; margin-bottom: 0; }
.field span.unit-box > span { display: inline; margin-bottom: 0; }

/* 一行式表单：桌面不换行（第 6 批需求 1）；第 7 批加固：字段内部（数字与单位之间）永不换行 */
.one-line { flex-wrap: nowrap !important; align-items: flex-end; }
.one-line .field { min-width: 0; flex: 0 1 auto; white-space: nowrap; }
.one-line .field select { max-width: 200px; }
@media (max-width: 900px) { .one-line { flex-wrap: wrap !important; } }

/* ---------- 一级目录分组标签 ---------- */
/* （已并入顶部 .nav-group 定义：第 6 批需求 9 一级/二级目录 + 滚动条） */
/* ---------- 订单列表：可展开行 ---------- */
.ol-row { cursor: pointer; transition: background .15s; }
.ol-row:hover { background: rgba(26,107,74,.05); }
.ol-row.open { background: rgba(26,107,74,.08); }
.ol-detail > td { background: var(--panel-2, #f7faf8); padding: 0 !important; }
.ol-detail-box { padding: 14px 18px; border-top: 1px dashed var(--line); animation: olSlide .18s ease; }
@keyframes olSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.day-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.day-card .dh { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.day-card .dh b.dn { background: var(--brand, #1a6b4a); color: #fff; border-radius: 6px; font-size: 12px; padding: 2px 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(26,107,74,.08); border: 1px solid rgba(26,107,74,.18); color: var(--brand, #1a6b4a); border-radius: 999px; padding: 2px 9px; font-size: 11.5px; margin: 2px 4px 2px 0; }
.conf-chip { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; margin: 4px 0; font-size: 12px; }
.conf-chip a { color: var(--brand, #1a6b4a); text-decoration: none; font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: 1fr; } }
.mini-table table { font-size: 12px; }

/* ---------- 第 15 批需求 3：全球城市选择弹窗（大洲 / 国家 / 城市三栏） ---------- */
.cp-item { padding: 6px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-item:hover { background: rgba(26,107,74,.08); }
.cp-item.on { background: rgba(26,107,74,.14); font-weight: 700; color: var(--brand, #1a6b4a); }

/* ---------- 统计图表化（多维统计全部用图 · 导出才生成 Excel） ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

/* 一排 4 图（窄屏自动降为 3 / 2 / 1 列）；卡片收紧内边距，让图表占满可视区 */
.chart-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1420px) { .chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1080px) { .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 660px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 9px 9px; min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.chart-box .chart-title { display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin: 0; min-height: 22px; }
.chart-box .chart-title b { font-size: 12px; line-height: 1.25; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.chart-box .chart-acts { display: flex; gap: 2px; flex: none; }
.btn.xs { padding: 2px 7px; font-size: 11.5px; line-height: 1.45; border-radius: 6px; }
.chart-box svg { display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 2px; }
.legend { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); white-space: nowrap; }
.chart-empty { padding: 22px 8px; text-align: center; }

/* 饼图：纵向布局 —— 大饼在上（占满卡片宽度、居中），名称/数值/占比图例在下。
   dense 网格里图例排两列以控制高度；窄屏自动回落单列。 */
.pie-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pie-wrap > svg { flex: none; }
.pie-leg { width: 100%; min-width: 0; }
.pie-leg.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 620px) { .pie-leg.cols2 { grid-template-columns: 1fr; } }
.pie-leg-row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.pie-leg-row .pie-leg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-leg-row b { font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.pie-leg-row .muted { white-space: nowrap; flex: none; }

/* 图表放大弹窗（宽版） */
.modal.wide { max-width: 1080px; }
.chart-zoom { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
