/* ============================================================
   商拍客户管理系统 · app.css
   组件与页面级样式
   ============================================================ */

/* ---------- 基础：hidden 属性优先 ----------
   必须放在组件规则之前并用 !important：
   组件自身的 display（如 .modal{display:flex}）会覆盖浏览器默认的 [hidden]{display:none}，
   导致带 hidden 属性的弹窗/输入框仍然显示。 */
[hidden] { display: none !important; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
    display: none;
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    padding: calc(12px + var(--safe-t)) 10px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar__brand { display: flex; align-items: center; gap: 8px; padding: 6px 8px 14px; }
.brand__logo { width: 30px; height: 30px; }
.brand__text { font-weight: 700; color: var(--color-primary); }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 12px; color: var(--text-3); padding: 12px 10px 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); min-height: 44px;
}
.nav-item:hover { background: var(--bg-hover); text-decoration: none; }
.nav-item.is-active { background: rgba(255, 106, 0, .12); color: var(--color-primary); font-weight: 600; }
.nav-item__icon { width: 20px; text-align: center; }
.sidebar__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: calc(var(--topbar-h) + var(--safe-t));
    padding: var(--safe-t) 12px 0;
    /* 三区布局：左 = 当前栏目名 / 中 = 新增客户 / 右 = 列表工具（排序等）+ 用户名（管理员）+ 退出 */
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar__left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar__logo { width: 26px; height: 26px; }
.topbar__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__center { display: flex; justify-content: center; min-width: 0; }
.topbar__right { display: flex; align-items: center; gap: 6px; justify-content: flex-end; min-width: 0; }
.topbar__user { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 顶栏右上角工具体：桌面端由 list.js 把列表页的「搜索框 + 排序工具条」依次搬到这里（用户名之前） */
.topbar__tools { display: flex; align-items: center; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar__tools::-webkit-scrollbar { height: 0; }
.topbar__tools .toolbar-row { margin: 0; flex-wrap: nowrap; gap: 4px; }
.topbar__tools .inline-field { font-size: 13px; white-space: nowrap; }
.topbar__tools .inline-field .input { min-width: 84px; }
.topbar__tools .list-count { margin-left: 2px; }
.topbar__right .btn { white-space: nowrap; }
/* 顶栏里的紧凑搜索框：约 8 个汉字宽（内容宽 ≈124px），不再是通长输入框；
   整组再向左让出约 3 个汉字（42px），与右侧排序工具条拉开距离，避免挤在一起 */
.topbar__tools .search-bar { margin: 0 42px 0 0; flex: 0 0 auto; gap: 4px; }
.topbar__tools .search-bar .input {
    flex: 0 0 auto; width: 146px; min-height: 34px; padding: 6px 10px; font-size: 14px;
}
.topbar__tools .search-bar .btn { flex: 0 0 auto; min-height: 34px; padding: 6px 12px; font-size: 14px; }

/* 列表页顶部搜索框 + 排序工具条：桌面端（≥1340px）由 list.js 搬到顶栏右上角。
   搬运完成前先隐藏，避免加载瞬间在内容区闪一下；未启用 JS 时仍留在内容区可用。 */
@media (min-width: 1340px) {
    html.js .list-toolbar > .search-bar,
    html.js .toolbar-line > .toolbar-row { display: none; }
}

/* 移动端 / 平板：底部标签栏已有「＋」新增入口，顶栏中间的新增隐藏，保证一页只有一个新增按钮 */
@media (max-width: 1023px) {
    .topbar__center { display: none; }
}
@media (max-width: 767px) {
    .topbar__role { display: none; }
}

.content {
    flex: 1 1 auto;
    padding: 10px 14px calc(14px + var(--tabbar-h) + var(--safe-b));
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- 底部标签栏（移动/平板） ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    display: flex; align-items: stretch;
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
}
.tabbar__item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--text-3); font-size: 11px; position: relative; min-height: 44px;
}
.tabbar__item:hover { text-decoration: none; }
.tabbar__item.is-active { color: var(--color-primary); }
.tabbar__icon { font-size: 20px; line-height: 1; }
.tabbar__item--add { flex: 0 0 68px; }
.tabbar__plus {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    box-shadow: 0 6px 16px rgba(255, 106, 0, .4);
    margin-top: -14px;
}
.tabbar__badge {
    position: absolute; top: 4px; right: 50%; transform: translateX(20px);
    background: var(--color-danger); color: #fff; font-size: 10px;
    min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
}

/* ---------- 通用组件 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; }
.page-sub { color: var(--text-3); font-size: 13px; margin: 2px 0 0; }

.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 14px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card__title { font-size: 16px; }
.card__more { font-size: 13px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px; padding: 10px 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
    background: var(--bg-elev); color: var(--text); cursor: pointer;
    font-weight: 500; white-space: nowrap; text-align: center;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn--danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 34px; padding: 6px 12px; font-size: 14px; }
.btn--block { width: 100%; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.alert { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 14px; }
.alert--error { background: rgba(220, 38, 38, .1); color: var(--color-danger); }
.alert--warn { background: rgba(245, 158, 11, .12); color: #9A5B00; }

.pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: var(--bg-sunken); color: var(--text-2); font-size: 12px;
}
.badge { display: inline-block; background: var(--color-primary); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }

.status-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; color: #fff; font-size: 12px; white-space: nowrap; }
.status-tag--muted { background: #9CA3AF; }
.status-tag--ok { background: var(--color-ok); }

/* 头部状态胶囊（标的名称旁）：点一下弹系统原生选择器、选中即生效。
   外观仍是 .status-tag（底色随状态变），底层是一个**透明覆盖的原生 <select>** ——
   不做自造轮子，iOS 滚轮 / Android 列表照旧；也避开某些微 webview 把
   appearance:none 后的原生下拉画成空白的老问题。 */
