:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #1f2328;
  --text-2: #5b6472;
  --text-3: #8a93a0;
  --brand: #1d4ed8;
  --brand-soft: #eef2ff;
  --teal: #0f6e56;
  --teal-soft: #e6f5f0;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --red: #b42318;
  --red-soft: #fdeceb;
  --green: #146c43;
  --green-soft: #e8f5ee;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.login-card .sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.login-logo {
  display: block;
  width: 176px;
  max-width: 74%;
  height: auto;
  margin: 4px auto 14px;
}
.login-title {
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.login-card .sub { text-align: center; margin-bottom: 20px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.login-hint {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.8;
}
.login-hint code { color: var(--brand); }
.login-hint .hint-title {
  font-size: 12px; font-weight: 600; color: var(--text-1);
  margin-bottom: 6px; padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.login-hint .hint-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 0;
}
.login-hint .hint-row > span:first-child { color: var(--text-1); }
.login-hint .hint-role { font-size: 11.5px; color: var(--text-3); }
.login-hint .hint-foot {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-3); line-height: 1.6;
}
tr.row-muted td { color: var(--text-3); }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { padding: 2px 10px 14px; }
.brand-logo {
  display: block;
  width: 132px;
  max-width: 100%;
  height: auto;
  margin-bottom: 6px;
}
.brand-sub { font-size: 11.5px; color: var(--text-3); letter-spacing: .2px; }
.nav-group { padding: 10px 8px 4px; font-size: 11px; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: 8px; cursor: pointer;
  color: var(--text-2); font-size: 13.5px;
  border: none; background: none; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumb { font-size: 15px; font-weight: 600; }
.topbar .role-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--bg); color: var(--text-2);
}
.topbar .spacer { flex: 1; }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.content { padding: 20px; flex: 1; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .spacer { flex: 1; }

.btn {
  border: 1px solid var(--line-strong);
  background: #fff; color: var(--text);
  padding: 6px 13px; border-radius: 8px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn-primary:hover { background: #1a43b8; color: #fff; }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { color: var(--red); border-color: #f0c9c6; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
textarea { resize: vertical; min-height: 68px; }
label.f {
  display: block; font-size: 12px; color: var(--text-2);
  margin-bottom: 4px;
}
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl-scroll { overflow-x: auto; }
.tbl-scroll table { min-width: 1080px; }
th {
  text-align: left; font-weight: 500; color: var(--text-2);
  padding: 9px 10px; border-bottom: 1px solid var(--line);
  background: #fafbfc; white-space: nowrap; font-size: 12.5px;
}
td { padding: 10px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 结算与回款：同一客户跨行合并的「客户名称」单元格 */
td.cmerge { vertical-align: middle; font-weight: 500; background: #fcfcfd; border-right: 1px solid var(--line); }
tbody tr.grp-start td { border-top: 1px solid var(--line-strong); }

.toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.toolbar input, .toolbar select { width: auto; min-width: 130px; }
.toolbar .spacer { flex: 1; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; line-height: 1.7; white-space: nowrap;
}
.tag-blue { background: var(--brand-soft); color: var(--brand); }
.tag-teal { background: var(--teal-soft); color: var(--teal); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-gray { background: var(--bg); color: var(--text-2); }

/* ---------- 客户结构筛选 ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
  border-radius: 20px; padding: 4px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip b { font-weight: 600; margin-left: 3px; }
.chip-on {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand);
}
.cb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-top: 4px; }
.cb input { width: 14px; height: 14px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.pager .spacer { flex: 1; }
.pg-info { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pg {
  min-width: 30px; height: 30px; padding: 0 9px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text-2);
  border-radius: 8px; font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.pg:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pg:disabled { opacity: .45; cursor: not-allowed; }
.pg-on {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand);
  font-weight: 600;
}

/* ---------- 跟进记录：客户维度时间线 ---------- */
.fgroup {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; background: var(--bg);
}
.fg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fg-head > a { font-size: 14.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.fg-head > a:hover { color: var(--brand); }
.fg-meta { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fg-owners { margin-top: 5px; font-size: 12.5px; color: var(--text-2); }
.fg-timeline { list-style: none; margin: 10px 0 0; padding: 0; }
.fg-timeline > li {
  display: flex; gap: 12px; padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.fg-timeline > li:first-child { border-top: 0; }
.fg-date {
  flex: 0 0 92px; width: 92px; font-size: 13px; color: var(--text);
  font-variant-numeric: tabular-nums; display: flex; flex-direction: column; line-height: 1.35;
}
.fg-date .al-sub { font-size: 11.5px; }
.fg-body { flex: 1; min-width: 0; }
.fg-item { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; }
.fg-main { flex: 1; min-width: 0; }
.fg-con { font-size: 13.5px; color: var(--text); line-height: 1.55; word-break: break-word; }
.fg-who { margin-top: 2px; font-size: 12px; color: var(--text-2); }

/* ---------- 看板 ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.kpi {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.kpi .k-label { font-size: 12px; color: var(--text-2); }
.kpi .k-value { font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: -.3px; }
.kpi .k-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.kpi.accent .k-value { color: var(--brand); }
.kpi.warn .k-value { color: var(--red); }

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 12.5px; }
.bar-row .b-name { width: 76px; color: var(--text-2); flex: 0 0 76px; }
.bar-track { flex: 1; height: 14px; background: #f0f1f3; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }
.bar-row .b-val { width: 84px; text-align: right; flex: 0 0 84px; font-variant-numeric: tabular-nums; }

.pipeline { display: flex; gap: 8px; margin-top: 4px; }
.pipe-stage { flex: 1; text-align: center; }
.pipe-stage .ps-box {
  background: var(--brand-soft); color: var(--brand);
  border-radius: 8px; padding: 12px 4px; font-size: 12.5px;
}
.pipe-stage .ps-cnt { font-size: 17px; font-weight: 600; display: block; }
.pipe-stage .ps-money { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #f0f1f3; font-size: 13px;
}
.alert-list li:last-child { border-bottom: none; }
.alert-list .al-main { flex: 1; min-width: 0; }
.alert-list .al-sub { font-size: 11.5px; color: var(--text-3); }

/* ---------- 弹窗 ---------- */
.mask {
  position: absolute; inset: 0;
  background: rgba(17, 24, 39, .38);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto; z-index: 50;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 620px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
}
.modal-lg { max-width: 760px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px 20px; max-height: 64vh; overflow-y: auto; }
.modal-foot {
  padding: 12px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
}
.close-x {
  border: none; background: none; font-size: 20px; cursor: pointer;
  color: var(--text-3); line-height: 1; padding: 0 4px;
}

/* ---------- 详情抽屉内的分节 ---------- */
.sec { margin-bottom: 18px; }
.sec-title {
  font-size: 12px; color: var(--text-3); margin-bottom: 8px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
}
.sec-title .spacer { flex: 1; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; font-size: 13px; }
.kv .k { color: var(--text-2); }
.calc-box {
  background: var(--bg); border-radius: 8px; padding: 12px 14px;
  font-size: 13px; margin-top: 8px;
}
.calc-row { display: flex; justify-content: space-between; padding: 3px 0; }
.calc-row.strong { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 8px; font-weight: 600; }

.toast {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 200;
}
.readonly-note {
  background: var(--amber-soft); color: var(--amber);
  padding: 8px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px;
}
.foot-note { color: var(--text-3); font-size: 12px; padding: 16px 4px; text-align: center; }

@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-row { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}

/* 驻场管理 */
.seg { display: inline-flex; gap: 6px; }
.muted { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---------- AI 对话助手 ---------- */
.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 16px; border: none; border-radius: 20px;
  background: linear-gradient(135deg, #1d4ed8, #4338ca); color: #fff;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 18px rgba(29, 78, 216, .32);
}
.ai-fab:hover { filter: brightness(1.06); }
.ai-fab.on { background: linear-gradient(135deg, #334155, #1e293b); }
.ai-fab-t { letter-spacing: .5px; }

.ai-panel {
  position: fixed; right: 18px; bottom: 18px; top: 18px; z-index: 70;
  width: 420px; max-width: calc(100vw - 36px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}
.ai-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f7f9ff, #eef2ff);
}
.ai-logo { color: var(--brand); display: inline-flex; }
.ai-hd-txt { display: flex; flex-direction: column; }
.ai-title { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.ai-sub { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }
.ai-icon-btn {
  border: none; background: transparent; color: var(--text-3);
  font-size: 12.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.ai-icon-btn:hover { background: rgba(15, 23, 42, .06); color: var(--text); }

.ai-body { flex: 1; overflow-y: auto; padding: 14px; background: #fbfcfe; }
.ai-row { margin-bottom: 12px; }
.ai-row.r-me { text-align: right; }
.ai-bub {
  display: inline-block; max-width: 92%; text-align: left;
  padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.65;
  white-space: normal; word-break: break-word;
}
.ai-me { background: var(--brand); color: #fff; }
.ai-bot { background: #fff; border: 1px solid var(--line); color: var(--text); }
.ai-typing i {
  display: inline-block; width: 6px; height: 6px; margin-right: 4px;
  border-radius: 50%; background: var(--text-3); animation: aiBlink 1.2s infinite;
}
.ai-typing i:nth-child(2) { animation-delay: .2s; }
.ai-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.ai-tbl-wrap { max-height: 300px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.ai-tbl { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; }
.ai-tbl th {
  position: sticky; top: 0; background: #f3f5f9; color: var(--text-2);
  text-align: left; font-weight: 600; padding: 6px 8px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.ai-tbl td { padding: 6px 8px; border-bottom: 1px solid #f0f2f5; color: var(--text); }
.ai-tbl tr:last-child td { border-bottom: none; }
.ai-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.ai-tbl th.num { text-align: right; }

.ai-card {
  margin-top: 8px; border: 1px solid var(--amber); background: var(--amber-soft);
  border-radius: 10px; padding: 10px 12px;
}
.ai-card.ok { border-color: var(--green); background: var(--green-soft); }
.ai-card.bad { border-color: var(--red); background: var(--red-soft); }
.ai-card.busy { border-color: var(--line-strong); background: #f8fafc; }
.ai-card-t { font-size: 13px; font-weight: 700; color: var(--amber); margin-bottom: 6px; }
.ai-card.ok .ai-card-t { color: var(--green); }
.ai-card.bad .ai-card-t { color: var(--red); }
.ai-card.busy .ai-card-t { color: var(--text-2); }
.ai-kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ai-kv th {
  width: 88px; text-align: left; font-weight: 500; color: var(--text-2);
  vertical-align: top; padding: 3px 8px 3px 0;
}
.ai-kv td { padding: 3px 0; color: var(--text); word-break: break-word; }
.ai-note { margin-top: 6px; font-size: 12px; color: var(--amber); line-height: 1.6; }
.ai-note.ok { color: var(--green); }
.ai-card-btns { margin-top: 10px; display: flex; gap: 8px; }
.ai-acts { margin-top: 8px; }

.ai-tips, .ai-chips {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px;
  border-top: 1px solid var(--line); background: #fff;
}
.ai-chips { border: none; padding: 8px 0 0; background: transparent; }
.ai-tip {
  border: 1px solid var(--line); background: #f8fafc; color: var(--text-2);
  font-size: 12px; padding: 4px 10px; border-radius: 14px; cursor: pointer; line-height: 1.5;
}
.ai-tip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.ai-foot {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px;
  border-top: 1px solid var(--line); background: #fff;
}
.ai-foot textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
}
.ai-foot textarea:focus { outline: none; border-color: var(--brand); }
.ai-foot .btn { flex: none; height: 34px; }

/* 表格横向滚动容器（render 时由 JS 包裹） */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tscroll > table { min-width: max-content; }

/* ---------- 手机 / 窄屏 ---------- */
@media (max-width: 820px) {
  .layout { flex-direction: column; }

  /* 侧栏 → 顶部横向滑动的标签条 */
  .sidebar {
    position: sticky; top: 0; z-index: 30;
    width: auto; flex: none; height: auto;
    display: flex; align-items: center; gap: 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 10px;
    border-right: none; border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand, .nav-group { display: none; }
  .nav-item {
    width: auto; flex: none; white-space: nowrap;
    padding: 7px 13px; border-radius: 18px;
    background: var(--bg); font-size: 13px;
  }
  .nav-item .dot { display: none; }
  .nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }

  .topbar { height: 46px; padding: 0 12px; gap: 8px; }
  .topbar .crumb { font-size: 14px; }
  .topbar .role-tag, .topbar .tag { display: none; }
  .user-box span:not(.avatar) { display: none; }
  .content { padding: 12px 10px 84px; }

  .card { padding: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi .k-value { font-size: 19px; }
  .grid2, .grid3 { grid-template-columns: 1fr; gap: 0; }
  .toolbar { gap: 6px; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1 1 130px; font-size: 16px; }
  .toolbar .btn, .toolbar button { flex: none; }
  input, select, textarea, button { font-size: 16px; }   /* 防 iOS 聚焦缩放 */
  .btn, .btn-sm { min-height: 36px; }
  .pager { flex-wrap: wrap; row-gap: 6px; }

  .modal { width: calc(100vw - 24px); max-width: none; max-height: 88vh; }
  .modal-body { padding: 14px; max-height: calc(88vh - 108px); }
  .modal-foot { flex-wrap: wrap; }

  .ai-fab { right: 14px; bottom: 18px; height: 44px; padding: 0 18px; }
}

@media (max-width: 640px) {
  /* 助手抽屉在手机上全屏 */
  .ai-panel {
    left: 0; right: 0; top: 0; bottom: 0;
    width: 100%; max-width: none; border-radius: 0; border: none;
  }
  .ai-body { padding: 12px; }
  .ai-bub { max-width: 96%; }
  .ai-foot textarea { max-height: 96px; }
  .login-wrap { padding: 20px 14px; }
  .login-card { padding: 20px 16px; }
  .login-hint { display: none; }
}

/* 助手全屏时锁定页面滚动 */
body.ai-open { overflow: hidden; }
