:root {
  --sidebar-w: 216px;
  --sidebar-w-collapsed: 64px;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e5e9f0;
  --border-strong: #d5dbe6;
  --text: #1c2430;
  --text-2: #5a6577;
  --text-3: #8b95a6;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --danger: #e0483c;
  --danger-soft: #fdeceb;
  --ok: #12876f;
  --ok-soft: #e6f6f1;
  --warn: #b7791f;
  --warn-soft: #fdf5e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

/* hidden 属性必须优先生效：否则 .modal-mask{display:flex} 会覆盖它，导致弹窗常驻显示 */
[hidden] { display: none !important; }

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

button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }

/* ---------- 布局骨架：左侧导航 + 右侧内容 ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 50;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .18s ease;
}
body.collapsed .sidebar { width: var(--sidebar-w-collapsed); }

.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 65px;
}
.sidebar-head .brand-logo { flex: none; }
.sidebar-head .brand-text { overflow: hidden; }
.sidebar-head .brand-text h1 { font-size: 15.5px; }
.sidebar-head .brand-text span { font-size: 11.5px; }

.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: .15s;
}
.sidebar-nav .nav-item:hover { background: #f1f4f9; color: var(--text); }
.sidebar-nav .nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
/* 经营者视角入口（老板座舱 / 智能定价）：默认隐藏，登录态确认为主账号或超管后由 auth.js
   在 <html> 上加 .nav-owner 才显示。子账号既看不到入口，后端也会拦页面与接口。 */
.sidebar-nav .nav-item[data-role-only="owner"] { display: none; }
html.nav-owner .sidebar-nav .nav-item[data-role-only="owner"] { display: flex; }
.sidebar-nav .nav-item .ico { flex: none; display: grid; place-items: center; width: 20px; }
.sidebar-nav .nav-item .nav-label { overflow: hidden; }

/* ---------- 侧栏「分组 + 子项」导航（订单管理 → 订单登记 / 闲鱼订单） ---------- */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .nav-parent {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 0; border-radius: 8px;
  background: none; width: 100%;
  font-family: inherit; font-size: 13.5px; text-align: left;
  color: var(--text-2);
  cursor: pointer; white-space: nowrap;
  transition: .15s;
}
.nav-group .nav-parent:hover { background: #f1f4f9; color: var(--text); }
/* 组内有子项处于激活态时，父项也高亮（弱化版，避免与子项抢焦点） */
.nav-group.has-active .nav-parent { color: var(--primary); font-weight: 600; }
.nav-group .nav-parent .ico { flex: none; display: grid; place-items: center; width: 20px; }
.nav-group .nav-parent .nav-label { flex: 1; overflow: hidden; }
.nav-group .nav-caret {
  flex: none; font-size: 10px; line-height: 1; color: var(--text-3);
  transition: transform .18s ease;
}
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }

/* 子项：缩进 + 左侧引导线 */
.nav-sub {
  display: flex; flex-direction: column; gap: 2px;
  margin-left: 19px; padding-left: 11px;
  border-left: 1px solid var(--border);
  overflow: hidden;
  max-height: 200px;
  transition: max-height .2s ease, opacity .16s ease;
}
.nav-group.collapsed .nav-sub { max-height: 0; opacity: 0; }
.nav-sub .nav-item { padding: 7px 10px; font-size: 13px; }
.nav-sub .nav-item .ico { width: 16px; }
.nav-sub .nav-item .ico svg { width: 15px; height: 15px; }

/* 折叠态：只剩图标，分组直接摊平展示子项，隐藏父项标题与引导线 */
body.collapsed .nav-group .nav-parent { justify-content: center; }
body.collapsed .nav-group .nav-caret { display: none; }
body.collapsed .nav-sub {
  margin-left: 0; padding-left: 0; border-left: 0;
  max-height: 200px; opacity: 1;
}

