/* 云多多 CRM —— 无外部依赖、无 CDN，全部本地资源（内网/私有化可用） */

:root {
  --brand: #f5820b;
  --brand-ink: #b96206;
  --brand-soft: #fff4e8;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1f2329;
  --ink-2: #5b6470;
  --ink-3: #8b95a1;
  --line: #e6e9ed;
  --line-2: #f0f2f5;
  --ok: #17934f;
  --ok-soft: #e8f6ee;
  --warn: #c98a00;
  --warn-soft: #fdf3dc;
  --danger: #cf3f3a;
  --danger-soft: #fdeceb;
  --info: #2f6fdb;
  --info-soft: #eaf1fd;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

/* hidden 属性必须真能隐藏：带 display:flex/grid 的类（.banner、.login-wrap 等）会顶掉浏览器默认的
   [hidden]{display:none}，导致「没有内容也占一条、该藏起来的东西还露着」。统一压回来。 */
[hidden] { display: none !important; }

/* 只读角色（运维经理）：藏掉所有写操作入口。真正的拦截在服务端，这里只是不让人点了才报错。 */
body.readonly [data-act="new-customer"], body.readonly [data-act="edit-customer"],
body.readonly [data-act="archive-customer"], body.readonly [data-act="restore-customer"],
body.readonly [data-act="add-contact"], body.readonly [data-act="edit-contact"], body.readonly [data-act="del-contact"],
body.readonly [data-act="add-account"], body.readonly [data-act="edit-account"], body.readonly [data-act="del-account"],
body.readonly [data-act="new-opp"], body.readonly [data-act="add-opp"], body.readonly [data-act="edit-opp"],
body.readonly [data-act="del-opp"], body.readonly [data-act="follow-opp"],
body.readonly [data-act="follow"], body.readonly [data-act="edit-follow"], body.readonly [data-act="del-follow"],
body.readonly [data-act="new-order"], body.readonly [data-act="add-order"], body.readonly [data-act="edit-order"],
body.readonly [data-act="renew-order"], body.readonly [data-act="del-order"],
body.readonly [data-act="new-user"], body.readonly [data-act="edit-user"],
body.readonly [data-act="reset-user"], body.readonly [data-act="toggle-user"],
body.readonly [data-act="tpl"], body.readonly [data-act="dl-export"], body.readonly [data-act="dl-db"] { display: none !important; }

/* 顶栏给只读账号一个明确标记，避免"为什么没有新建按钮"的疑问 */
body.readonly .user-chip::after {
  content: "只读"; font-size: 11px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 7px; margin-left: 6px; align-self: center;
}

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans CN", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: #2b2f36;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border-radius: 12px; padding: 32px 30px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.login-brand h1 { font-size: 19px; }
.login-sub { color: var(--ink-3); font-size: 12.5px; margin: 0 0 22px; }
.login-card .field { margin-bottom: 14px; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ---------------- 布局 ---------------- */
#app { display: none; min-height: 100%; }
#app.on { display: flex; }

.sidebar {
  width: 210px; flex: 0 0 210px; background: #23262b; color: #c8cdd4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 16px 18px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid #2f333a; }
.side-brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.side-brand b { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px; }
.nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-group { padding: 12px 18px 6px; font-size: 11px; color: #6d7480; letter-spacing: .5px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 18px; color: #c8cdd4;
  font-size: 13.5px; border-left: 3px solid transparent;
}
.nav a:hover { background: #2b2f35; text-decoration: none; }
.nav a.active { background: #2f343b; color: #fff; border-left-color: var(--brand); }
.nav .ico { width: 16px; text-align: center; opacity: .9; font-size: 14px; }
.nav .badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; line-height: 17px; }
.side-foot { padding: 12px 18px; border-top: 1px solid #2f333a; font-size: 11.5px; color: #6d7480; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 54px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 18px; position: sticky; top: 0; z-index: 30;
}
.topbar .title { font-size: 15.5px; font-weight: 600; }
.topbar .grow { flex: 1; }
.searchbox { position: relative; width: 240px; }
.searchbox input { width: 100%; height: 32px; padding: 0 10px 0 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.searchbox .s-ico { position: absolute; left: 10px; top: 7px; color: var(--ink-3); font-size: 13px; }
.search-result {
  position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16,24,40,.12); max-height: 380px; overflow: auto; z-index: 50;
}
.search-result a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); font-size: 13px; }
.search-result a:hover { background: var(--brand-soft); text-decoration: none; }
.search-result .t { color: var(--ink-3); font-size: 11.5px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.user-chip:hover { background: var(--bg); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.user-chip .n { font-size: 13px; }
.user-chip .r { font-size: 11px; color: var(--ink-3); }

.view { padding: 18px; flex: 1; }

/* ---------------- 通用组件 ---------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 14px; }
.panel-hd { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.panel-hd h3 { font-size: 14.5px; }
.panel-hd .grow { flex: 1; }
.panel-bd { padding: 16px; }
.panel-bd.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 13px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px;
  cursor: pointer; font-size: 13px; white-space: nowrap; transition: .12s;
}
.btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #e2760a; color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c8c6; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; height: 38px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.field { display: block; }
.field > label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.field > label .req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  outline: none; transition: .12s; font-size: 13.5px;
}
textarea { height: auto; min-height: 74px; padding: 8px 10px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(245,130,11,.12); }
input:disabled, select:disabled { background: var(--line-2); color: var(--ink-3); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { width: auto; height: auto; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.col-2 { grid-column: span 2; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input { height: 30px; width: auto; min-width: 108px; font-size: 13px; }
.filters .grow { flex: 1; }

/* ---------------- 表格 ---------------- */
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; padding: 9px 12px; background: #fafbfc; color: var(--ink-2);
  font-weight: 500; font-size: 12.5px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tb th.sortable { cursor: pointer; user-select: none; }
table.tb th.sortable:hover { color: var(--brand-ink); }
table.tb td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tb tbody tr:hover { background: #fcfcfd; }
table.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb .acts { white-space: nowrap; text-align: right; }
table.tb .acts .btn { margin-left: 4px; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; }
.click { cursor: pointer; }
.click:hover { color: var(--brand-ink); }

.empty { padding: 44px 16px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 6px; font-weight: 500; }

.pager { display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.pager .grow { flex: 1; }
.pager button { min-width: 30px; height: 26px; border: 1px solid var(--line); background: #fff; border-radius: 5px; cursor: pointer; font-size: 12.5px; }
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- 标签 ---------------- */
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; background: var(--line-2); color: var(--ink-2); line-height: 18px; white-space: nowrap; }
.tag.lv-A { background: #fdeceb; color: #cf3f3a; }
.tag.lv-B { background: #fdf3dc; color: #a97300; }
.tag.lv-C { background: #eaf1fd; color: #2f6fdb; }
.tag.lv-D { background: #f0f2f5; color: #8b95a1; }
.tag.st-signed { background: var(--ok-soft); color: var(--ok); }
.tag.st-following { background: var(--info-soft); color: var(--info); }
.tag.st-potential { background: #f0f2f5; color: var(--ink-2); }
.tag.st-dormant { background: #fdf3dc; color: var(--warn); }
.tag.st-lost { background: #f0f2f5; color: var(--ink-3); }
.tag.due { background: var(--danger-soft); color: var(--danger); }
.tag.soon { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.gray { background: #f0f2f5; color: var(--ink-3); }
.tag.vendor { background: var(--brand-soft); color: var(--brand-ink); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; background: var(--ink-3); }
.dot.red { background: var(--danger); }
.dot.amber { background: var(--warn); }
.dot.green { background: var(--ok); }

/* ---------------- 工作台 ---------------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--ink-3); margin-bottom: 7px; }
.kpi .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.kpi.alert .v { color: var(--danger); }
.kpi.warn .v { color: var(--warn); }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--brand); }
.kpi .s { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; align-items: start; }

.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.funnel-row .nm { width: 76px; color: var(--ink-2); flex: 0 0 76px; }
.funnel-row .bar { flex: 1; height: 20px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.funnel-row .bar i { display: block; height: 100%; background: var(--brand); opacity: .85; }
.funnel-row .bar.lost i { background: #b9c0c8; }
.funnel-row .vv { width: 116px; text-align: right; flex: 0 0 116px; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 140px; padding-top: 12px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .col i { display: block; width: 70%; max-width: 38px; background: var(--brand); opacity: .8; border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .col .n { font-size: 11.5px; color: var(--ink-2); }
.bars .col .m { font-size: 11px; color: var(--ink-3); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.todo-list .item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.todo-list .item:last-child { border-bottom: 0; }
.todo-list .item .grow { flex: 1; min-width: 0; }
.todo-list .item .c { font-weight: 500; }
.todo-list .item .d { color: var(--ink-3); font-size: 12px; margin-top: 2px; }

/* ---------------- 商机看板 ---------------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(150px,1fr)); gap: 10px; overflow-x: auto; }
.kb-col { background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius); min-height: 160px; }
.kb-hd { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kb-hd b { display: block; font-size: 13px; font-weight: 600; }
.kb-hd span { color: var(--ink-3); font-size: 11.5px; }
.kb-bd { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.kb-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; font-size: 12.5px; cursor: pointer; }
.kb-card:hover { border-color: var(--brand); }
.kb-card .t { font-weight: 500; margin-bottom: 4px; }
.kb-card .m { color: var(--ink-3); font-size: 11.5px; display: flex; justify-content: space-between; gap: 6px; }

/* ---------------- 客户详情 ---------------- */
.detail-hd { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.detail-hd h2 { font-size: 19px; }
.detail-hd .meta { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.detail-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 14px 0 0; }
.detail-stats .s { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fbfcfd; }
.detail-stats .s .l { font-size: 11.5px; color: var(--ink-3); }
.detail-stats .s .v { font-size: 17px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0 0; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 13px; }
.kv .k { color: var(--ink-3); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line-2); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline .when { font-size: 11.5px; color: var(--ink-3); }
.visit-meta { font-size: 12px; color: var(--ink-2); margin: 3px 0; }
.visit-result { font-size: 12.5px; color: var(--ok); background: var(--ok-soft); border-radius: 5px; padding: 5px 9px; margin-top: 5px; display: inline-block; }

/* 拜访表单：时间段、同行人、附件 */
.time-range { display: flex; gap: 6px; align-items: center; }
.time-range input { width: 108px; }
.time-range .hint { margin: 0 0 0 4px; white-space: nowrap; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 16px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-height: 34px; align-items: center; }
.file-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.file-grid:empty { display: none; }
.file-item { position: relative; width: 96px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fbfcfd; display: block; color: inherit; }
.file-item .thumb { height: 72px; display: flex; align-items: center; justify-content: center; background: #eef1f4; }
.file-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-item .thumb .ext { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.file-item .fn { font-size: 11px; padding: 4px 5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .x { position: absolute; right: 2px; top: 0; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 0 0 0 5px; width: 18px; height: 18px; line-height: 17px; font-size: 13px; cursor: pointer; padding: 0; }
.file-grid.small .file-item { width: 76px; }
.file-grid.small .file-item .thumb { height: 54px; }

/* ---------------- 导入向导 ---------------- */
.steps { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.step { flex: 1; min-width: 130px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font-size: 12.5px; color: var(--ink-3); }
.step b { display: block; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.step.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.step.on b { color: var(--brand-ink); }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 20px; text-align: center;
  background: #fbfcfd; cursor: pointer; transition: .15s;
}
.drop:hover, drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop b { display: block; font-size: 15px; margin-bottom: 4px; }
.drop .sub { color: var(--ink-3); font-size: 12.5px; }
.map-group { font-size: 11.5px; color: var(--ink-3); background: var(--line-2); border-radius: 4px; padding: 3px 8px; margin: 10px 0 2px; letter-spacing: .3px; }
.map-row { display: grid; grid-template-columns: 1fr 40px 1fr; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.map-row .src { color: var(--ink-2); }
.map-row .arrow { text-align: center; color: var(--ink-3); }
.map-row select { height: 30px; font-size: 12.5px; }
.report { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.report .r { border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; }
.report .r .l { font-size: 12px; color: var(--ink-3); }
.report .r .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.report .r.ok .v { color: var(--ok); }
.report .r.warn .v { color: var(--warn); }
.report .r.bad .v { color: var(--danger); }

/* ---------------- 弹层 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(23,26,30,.42); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 620px; box-shadow: 0 12px 40px rgba(0,0,0,.22); }
.modal.wide { max-width: 900px; }
.modal-hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-hd h3 { font-size: 15.5px; flex: 1; }
.modal-hd .x { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 2px; }
.modal-hd .x:hover { color: var(--ink); }
.modal-bd { padding: 18px; max-height: calc(100vh - 210px); overflow: auto; }
.modal-ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.drawer-mask { position: fixed; inset: 0; background: rgba(23,26,30,.35); z-index: 90; display: flex; justify-content: flex-end; }
.drawer { background: #fff; width: 100%; max-width: 480px; height: 100%; overflow: auto; box-shadow: -6px 0 24px rgba(0,0,0,.16); }
.drawer .modal-hd { position: sticky; top: 0; background: #fff; z-index: 2; }

.toasts { position: fixed; top: 14px; right: 14px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: #23262b; color: #fff; padding: 9px 14px; border-radius: 6px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 380px; }
.toast.ok { background: #12703e; }
.toast.err { background: #b2332f; }
.toast.warn { background: #9a6b00; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.banner.info { background: var(--info-soft); border-color: #cfe0fb; color: #1d4f9e; }
.banner.warn { background: var(--warn-soft); border-color: #f3e0b6; color: #8a5f00; }
.banner b { display: block; margin-bottom: 2px; }

.spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(0,0,0,.15); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--ink-3); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 0 11px; height: 30px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand); color: #fff; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.split { display: flex; gap: 14px; align-items: flex-start; }
.split > .grow { flex: 1; min-width: 0; }
.scroll-x { overflow-x: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1400px) { .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .g6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .detail-stats { grid-template-columns: repeat(3, 1fr); }
  .searchbox { width: 170px; }
}
@media (max-width: 860px) {
  #app.on { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .side-brand { border-bottom: 0; padding: 10px 14px; flex: 0 0 auto; }
  .nav { display: flex; padding: 0; }
  .nav-group { display: none; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 10px 12px; white-space: nowrap; }
  .nav a.active { border-left: 0; border-bottom-color: var(--brand); }
  .side-foot { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g2, .g3, .g4, .g6 { grid-template-columns: 1fr; }
  .view { padding: 12px; }
  .filters select, .filters input { min-width: 92px; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  .col-2 { grid-column: span 1; }
}
