/* ============================================================
   商拍客户管理系统 · 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); }

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

.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); }
.input--sm { min-height: 34px; padding: 6px 10px; font-size: 14px; }
.textarea { line-height: 1.5; }
/* 跟进内容输入框：宽 30 个汉字（16px 字号 → 内容宽 480px）、高 6 行（行高 24px → 内容高 144px），
   不再通长整行；窄屏自动收成整行宽；仍保留右下角可手动向下拉伸 */
.textarea--follow { width: 506px; 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; }

/* 跟进表单：「更新状态」挪到方式行末尾（「其他」之后），下拉约 4 个汉字宽
   （16px 字号 → 内容 64px = 「保持不变」正好放得下；16px 也是 iOS 不自动放大的下限） */
.status-inline { display: inline-flex; align-items: center; gap: 6px; }
.status-inline__label { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.status-inline__select { width: 86px; min-height: 34px; padding: 6px 10px; font-size: 16px; }

/* 跟进表单：提交按钮贴在跟进内容框右下角的外侧（间距 16px = 1 个汉字），
   补录放在该按钮上方，两者合成右侧一列（底部对齐 → 按钮正好落在输入框右下角）；
   窄屏整列折到下一行 */
.follow-editor { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.follow-editor__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.follow-editor__side .check { min-height: 30px; font-size: 13px; }
.follow-editor__side .input--dt { max-width: 230px; }
/* 手机端：提交没有右侧空间，与「补录」并排一行（补录靠左、提交靠右），
   勾选补录后出现的日期输入独占下一行（order 排到最后） */
@media (max-width: 767px) {
    .follow-editor { gap: 10px; }
    .follow-editor__side {
        width: 100%;
        flex-direction: row; flex-wrap: wrap;
        align-items: center; justify-content: space-between;
        gap: 8px;
    }
    .follow-editor__side .check { min-height: 34px; }
    .follow-editor__side .input--dt { order: 3; flex: 1 1 100%; max-width: none; }
    .follow-editor__side .btn { padding: 9px 22px; }
}
.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); }
.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); }

/* ---------- 详情 ---------- */
/* 详情页头部压成一行：返回在左，标的名称 / 电话 / 资料 / 跟进时间 / 状态推进按钮依次排在其右侧，
   右上角仍是「标的·拍卖 / 编辑 / 删除」。宽度不够时按需换行，不会溢出或互相压住 */
.detail-head__top { display: flex; align-items: center; gap: 8px 10px; margin-bottom: 0; flex-wrap: wrap; }
.detail-head__back { flex: 0 0 auto; }
/* flex-basis 取 0（而不是 auto）：否则该块按“最大内容宽”参与换行判定，
   会把右上角的「标的·拍卖 / 编辑 / 删除」挤到第二行去 */
.detail-head__main { flex: 1 1 0; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.detail-head__name { font-size: 16px; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-head__item { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.detail-head__actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-left: auto; flex: 0 0 auto; }
/* 桌面端（≥1024px）：头部内的小按钮再压一号 + 收紧间距，把整块信息尽量收进同一行；
   窄屏（手机 / 平板）保持 34px 触控尺寸，放不下时自然换行 */
@media (min-width: 1024px) {
    .detail-head .btn--sm { min-height: 28px; padding: 3px 9px; font-size: 12px; }
    .detail-head__main { gap: 4px; }
}
/* 手机端（<768px）：头部改成纵向两段式 ——
   第 1 行「返回 + 标的·拍卖/编辑/删除」，第 2 段「名称+状态」与全部资料通长换行。
   必须这么改的原因：窄屏下 .detail-head__main 的 flex:1 1 0 会被「返回」和右侧按钮区
   夹成十几像素的窄列（实测仅 12px），列里 white-space:nowrap 的资料项则全部溢出，
   与按钮区叠在一起（实测 6 处重叠）。桌面端（≥768px）完全不受影响。 */
@media (max-width: 767px) {
    .detail-head__back { order: 1; }
    .detail-head__actions { order: 2; margin-left: auto; }
    .detail-head__main {
        order: 3;
        flex: 0 0 100%; max-width: 100%;
        align-items: flex-start; gap: 6px 10px;
        margin-top: 6px; padding-top: 10px;
        border-top: 1px dashed var(--border);
    }
    .detail-head__name { flex: 0 0 100%; font-size: 18px; }
    .detail-head__item { font-size: 13px; }
    .detail-head__item--phone { font-size: 15px; }
    .detail-head__item--phone .link { font-weight: 600; }
    .detail-head__actions .btn--sm { min-height: 34px; padding: 7px 12px; 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; }

/* ---------- 字典 / 导入 ---------- */
.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; }
}