.status-select { position: relative; display: inline-flex; align-items: center; vertical-align: middle; }
.status-select__input {
    position: absolute; inset: 0; z-index: 2;
    width: 100%; height: 100%; min-height: 0;   /* ⚠️ base.css 给 input/select 全局设了 min-height:44px，
                                                   不清零的话透明 select 会比胶囊高 21px、多出来的区域
                                                   会叠到下方元素上造成误点（实测踩到） */
    margin: 0; padding: 0; border: none; border-radius: 999px;
    opacity: 0; cursor: pointer;
    font-size: 16px;                            /* ≥16px 避免 iOS 聚焦时页面放大 */
}
.status-select__input:focus { box-shadow: none; }
.status-select:focus-within .status-select__face { box-shadow: 0 0 0 3px rgba(100, 116, 139, .28); }
.status-select__face { pointer-events: none; }
.status-select__caret { margin-left: 4px; font-size: 9px; opacity: .85; }
@media (hover: hover) {
    .status-select:hover .status-select__face { filter: brightness(1.09); }
}

.prio { font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.prio--high { background: rgba(220, 38, 38, .12); color: var(--color-danger); }

/* 搜索结果里「只在跟进内容中命中关键字」的标记（列表 + 手机卡片共用） */
.tag-hit {
    display: inline-flex; align-items: center; flex: 0 0 auto;
    margin-left: 6px; padding: 1px 6px; border-radius: 4px;
    font-size: 11px; line-height: 1.6; white-space: nowrap;
    color: var(--color-info); background: rgba(37, 99, 235, .10);
    border: 1px solid rgba(37, 99, 235, .22);
}

/* 搜索命中跟进内容时，把命中的那句原文摊出来（列表第 1 列与手机卡片共用） */
.hit-snippet {
    margin-top: 3px; max-width: 220px;
    font-size: 12px; line-height: 1.5; color: var(--text-3);
    word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.hit-snippet mark {
    background: rgba(250, 204, 21, .45); color: inherit;
    padding: 0 1px; border-radius: 2px;
}
/* 桌面表格 10 列，第 1 列限宽 220px 才不会把「下次跟进 / 操作」挤到换行；
   手机端卡片是通栏的，放开到 100% */
@media (max-width: 767px) {
    .hit-snippet { max-width: 100%; }
}

/* 搜索结果里带出的「回收站客户」（已删除 / 已过户归档）—— 灰色虚线标 + 标题转灰，
   与现役客户一眼区分；这类行的操作是「恢复」而不是「记跟进」 */
.tag-recycle {
    display: inline-flex; align-items: center; flex: 0 0 auto;
    margin-left: 6px; padding: 1px 6px; border-radius: 4px;
    font-size: 11px; line-height: 1.6; white-space: nowrap;
    color: var(--text-2); background: var(--bg-sunken);
    border: 1px dashed var(--border);
}
.is-recycled .cell-title,
.is-recycled .customer-card__name { color: var(--text-3); }

.empty-text { color: var(--text-3); text-align: center; padding: 18px 8px; }
/* ---------- 表单 ---------- */
.form-card { max-width: 720px; }
.field { display: block; margin-bottom: 12px; }
.field__label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.field__hint { display: block; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.field--inline { display: inline-flex; flex-direction: column; margin: 0; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1 1 0; min-width: 0; }
.required { color: var(--color-danger); }

/* ---------- 客户登记表单：三列「标签在左 / 控件在右」网格 ----------
   原来每个字段「标签一行 + 控件一行」竖着垒 21 行；现在一行放 3 个字段，
   纵向占高约 1/3。窄屏依次折成 2 列 / 1 列，标签列固定 90px 保证各列对齐。 */
.form-card--wide { max-width: 1180px; }
.fgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.fitem {
    display: grid; grid-template-columns: 90px minmax(0, 1fr);
    align-items: center; gap: 8px; min-width: 0;
}
.fitem > *:not(.fitem__label) { min-width: 0; }
.fitem__label { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.fitem .input { min-height: 40px; padding: 8px 10px; }
.fitem .field__pw .input { padding-right: 52px; }
/* 跨列单元格：手机不跨（单列时跨列会产生隐式列）、两列时通长、三列时占两格 */
.fitem--span2, .fitem--span3 { grid-column: auto; }
@media (min-width: 768px) {
    .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fitem--span2, .fitem--span3 { grid-column: 1 / -1; }
    /* 保存按钮靠右（贴表单右下角），与网格右缘对齐 */
    .form-card--wide .form-actions { justify-content: flex-end; }
}
@media (min-width: 1280px) {
    .fgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fitem--span2 { grid-column: span 2; }
    .fitem--span3 { grid-column: 1 / -1; }
}
/* 表单里的紧凑胶囊（目前状况多选） */
.pill-select--sm { gap: 6px; }
.pill-select--sm .pill-option span { padding: 4px 10px; font-size: 13px; min-height: 30px; line-height: 20px; }
.form-card--wide > .check { min-height: 36px; margin-bottom: 10px; font-size: 14px; }
.input--sm { min-height: 34px; padding: 6px 10px; font-size: 14px; }
.textarea { line-height: 1.5; }
/* 跟进内容输入框：通长（下方一行已让给「下次跟进时间 + 补录/更新状态/提交」，
   右侧不再有竖排按钮列，文本框自然铺满整行）；高 6 行（行高 24px → 内容高 144px）；
   仍保留右下角可手动向下拉伸 */
.textarea--follow { width: 100%; max-width: 100%; height: 166px; min-height: 166px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.check input { width: 20px; height: 20px; min-height: auto; }

/* 跟进表单：「更新状态」胶囊按钮（位于「下次跟进时间」行末尾、与「补录」「提交」同排靠右）。
   本质仍是原生 <select>，但让它整块透明覆盖在自绘胶囊之上 ——
   ① 文字与颜色由 .status-pill__face 自绘，任何内核（含微信 webview）都能显示，
      不会出现「原生 select 被 appearance:none 抹掉后看不到文字」的情况；
   ② 点一下仍唤起 iOS/Android 原生选择器，零依赖、零 JS 轮子。 */
.status-pill {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px; min-height: 34px; border-radius: 999px;
    background: var(--color-pink); border: 1px solid var(--color-pink);
    color: #fff; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.status-pill__face { pointer-events: none; }
.status-pill__caret { font-size: 11px; line-height: 1; opacity: .9; pointer-events: none; }
.status-pill__select {
    position: absolute; inset: 0; z-index: 2;
    width: 100%; height: 100%; min-height: 0;
    padding: 0; margin: 0; border: 0; border-radius: 0;
    opacity: 0; cursor: pointer;
    font-size: 16px; /* 保持 ≥16px，避免 iOS 聚焦时页面放大 */
}
.status-pill__select:focus { box-shadow: none; }
.status-pill:focus-within { box-shadow: 0 0 0 3px rgba(219, 39, 119, .22); }
.status-pill.is-set { background: var(--color-pink-dark); border-color: var(--color-pink-dark); }

/* 跟进表单底部：文本框通长，下方**一整行** = [补录] [跟进计划▾] [更新状态▾] …… [提交]。
   用户 2026-10-29：原来「下次跟进时间」的 5 个 chip（明天/3 天后/1 周后/自定义/无计划）
   折进「跟进计划」下拉后，四个控件才能排成整齐一行，提交靠右（margin-left:auto）。
   宽度实测（无头浏览器量元素，非估算）：卡片内容宽 = 视口 − 28（内容区左右）− 30（卡片内边距+边框），
   375px 视口 → 317px 可用，本行实占 295px（补录 58 + 两胶囊 81+81 + 提交 60 + 3×5 间距），余 22px；
   360px 视口 → 302px 可用，同样 295px 一行放下，余 7px；再窄到 ≤374px 走下一档收紧。
   flex-wrap 只是 320px 老机型的兜底，换行时「提交」靠 margin-left:auto 仍贴右。 */
.follow-editor { display: block; }
.follow-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-top: 8px;
}
/* 行内控件一律不缩放，宁可整组折行也不压字/压出省略号 */
.follow-bar > * { flex: 0 0 auto; }
.follow-bar .check { min-height: 34px; font-size: 13px; gap: 6px; }
.follow-bar .btn { min-height: 34px; padding: 5px 16px; font-size: 14px; margin-left: auto; }

/* 「跟进计划」胶囊：结构照抄上面的 .status-pill（透明原生 select 叠在自绘文字上，
   任何内核都能显示文字）。未选 / 无计划 = 白底 + --border-strong 描边 + --text-2 文字的
   中性占位「跟进计划」（次要控件，不跟粉色的「更新状态」抢眼）；
   选中非「无计划」才加 .is-set（浅蓝描边，见下）。
   选项名变长时用 max-width + 省略号兜底，绝不撑破那一行。 */
.plan-pill {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px; min-height: 34px; border-radius: 999px; max-width: 132px;
    background: var(--bg-elev); border: 1px solid var(--border-strong);
    color: var(--text-2); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.plan-pill__face {
    min-width: 0; pointer-events: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plan-pill__caret { flex: 0 0 auto; font-size: 11px; line-height: 1; opacity: .75; pointer-events: none; }
.plan-pill__select {
    position: absolute; inset: 0; z-index: 2;
    width: 100%; height: 100%; min-height: 0;
    padding: 0; margin: 0; border: 0; border-radius: 0;
    opacity: 0; cursor: pointer;
    font-size: 16px; /* 保持 ≥16px，避免 iOS 聚焦时页面放大 */
}
.plan-pill__select:focus { box-shadow: none; }
.plan-pill:focus-within { box-shadow: 0 0 0 3px rgba(37, 99, 235, .20); }
/* 已选计划（明天 / 3 天后 / 1 周后 / 自定义）：**只动颜色、绝不动字重** ——
   一旦加粗，文字宽度就变，右边的「更新状态」和「提交」会跟着左右挪，
   「整齐的一行」在操作过程中乱跳，比配色不好看更难受。
   浅蓝底 + 蓝字（--color-info）+ 蓝色描边：有"已设置"提示，但仍是浅底描边，
   不会和橙色实心的「提交」、粉色实心的「更新状态」抢层级。
   一行四件的视觉层级：提交（橙实心）> 更新状态（粉实心）> 跟进计划（浅蓝描边）> 补录（纯文字）。 */
.plan-pill.is-set {
    background: rgba(37, 99, 235, .10);
    border-color: rgba(37, 99, 235, .45);
    color: var(--color-info);
}
/* 选了「自定义 / 明天 / 3 天后 / 1 周后」露出的 datetime-local：紧贴操作行、小尺寸不通长 */
.follow-foot > .input--dt { margin-top: 8px; }
@media (max-width: 767px) {
    /* 窄屏把整行间距收到 5px、胶囊左右内边距收到 7px、提交收到 15px ——
       实测（卡片内容宽 = 视口 − 内容区 28 − 卡片内边距+边框 30）：
       360px 视口可用 302px，本行实占 ≈295px，仍排成一行；320px 老机型才走换行兜底 */
    .follow-bar { gap: 5px; }
    .follow-bar .check { gap: 5px; }
    .follow-bar .plan-pill,
    .follow-bar .status-pill { padding: 5px 7px; }
    .follow-bar .btn { padding: 5px 15px; }
}
/* ≤374px 一档（Redmi / 荣耀等常见安卓机）：可用宽 374px 视口只有 ≈316px、320px 视口只剩 ≈262px，
   上面那档的 295px 在 344px 以下就会把「提交」挤到第二行。
   这里把间距收到 4px、胶囊左右内边距收到 6px、提交收到 11px、补录字号降到 12px，
   整行降到 ≈266px —— 344px 视口（286px 可用）仍是一行；320px 老机型才靠 flex-wrap 换行兜底。 */
@media (max-width: 374px) {
    .follow-bar { gap: 4px; }
    .follow-bar .check { gap: 4px; font-size: 12px; }
    .follow-bar .plan-pill,
    .follow-bar .status-pill { padding: 5px 6px; }
    .follow-bar .btn { padding: 5px 11px; }
}
.field__pw { position: relative; }
.pw-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: none; border: none; min-height: 36px; padding: 6px 8px; color: var(--text-2); cursor: pointer;
}
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions--sticky {
    position: sticky; bottom: calc(8px + var(--safe-b));
    background: var(--bg-elev); padding: 10px 0; border-top: 1px solid var(--border); z-index: 5;
}
.pill-select { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-option { position: relative; }
.pill-option input { position: absolute; opacity: 0; pointer-events: none; }
.pill-option span {
    display: inline-block; padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--bg-elev); font-size: 14px; min-height: 40px; line-height: 22px;
}
.pill-option input:checked + span { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.dup-hint { background: rgba(245, 158, 11, .12); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; font-size: 14px; }

/* ---------- 列表工具栏 ---------- */
.list-toolbar { margin-bottom: 12px; }
.list-count { margin-left: auto; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-bar .input { flex: 1 1 auto; }
.tag-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tag-chip {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border-radius: 999px; background: var(--bg-elev);
    border: 1px solid var(--border); color: var(--text-2); font-size: 14px; white-space: nowrap; min-height: 38px;
}
.tag-chip.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.tag-chip__badge { background: rgba(0, 0, 0, .12); border-radius: 999px; padding: 0 6px; font-size: 12px; }
.tag-chip.is-active .tag-chip__badge { background: rgba(255, 255, 255, .3); }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.inline-field { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--text-2); }
.inline-field .input { width: auto; min-width: 96px; }
/* 快捷筛选 + 排序工具条：小屏上下堆叠，桌面并排成一行（排序跟在标签行右侧） */
.toolbar-line { display: block; }
.filters { display: grid; gap: 8px; padding: 12px; background: var(--bg-sunken); border-radius: var(--radius-sm); margin-bottom: 10px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--text-2); font-weight: 600; background: var(--bg-sunken); white-space: nowrap; }
.table tbody tr:hover { background: var(--bg-hover); }
.table__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-date { white-space: nowrap; color: var(--text-2); font-size: 13px; }
/* 客户列表列数多（10 列），单元格内边距收窄 2px、日期列字号 13px，
   尽量把「小笔记本（≈1080px）下出现横向滚动」的概率压低（不改动其它页面的表格） */
.customer-table .table th, .customer-table .table td { padding: 10px 10px; }
/* 表头可排序（下次跟进 / 创建日期）：整格是链接，点击切换升序 / 降序。
   箭头用绝对定位塞进右内边距里、不参与列宽计算 —— 客户列表有 10 列，
   箭头若占宽度会在 ≈1080px 窗口额外撑出横向滚动。（故此处不能用 flex） */
.table th.th-sort { padding: 0; position: relative; }
.th-sort__link { display: block; padding: 10px 12px; color: inherit; font-weight: 600; white-space: nowrap; }
.th-sort__link:hover { color: var(--color-primary); }
.th-sort__arrow { position: absolute; top: 50%; right: 3px; transform: translateY(-50%); font-size: 10px; line-height: 1; color: var(--text-3); }
.th-sort.is-active .th-sort__link,
.th-sort.is-active .th-sort__arrow { color: var(--color-primary); }
/* 客户列表表头内边距与该表单元格保持一致（该表内边距已收窄为 10px） */
.customer-table .table th.th-sort .th-sort__link { padding: 10px 10px; }
.log-detail { max-width: 320px; word-break: break-all; color: var(--text-2); }

.customer-table { display: none; }

/* ---------- 移动卡片 ---------- */
.customer-cards { display: grid; gap: 10px; }
.customer-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.customer-card__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.customer-card__name { font-weight: 600; color: var(--text); flex: 1 1 auto; }
.customer-card__meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--text-3); font-size: 13px; margin: 8px 0; }
.customer-card__times { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.customer-card__actions { display: flex; gap: 8px; }
.customer-card__actions .btn { flex: 1 1 0; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0; }
.pager__link { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev); }
.pager__info { color: var(--text-3); font-size: 14px; }
.load-more-wrap { margin: 10px 0; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.stat-card__num { font-size: 26px; font-weight: 700; color: var(--color-primary); }
.stat-card__label { color: var(--text-2); font-size: 13px; }
.stat-card--danger .stat-card__num { color: var(--color-danger); }
.two-col { display: grid; gap: 14px; }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-stat { background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.mini-stat__n { display: block; font-size: 18px; font-weight: 700; }
.mini-stat__l { font-size: 12px; color: var(--text-3); }

/* ---------- 条形图 / 漏斗（纯 CSS） ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars__item { display: grid; grid-template-columns: 88px 1fr 40px; align-items: center; gap: 8px; font-size: 13px; }
.bars__label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { background: var(--bg-sunken); border-radius: 999px; height: 14px; overflow: hidden; }
.bars__fill { display: block; height: 100%; border-radius: 999px; }
.bars__n { text-align: right; color: var(--text-2); }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.funnel__row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.funnel__label { width: 72px; color: var(--text-2); }
.funnel__bar { display: inline-block; min-width: 28px; color: #fff; border-radius: 4px; padding: 4px 8px; text-align: right; }

/* ---------- 待办 / 时间线 ---------- */
.todo-mini, .todo-list { list-style: none; margin: 0; padding: 0; }
.todo-mini li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.todo-mini li:last-child { border-bottom: none; }
.todo-mini a { display: flex; justify-content: space-between; gap: 10px; color: var(--text); }
.todo-mini__time { color: var(--text-3); font-size: 13px; }
.todo-mini__time.is-overdue { color: var(--color-danger); }
.todo-list__item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.todo-list__item:last-child { border-bottom: none; }
.todo-list__main { flex: 1 1 auto; min-width: 0; color: var(--text); }
.todo-list__name { display: block; font-weight: 600; }
.todo-list__meta { display: block; font-size: 12px; color: var(--text-3); }

.timeline-filter, .method-row, .quick-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
    padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
    background: var(--bg-elev); color: var(--text-2); cursor: pointer; min-height: 38px; font-size: 14px;
}
.chip.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chip--sm { padding: 5px 10px; font-size: 13px; min-height: 34px; }

/* 下次跟进时间：日期时间框紧贴按钮行、收窄为小尺寸，
   避免整行通长导致日历图标离按钮太远，鼠标要跑很远才能点到 */
.quick-row { margin-bottom: 6px; }
.input--dt { display: block; width: 100%; max-width: 220px; margin-bottom: 2px; }

.timeline { position: relative; padding-left: 18px; }
.tl-item { position: relative; padding: 0 0 14px 12px; border-left: 2px solid var(--border); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item__dot { position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-primary); }
.tl-item--system .tl-item__dot { background: var(--text-3); }
.tl-item__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--text-3); }
.tl-item__method { font-weight: 600; color: var(--color-primary); }
.tl-item__user { color: var(--text-2); }
.tl-item__content { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.tl-item__content--muted { color: var(--text-3); font-size: 13px; }
.tl-item__next { margin-top: 4px; font-size: 13px; color: var(--color-info); }
/* 蓝色「下次跟进」日期：点一下即把这条待办标记完成（只标记，不删记录、不改时间） */
.tl-item__next.is-action {
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px;
    min-height: 30px; padding: 2px 10px; margin-left: -10px;
    border: 1px dashed var(--color-info); border-radius: 8px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.tl-item__next.is-action::after { content: '点击标记完成'; font-size: 11px; opacity: .8; white-space: nowrap; }
.tl-item__next.is-action:hover  { background: rgba(37, 99, 235, .08); }
.tl-item__next.is-action:active { background: rgba(37, 99, 235, .16); }
.tl-item__next.is-action:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }
.tl-item__next.is-done { color: var(--text-3); }
/* 已标记「未完成」：同样不可再点，用橙色与「已完成」区分 */
.tl-item__next.is-undone { color: var(--text-3); }
.tl-item__done {
    display: inline-flex; align-items: center; margin-left: 6px;
    padding: 1px 8px; border-radius: 999px; font-size: 11px; line-height: 1.7;
    color: var(--color-ok); background: rgba(22, 163, 74, .10);
    border: 1px solid rgba(22, 163, 74, .30);
}
.tl-item__undone {
    display: inline-flex; align-items: center; margin-left: 6px;
    padding: 1px 8px; border-radius: 999px; font-size: 11px; line-height: 1.7;
    color: #B45309; background: rgba(245, 158, 11, .12);
    border: 1px solid rgba(245, 158, 11, .35);
}

/* ---------- 详情 ---------- */
/* 头部固定三行（桌面端与手机端同一套结构，字段有无都不会让位置漂移）：
   ① 名称 + 复制 …… 右：高优先 + 跟进状态
   ② 电话 / 复制 / 客户类型 / 城市 / 资产类型 —— 5 列栅格，城市与资产定宽右对齐
   ③ 最近跟进 / 下次跟进（只到年月日）
   编辑 / 删除已移到顶栏「管理员」之后，这里不再有动作按钮；负责人也不再出现在头部。 */
.detail-head__top { display: flex; flex-direction: column; gap: 10px; }
.dh-line { display: flex; align-items: center; gap: 6px 8px; min-width: 0; }
.dh-line--title { flex-wrap: nowrap; }
.detail-head__name {
    flex: 1 1 auto; min-width: 0; margin: 0;
    font-size: 17px; display: flex; align-items: center; gap: 6px;
}
.detail-head__name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 第一行右端（高优先 + 状态）：固定贴右，名称长短都不会把它挤走 */
.dh-line__end { margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.detail-head__item { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
/* 第二行：电话 / 拨打 / 复制 / 客户类型 / 城市 / 资产类型。
   用 flex 而不是等分栅格：客户类型可以随宽度收缩（长了出省略号），
   城市与资产类型永远按内容宽、定宽右对齐，并用 margin-left:auto 把空白全部推到
   客户类型与城市之间 —— 桌面端不会出现「类型列被拉成 800px 宽」的怪样子，
   城市 / 资产类型的右缘与第一行状态、第三行日期落在同一条竖线上。 */
.dh-line--contact { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
/* ⚠️ 电话与「拨打 / 复制」三项必须 flex-shrink:0：
   早先只给类型设了可压缩、忘了给电话设不可压缩，宽度不够时浏览器把电话压成了 0 宽
   → 用户 2026-10-18 反馈「电话没显示出来」。要压缩只能压「客户类型」。 */
.dh-line--contact .detail-head__item--phone { flex: 0 0 auto; white-space: nowrap; }
.dh-line--contact .btn--sm { flex: 0 0 auto; min-height: 28px; padding: 3px 9px; font-size: 12px; }
.dh-line--contact .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-cell { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-cell--type { flex: 0 1 auto; min-width: 0; }
.dh-cell--city { flex: 0 0 auto; min-width: 2.4em; text-align: right; margin-left: auto; }
.dh-cell--asset { flex: 0 0 auto; min-width: 2.4em; text-align: right; }
.dh-line--dates { gap: 4px 18px; }
/* 客户类型胶囊（.type-select）：永远显示。没设置时是**虚线占位胶囊**，写「客户类型」，
   提示这里可点；点一下弹系统选择器、选中即生效（同状态胶囊的交互）。 */
.type-select .type-face { white-space: nowrap; cursor: pointer; }
.type-select .type-face.is-empty {
    background: transparent; color: var(--text-3);
    border: 1px dashed var(--border-strong); font-weight: 400;
}
.type-select .status-select__caret { margin-left: 3px; }
/* 桌面端（≥1024px）：头部内的小按钮压一号，避免「复制」把第二行撑开 */
@media (min-width: 1024px) {
    .detail-head .btn--sm { min-height: 28px; padding: 3px 9px; font-size: 12px; }
}
/* 手机端（<768px）：同样三行，只放大字号与触控尺寸，不改变行结构 */
@media (max-width: 767px) {
    .detail-head__top { gap: 8px; }
    .detail-head__name { font-size: 18px; }
    .dh-line--contact { gap: 4px; }
    .dh-cell { font-size: 13px; }
    .dh-cell--city, .dh-cell--asset { min-width: 2em; }
    .detail-head__item { font-size: 13px; }
    .detail-head__item--phone { font-size: 14px; }
    .detail-head__item--phone .link { font-weight: 600; }
    .detail-head .btn--sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
    /* 第二行的「拨打 / 复制」压小一号，给电话、客户类型、城市、资产类型腾空间
       （必须写在本块最后，同权重时才压得住上面的 .detail-head .btn--sm） */
    .dh-line--contact .btn--sm { min-height: 28px; padding: 3px 7px; font-size: 12px; }
}
/* 超窄屏（≤380px）：第二行再收一号，保证 11 位手机号不被省略号截断、不产生横向滚动 */
@media (max-width: 380px) {
    .dh-line--contact { gap: 3px; }
    .dh-cell { font-size: 12px; }
    .dh-cell--city, .dh-cell--asset { min-width: 1.9em; }
    .dh-line--contact .btn--sm { padding: 3px 6px; font-size: 11px; }
    .detail-head__item--phone { font-size: 13px; }
}
.detail-dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.detail-dl dt { color: var(--text-3); }
.detail-dl dd { margin: 0; word-break: break-word; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tab { flex: 0 0 auto; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-2); min-height: 40px; }
.tab.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- 文件 ---------- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.file-item { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--bg-elev); }
.file-item__link { display: block; color: var(--text); text-align: center; }
.file-item__thumb { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.file-item__icon { display: block; font-size: 34px; margin-bottom: 6px; }
.file-item__name { font-size: 13px; display: block; word-break: break-all; }
.file-item__meta { display: block; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.file-item__del { position: absolute; top: 6px; right: 6px; background: rgba(220, 38, 38, .9); color: #fff; border: none; border-radius: 4px; font-size: 12px; padding: 4px 8px; cursor: pointer; }
.upload-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.upload-box input[type="file"] { min-height: 44px; padding: 8px; }
.upload-progress { flex: 1 1 100%; height: 6px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden; }
.upload-progress span { display: block; height: 100%; width: 0; background: var(--color-primary); transition: width .2s; }

/* ---------- 拍卖轮次 / 过户 / 回款 ---------- */
.round { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; }
.round__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.round__no { font-weight: 600; }
.round__meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--text-3); margin: 8px 0; }
.round__remark { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.round__ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.round__ops .input--sm { width: auto; min-width: 96px; }
.sub-card { background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 12px; margin-top: 12px; }
.sub-card__title { margin-bottom: 10px; }

.step-list { list-style: none; margin: 0 0 12px; padding: 0; }
.step-list__item { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.step-list__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); }
.step-list__title { font-weight: 600; }
.step-list__date { color: var(--text-3); font-size: 13px; }
.step-list__remark { color: var(--text-3); font-size: 13px; }

.pay-list { list-style: none; margin: 0 0 12px; padding: 0; }
.pay-list__item { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.modal__card {
    position: relative; background: var(--bg-elev); width: 100%; max-width: 480px;
    border-radius: var(--radius) var(--radius) 0 0; padding: 16px 16px calc(16px + var(--safe-b));
    box-shadow: var(--shadow-lg); max-height: 88vh; max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal__title { margin-bottom: 8px; }
.modal__text { color: var(--text-2); margin: 0 0 12px; }
.modal__actions { display: flex; gap: 10px; margin-top: 14px; }
.modal__actions .btn { flex: 1 1 0; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translate(-50%, 20px);
    background: rgba(31, 35, 41, .94); color: #fff; padding: 10px 18px; border-radius: 999px;
    font-size: 14px; max-width: 84vw; text-align: center; opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s; z-index: 80;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: rgba(220, 38, 38, .95); }
.toast--success { background: rgba(22, 163, 74, .95); }

/* ---------- 登录页 ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px 20px calc(24px + var(--safe-b)); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand__logo { width: 56px; height: 56px; margin: 0 auto 8px; }
.auth-brand__title { font-size: 18px; }
.auth-form { display: block; }
.auth-form .btn { margin-top: 6px; }
.auth-tip { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 14px; }

/* ---------- 回收站 ---------- */
.recycle-list { display: grid; gap: 10px; }
.recycle-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; flex-wrap: wrap; }
.recycle-item__title { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.recycle-item__meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--text-3); margin-top: 6px; }
.recycle-item__actions { display: flex; gap: 8px; }
/* 手机端：信息占满一行，两个按钮折到下一行、通栏等分（手指好点；否则按钮靠右挤成一坨） */
@media (max-width: 767px) {
    .recycle-item { align-items: stretch; }
    .recycle-item__main { flex: 1 1 100%; }
    .recycle-item__actions { flex: 1 1 100%; gap: 8px; }
    .recycle-item__actions .btn { flex: 1 1 0; min-height: 40px; justify-content: center; }
}

/* ---------- 设置页「其他」入口行（回收站等） ---------- */
.settings-links { margin-top: 14px; }
.link-row {
    display: flex; align-items: center; gap: 10px;
    min-height: 52px; padding: 6px 2px;
    border-top: 1px solid var(--border);
    color: inherit; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.link-row:hover  { background: var(--bg-hover); }
.link-row:active { background: var(--bg-hover); }
.link-row__icon  { flex: 0 0 auto; font-size: 17px; line-height: 1; }
.link-row__label { flex: 0 0 auto; font-weight: 600; }
.link-row__meta  { margin-left: auto; color: var(--text-3); font-size: 13px; text-align: right; }
.link-row__arrow { flex: 0 0 auto; color: var(--text-3); font-size: 18px; line-height: 1; }

/* ---------- 字典 / 导入 ---------- */
.dict-list { list-style: none; margin: 0 0 10px; padding: 0; }
.dict-list__item { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.dict-list__item.is-off { opacity: .5; }
.dict-rename { display: flex; gap: 6px; flex: 1 1 auto; }
.dict-add { display: flex; gap: 8px; }
.import-summary { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; }

/* ---------- 断点 ---------- */
@media (min-width: 768px) {
    .content { padding: 12px 18px calc(18px + var(--tabbar-h) + var(--safe-b)); }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .two-col { grid-template-columns: 1fr 1fr; }
    .customer-cards { display: none; }
    .customer-table { display: block; }
    .load-more-wrap { display: none; }
    .modal { align-items: center; }
    .modal__card { border-radius: var(--radius); }
    .detail-dl { grid-template-columns: 140px 1fr; }
}

@media (min-width: 1024px) {
    .sidebar { display: block; }
    .tabbar { display: none; }
    .content { padding: 12px 28px 40px; }
    .form-actions--sticky { position: static; }
    /* 标签行与排序工具条：≥1340px 时搜索框/工具条被搬到顶栏，这里只剩标签行（占满整行）；
       1024–1339px 时两者并排——标签在左、工具条靠右，宽度不够时整组换到下一行 */
    .toolbar-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
    /* flex:0 1 auto —— 换行判定用标签的自然宽度，放不下才换行；本身仍可收缩避免溢出 */
    .toolbar-line .tag-scroll {
        flex: 0 1 auto; min-width: 0; max-width: 100%;
        flex-wrap: wrap; column-gap: 6px; row-gap: 8px; overflow: visible; padding-bottom: 0;
    }
    .toolbar-line .tag-chip { padding: 6px 10px; font-size: 13px; min-height: 34px; }
    .toolbar-line .toolbar-row { flex: 0 0 auto; margin-left: auto; flex-wrap: nowrap; margin-bottom: 0; gap: 5px; }
    .toolbar-line .inline-field { font-size: 13px; }
    .toolbar-line .inline-field .input { min-width: 78px; }
    .toolbar-line .list-count { margin-left: 6px; }
}

/* ============================================================
   v1.7（2026-10-18）：顶栏返回 / 顶栏动作区 / 待办整行可点 /
   列表筛选入口与导出按钮 / 手机端整卡可点
   ============================================================ */

/* 内页顶栏最左的「← 返回列表」：取代原来的「logo + 栏目名」（图标已去掉）。
   触控热区放大到 44px 高、左右各 14px 内边距 —— 原来只有文字那一点，拇指很容易点空；
   用负左边距抵消内边距，视觉位置基本不动。 */
.topbar__back {
    display: inline-flex; align-items: center; gap: 4px;
    font-weight: 600; color: var(--text);
    min-height: 44px; padding: 8px 14px; margin-left: -8px;
    border-radius: var(--radius-sm);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__back:hover, .topbar__back:active { background: var(--bg-sunken); }

/* 顶栏右侧动作区（详情页的「编辑 / 删除」）：排在用户名之后、「退出」之前。
   只有详情页会渲染，列表页不出现。 */
.topbar__actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.topbar__actions .btn { white-space: nowrap; }

/* 待办：整行任意位置都能点进详情 —— 用「拉伸点击热区」把 <a> 覆盖到整个 li
   （含右侧状态胶囊与 li 的内边距），不需要额外 JS，也不改 DOM 结构。
   z-index:1 是必需的：状态胶囊是 static 定位的兄弟节点、默认画在 <a> 之上，
   不给伪元素抬层的话，点胶囊那一下会落空（用户上报的「点好几次才进去」就是这个）。 */
.todo-list__item { position: relative; }
.todo-list__main::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.todo-mini li { position: relative; }
.todo-mini a::after { content: ''; position: absolute; inset: 0; z-index: 1; }

/* 列表页：筛选入口跟搜索框同一组；面板底部的「确定」负责应用筛选 */
.search-bar .filter-toggle { flex: 0 0 auto; }
.filters__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }

/* 手机端列表卡片整卡可点（事件委托在 list.js，这里只给手感） */
.customer-card { cursor: pointer; }

@media (max-width: 767px) {
    /* 手机端第一行 = 左「筛选」+ 搜索框（撑满）+ 搜索按钮。
       用 order 重排、不改 DOM 顺序 —— 桌面端把这组搬进顶栏时仍是「搜索框 + 搜索 + 筛选」。 */
    .search-bar { flex-wrap: nowrap; align-items: center; gap: 8px; }
    .search-bar .filter-toggle { order: 1; flex: 0 0 auto; margin-left: 0; }
    .search-bar .input { order: 2; flex: 1 1 auto; width: auto; min-width: 0; }
    .search-bar .btn--primary { order: 3; flex: 0 0 auto; min-height: 38px; padding: 7px 12px; font-size: 14px; }
    .filters__actions .btn { width: 100%; }
    /* 手机端隐藏「导出 CSV」（桌面端保留） */
    .toolbar-row .export-csv { display: none; }
    /* 顶栏要给「返回列表 + 用户名 + 编辑 + 删除 + 退出」腾地方，375px 实测不换行 */
    .topbar__user { max-width: 4.5em; font-size: 13px; }
    .topbar__actions .btn--sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
    .topbar__back { padding: 8px 10px; font-size: 15px; }

    /* ============================================================
       列表页（只有它带 data-topbar-slot）：搜索 / 筛选搬进顶栏最顶行
       （2026-10-18 第三轮）
       ============================================================ */
    /* 顶栏改 flex：左边栏目名，右边工具区吃满剩余宽度；这一页不显示用户名（「管理员」） */
    body[data-topbar-slot="1"] .topbar { display: flex; align-items: center; gap: 8px; }
    /* 栏目名不给压缩：原来是 0 1 auto，375px 时被挤成「客...」。搜索框本身 min-width:0 可以缩，
       让搜索框让步、标题保持完整 */
    body[data-topbar-slot="1"] .topbar__left { flex: 0 0 auto; min-width: 0; }
    body[data-topbar-slot="1"] .topbar__right { flex: 1 1 auto; min-width: 0; }
    body[data-topbar-slot="1"] .topbar__user { display: none; }
    body[data-topbar-slot="1"] .topbar__tools { flex: 1 1 auto; min-width: 0; overflow: visible; }
    /* 顶栏内搜索行：筛选 / 搜索框 / 搜索一行，搜索框按实际剩余宽度自适应（原来固定 146px） */
    .topbar__tools .search-bar { flex: 1 1 auto; width: 100%; margin: 0; gap: 6px; }
    .topbar__tools .search-bar .input { flex: 1 1 auto; width: auto; min-width: 0; min-height: 34px; padding: 6px 10px; font-size: 14px; }
    .topbar__tools .search-bar .btn { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; font-size: 13px; }
    /* 主脚本搬运前先藏住，避免搜索框在内容区闪一下；搬进顶栏后父级选择器不再匹配，自动恢复 */
    html.js .list-toolbar > .search-bar { display: none; }
}