.sidebar-foot { padding: 8px; border-top: 1px solid var(--border); }
.collapse-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.collapse-btn:hover { background: #f1f4f9; color: var(--text); }
.collapse-btn .collapse-icon { flex: none; width: 20px; text-align: center; font-size: 14px; }

body.collapsed .brand-text,
body.collapsed .sidebar-nav .nav-label,
body.collapsed .collapse-btn .nav-label { display: none; }
body.collapsed .sidebar-nav .nav-item,
body.collapsed .collapse-btn { justify-content: center; }
body.collapsed .sidebar-head { justify-content: center; padding: 14px 8px; }

.main-wrap {
  margin-left: var(--sidebar-w);
  transition: margin-left .18s ease;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.collapsed .main-wrap { margin-left: var(--sidebar-w-collapsed); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.page-title { margin: 0; font-size: 16px; font-weight: 650; }
/* 顶栏右侧：当前登录账号 + 退出（由 auth.js 注入；topbar 是 space-between，
   所以要用 margin-left:auto 顶到最右） */
.topbar .auth-user {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  font-size: 13px; color: var(--text-2);
}
.topbar .auth-user .auth-who {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: #f3f6fb; border: 1px solid var(--border);
  border-radius: 999px; white-space: nowrap;
}
.topbar .auth-user .auth-role {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}
.topbar .auth-user .auth-role.super { background: #fdf5e3; color: #b7791f; }
.topbar .auth-user button {
  padding: 4px 10px; font-size: 12.5px; color: var(--text-2);
  background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.topbar .auth-user button:hover { background: #f6f8fc; }
/* 登录态未确认前遮住页面，避免先闪出内容再盖登录层 */
body.auth-locked .main-wrap { visibility: hidden; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.brand-text h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.brand-text span { font-size: 12px; color: var(--text-3); }
.conn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2);
  background: #f6f8fc; border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 20px;
}
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); display: inline-block; }

/* ---------- 布局 ---------- */
/* 页面满高：数据区撑满视口，底部信息栏贴住页面最底（不留空白，同屏显示最多数据） */
.page {
  max-width: 1680px;
  margin: 0 auto;
  padding: 16px 24px 12px;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* 设备页两个视图的包裹层（台账 / 类型表） */
.view-box { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-value { font-size: 24px; font-weight: 650; margin-top: 4px; letter-spacing: .3px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.search-box {
  position: relative;
  display: flex; align-items: center;
  background: #fbfcfe;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text-3);
  min-width: 300px;
}
.search-box input {
  border: 0; outline: none; background: transparent;
  padding: 8px 6px; width: 100%;
}
.search-box:focus-within { border-color: var(--primary); background: #fff; }

.select, .field input, .field select, .field textarea {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  outline: none;
}
.select { min-width: 130px; cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
/* 自动计算字段（只读）：浅灰底 + 主色提示，表示不可手填 */
.field input[readonly], .field select[readonly], .field textarea[readonly] {
  background: #f5f7fb;
  color: var(--text-2);
  cursor: default;
}
.field .hint.auto { color: var(--primary); }
/* 锁定字段（如编辑时的「租期登记人」）：浅灰底 + 锁标，表示登记后不可更改 */
.field input.locked-field {
  background: #eef1f6;
  color: var(--text-2);
  cursor: not-allowed;
  border-style: dashed;
}

/* ---------- 父子记录（同租客）标记 + 筛选下变暗 ---------- */
.family-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  font-size: 11px;
  line-height: 16px;
  border-radius: 8px;
  background: #e8f0ff;
  color: #2563eb;
  vertical-align: middle;
  white-space: nowrap;
}
.g-family-badge { font-size: 10px; opacity: .85; }
/* 筛选条件下不满足、但因同组兄弟命中而保留展示的订单：整行变暗 */
.row-dim { opacity: .45; }
.row-dim:hover { opacity: .8; }
.row-dim td.cell-actions .btn { opacity: .7; }
/* 字段查重失败：输入框标红 + 错误提示 */
.field-error > label, .field-error .req { color: #e0483c; }
.field-error input, .field-error select, .field-error textarea,
.field-error .opt-select-trigger, .field-error .combo > input {
  border-color: #e0483c !important; box-shadow: 0 0 0 3px rgba(224,72,60,.14);
}
.field .hint.dup-err { color: #e0483c; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { background: #f6f8fc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #f0c4c0; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 10px; border-radius: 7px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f1f4f9; border-color: var(--border); color: var(--text); }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 12.5px; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { background: #0f735f; border-color: #0f735f; }
.btn:disabled { opacity: .5; cursor: not-allowed; background: #eef1f6; color: var(--text-3); border-color: var(--border); box-shadow: none; }
/* 导入成功后的「确认导入」按钮：定格成结果态（成功色 + 禁用），明确告诉用户「已经导完了」，
   避免还显示「确认导入」让人以为没生效而反复点击、重复提交。 */
.btn.imp-confirm-done,
.btn.imp-confirm-done:disabled {
  background: #12876f; border-color: #12876f; color: #fff; opacity: 1; cursor: default;
}

.icon-btn {
  border: 0; background: none; cursor: pointer;
  font-size: 16px; color: var(--text-3);
  width: 30px; height: 30px; border-radius: 8px;
}
.icon-btn:hover { background: #f1f4f9; color: var(--text); }

/* ---------- 列显示下拉 ---------- */
.col-dropdown { position: relative; }
.col-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 260px; z-index: 30;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
  overflow: hidden;
}
.col-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2); background: #fafbfd;
}
.col-panel-body { max-height: 340px; overflow: auto; padding: 8px; }
.col-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.col-item:hover { background: #f5f7fb; }
.col-item .col-check { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: pointer; }
.col-item .col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-item input { accent-color: var(--primary); }
/* 列位置上/下移按钮（表格中即 左/右 移） */
.col-move { display: flex; gap: 2px; flex: none; }
.col-mv {
  width: 20px; height: 20px; padding: 0; border: 1px solid var(--border);
  background: #fff; border-radius: 5px; color: var(--text-2);
  font-size: 9px; line-height: 1; cursor: pointer;
}
.col-mv:hover:not(:disabled) { background: #eef4ff; border-color: var(--primary); color: var(--primary); }
.col-mv:disabled { opacity: .35; cursor: default; }
.col-sub { margin: 8px 2px 2px; padding-top: 7px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--text-3); }
.col-empty { padding: 8px 6px; font-size: 12.5px; color: var(--text-3); }
.caret { font-size: 11px; color: var(--text-3); }

/* ---------- 快捷筛选条 ---------- */
.quick-filter-bar {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
}
.quick-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text-2);
  padding: 5px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.quick-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.quick-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.quick-chip.active .caret { color: rgba(255, 255, 255, .8); }
.quick-pop {
  position: absolute; top: calc(100% - 2px); left: 0; z-index: 40;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
  padding: 6px;
}
.quick-pop-item {
  border: 0; background: none; text-align: left;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.quick-pop-item:hover { background: #f5f7fb; color: var(--text); }
.quick-pop-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

/* ---------- 表格 ---------- */
/* 数据区自身滚动、撑满面板剩余高度（底部信息栏因此贴住页面最底） */
.table-wrap { overflow: auto; flex: 1; min-height: 0; }
.data-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; white-space: nowrap; }
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
/* 最右列（操作）右边去掉竖线 → 表格边缘干净 */
.data-table th:last-child, .data-table td:last-child { border-right: 0; }
.data-table thead th {
  position: sticky; top: 0; z-index: 10;
  background: #fafbfd;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-strong);
}
.data-table tbody tr:hover { background: #f8fafd; }
.data-table tbody tr { height: 46px; }
.data-table tbody tr.row-selected > td,
.data-table tbody tr.row-selected .cell-actions { background: var(--primary-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }
/* 分组分隔线：相同「预约组」聚在一起，组与组之间加粗分隔（颜色 #e6c3a5） */
.data-table tbody tr.group-start td { border-top: 2px solid #e6c3a5; }

/* ===================== 行分组（设备台账按设备型号，cfg.groupRows） =====================
   一级分组头 = 拖动手柄 + 折叠箭头 + 型号 + 「N 台设备（X 台已出租，Y 台可出租）」
   二级分组头 = 同型号内按「设备状态」细分（缩进显示）
   调序 = **鼠标拖动分组头整行**（落点用内阴影线提示），不再是 ↑↓ 按钮 */
.group-bar { padding: 0 0 10px; }
.group-hint { margin-left: 10px; font-size: 12.5px; color: var(--text-3); }
.data-table tbody tr.row-group { height: 40px; cursor: grab; }
.data-table tbody tr.row-group:active { cursor: grabbing; }
.data-table tbody tr.row-group:hover { background: transparent; }
.data-table tbody tr.row-group > td.group-cell {
  height: 38px; padding: 0 10px; background: #f7f9fc;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.data-table tbody tr.row-group:first-child > td.group-cell { border-top: 0; }
.group-inner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.group-drag { flex: none; color: var(--text-3); font-size: 13px; line-height: 1; user-select: none; }
.data-table tbody tr.row-group:hover .group-drag { color: var(--primary); }
.group-toggle {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 6px; background: #fff;
  color: var(--text-2); font-size: 10px; line-height: 1; cursor: pointer;
}
.group-toggle:hover { border-color: var(--primary); color: var(--primary); }
.group-name {
  flex: none; font-size: 13.5px; font-weight: 700; color: var(--text);
  padding-left: 8px; border-left: 3px solid var(--primary); line-height: 1.2;
}
.group-meta { flex: 0 1 auto; min-width: 0; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
/* 拖动中：被拖的那一行变淡；落点行用内阴影线标出会插到哪一侧 */
.data-table tbody tr.row-group.is-dragging { opacity: .45; }
.data-table tbody tr.row-group.drop-before > td.group-cell { box-shadow: inset 0 3px 0 var(--primary); }
.data-table tbody tr.row-group.drop-after  > td.group-cell { box-shadow: inset 0 -3px 0 var(--primary); }
/* 二级分组头（型号内的设备状态）：缩进 + 轻量配色，与一级明显区分 */
.data-table tbody tr.row-subgroup > td.group-cell { height: 34px; background: #fbfcfe; }
.data-table tbody tr.row-subgroup .group-inner { padding-left: 24px; }
.data-table tbody tr.row-subgroup .group-name {
  font-size: 12.5px; font-weight: 600; border-left-color: var(--border-strong);
}
.data-table tbody tr.row-subgroup .group-meta { font-size: 12px; }
.data-table tbody tr.row-group.is-collapsed .group-name { color: var(--text-2); }

.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-actions {
  position: sticky; right: 0;
  /* 高于甘特条（.g-bar z-index 2），横向滚动时操作列不被甘特数据压住 */
  z-index: 15;
  background: #fff;
  box-shadow: -6px 0 8px -8px rgba(16, 24, 40, .25);
}
.data-table tbody tr:hover .cell-actions { background: #f8fafd; }
thead .cell-actions { z-index: 14; background: #fafbfd; }

/* ---------- 首列冻结（订单页甘特视图：租客列横向滚动保持不动） ---------- */
.data-table th.col-fixed, .data-table td.col-fixed { position: sticky; left: 0; }
.data-table thead th.col-fixed {
  z-index: 13;                       /* 高于普通表头(10)与甘特条(2)，低于操作列表头(14) */
  background: #fafbfd;
  box-shadow: 5px 0 8px -8px rgba(16, 24, 40, .22);
}
.data-table tbody td.col-fixed {
  z-index: 6;                        /* 高于甘特条(2)，滚动时盖住下方的甘特数据 */
  background: #fff;
  box-shadow: 5px 0 8px -8px rgba(16, 24, 40, .22);
}
.data-table tbody tr:hover td.col-fixed { background: #f8fafd; }
.data-table tbody tr.row-selected td.col-fixed { background: var(--primary-soft); }
.muted { color: var(--text-3); }
/* 顺丰标快估算值（快递费留空时列表里的灰色预估值，虚线提示「非实际填写值」） */
.est { border-bottom: 1px dashed currentColor; }
/* 运输天数 = 1 时列表显示「当日达」：加个小徽标，和纯数字区分开 */
.same-day {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #12876f;
  background: #e6f6f1;
  white-space: nowrap;
}
.nowrap-ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; }
.cell-clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 可复制单元格：点击即复制该格数据（配合 title「点击复制」与 copy 光标） */
td.cell-copy { cursor: copy; }
td.cell-copy .cell-clip { text-decoration: underline dotted; text-decoration-color: var(--text-3); text-underline-offset: 2px; }
td.cell-copy:hover { background: #eef4ff; }
td.cell-copy:hover .cell-clip { text-decoration-color: var(--primary); }

/* 就地编辑单元格（如「租客」）：点显示值直接改，回车/失焦保存，Esc 取消 */
td.cell-inline { cursor: text; }
td.cell-inline:hover { background: #fff8e8; }
td.cell-inline .cell-clip { text-decoration: underline dotted; text-decoration-color: #d8b26a; text-underline-offset: 2px; }
td.cell-inline:hover .cell-clip { text-decoration-color: #b7791f; }
.cell-inline-input {
  width: 100%; box-sizing: border-box;
  padding: 2px 6px; font-size: 13px; line-height: 20px;
  border: 1px solid var(--primary); border-radius: 5px;
  background: #fff; color: var(--text);
  outline: none; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}

/* 列宽拖拽手柄 */
.col-resizer {
  position: absolute; top: 0; right: -4px; bottom: 0; width: 9px;
  cursor: col-resize; z-index: 12; user-select: none;
}
.col-resizer::after {
  content: ''; position: absolute; top: 25%; bottom: 25%; left: 4px; width: 1px;
  background: transparent; transition: background .12s;
}
.col-resizer:hover::after, .col-resizer:active::after { background: var(--primary); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }
th .th-label { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
}
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty-state p { margin: 10px 0 0; font-size: 13.5px; }
/* 载入占位行（数据未到时先在表格区给一句提示，不留下整块空白） */
.data-table tbody tr.row-loading > td {
  padding: 46px 16px; text-align: center; color: var(--text-3);
  background: repeating-linear-gradient(45deg, #fafbfd, #fafbfd 10px, #f4f6fa 10px, #f4f6fa 20px);
}
.load-hint { font-size: 13.5px; }

.table-foot {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  font-size: 12.5px; color: var(--text-2);
}
.foot-tip { color: var(--text-3); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 27, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px;
  overflow: auto;
}
.modal {
  width: 100%; max-width: 960px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .25);
  overflow: hidden;
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-x {
  border: none; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--text-3); padding: 0 4px;
}
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px 20px; max-height: calc(100vh - 240px); overflow: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfd;
}
.modal-foot > div { display: flex; gap: 8px; }
.foot-note { font-size: 12.5px; color: var(--text-3); }

/* ---------- 嵌入式订单表单（?embed=1，供「闲鱼订单」页用 iframe 内嵌） ----------
   隐藏侧栏与页面内容，只保留订单表单弹窗并铺满 iframe；由 index.html 顶部脚本加 html.embed-mode。
   ⚠️ 曾因 index/devices/settings 三页的 .main-wrap 漏写 </div>，弹窗被吞进内容容器内部；
   现已补齐闭合标签（弹窗独立于 .main-wrap 之外），但仍保留「只隐藏 .main-wrap 里的
   .topbar / .page」这种做法——不整体隐藏 .main-wrap 对两种结构都成立，改回去没有收益。 */
html.embed-mode, html.embed-mode body { height: 100%; }
html.embed-mode body { background: #fff; overflow: hidden; }
html.embed-mode .sidebar,
html.embed-mode .toast { display: none !important; }
/* ⚠️ 必须整体隐藏 .main-wrap，不能只隐藏它里面的 .topbar/.page：
   .main-wrap 正常布局下是 height:100vh 的**整屏空壳**，把子元素藏掉它自己仍占满一屏 →
   embed 里弹窗被改成 position:static（正常流），于是被顶到**首屏之下**，
   而 body 又是 overflow:hidden 滚不过去 → 现象就是「弹窗打开了，但里面一片空白」。
   实测（1100×640 的 iframe）：.main-wrap 占 0..640，弹窗从 y=640 才开始，订单编号输入框在 y=898。
   安全性：弹窗位于 .main-wrap **之外**（有结构测试锁定 !modalMask.closest('.main-wrap')），
   且 app.js 只被订单页引入、?embed=1 也只有订单页支持 —— 整体隐藏不会连弹窗一起藏掉。 */
html.embed-mode .main-wrap { display: none !important; }
/* 保底：即便将来有人把 .main-wrap 加回来，也让它不占高度 */
html.embed-mode .main-wrap > .topbar,
html.embed-mode .main-wrap > .page { display: none !important; }
html.embed-mode .modal-mask {
  position: static; inset: auto; background: #fff; padding: 0; overflow: visible; display: block;
}
html.embed-mode .modal-mask[hidden] { display: none; }
html.embed-mode .modal {
  width: 100%; max-width: none; min-height: 100vh; border-radius: 0; box-shadow: none; animation: none;
}
/* 隐藏订单页弹窗**自带的标题栏**：宿主（闲鱼页）弹窗已有标题与关闭按钮，
   否则会出现「登记新订单」+「新增订单」两个表头 */
html.embed-mode .modal-head { display: none !important; }
html.embed-mode .modal-body { max-height: calc(100vh - 66px); }

/* ---------- 必填缺失提示弹窗（独立于 .modal-mask，embed 模式也居中浮顶） ---------- */
.req-modal-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20, 27, 40, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.req-modal {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .3);
  overflow: hidden; animation: pop .18s ease-out;
}
.req-modal-head {
  padding: 15px 20px; font-size: 15px; font-weight: 650; color: #c0392b;
  border-bottom: 1px solid var(--border); background: #fff5f4;
}
.req-modal-body { padding: 16px 20px; }
.req-modal-sub { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.req-modal-list { margin: 0; padding-left: 20px; }
.req-modal-list li { font-size: 13.5px; color: var(--text); padding: 3px 0; }
.req-modal-foot {
  padding: 12px 20px; border-top: 1px solid var(--border); background: #fafbfd; text-align: right;
}

/* ---------- 导入数据弹窗 ---------- */
.import-modal { max-width: 720px; }
.imp-steps { display: flex; flex-wrap: wrap; gap: 16px; }
.imp-step { flex: 1 1 260px; background: #fafbfd; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.imp-step h3 { margin: 0 0 6px; font-size: 13.5px; font-weight: 650; }
.imp-step .muted { margin: 0 0 12px; font-size: 12.5px; }
.imp-file-name { margin-left: 10px; font-size: 12.5px; color: var(--text-2); word-break: break-all; }
.imp-result { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 16px; }
.imp-summary { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }
.imp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.imp-sub { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 12px 0 6px; }
.imp-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.imp-table th, .imp-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.imp-table th { position: sticky; top: 0; background: #f4f6fa; font-weight: 600; color: var(--text-2); }
.imp-table td:last-child { white-space: normal; color: #b42318; }
.imp-table tbody tr:nth-child(even) { background: #fafbfd; }

.form-section { margin-bottom: 20px; }
.form-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.form-section h3::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
/* span-2：整行铺开（grid 为 auto-fill 多列，用 1/-1 才能真正占满一整行） */
.field.span-2 { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field label .req { color: var(--danger); margin-left: 2px; }
/* 锁定/只读的输入控件：灰底灰字 + 禁止光标，明确「不可更改」 */
select:disabled, input:disabled, textarea:disabled,
.field select:disabled, .field input:disabled {
  background: #f3f5f8; color: #98a2b3; cursor: not-allowed; border-color: var(--border);
}
.field textarea { resize: vertical; min-height: 62px; }
/* oneLine 文本框（收货人信息）：与其他单行输入框**同宽同高**——
   占一个格子（不铺满整行），高度交给 rows=1 决定，并去掉 62px 的最小高度与拖拽手柄，
   避免它在表单里比别的字段高出一截。内容超长时框内纵向滚动，不改动框体尺寸。 */
.field.field-one-line textarea {
  min-height: 0; height: auto; resize: none;
  /* 长文本超出时内容可滚（光标移动会自动带入视野），但**不显示滚动条**——
     与原生单行 input 的观感一致，框体尺寸恒定不变 */
  overflow: auto; scrollbar-width: none;
}
.field.field-one-line textarea::-webkit-scrollbar { width: 0; height: 0; }
/* hidden 字段（如订单的 parentId）：随表单提交但不占可见格子、不撑开布局 */
.field.field-hidden { display: none; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.inline-act { display: flex; gap: 6px; align-items: center; }

/* ---------- 视频数据框（发货 / 验货） ---------- */
.video-row { display: flex; gap: 8px; align-items: center; }
.video-row > input { flex: 1; min-width: 0; }
.video-file-btn { white-space: nowrap; }
.video-preview { margin-top: 2px; }
.field-video { max-width: 100%; max-height: 180px; border-radius: 8px; border: 1px solid var(--border); background: #000; }
.field-video-empty { font-size: 12px; color: var(--text-2); background: #f3f5f8; border: 1px dashed var(--border); border-radius: 8px; padding: 6px 10px; word-break: break-all; }
.cell-video { color: var(--primary); text-decoration: none; font-weight: 500; }
.cell-video:hover { text-decoration: underline; }
.cell-video-file { color: var(--text-2); font-size: 12px; }

/* ---------- 可搜索下拉（预约组：输入框 + 候选项面板） ---------- */
.combo { position: relative; display: flex; align-items: center; }
.combo > input { flex: 1; min-width: 0; padding-right: 30px; }
.combo.open > input { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.combo-btn {
  position: absolute; right: 1px; top: 1px; bottom: 1px;
  width: 28px; border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 11px; line-height: 1;
  border-left: 1px solid var(--border);
}
.combo-btn:hover { color: var(--primary); background: #f4f7fd; }
.combo-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  max-height: 260px; overflow: auto;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
  padding: 4px 0;
}
.combo-pop[hidden] { display: none; }
.combo-head { padding: 6px 12px 7px; font-size: 11.5px; color: var(--text-3); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.combo-item { padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.combo-item:hover, .combo-item.hl { background: #eef4ff; color: var(--primary); }
.combo-item.cur { font-weight: 600; }
.combo-item .combo-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* 候选项附注标签（预约组的「空闲 / 占用」） */
.combo-tag {
  flex: none; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; line-height: 17px; font-weight: 500; letter-spacing: .02em;
  border: 1px solid transparent;
}
.combo-tag.free { color: #157f45; background: #e8f7ee; border-color: #bfe6cf; }
.combo-tag.busy { color: #b4232a; background: #fdecec; border-color: #f6cccd; }
.combo-item:hover .combo-tag.free, .combo-item.hl .combo-tag.free { background: #d8f0e3; }
.combo-item:hover .combo-tag.busy, .combo-item.hl .combo-tag.busy { background: #f9dcdc; }
.combo-empty { padding: 8px 12px; font-size: 12.5px; color: var(--text-3); }

/* 预约组：自动选组失败且原因为「可出租设备不足 / 无可选组」时，整字段显眼告警 */
.field-shortage > label { color: #c0392b; font-weight: 700; }
.field-shortage .combo { border-color: #e0483c; box-shadow: 0 0 0 3px rgba(224,72,60,.16); background: #fff5f4; }
.field-shortage .combo-alert { border-color: #e0483c; box-shadow: 0 0 0 3px rgba(224,72,60,.16); }
.field-shortage .hint { color: #c0392b; font-weight: 600; }
.field-alert {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 7px 10px;
  background: #fdecea; border: 1px solid #f3b6b1; border-left: 4px solid #e0483c;
  border-radius: 6px; color: #b3261e; font-size: 13px; font-weight: 700; line-height: 1.35;
}
.field-alert::before { content: "\26A0"; font-size: 14px; line-height: 1; }
.field-alert.warn { background: #fff7e6; border-color: #f3d39b; border-left-color: #c2703a; color: #9a5310; }
.field-alert.warn::before { content: "\26A0"; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #1c2430; color: #fff;
  padding: 10px 18px; border-radius: 8px;
  font-size: 13.5px; z-index: 90;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .3);
}

@media (max-width: 900px) {
  /* 窄屏自动收起侧边栏，保证表格可用宽度 */
  .sidebar { width: var(--sidebar-w-collapsed); }
  .main-wrap { margin-left: var(--sidebar-w-collapsed); }
  .brand-text, .sidebar-nav .nav-label, .collapse-btn .nav-label { display: none; }
  .sidebar-nav .nav-item, .collapse-btn { justify-content: center; }
  /* 窄屏同样是图标态：分组摊平，父子项都居中 */
  .nav-group .nav-parent { justify-content: center; }
  .nav-group .nav-caret { display: none; }
  .nav-sub { margin-left: 0; padding-left: 0; border-left: 0; max-height: 200px; opacity: 1; }
}

@media (max-width: 720px) {
  .page { padding: 10px 12px 8px; }
  .topbar { padding: 10px 12px; flex-wrap: wrap; }
  .search-box { min-width: 180px; }
}

/* ===================== 甘特图（订单数据表右侧时间轴列） ===================== */
/* 时间轴控制条：周/月/季/年 + 今天 + 翻页 + 独立横向缩放（常驻甘特区顶部） */
.gantt-headbar {
  position: absolute; top: 0; right: 0; z-index: 14;
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 8px;
  background: #f7f9fc;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 8px;
}
.gantt-scales { display: flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.gantt-scale {
  border: 0; background: #fff; color: var(--text-2);
  padding: 0 10px; height: 22px; font-size: 12px; cursor: pointer;
  border-right: 1px solid var(--border); line-height: 22px;
}
.gantt-scale:last-child { border-right: 0; }
.gantt-scale:hover { background: #eef2f8; color: var(--text); }
.gantt-scale.active { background: var(--primary); color: #fff; font-weight: 600; }
.gantt-nav { display: flex; align-items: center; gap: 4px; }
.gantt-nav-btn {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  min-width: 24px; height: 22px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px; line-height: 1; padding: 0 6px;
}
.gantt-nav-btn:hover { background: #eef2f8; color: var(--text); }
.gantt-nav-today { font-size: 12px; font-weight: 600; color: var(--primary); border-color: #c7dbff; }

/* 时间轴表头：月份行 + 日期行 */
/* 甘特内容包裹层：表头 + 行容器同层 → 表头用**原生 sticky**纵向悬浮（浏览器同帧计算，不抖动），
   横向仍随滚动条走，年月文字靠 .gm-label 的 sticky 钉在左缘。宽度由 JS 按时间轴宽内联给定。 */
.gantt-inner { position: relative; }
/* ⚠️ sticky 必须挂在这层 div 上：它若在 <table>/<th> 里，会被「只有表头那么高」的
   containing block 限制住，滚过 51px 就失效。 */
.gantt-head {
  position: sticky; top: 0; z-index: 12;
  height: 51px; background: #f7f9fc;
}
/* 时间轴区域：日期单元格固定宽度（按粒度档位），不支持拖动拉伸 */
.tg-axis { cursor: default; }
.tg-axis-inner { position: relative; }
/* ⚠️ 这里**不能**加 overflow:hidden：它会让内部 .gm-label 的 position:sticky 把
   .tg-months 当成滚动容器（永远不滚），横向钉住效果就失效了。月份格本身宽度正好铺满
   时间轴，无需裁剪；超长年月文字由 .gm-label 自己 max-width:100% + 省略号处理。 */
.tg-months { position: relative; height: 26px; background: #f7f9fc; border-bottom: 1px solid var(--border); }
.tg-days { position: relative; display: flex; height: 23px; background: #fff; overflow: hidden; }
.gantt-month {
  position: absolute; top: 0; height: 100%;
  display: flex; align-items: center;
  padding-left: 8px; font-size: 12px; font-weight: 600; color: var(--text-2);
  border-left: 1px solid var(--border-strong); white-space: nowrap;
}
/* 年月文字「双向固定」的横向部分：横向滚动时钉在甘特区左边缘，不随时间轴滑走。
   ⚠️ 祖先链上任何一处 overflow:hidden/auto 都会让 sticky 认错滚动容器而失效。 */
.gantt-month .gm-label {
  position: sticky; left: 0; z-index: 1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gantt-day {
  flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; color: var(--text-3);
  border-left: 1px solid #eef1f6; overflow: hidden;
}
.gantt-day.weekend { color: #b7791f; background: #fdfaf3; }
.gantt-day.today { color: var(--primary); font-weight: 700; }

/* 行内甘特轨道：撑满单元格高度，与数据行同高（46px 行高 - 1px 下边框） */
.cell-gantt { padding: 0 !important; box-sizing: border-box; position: relative; }
.tg-track { position: relative; box-sizing: border-box; height: 45px; }
.tg-track .g-bar { z-index: 2; }
/* 今日竖线（每行轨道内一条，视觉上连成整列） */
.tg-today {
  position: absolute; top: 0; bottom: 0; z-index: 1;
  width: 0; border-left: 2px solid var(--primary);
  pointer-events: none;
}

/* ---------- 甘特条：整段 = 发货→回签 胶囊，两端箭头 ---------- */
/* 头尾斜纹段（发货→起租前一天 / 结束+1天→回签）：通用灰斜纹，描边染状态色（内联给出） */
/* 中间实色段（起租→结束）：状态色实底 + 白字，条内显示租客名，左对齐 */
.g-bar { position: absolute; border-radius: 12px; }
.g-bar .g-part { position: absolute; top: 0; bottom: 0; border-radius: 10px; box-sizing: border-box; }
.g-part-fade {
  background: repeating-linear-gradient(45deg, #eef3fb 0 6px, #e0e9f5 6px 12px);
  border: 1px solid #d4deec;
}
.g-part-solid {
  display: flex; align-items: center; justify-content: flex-start;   /* 内容左对齐 */
  overflow: hidden; min-width: 20px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
/* 条内文字 = 租客名（实色段为状态色深底 → 白字），过长省略 */
.g-part-solid .g-text {
  font-size: 11px; font-weight: 600; color: #fff; padding: 0 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 两端箭头（随状态色，由内联样式给出颜色） */
.g-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.g-arrow-l { left: 0; border-right: 8px solid #4a7dbe; }
.g-arrow-r { right: 0; border-left: 8px solid #4a7dbe; }

/* ===================== 分段切换（设备台账 / 设备类型表，带滑块动效） ===================== */
.seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 3px;
  background: #eef1f6;
  border-radius: 9px;
}
.seg-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  width: 0;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .14);
  transition: left .22s cubic-bezier(.4, 0, .2, 1), width .22s cubic-bezier(.4, 0, .2, 1);
}
.seg-item {
  position: relative;
  z-index: 1;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 7px 20px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  transition: color .18s;
}
.seg-item:hover { color: var(--text); }
.seg-item.active { color: var(--primary); font-weight: 600; }

/* ===================== 设备维修记录面板 ===================== */
.repair-panel { display: flex; flex-direction: column; gap: 10px; }
/* 新增行：浅底虚线框，与下方记录列表区分；排成规整两行（原因|渠道|图片 / 关联订单|新增） */
.repair-add {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px; align-items: center;
  padding: 9px 11px; background: #fafbfd;
  border: 1px dashed var(--border-strong); border-radius: 8px;
}
.repair-add .repair-reason  { grid-column: 1; grid-row: 1; }
.repair-add .repair-channel { grid-column: 2; grid-row: 1; }
.repair-add .repair-file    { grid-column: 3; grid-row: 1; font-size: 12.5px; padding: 5px 7px; max-width: 210px; }
.repair-add .repair-order-new { grid-column: 1 / 3; grid-row: 2; min-width: 0; }
.repair-add .repair-add-btn   { grid-column: 3; grid-row: 2; justify-self: end; }
/* 窄屏（弹窗很窄时）退回单列堆叠 */
@media (max-width: 620px) {
  .repair-add { display: flex; flex-direction: column; align-items: stretch; }
  .repair-add .repair-file { max-width: none; }
  .repair-add .repair-add-btn { align-self: flex-end; }
}
/* 关联订单登记（引用订单登记中的订单编号） */
.repair-add .repair-order-new { flex: 1 1 170px; min-width: 130px; }
.repair-order-cell { display: inline-flex; align-items: center; gap: 4px; }
.repair-order-cell select,
.repair-order-cell input { max-width: 240px; }

/* 维修图片：上传 + 摄像头实时拍摄（与发货留存图片同款交互） */
.repair-media-cell { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.repair-media-cell .repair-file { max-width: none; }
.repair-cam-btn { align-self: flex-start; }
.repair-cam-prev { position: relative; display: inline-block; }
.repair-cam-prev[hidden] { display: none; }
.repair-cam-prev img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.repair-cam-prev .repair-cam-clear { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; line-height: 1; border: 0; border-radius: 50%; background: rgba(17,24,39,.6); color: #fff; font-size: 13px; cursor: pointer; }
.repair-cam-prev .repair-cam-clear:hover { background: var(--danger, #dc2626); }
.repair-cam { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: #0b0f14; border-radius: 8px; }
.repair-cam[hidden] { display: none; }
.repair-cam-video { width: 100%; max-height: 320px; background: #000; border-radius: 6px; }
.repair-cam-ops { display: flex; align-items: center; gap: 8px; }
.repair-cam-count { color: #cfd6e4; font-size: 12.5px; }
/* 关联订单：可搜索下拉（单个控件——输入即搜索、点 ▾ 展开候选浮层、选中回填） */
.repair-order-wrap {
  position: relative; display: inline-flex; align-items: center;
  border: 1px solid var(--border-strong); border-radius: 8px; background: #fff;
  padding: 0 2px 0 0; vertical-align: middle;
}
.repair-order-wrap.is-disabled { background: #f7f8fa; opacity: .7; }
.repair-order-wrap .repair-order-input {
  flex: 1 1 auto; min-width: 110px; max-width: none;
  border: 0; outline: none; background: transparent;
  padding: 7px 8px; font-size: 13px; color: var(--text);
}
.repair-order-wrap .repair-order-btn {
  flex: none; border: 0; background: transparent; cursor: pointer;
  color: var(--text-3); font-size: 12px; padding: 4px 7px; line-height: 1;
}
.repair-order-wrap .repair-order-btn:hover { color: var(--primary); }
.repair-order-wrap.open { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.repair-order-pop {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 80;
  min-width: 100%; max-width: 320px; max-height: 240px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16); padding: 4px;
}
.repair-order-pop[hidden] { display: none; }
.repair-order-opt {
  padding: 6px 9px; border-radius: 6px; cursor: pointer; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.repair-order-opt:hover { background: #f3f6fb; }
.repair-order-opt.cur { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.repair-order-group { padding: 6px 9px 2px; font-size: 11.5px; color: var(--text-3); }
.repair-order-none { padding: 8px 9px; color: var(--text-3); font-size: 12.5px; }
.repair-order-cell .repair-order-wrap { min-width: 230px; max-width: 300px; }
/* 维修图片缩略图（沿用 .damage-thumb 外框 + .damage-thumb-img 可点击放大） */
.repair-thumb { width: 52px; height: 52px; border-radius: 7px; }
.repair-list { display: flex; flex-direction: column; gap: 8px; }
.repair-empty {
  color: var(--text-3); font-size: 13px; padding: 10px; text-align: center;
  background: #fafbfd; border: 1px dashed var(--border); border-radius: 8px;
}
/* 记录卡：左侧缩略图 + 右侧内容列（标题行 / 信息行 / 操作行），紧凑三行 */
.repair-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--border); border-left: 4px solid var(--border-strong);
  border-radius: 8px; background: #fff;
}
.repair-item.is-open      { border-left-color: #b7791f; background: #fffdf7; }
.repair-item.is-done      { border-left-color: #12876f; }
.repair-item.is-cancelled { border-left-color: #8b95a6; opacity: .85; }
/* 左：图片（固定宽度，不被内容挤压） */
.repair-media { flex: none; }
/* 右：内容列（占满剩余宽度，内部三行） */
.repair-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.repair-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.repair-no { font-weight: 700; color: var(--text-2); font-size: 12.5px; }
.repair-state {
  font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 12px;
  background: #f1f3f7; color: var(--text-2); white-space: nowrap;
}
.repair-item.is-open .repair-state      { background: #fdf5e3; color: #b7791f; }
.repair-item.is-done .repair-state      { background: #e6f6f1; color: #12876f; }
.repair-item.is-cancelled .repair-state { background: #f1f3f7; color: #8b95a6; }
.repair-paid { color: #12876f; font-weight: 600; font-size: 12px; white-space: nowrap; }
/* 时间信息：右对齐到标题行末尾（不再单独占一行） */
.repair-time {
  margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 3px 14px;
  font-size: 12px; color: var(--text-3);
}
.repair-info { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; font-size: 13px; }
.repair-info b { color: var(--text-3); font-weight: 500; }
.repair-fld { display: inline-flex; align-items: baseline; min-width: 0; }
.repair-fld-v { color: var(--text); word-break: break-all; }
.repair-ops { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.repair-amount { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.repair-amount input { width: 96px; }
.repair-lock-note { color: #b7791f; font-weight: 600; }
.tag-locked { cursor: help; }


/* ===================== 两段式布局：左数据区 / 右甘特区（各自一条横向滑动条） ===================== */
.split-view { display: flex; flex: 1; min-height: 0; min-width: 0; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane-data { flex: 1 1 auto; min-width: 360px; }
.pane-gantt {
  flex: 0 0 620px; position: relative;
  border-left: 1px solid var(--border);
  background: var(--card);
}
.pane-scroll { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; position: relative; }
.gantt-table { table-layout: fixed; }
.gantt-table thead th { height: 51px; padding: 0 !important; vertical-align: top; }
/* ===================== 甘特行：绝对定位落位（左数据行 <-> 右甘特行逐行对齐） =====================
   甘特行不再放在 <table><tbody> 里，而是放在一个 position:relative 的块容器里，
   每一行 position:absolute + top = 「左侧对应行的实测顶边」。这样：
     · 行与行之间不存在任何「累加关系」→ 不会有累计错位；
     · 左侧第 N 行内容的中线（top + h/2）== 右侧第 N 行甘特条的中线（bar.top + barH/2）。
   JS（renderGanttPane）会把 top / height 内联写死，这里只负责 display/position 基线。 */
.gantt-body { position: relative; display: block; }
/* ⚠️ 不要加 will-change: top —— 订单页几千行会给每行建合成层，内存爆掉 */
#ganttBody > tr { display: block; position: absolute; left: 0; }
#ganttBody > tr > td.cell-gantt { display: block; height: 100%; }
/* 甘特区独立横向缩放：点 - / + 只改变右侧日期区可视宽度（显示范围），左侧数据列宽度不变 */
.gantt-zoom { display: flex; align-items: center; gap: 4px; }
.gantt-splitter {
  flex: 0 0 6px; position: relative; z-index: 16;
  background: var(--border); cursor: col-resize;
}
.gantt-splitter::after {
  content: ''; position: absolute; top: 50%; left: 1px; right: 1px; height: 30px;
  transform: translateY(-50%); border-radius: 3px; background: #c3ccdb;
}
.gantt-splitter:hover, .gantt-splitter:active { background: var(--primary); }
/* 两侧行悬停 / 选中同步高亮（甘特行在 #ganttBody 里，不再是 tbody，故单独选择器） */
.data-table tbody tr.row-hover > td { background: #f8fafd; }
#ganttBody > tr.row-hover > td { background: #f8fafd; }
.data-table tbody tr.row-selected > td { background: var(--primary-soft); }
#ganttBody > tr.row-selected > td { background: var(--primary-soft); }
/* 分组分隔线：与左侧 .data-table tbody tr.group-start td 同口径（border-top 在 border-box 内，不撑高；颜色 #e6c3a5） */
#ganttBody > tr.group-start > td { border-top: 2px solid #e6c3a5; }

/* ===================== 行高严格对齐（左数据行 <-> 右甘特行） ===================== */
.data-table th, .data-table td { box-sizing: border-box; }
.data-table thead th { height: 51px; padding-top: 0; padding-bottom: 0; }
/* ⚠️ 行高固定：overflow:hidden 是「数据再多也不撑高行」的最后一道保险
   （单元格内容自身也必须单行——见 .rec-cell / .data-table td .tenant-chips） */
.data-table tbody td { height: 46px; padding-top: 0; padding-bottom: 0; overflow: hidden; }

/* ===================== 表头 / 冻结列层级（横向滚动时「操作」列表头不被覆盖） =====================
   常规 th(10) < 首列表头(13) < 操作列表头(20)；数据区：首列(6) < 操作列(15) */
.data-table thead th.col-fixed { z-index: 13; background: #fafbfd; }
.data-table tbody td.col-fixed { z-index: 6; }
.data-table thead th.cell-actions { z-index: 20; background: #fafbfd; }
.data-table tbody td.cell-actions { z-index: 15; }

/* ===================== 图片缩略图（维修记录复用） ===================== */
.damage-thumb {
  flex: none; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  background: #f1f4f9; display: grid; place-items: center;
  border: 1px solid var(--border);
}
.damage-thumb-img { width: 100%; height: 100%; object-fit: cover; }

/* ===================== 设备维修记录（展示设备管理里的维修记录，只读表格） ===================== */
.tag-repair { background: #fdf5e3; color: #b7791f; }
.device-repairs-panel { margin-top: 2px; }
.device-repairs-table {
  width: 100%; border-collapse: collapse; font-size: 13px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.device-repairs-table th, .device-repairs-table td {
  padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.device-repairs-table thead th {
  background: #f5f7fb; color: var(--text-2); font-weight: 600;
  white-space: nowrap; position: sticky; top: 0;
}
.device-repairs-table tbody tr:last-child td { border-bottom: none; }
.device-repairs-table .damage-note-cell { max-width: 240px; word-break: break-all; color: var(--text); }
.device-repairs-table .damage-img-cell { width: 56px; text-align: center; }
.device-repairs-table .damage-time-cell { white-space: nowrap; color: var(--text-3); }
.device-repairs-table .damage-thumb-img {
  width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border);
}

/* ===================== 图片放大预览（点击缩略图看原图） ===================== */
.damage-thumb-img { cursor: zoom-in; }             /* 可点击放大的提示 */
body.img-zoom-open { overflow: hidden; }           /* 预览时锁背景滚动 */
.img-zoom-mask {
  position: fixed; inset: 0; z-index: 5000;        /* 高于所有弹窗（表单 60 / 订单详情 1200） */
  background: rgba(15, 20, 30, .86);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 40px;
}
.img-zoom-img {
  max-width: 92vw; max-height: 86vh; object-fit: contain;
  background: #fff; border-radius: 6px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, .55);
}
.img-zoom-close {
  position: fixed; top: 16px; right: 20px;
  width: 42px; height: 42px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #1f2430;
  font-size: 26px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
.img-zoom-close:hover { background: #fff; }

/* ===================== 个人设置：发货地址 ===================== */
.settings-head { padding: 16px 18px 4px; }
.settings-head h3 { margin: 0 0 4px; font-size: 15px; }
.settings-head p { margin: 0; font-size: 12.5px; color: var(--text-3); }
.settings-body { padding: 8px 18px 18px; }
.saved-addr {
  margin-top: 18px; padding: 12px 14px; border-radius: 10px;
  background: var(--ok-soft); border: 1px solid #bfe6da;
}
.saved-title { font-size: 12.5px; color: var(--ok); font-weight: 600; margin-bottom: 4px; }
.saved-text { font-size: 14px; color: var(--text); line-height: 1.6; word-break: break-all; }

/* ---------- 个人设置内的轻量数据表（押金方式等） ---------- */
.mini-table-wrap {
  margin-top: 16px;
  max-height: 320px;          /* 条目多时可纵向滚动查看，不再被裁切 */
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.mini-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
}
.mini-table th, .mini-table td {
  padding: 8px 12px;
  text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.mini-table th {
  position: sticky; top: 0; z-index: 1;
  background: #fafbfd;
  color: var(--text-2);
  font-weight: 500;
  font-size: 12.5px;
}
.mini-table tbody tr:last-child td { border-bottom: 0; }
.mini-table .mini-idx { color: var(--text-3); }
.mini-table .muted { color: var(--text-3); }
.mini-table .link-btn.danger { color: var(--danger); }
.mini-table .row-actions { display: flex; gap: 10px; align-items: center; }
.mini-table .row-default {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--text-3); cursor: pointer;
}
.mini-table tr.is-default { background: var(--primary-soft); }
.mini-empty {
  margin-top: 16px; padding: 14px; text-align: center;
  font-size: 13px; color: var(--text-3);
  background: #fafbfd; border: 1px dashed var(--border-strong); border-radius: 10px;
}
#depositRate,
#depositPerCharge { max-width: 220px; }

/* ===================== 个人设置页布局优化 ===================== */
/* 左侧设置项导航 + 右侧面板区：单页内切换，不刷新 */
.settings-page .page { gap: 0; }
.settings-page-main { padding-top: 16px; }
.set-wrap {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.set-nav {
  flex: 0 0 190px;
  width: 190px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  position: sticky;
  top: 16px;
}
.set-nav-title {
  font-size: 11.5px; font-weight: 600; letter-spacing: .6px;
  color: var(--text-3); text-transform: uppercase;
  padding: 6px 10px 8px;
}
.set-nav-group {
  font-size: 11.5px; font-weight: 600; letter-spacing: .6px;
  color: var(--text-3);
  padding: 12px 10px 6px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.set-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
}
.set-item:hover { background: #f1f4f9; color: var(--text); }
.set-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.set-item .ico { flex: none; display: grid; place-items: center; width: 18px; }
.set-item .t { overflow: hidden; }

.set-panels {
  flex: 1;
  min-width: 0;
  /* 撑满可用高度，让内部面板自己滚动（父级 .set-wrap 是 align-items:flex-start，
     不显式 stretch 的话面板高度=内容高 → 超出视口被 .main-wrap 的 overflow:hidden 直接裁掉，无法下滑） */
  align-self: stretch;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* 当前面板撑满剩余高度，内容超出时在面板内出现纵向滚动条（可下滑查看） */
.set-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* ============ 闲管家 API（个人设置，按主体绑定凭证） ============ */
.xy-api-panel { display: flex; flex-direction: column; gap: 12px; }
.xy-api-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: #f7f9fc; border: 1px solid var(--border);
}
.xy-api-badge {
  font-weight: 600; padding: 2px 10px; border-radius: 999px; font-size: 12.5px;
  background: #f1f3f7; color: var(--text-2);
}
.xy-api-status.is-on .xy-api-badge { background: #e6f6f1; color: #12876f; }
.xy-api-status.is-off .xy-api-badge { background: #fdf5e3; color: #b7791f; }
.xy-api-meta { color: var(--text-3); font-size: 12.5px; }
.xy-api-hint {
  font-size: 12.5px; color: var(--text-3); line-height: 1.7;
  background: #fafbfd; border: 1px dashed var(--border); border-radius: 8px; padding: 9px 11px;
}
.xy-api-hint code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.xy-api-grid { display: flex; flex-direction: column; gap: 10px; }
.xy-api-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-2); }
.xy-api-field > span:first-child { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.xy-api-field input {
  width: 100%; box-sizing: border-box; max-width: 460px;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; background: #fff;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
}
.xy-api-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.xy-api-secret { display: flex; align-items: center; gap: 8px; }
.xy-api-secret input { flex: 1 1 auto; }
.xy-api-secret .btn { flex: none; }
.xy-api-ops { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.xy-api-msg { font-size: 12.5px; min-height: 18px; color: var(--text-3); }
.xy-api-msg.ok { color: #12876f; }
.xy-api-msg.bad { color: #e0483c; }

/* ============ 选项设置（颜色与默认项） ============ */
.opt-panel { display: flex; flex-direction: column; gap: 18px; }
.opt-block {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff;
}
.opt-block-title {
  padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--text);
  background: #f7f9fc; border-bottom: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  user-select: none; transition: background .15s;
}
.opt-block-title:hover { background: #eef2f7; }
.opt-block-title:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.opt-block-caret {
  font-size: 12px; color: var(--text-3); transition: transform .2s ease;
  display: inline-block; line-height: 1;
}
/* 折叠态：隐藏 rows，caret 旋转 */
.opt-block.collapsed .opt-rows { display: none; }
.opt-block.collapsed .opt-block-caret { transform: rotate(-90deg); }
/* 折叠时也去掉底部 border（更紧凑） */
.opt-block.collapsed .opt-block-title { border-bottom-color: transparent; }
.opt-rows { padding: 6px 8px; }
.opt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px;
}
.opt-row:hover { background: #f6f8fb; }
.opt-pill {
  min-width: 88px; text-align: center; padding: 4px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.4;
  background: #eef1f5; color: var(--text-2); border: 1px dashed #cdd5e0;
}
.opt-pill.has { border-style: solid; border-color: transparent; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.opt-acts { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.opt-star, .opt-palette {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  width: 34px; height: 32px; cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-3);
  transition: background .15s, color .15s, border-color .15s;
}
.opt-star:hover { color: #eab308; border-color: #eab308; }
.opt-star.on { color: #fff; background: #eab308; border-color: #eab308; }
.opt-palette:hover { color: var(--primary); border-color: var(--primary); }
.opt-empty { padding: 12px 14px; font-size: 13px; }

/* 删除按钮（×）：默认中性灰，hover 变红 */
.opt-del {
  border: 1px solid transparent; background: transparent; border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-3);
  transition: background .15s, color .15s, border-color .15s;
}
.opt-del:hover { color: #dc2626; background: #fef2f2; border-color: #fecaca; }

/* 押金方式增删提示 */
.opt-deposit-tip { padding: 6px 10px 4px; font-size: 12px; }

/* 新增选项输入条 */
.opt-add-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 10px; border-top: 1px dashed #e5e7eb; margin-top: 4px;
}
.opt-add-input {
  flex: 1 1 auto; min-width: 0;
  height: 34px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.opt-add-input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.opt-add-btn {
  flex: 0 0 auto; height: 34px; padding: 0 14px; font-size: 13px;
  border: 1px solid var(--primary); background: var(--primary); color: #fff;
  border-radius: 8px; cursor: pointer; font-weight: 600;
  transition: background .15s, border-color .15s;
}
.opt-add-btn:hover { background: #2563eb; border-color: #2563eb; }

/* 订单列表里的选项彩色标签（覆盖通用 .tag 默认配色） */
.tag.opt-tag { border: none; font-weight: 600; }

/* 编辑弹窗：选项字段 select 旁的颜色点 */
.opt-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  margin-left: 8px; vertical-align: middle; background: transparent; visibility: hidden;
  border: 1px solid rgba(0,0,0,.12);
}

/* 下拉候选里的颜色小圆点（combo / 选项下拉） */
.combo-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 7px; vertical-align: middle; border: 1px solid rgba(0,0,0,.12);
}

/* 编辑弹窗：选项字段自定义下拉（下拉内每个选项显示彩色胶囊，原生 <select> 无法给 <option> 上色） */
.opt-select { position: relative; display: inline-block; width: 100%; }
.opt-select-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 6px 10px; cursor: pointer;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text-1); text-align: left;
}
.opt-select-trigger:hover { border-color: var(--primary); }
.opt-select.open .opt-select-trigger { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.opt-sel-pill {
  width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid rgba(0,0,0,.12); background: transparent;
}
.opt-sel-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-sel-caret { color: var(--text-3); font-size: 12px; flex: 0 0 auto; }
.opt-select-pop {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16); padding: 6px; max-height: 264px; overflow: auto;
}
.opt-select-pop[hidden] { display: none; }
.opt-select-list { display: flex; flex-direction: column; gap: 4px; }
.opt-opt { padding: 2px 4px; border-radius: 8px; cursor: pointer; }
.opt-opt:hover { background: #f3f6fb; }
.opt-opt .opt-pill { display: block; width: 100%; box-sizing: border-box; text-align: center; }

/* 取色器弹层 */
.opt-pop {
  position: fixed; z-index: 4000; width: 236px; max-width: calc(100vw - 16px); padding: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.opt-pop[hidden] { display: none; }
.opt-pop-sw { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 10px; }
.opt-sw {
  width: 100%; aspect-ratio: 1 / 1; border: none; border-radius: 6px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.opt-sw:hover { transform: scale(1.08); }
.opt-pop-row { display: flex; align-items: center; gap: 8px; }
.opt-color { width: 34px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.opt-hex {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.opt-reset {
  height: 30px; padding: 0 10px; font-size: 12.5px; border: 1px solid var(--border);
  background: #f7f9fc; border-radius: 6px; cursor: pointer; color: var(--text-2);
}
.opt-reset:hover { background: #eef1f5; }
/* 账号表格里密码列 / 状态列 */
.mini-table .pwd-cell { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.mini-table .tag {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok);
}
.mini-table .tag.off { background: #f1f3f7; color: var(--text-3); }
/* 超级管理员标签（主账号列表首行）与整行标识 */
.mini-table .tag.super { background: var(--warn-soft); color: var(--warn); margin-left: 6px; }
.mini-table tr.is-super { background: #fffdf6; }
.mini-table tr.is-super.is-self { background: var(--primary-soft); }
.mini-table tr.is-self { background: var(--primary-soft); }

/* 子账号进入个人设置时看到的「我的账号」信息卡 */
.set-self-card {
  padding: 14px 16px; border-radius: 10px;
  background: #fafbfd; border: 1px solid var(--border);
  margin-bottom: 14px;
}
.set-self-card .row { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.9; }
.set-self-card .k { flex: none; width: 90px; color: var(--text-3); }
.set-self-card .v { color: var(--text); }

/* 子账号进入个人设置：只保留「我的账号」自助入口，其余设置面板不显示 */
body.is-sub-account .set-item[data-set-tab="address"],
body.is-sub-account .set-item[data-set-tab="express"],
body.is-sub-account .set-item[data-set-tab="deposit"],
body.is-sub-account .set-panel[data-set-view="address"],
body.is-sub-account .set-panel[data-set-view="express"],
body.is-sub-account .set-panel[data-set-view="deposit"] { display: none !important; }

@media (max-width: 900px) {
  .set-wrap { flex-direction: column; }
  .set-nav { position: static; width: 100%; flex: none; }
  .set-panels { width: 100%; }
}

/* 押金方式面板：与上一面板明确留白，内容区不贴边 */
.deposit-panel { margin-top: 2px; }
.deposit-panel .settings-body { padding-top: 12px; }
/* 折扣输入较窄，避免在宽列里被拉得过长 */
#expressDiscount { max-width: 220px; }

/* ===================== 订单表单：复合面板整行铺开 ===================== */
/* 「设备维修记录」复合框需要横向空间，独占整行更易用 */
.field.span-2 .repair-panel,
.field.span-2 .device-repairs-panel,
.field.span-2 .tenant-orders-panel { width: 100%; }

/* ===================== 闲鱼订单页 ===================== */
/* 顶部面板：绑定状态条 + 工具条同处一个 panel，压缩纵向占用 */
.xy-panel {
  padding: 10px 14px 0;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.xy-panel .toolbar { margin-top: 8px; }
.xy-panel .table-wrap { flex: 1; min-height: 0; }

/* 绑定状态条：单行紧凑（状态点 + 标题 + 说明 + 计数），不换行撑高 */
.xy-bind {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 24px; line-height: 1.5;
}
.xy-bind-dot {
  flex: none; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
}
.xy-bind.ok .xy-bind-dot { background: #16a34a; }
.xy-bind.warn .xy-bind-dot { background: #d97706; }
.xy-bind.err .xy-bind-dot { background: #dc2626; }
.xy-bind strong { font-size: 13px; font-weight: 650; white-space: nowrap; }
.xy-bind-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.xy-bind-body {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 12px;
  font-size: 12.5px; color: var(--text-3);
}
.xy-bind-body .kv { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.xy-bind-body .kv b { font-weight: 600; color: var(--text-2); }
.xy-shop-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 600;
}

/* 同步状态文字（工具条右侧，按钮左边） */
.xy-syncinfo { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }

/* 提示条（未绑定 / 同步失败） */
.xy-hint {
  margin: 8px 0 0;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  background: #fff8e6; border: 1px solid #f4dfae; color: #8a6100;
}
.xy-hint.err { background: #fdeceb; border-color: #f6c9c6; color: #b42318; }
.xy-hint code {
  background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px;
  font-size: 12px;
}

.xy-empty { padding: 46px 0; text-align: center; color: var(--text-3); font-size: 13.5px; }
.xy-empty p { margin: 0; }

/* ---------- 分页 ---------- */
.xy-pagination { padding: 10px 0 14px; display: flex; justify-content: center; }
.xy-page-bar {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border);
}
.xy-page-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
.xy-page-info { font-size: 13px; color: var(--text-2); }
.xy-page-info b { color: var(--text); }

/* ---------- 操作日志（个人设置） ---------- */
.oplog-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
}
.oplog-bar select,
.oplog-bar input[type="text"],
.oplog-bar input[type="date"] {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 13px;
}
.oplog-bar input[type="text"] { min-width: 180px; }
.oplog-bar .btn { height: 32px; }
.oplog-sep { font-size: 13px; color: var(--text-3); }

/* ---------- 列表单元格 ---------- */
.xy-center { text-align: center; }
/* 订单号等长文本：省略号截断，title 里给全文 */
.xy-ellip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xy-order-no { font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* 关联状态：本系统尚未做订单关联，恒显示「未关联」黄标签 */
.xy-link-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #fdf5e3; color: #b7791f;   /* 默认（未关联）黄色 warn 配色 */
  cursor: pointer; user-select: none;
  transition: filter .15s ease, box-shadow .15s ease, transform .05s ease;
}
.xy-link-tag:hover { filter: brightness(.97); box-shadow: 0 0 0 1px rgba(0,0,0,.05); }
.xy-link-tag:active { transform: translateY(1px); }
.xy-link-tag:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.xy-link-tag.linked { background: #e6f6f1; color: #12876f; }   /* 已关联订单登记：绿色成功态 */
.xy-link-tag.unlinked { background: #fdf5e3; color: #b7791f; }

/* 商品列：缩略图 + 标题（标题截断） */
.xy-goods { display: flex; align-items: center; gap: 8px; min-width: 0; }
.xy-goods-txt { min-width: 0; }
.xy-goods-qty { font-size: 11.5px; color: var(--text-3); }

/* 商品图放大后相应拉高行高，让图片上下留白协调 */
#xyTable tbody tr, #xyTable tbody td { height: 64px; }
#xyTable tbody td { vertical-align: middle; }

/* ---------- 关联状态弹窗（页内，不跳转；窗口保持在闲鱼订单页） ---------- */
.xy-modal-mask {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(15, 20, 30, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.xy-modal-mask[hidden] { display: none; }
.xy-modal {
  width: 460px; max-width: 100%; max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 20, 30, .28);
  display: flex; flex-direction: column;
}
.xy-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.xy-modal-head strong { font-size: 15px; }
.xy-modal-x {
  border: none; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--text-3); padding: 0 4px;
}
.xy-modal-x:hover { color: var(--text); }
/* 大号弹窗：内嵌「订单登记表单」iframe，铺满可用区域 */
.xy-modal-lg { width: 1120px; max-width: 96vw; height: 90vh; max-height: 90vh; overflow: hidden; }
.xy-modal-frame { position: relative; flex: 1 1 auto; min-height: 0; background: #f7f9fc; }
.xy-modal-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.xy-modal-loading {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13.5px; background: #fff;
}
.xy-modal-loading[hidden] { display: none; }
.xy-thumb {
  flex: none; width: 48px; height: 48px; border-radius: 7px;
  object-fit: cover; background: #f1f4f9;
  border: 1px solid var(--border);
}
.xy-thumb.is-ph {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
}

/* 收货人：姓名 + 电话两行 */
.xy-recv { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.xy-recv .n { font-weight: 600; }
.xy-recv .m { font-size: 11.5px; color: var(--text-3); }

/* 金额列：右对齐等宽数字 */
#xyTable td.num { font-variant-numeric: tabular-nums; }

/* 状态徽标：颜色由 data-tone 决定（成功/进行中/警告/中性） */
.xy-tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #f1f4f9; color: var(--text-2);
}
.xy-tag[data-tone="ok"]   { background: #e6f6f1; color: #12876f; }
.xy-tag[data-tone="info"] { background: var(--primary-soft); color: var(--primary); }
.xy-tag[data-tone="warn"] { background: #fdf5e3; color: #b7791f; }
.xy-tag[data-tone="err"]  { background: #fdeceb; color: #b42318; }

/* 表头排序（与订单登记 / 设备管理同款交互：可点列高亮 + 箭头） */
#xyTable thead th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#xyTable thead th.sortable:hover { color: var(--primary); }
#xyTable thead th.sort-asc,
#xyTable thead th.sort-desc { color: var(--primary); }

/* 同步按钮转圈（请求进行中） */
#xySyncBtn.loading svg { animation: xy-spin .9s linear infinite; }
@keyframes xy-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .xy-syncinfo { display: none; }
}
/* ==========================================================================
 * 设备页 · 订单联动（租客胶囊 / 订单详情弹窗）
 * ========================================================================== */
.tenant-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.tenant-chip {
  display: inline-block;
  padding: 1px 7px;
  font-size: 12px;
  line-height: 18px;
  color: #185fa5;
  background: #eaf1ff;
  border: 1px solid #c7dbff;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.tenant-chip:hover { background: #d6e6ff; border-color: #9dc0ff; }
.rec-count { margin-right: 5px; color: #6b7280; font-size: 12px; }

/* 列表单元格里的紧凑租客摘要（累计出租记录 / 现租用租客）：
   台账行高固定 46px，所以这里**强制单行**——旧实现把全部胶囊塞进 flex-wrap:wrap 的
   .tenant-chips，记录一多就折行、整行被撑高（用户报障）。
   规则：次数 + 前 2 位租客 + 「+K」徽标；完整名单在悬停 title 里，点「+K」弹窗看全部。 */
.rec-cell { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.rec-cell .rec-count { flex: none; margin-right: 2px; }
.rec-cell .tenant-chip { flex: none; }
.chip-rest { background: #f1f3f7; border-color: #dde2ea; color: #4b5563; }
.chip-rest:hover { background: #e7ebf2; border-color: #ccd4e0; }
/* 兜底（防回归）：表格单元格里的租客胶囊一律不换行 */
.data-table td .tenant-chips { flex-wrap: nowrap; }
.tenant-panel .tenant-chips > .tenant-chip { flex: none; }

/* 编辑弹窗内的租客数据框（现租用租客 / 累计出租记录）：只读展示 + 可展开查看更多租客 */
.tenant-panel {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 38px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
}
.tenant-panel .tenant-chips { max-width: 100%; }
/* 租客名较长时（长中文名 / 英文名）也不允许溢出数据框：胶囊自身省略号 */
.tenant-panel .tenant-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tenant-panel .muted { font-size: 12.5px; }
.tenant-panel .rec-count { font-size: 12.5px; }
.chips-more {
  padding: 2px 9px; font-size: 12px; line-height: 18px;
  color: var(--primary); background: #eef4ff;
  border: 1px solid #d5e3ff; border-radius: 999px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.chips-more:hover { background: #dfeaff; border-color: #b9d2ff; }

/* 全部租客弹窗（编辑弹窗里「查看全部 N 位租客」/ 台账里点「+K」的目标）：
   单独弹窗 + 内部滚动，避免就地展开把数据框撑破、租客名溢出 */
.tenant-list-mask { z-index: 1210; }
.tenant-list-modal { max-width: 460px; width: 92vw; }
.tenant-list-modal .modal-body { max-height: 56vh; overflow: auto; }
.tl-meta { margin-bottom: 8px; font-size: 12.5px; color: var(--text-3); }
.tl-list { display: flex; flex-direction: column; gap: 6px; }
.tl-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
}
.tl-row .tenant-chip { flex: none; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.tl-count { flex: none; font-size: 12px; color: var(--text-2); }
.tl-last {
  margin-left: auto; min-width: 0; font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tl-empty { padding: 20px 0; text-align: center; color: var(--text-3); font-size: 13px; }

/* ==========================================================================
 * 订单登记弹窗 · 同租客订单记录（子记录，只读汇总）
 * 以「租客」为主记录，归拢其名下其它订单：汇总条 + 明细表（可滚动、行可点开详情）
 * ========================================================================== */
.tenant-orders-panel { margin-top: 2px; }
.to-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  margin-bottom: 6px; font-size: 12.5px; color: var(--text-2);
}
.to-meta b { color: var(--text); }
.to-active { color: #b7791f; }
.to-add {
  margin-left: auto; padding: 2px 10px; font-size: 12px; line-height: 18px;
  color: var(--primary); background: #eef4ff;
  border: 1px solid #d5e3ff; border-radius: 999px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.to-add:hover { background: #dfeaff; border-color: #b9d2ff; }
.to-add[disabled] { opacity: .45; cursor: not-allowed; }
.to-add[disabled]:hover { background: #eef4ff; border-color: #d5e3ff; }
.to-empty { display: flex; align-items: center; gap: 12px; min-height: 34px; }
.to-empty .to-add { margin-left: 0; }
.to-wrap {
  max-height: 260px; overflow: auto;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.tenant-orders-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tenant-orders-table th,
.tenant-orders-table td {
  padding: 6px 9px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap;
}
.tenant-orders-table thead th {
  background: #f5f7fb; color: var(--text-2); font-weight: 600;
  position: sticky; top: 0; z-index: 1;
}
.tenant-orders-table tbody tr:last-child td { border-bottom: none; }
.tenant-orders-table tbody tr { cursor: pointer; }
.tenant-orders-table tbody tr:hover { background: #f3f7ff; }
.tenant-orders-table .to-no { font-weight: 600; color: var(--primary); }
.tenant-orders-table .to-date { color: var(--text-2); }
.tenant-orders-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.to-pill {
  display: inline-block; padding: 1px 7px; font-size: 11.5px; line-height: 17px;
  border-radius: 10px; background: #eef1f5; color: var(--text-2); white-space: nowrap;
}

.device-order-mask { z-index: 1200; }
.device-order-modal { max-width: 560px; width: 92vw; }
.device-order-modal .modal-body { max-height: 62vh; overflow: auto; }
.device-order-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.device-order-table th,
.device-order-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  text-align: left;
  vertical-align: top;
}
.device-order-table th {
  width: 96px;
  color: #6b7280;
  font-weight: 400;
  white-space: nowrap;
}
.device-order-table td { color: #1f2328; word-break: break-all; }


/* ===================== 智能登记（订单弹窗顶部） ===================== */
.si-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px; padding: 9px 12px;
  background: #f5f8ff; border: 1px solid #dbe6fb; border-radius: 8px;
}
.si-bar-txt { flex: 1 1 220px; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.si-bar-txt b { font-size: 13px; color: var(--primary); }
.si-bar-txt span { font-size: 12.5px; color: var(--text-3); }
.si-modal { width: 640px; }
.si-steps { margin-bottom: 10px; }
.si-step { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); margin-bottom: 7px; }
.si-step-no {
  flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff;
  font-size: 11px; display: grid; place-items: center;
}
.si-plat-box { display: flex; gap: 8px; flex-wrap: wrap; }
.si-plat {
  padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 16px; background: #fff;
  font-size: 13px; color: var(--text-2); cursor: pointer;
}
.si-plat.active { border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 600; }
.si-text { width: 100%; min-height: 160px; resize: vertical; font-size: 12.5px; line-height: 1.6; }
.si-preview {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #fafbfd; margin-top: 6px;
}
.si-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.si-table th, .si-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.si-table th { width: 100px; color: var(--text-3); font-weight: 400; white-space: nowrap; }
.si-table td { color: var(--text); word-break: break-all; }
.si-table tr:last-child th, .si-table tr:last-child td { border-bottom: none; }
.si-empty { padding: 14px; text-align: center; font-size: 13px; color: var(--text-3); }

/* ===================== 搜索高亮 + 切换（不隐藏行） ===================== */
/* ⚠️ 整行不高亮：仅命中的单元格用 #1456f0 蓝色框标记（不挤压布局，用 outline） */
td.cell-hit {
  outline: 1.5px solid rgba(20, 86, 240, 0.45);
  outline-offset: -2px;
}
/* 当前切换到的命中单元格：更醒目的蓝色实心框 + 浅蓝底，并自动定位到视野中央 */
td.cell-hit-cur {
  outline: 2px solid #1456f0;
  outline-offset: -2px;
  background: rgba(20, 86, 240, 0.10);
}
/* 关键字片段：蓝色高亮，与框呼应 */
mark.search-mark { background: rgba(20, 86, 240, 0.18); color: #1456f0; border-radius: 2px; padding: 0 1px; }
mark.search-mark-cur { background: rgba(20, 86, 240, 0.30); color: #1456f0; }
/* 命中「当前未显示的列」：行首给出字段名标签（避免有计数却看不到高亮在哪） */
.hit-field-tag {
  display: inline-block; margin-left: 6px; vertical-align: middle;
  font-size: 11px; line-height: 1.5; padding: 0 6px; border-radius: 8px;
  color: #1456f0; background: rgba(20, 86, 240, 0.10);
  border: 1px solid rgba(20, 86, 240, 0.35); white-space: nowrap;
}
/* 命中全在未显示列时：整行标记当前项（没有单元格可框） */
tr.row-hit-cur > td { background: rgba(20, 86, 240, 0.07); }
tr.row-hidden-hit > td:first-child { box-shadow: inset 2px 0 0 #1456f0; }
/* 搜索切换控件里的「命中字段」提示 */
.search-nav-field {
  font-size: 12px; color: var(--text-3); max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 搜索切换控件：搜索框右侧 ‹ 当前/总数 › */
.search-nav {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 8px; padding: 2px 6px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 12.5px; color: var(--text-2); white-space: nowrap; user-select: none;
}
.search-nav[hidden] { display: none; }
.search-nav-btn {
  width: 22px; height: 22px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; background: #f1f4f9; color: var(--text);
  cursor: pointer; font-size: 15px; font-weight: 700;
}
.search-nav-btn:hover { background: var(--primary-soft); color: var(--primary); }
.search-nav-btn:active { transform: translateY(1px); }
.search-nav-count { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.search-nav-count b { color: var(--primary); font-weight: 700; }
/* 搜索控件两种形态：常规（‹ 1/N › + 命中字段名）/ 筛选内无匹配时的提示。
   ⚠️ 两个 span 都是 flex 子项，用 [hidden] 显式关掉（否则 display:inline-flex 会盖过 hidden）。 */
.search-nav-main { display: inline-flex; align-items: center; gap: 4px; }
.search-nav-main[hidden] { display: none; }
.search-nav-more { display: inline-flex; align-items: center; gap: 8px; }
.search-nav-more[hidden] { display: none; }
.search-nav-more-text { color: var(--warn-text, #b7791f); }
.search-nav-btn-text {
  border: 1px solid #d5e3ff; border-radius: 999px; background: #eef4ff;
  padding: 2px 9px; font-size: 12px; line-height: 18px; color: var(--primary); cursor: pointer;
}
.search-nav-btn-text:hover { background: #dfeaff; border-color: #b9d2ff; }

/* ============ 老板座舱仪表盘 ============ */
/* 顶栏右侧操作区（更新时间 / 刷新 / 账号胶囊）：整组靠右；
   .auth-user 自带 margin-left:auto，挂进本容器时必须清掉，否则两处 auto 会把本组顶到顶栏中间 */
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-right .auth-user { margin-left: 0; }
.cockpit-updated { font-size: 12px; color: #9aa3af; }
.cockpit-loading, .cockpit-error { padding: 40px; text-align: center; color: #6b7280; }
.cockpit-error { color: #e0483c; background: #fdeceb; border-radius: 10px; margin: 12px 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card { background: #fff; border: 1px solid #eef1f5; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(17,24,39,.04); }
.kpi-label { font-size: 13px; color: #6b7280; }
.kpi-value { font-size: 28px; font-weight: 700; color: #1f2937; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: #9aa3af; }
.kpi-blue .kpi-value { color: #2563eb; }
.kpi-green .kpi-value { color: #12876f; }
.kpi-red .kpi-value { color: #e0483c; }
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.dash-card { background: #fff; border: 1px solid #eef1f5; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(17,24,39,.04); min-width: 0; }
.dash-card-head { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 10px; }
.dash-card-head small { font-weight: 400; color: #9aa3af; margin-left: 6px; font-size: 12px; }
.dash-card-body { min-height: 200px; }
.empty { color: #9aa3af; font-size: 13px; padding: 24px 0; text-align: center; }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 160px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }
.legend-row .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-name { color: #374151; }
.legend-val { margin-left: auto; color: #6b7280; font-variant-numeric: tabular-nums; }
.hbar-list { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 96px 1fr 84px; align-items: center; gap: 8px; font-size: 12px; }
.hbar-name { color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { background: #f1f4f9; border-radius: 6px; height: 12px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: linear-gradient(90deg,#3b7dd8,#2563eb); border-radius: 6px; }
.hbar-val { text-align: right; color: #1f2937; font-variant-numeric: tabular-nums; }
.device-health { margin-top: 14px; }
.dh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.dh-stat { text-align: center; background: #f8fafc; border-radius: 10px; padding: 10px; }
.dh-stat-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dh-stat-l { font-size: 12px; color: #6b7280; margin-top: 2px; }
.dh-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #f1f4f9; }
.dh-seg { display: block; height: 100%; }
.dh-note { font-size: 12px; color: #9aa3af; margin-top: 8px; }

/* ---------- 老板座舱 v2 ---------- */
/* 全宽卡片（单日趋势图占满一整行） */
.dash-card.span2 { grid-column: 1 / -1; }

/* 累计概览小条（位于主 KPI 下方） */
.kpi-strip { background: #fff; border: 1px solid #eef1f5; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(17,24,39,.04); }
.strip-title { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 10px; }
.strip-title small { font-weight: 400; color: #9aa3af; margin-left: 6px; }
.strip-list { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.strip-cell { display: flex; flex-direction: column; }
.strip-v { font-size: 15px; font-weight: 700; color: #374151; font-variant-numeric: tabular-nums; line-height: 1.2; }
.strip-l { font-size: 11px; color: #9aa3af; }

/* 图表头部区间切换按钮 */
.chart-range { float: right; display: inline-flex; gap: 6px; font-weight: 400; }
.range-btn { font-size: 12px; padding: 3px 10px; border: 1px solid #e3e8ef; background: #fff; color: #6b7280; border-radius: 999px; cursor: pointer; line-height: 1.5; }
.range-btn:hover { border-color: #2563eb; color: #2563eb; }
.range-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; }

/* 图例（堆叠柱下方） */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; }
.chart-legend .legend-row { font-size: 12px; }

/* 设备回血程度 */
.recovery-box { min-height: 200px; }
.rc-note { font-size: 12px; color: #9aa3af; margin-bottom: 8px; }
.rc-list { display: flex; flex-direction: column; gap: 7px; max-height: 320px; overflow-y: auto; padding-right: 4px; }
.rc-row { display: grid; grid-template-columns: 118px 1fr 74px; align-items: center; gap: 8px; font-size: 12px; }
.rc-name { color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-track { background: #f1f4f9; border-radius: 6px; height: 12px; overflow: hidden; }
.rc-fill { display: block; height: 100%; border-radius: 6px; }
.rc-val { text-align: right; color: #1f2937; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .dash-card.span2 { grid-column: auto; } }

/* 各设备型号横向对比表
   关键点：13 列 nowrap 的宽表必须让 .mt-wrap 有确定宽度、并给表格一个「固有宽度」，
   否则表格会去撑祖先容器，被 .page 的 overflow-x:hidden 直接裁掉、哪儿都滚不动。 */
.model-note {
  font-size: 12px; color: #9aa3af; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mt-hint { color: #2563eb; background: #eff6ff; border: 1px solid #dbeafe; border-radius: 999px; padding: 2px 10px; font-size: 11.5px; }
.model-table-card { max-width: 100%; min-width: 0; }
.model-table-card .dash-card-body { max-width: 100%; min-width: 0; overflow: hidden; }
.mt-wrap {
  width: 100%; max-width: 100%; min-width: 0;
  overflow: auto; overscroll-behavior-x: contain;
  max-height: min(70vh, 620px);
  border: 1px solid #eef1f5; border-radius: 8px; background: #fff;
  cursor: grab;
}
.mt-wrap.dragging { cursor: grabbing; }
/* 滚动条加粗：默认的细线在卡片里几乎看不见，用户会以为不能滚 */
.mt-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.mt-wrap::-webkit-scrollbar-track { background: #f1f4f9; border-radius: 6px; }
.mt-wrap::-webkit-scrollbar-thumb { background: #b9c5d8; border-radius: 6px; border: 2px solid #f1f4f9; }
.mt-wrap::-webkit-scrollbar-thumb:hover { background: #93a3bd; }
.mt-wrap::-webkit-scrollbar-corner { background: #f1f4f9; }
.mt-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; width: max-content; min-width: 100%; }
.mt-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f7f9fc; color: #4b5563; font-weight: 600;
  text-align: right; padding: 8px 12px;
  border-bottom: 1px solid #e6ebf3;
}
.mt-table td {
  padding: 8px 12px; text-align: right; color: #374151;
  border-bottom: 1px solid #f1f4f9;
  font-variant-numeric: tabular-nums;
}
.mt-table tbody tr:hover td { background: #f9fbff; }
.mt-table td.mt-model { text-align: left; font-weight: 600; color: #1f2937; }
/* 冻结首列：横向滚动时型号名始终可见 */
.mt-table th:first-child,
.mt-table td.mt-model { position: sticky; left: 0; border-right: 1px solid #e6ebf3; }
.mt-table th:first-child { z-index: 3; background: #f7f9fc; text-align: left; }
.mt-table td.mt-model { z-index: 1; background: #fff; }
.mt-table tbody tr:hover td.mt-model { background: #f9fbff; }
.cell-na { color: #c3cad6; }

/* 「出租数据」表：各项数据怎么算的（折叠说明区） */
.model-formula { margin: 0 0 10px; border: 1px solid #e6ebf2; border-radius: 8px; background: #fafbfd; font-size: 12.5px; }
.model-formula > summary { cursor: pointer; padding: 8px 12px; color: #2563eb; font-weight: 600; user-select: none; }
.model-formula[open] > summary { border-bottom: 1px solid #e6ebf2; }
.mf-body { padding: 10px 12px 12px; }
.mf-group { font-weight: 600; color: #374151; margin: 2px 0 6px; }
.mf-group + .mf-group { margin-top: 12px; }
.mf-list { margin: 0; padding-left: 18px; color: #4b5563; line-height: 1.75; }
.mf-list li { margin: 2px 0; }
.mf-list b { color: #1f2937; }
.mf-dl { display: grid; grid-template-columns: minmax(120px, 176px) 1fr; gap: 4px 12px; color: #4b5563; }
.mf-line { display: contents; }
.mf-t { color: #1f2937; font-weight: 600; }
.mf-f { line-height: 1.7; }
.mt-table th[title] { cursor: help; }
@media (max-width: 720px) {
  .mf-dl { grid-template-columns: 1fr; }
  .mf-t { margin-top: 6px; }
}

/* 老板座舱：内容较长，允许整页纵向滚动（避免被 .main-wrap 的 overflow:hidden 裁掉看不到下方） */
body.cockpit-page .page { display: block; overflow-y: auto; overflow-x: hidden; }

/* 订单饱和度：每个型号一个独立图窗，内容通常远超一屏 → 同样允许整页纵向滚动。
   ⚠️ 缺这条会「只能看到上面一部分、怎么滑都滑不动」：.main-wrap 是 height:100vh + overflow:hidden，
   .page 若没有 overflow，超出视口的部分就被直接裁掉且没有滚动条（横向滚动仍由 .chart-scroll 承担）。 */
body.saturation-page .page { display: block; overflow-y: auto; overflow-x: hidden; }

/* ============ 子账号「分成」录入 ============ */
.input-suffix { display: flex; align-items: center; gap: 6px; }
.input-suffix input { flex: 1; min-width: 0; }
.input-suffix .suffix { color: var(--text-2); font-size: 13px; flex: none; }
.hint-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; margin-left: 5px;
  background: #e8eef8; color: #4b6b9e; font-size: 10px; font-weight: 700;
  cursor: help; vertical-align: middle;
}
.mini-table .comm-cell { font-variant-numeric: tabular-nums; }

/* ============ 分成对账 ============ */
body.commission-page .page { display: block; overflow-y: auto; overflow-x: hidden; }

.comm-filter { margin-bottom: 16px; }
.comm-filter-row { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.cf-item { display: flex; flex-direction: column; gap: 6px; min-width: 168px; }
.cf-item label { font-size: 12px; color: #6b7280; }
.cf-item select, .cf-item input[type="date"] {
  height: 34px; padding: 0 10px; border: 1px solid #dfe5ee; border-radius: 8px;
  background: #fff; color: var(--text); font-size: 13px; min-width: 168px;
}
.cf-item select { max-width: 340px; }
.cf-item select:focus, .cf-item input[type="date"]:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.cf-actions { min-width: 0; }
.cf-btns { display: flex; gap: 8px; }

.comm-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e8edf4; }
.comm-quick .ql { font-size: 12px; color: #9aa3af; }
.comm-quick .cf-note { font-size: 12px; color: #9aa3af; margin-left: 4px; }

.comm-formula {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: #f7faff; border: 1px solid #e3ecfb; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: #374151;
}
.comm-formula .f-x { color: #6b7280; }
.comm-formula .f-eq { color: #9aa3af; }
.comm-formula .f-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.comm-formula .f-res { font-size: 18px; font-weight: 700; color: #2563eb; font-variant-numeric: tabular-nums; }
.comm-formula .f-note { margin-left: auto; font-size: 12px; color: #9aa3af; }

.comm-status-body { min-height: 0; }

.comm-table { width: 100%; }
.comm-table th.num, .comm-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.comm-table td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text-2); }
.comm-table .tag.st { border-radius: 999px; padding: 1px 9px; font-size: 12px; white-space: nowrap; }
.comm-table tbody tr:hover { background: #f8fbff; }

@media (max-width: 720px) {
  .cf-item { min-width: 100%; }
  .cf-item select, .cf-item input[type="date"] { min-width: 100%; }
  .comm-formula .f-note { margin-left: 0; }
}

/* ============ 设备租赁智能定价（/pricing）============ */
body.pricing-page .page { display: block; overflow-y: auto; overflow-x: hidden; }

/* 定价表：建议价两列要高亮，一眼能找到报价 */
.pc-table td.pc-first { color: #b45309; font-size: 13.5px; font-weight: 600; background: #fffaf0; }
.pc-table td.pc-suggest { color: #1d4ed8; font-size: 13.5px; font-weight: 600; background: #f5f8ff; }
.pc-table td.pc-first .pc-none,
.pc-table td.pc-suggest .pc-none { font-size: 12px; font-weight: 400; }
.pc-table td.pc-band { color: #6b7280; font-size: 12px; }
.pc-table tr.pc-sel td { background: #eef4ff; }
.pc-table tr.pc-sel td.pc-suggest { background: #e3edff; }
.pc-table tr.pc-sel td.pc-first { background: #fff4e0; }
.pc-table tr.pc-sel td.mt-model { box-shadow: inset 3px 0 0 #2563eb; }
/* 单元格里的第二行小字（型号合计 / 议价区间 / 寿命进度） */
.pc-band { display: block; font-style: normal; font-size: 11.5px; color: #9aa3af; font-weight: 400; margin-top: 2px; }
.pc-loss { color: #d64545; font-weight: 600; }

/* 成本参数设置表 */
.pc-param-table td { padding: 6px 8px; }
.pc-param-table th i.pc-unit { font-style: normal; font-weight: 400; color: #9aa3af; font-size: 11px; margin-left: 3px; }
.pc-input {
  width: 92px; padding: 5px 7px; border: 1px solid #dfe4ec; border-radius: 6px;
  font-size: 12.5px; color: #1f2937; font-variant-numeric: tabular-nums;
}
.pc-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.pc-flag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; font-weight: 500; color: #9aa3af; background: #f3f4f6;
}
.pc-flag.on { color: #12876f; background: #e7f5f1; }

/* 健康度徽章 */
.pc-health {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap; font-weight: 600;
}

/* 处置建议徽章 */
.pc-act {
  display: inline-block; border-radius: 6px; padding: 3px 8px; font-size: 12px;
  white-space: nowrap; font-weight: 600; cursor: help;
}
.pc-act.danger { color: #b91c1c; background: #fdecec; }
.pc-act.warn { color: #b45309; background: #fdf3e3; }
.pc-act.ok { color: #12876f; background: #e7f5f1; }
.pc-act.blue { color: #1d4ed8; background: #eaf1ff; }
.pc-act.gray { color: #6b7280; background: #f3f4f6; }

/* 调价幅度：涨红跌绿（中国大陆习惯） */
.delta { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.delta.up { color: #d64545; }
.delta.down { color: #12876f; }
.delta.flat { color: #9aa3af; font-weight: 500; }

/* 热度标签 */
.pc-heat {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap;
}
.pc-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* 阶梯报价明细 */
.pc-tier-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pc-tier-model { font-size: 15px; font-weight: 700; color: #1f2937; }
.pc-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pc-step {
  display: grid; grid-template-columns: 168px 108px 1fr; gap: 12px; align-items: baseline;
  padding: 8px 12px; background: #f7f9fc; border: 1px solid #eef1f5; border-radius: 8px; font-size: 12.5px;
}
.pc-step-t { color: #374151; font-weight: 600; }
.pc-step-v { color: #1d4ed8; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-step-d { color: #6b7280; line-height: 1.5; }
.pc-tier-group { font-size: 12.5px; color: #374151; font-weight: 600; margin-bottom: 8px; }
.pc-tier-table td.pc-total { color: #1f2937; font-weight: 600; }
.pc-tier-table th { text-align: right; }
.pc-tier-table th:first-child, .pc-tier-table td:first-child { text-align: left; }

@media (max-width: 720px) {
  .pc-step { grid-template-columns: 1fr; gap: 4px; }
}

/* ===================== 发货留存图片（订单登记 / 出入库管理 共用） ===================== */
.ship-images-panel, .si-wrap { display: flex; flex-direction: column; gap: 10px; }
.si-tools {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 11px; background: #fafbfd;
  border: 1px dashed var(--border-strong); border-radius: 8px;
}
.si-tools .si-file { flex: 1 1 220px; min-width: 0; font-size: 12.5px; padding: 5px 7px; max-width: 300px; }
.si-tools .si-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.si-tools .si-count b { color: var(--primary); font-size: 13px; }

/* 摄像头拍摄区（点「📷 摄像头拍摄」后展开，拍完可关闭） */
.si-cam { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: #0b0f14; border-radius: 8px; }
.si-cam[hidden] { display: none; }
.si-cam-video { width: 100%; max-height: 320px; background: #000; border-radius: 6px; }
.si-cam-ops { display: flex; align-items: center; gap: 8px; }

/* 缩略图画廊 */
.si-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.si-gallery.compact { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.si-item {
  position: relative; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; padding-bottom: 26px;
}
.si-thumb { background: #f3f4f6; }
.si-thumb img { width: 100%; height: 108px; object-fit: cover; display: block; cursor: zoom-in; }
.si-gallery.compact .si-thumb img { height: 88px; }
.si-info {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; background: #fafbfc; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3);
}
.si-info .si-src { flex: none; color: var(--text-2); }
.si-info .si-at { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 1;
  border: 0; border-radius: 50%; background: rgba(17, 24, 39, .55); color: #fff;
  font-size: 14px; cursor: pointer;
}
.si-del:hover { background: var(--danger); }
.si-empty { grid-column: 1 / -1; color: var(--text-3); font-size: 12.5px; padding: 6px 0; }

/* 出入库右栏：发货留存图片的归属订单选择行 */
.si-order-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.si-order-row[hidden] { display: none; }
.si-sel { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; background: #fff; }

/* 图片放大预览（发货留存图片 / 维修图片点击缩略图后弹出，点任意处关闭） */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; z-index: 9999; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }

/* ============ 订单登记 · 今日发货三级分组汇总（大表方案） ============ */
/* 一张大表 + 一份 colgroup + 一个 sticky thead（固定顶部）+ 一个 .sg-outer 水平滚动容器（底部一条滚动条）。
   所有分组标题用 table 里的伪行（colspan），不是独立 div。 */
.ship-groups {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  padding: 4px 2px 8px;
}
.ship-groups[hidden] { display: none; }
.ship-groups.listmode { flex: 0 0 auto; overflow: visible; padding-bottom: 0; display: block; }
.ship-groups.listmode .sg-bar { margin-bottom: 10px; position: static; }

.sg-bar {
  position: sticky; top: 0; z-index: 5; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
}
.sg-title { font-size: 15px; font-weight: 650; color: #111827; }
.sg-sum { font-size: 13px; color: var(--text-2); }
.sg-toggle { margin-left: auto; }

/* ============ 唯一水平滚动容器（底部一条滑块） ============ */
/* flex:1 占满分组汇总区剩余高度 → 滚动条稳定贴在分组汇总区底部。 */
.sg-outer { flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: visible; padding-bottom: 10px; }

/* ============ 大表 .sg-global ============ */
/* 一份 colgroup → 拖某列 col-resizer 所有订单行该列一起变宽（正确的表格行为）。 */
/* ✅ table-layout: fixed → 浏览器严格遵守 colgroup 指定的宽度：
     1. 拖 A 列宽 → 只有 A 列变，其他列不动（不重新分配宽度）
     2. 内容超出列宽时被 text-overflow 裁切，不会撑破列（min-width 生效）
     和主列表 .data-table 完全一致的列宽规则。 */
.sg-table { border-collapse: separate; border-spacing: 0; white-space: nowrap; font-size: 13px; table-layout: fixed; }
.sg-table.sg-global { background: #fff; border-radius: 8px; overflow: hidden; }
.sg-table th, .sg-table td {
  padding: 7px 10px; border-bottom: 1px solid #f1f3f5; border-right: 1px solid #e5e7eb; text-align: left;
  overflow: hidden; text-overflow: ellipsis;
}
/* 最右列（操作）右边去掉竖线 → 表格边缘干净 */
.sg-table th:last-child, .sg-table td:last-child { border-right: 0; }
/* ✅ 关键：thead sticky 固定顶部 → 每行数据都和顶部表头对齐 */
.sg-table thead { position: sticky; top: 0; z-index: 10; }
.sg-table th {
  position: relative;       /* col-resizer 绝对定位手柄钉住 */
  height: 44px;
  font-size: 12px; color: var(--text-3); font-weight: 600; background: #fafbfc;
  border-bottom: 1px solid #e5e7eb; white-space: nowrap;
  box-shadow: 0 1px 0 #e5e7eb;   /* 让 sticky 时和下面的行有清晰分隔 */
}
.sg-table td.num, .sg-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sg-table tbody tr:not(.sg-group-row):hover td { background: #f8fafd; }

/* ============ 分组标题伪行（三级差异化视觉） ============ */
.sg-group-row td { border-bottom: 1px solid #e5e7eb; padding: 6px 12px; cursor: pointer; }
.sg-group-row td.sg-group-cell { overflow: visible; text-overflow: clip; }
.sg-group-row td.sg-group-slot { background: #fafbfc; }
.sg-group-row .sg-caret { transition: transform .15s; }
.sg-group-row.collapsed .sg-caret { transform: rotate(-90deg); }
/* L1 状态 = 蓝色粗 */
.sg-group-row.sg-l1 td.sg-group-cell { background: #eef4ff; font-weight: 650; font-size: 13.5px; color: #1e3a8a; }
/* L2 型号 = 中灰 + 缩进一档 */
.sg-group-row.sg-l2 td.sg-group-cell { background: #f5f7fb; font-weight: 500; font-size: 13px; color: #374151; padding-left: 30px; }
/* L3 收货方式 = 浅灰虚线左边 + 再缩进一档 */
.sg-group-row.sg-l3 td.sg-group-cell { background: #fafbfc; font-size: 12.5px; color: #6b7280; font-weight: 500; padding-left: 50px; border-left: 3px dashed #e5e7eb; }

/* 层级标签 / 徽章 / 计数 */
.sg-caret { color: var(--text-3); font-size: 12px; margin-right: 4px; }
.sg-lv { font-size: 11px; color: var(--text-3); background: #eef1f5; border-radius: 4px; padding: 1px 6px; white-space: nowrap; margin-right: 6px; }
.sg-gcount { margin-left: auto; font-size: 12.5px; color: var(--text-2); }
.st-ship { font-size: 12px; padding: 2px 10px; border-radius: 12px; white-space: nowrap; margin-right: 6px; }
.sg-method { font-size: 13px; color: #374151; padding: 2px 10px; background: #eef1f5; border-radius: 12px; margin-right: 6px; }
.sg-model { font-size: 14px; font-weight: 650; color: #111827; margin-right: 10px; }

.sg-table th.sg-actions, .sg-table td.sg-actions { overflow: visible; text-align: right; }
.sg-table td.sg-actions .btn + .btn { margin-left: 6px; }

.sg-table td.cell-copy { cursor: pointer; color: #2563eb; }
.sg-table td.cell-copy:hover .cell-clip { text-decoration: underline; }
.sg-table td.cell-quick-edit { cursor: pointer; }
.sg-table td.cell-quick-edit:hover .cell-clip { background: #f0f5ff; border-radius: 3px; }
.sg-table .cell-clip { display: inline-block; padding: 2px 4px; border-radius: 3px; }
.sg-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 14px; }

/* ---------- 订单登记表单：按业务段落组织，减少横向扫读 ---------- */
#orderForm .form-section {
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
#orderForm .form-section h3 { margin-bottom: 5px; }
#orderForm .form-section-note {
  margin: 0 0 12px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}
#orderForm .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.order-date-flow {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #dbe5f2;
  border-radius: 9px;
  background: #f7faff;
}
.order-date-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.order-date-node {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.order-date-node span { color: var(--text-3); font-size: 11px; }
.order-date-node strong { color: var(--text); font-size: 13px; font-weight: 650; }
.order-date-arrow { color: #94a3b8; font-size: 14px; }
.order-date-warning {
  margin: 8px 0 0;
  color: #a34b08;
  font-size: 12px;
}
.order-date-flow.has-warning {
  border-color: #f2c078;
  background: #fff9ed;
}
.order-date-warning[hidden] { display: none; }
@media (max-width: 720px) {
  #orderForm .form-grid { grid-template-columns: minmax(0, 1fr); }
  #orderForm .form-section { padding: 12px; }
  .order-date-flow { padding: 9px; }
  .order-date-track { gap: 4px; }
  .order-date-node strong { font-size: 11.5px; }
  .order-date-arrow { font-size: 11px; }
}

/* ---------- 订单登记：折叠低频信息，并保持键盘可访问 ---------- */
#orderForm .form-section.is-collapsed > .form-grid,
#orderForm .form-section.is-collapsed > .form-section-note,
#orderForm .form-section.is-collapsed > .order-date-flow { display: none; }
#orderForm .form-section h3 { display: flex; align-items: center; }
#orderForm .form-section-toggle {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--primary);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
#orderForm .form-section-toggle:hover { background: #f4f7fd; }

/* ---------- 订单表格快捷编辑：点击后进入独立确认弹窗 ---------- */
td.cell-quick-edit { position: relative; cursor: pointer; }
td.cell-quick-edit:hover,
td.cell-quick-edit:focus { background: #eef5ff; outline: 2px solid #8bb8ff; outline-offset: -2px; }
td.cell-quick-edit .cell-clip { text-decoration: underline dotted; text-decoration-color: #9bb4d2; text-underline-offset: 3px; }
td.cell-quick-edit:hover .cell-clip { text-decoration-color: var(--primary); }
td.cell-quick-edit[data-quick-loading="1"] { opacity: .55; cursor: progress; }
.cell-copy-action {
  position: absolute; top: 2px; right: 2px; padding: 0 3px;
  border: 0; border-radius: 4px; background: rgba(255,255,255,.92);
  color: var(--text-3); font-size: 12px; cursor: copy; opacity: 0;
}
td.cell-quick-edit:hover .cell-copy-action,
td.cell-quick-edit:focus .cell-copy-action { opacity: 1; }
.quick-edit-note,
.quick-edit-summary {
  margin: 12px 0 0; padding: 9px 11px; border-radius: 8px;
  font-size: 12px; line-height: 1.5;
}
.quick-edit-note { color: #475569; background: #f5f7fa; }
.quick-edit-summary { color: #1d4ed8; background: #eff6ff; }
#orderForm.quick-edit-mode > :not(.form-section) { display: none !important; }
#orderForm.quick-edit-mode .field[hidden],
#orderForm.quick-edit-mode .form-section[hidden],
#orderForm.quick-edit-mode .form-section-toggle[hidden],
#orderForm.quick-edit-mode .order-date-flow[hidden] { display: none !important; }
@media (hover: none) {
  td.cell-quick-edit .cell-copy-action { opacity: .8; }
}
