/* ==========================================================================
   邮件手机端 · iOS 原生视觉层
   原则：白/浅灰分组、0.5px 内缩分隔线、字号+字重建立层级、品牌橙只做 tint
   所有类名与拆分前的 app.js 保持一致，只改视觉，不改结构契约
   ========================================================================== */

:root {
  --bg: #f2f2f7;            /* 分组背景（iOS systemGroupedBackground） */
  --card: #ffffff;          /* 列表/卡片 */
  --text: #1c1c1e;
  --muted: #8e8e93;
  --line: rgba(60, 60, 67, 0.18);   /* 分隔线统一走这个，绘制时再压到 0.5px */
  --accent: #f35420;        /* 品牌橙，只用于 tint：主按钮、未读、选中 */
  --accent-soft: #fdeee8;   /* 橙色 12% 等效的浅底 */
  --danger: #d70015;
  --danger-soft: rgba(215, 0, 21, 0.1);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --track: rgba(118, 118, 128, 0.16);   /* 分段控件轨道 */
  --bar-bg: rgba(255, 255, 255, 0.94);
  --radius: 12px;
  --radius-pill: 999px;
  --nav-h: 44px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #8e8e93;
    --line: rgba(84, 84, 88, 0.6);
    --accent: #ff6b3d;
    --accent-soft: #3a2419;
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.16);
    --nav-bg: rgba(28, 28, 30, 0.86);
    --track: rgba(118, 118, 128, 0.24);
    --bar-bg: rgba(28, 28, 30, 0.94);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* 纵向挡下拉刷新，横向挡浏览器的"横滑前进/后退" */
  overscroll-behavior: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ── 顶栏 ─────────────────────────────────────────────────────────────
   普通页：‹ 返回 / 标题 / 操作，44px，半透明毛玻璃 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--nav-h);
  padding: env(safe-area-inset-top, 0px) 12px 0;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 0.5px solid var(--line);
}
.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 0;
}
.topbar-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 6px 2px;
}
.actions { display: flex; gap: 8px; align-items: center; }

/* 还原 iOS 的点击反馈：按下时整块变浅灰，而不是缩放 */
a.row:active, button:active, .msg-head:active { background: var(--bg); }

/* ── 按钮 ─────────────────────────────────────────────────────────────
   默认是"描边 pill"（次级），.primary 是品牌色实心（主操作） */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 0.5px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.wide {
  display: flex;
  width: calc(100% - 24px);
  margin: 12px;
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 15px;
}
.btn:disabled { opacity: 0.45; }

/* 顶栏里的"返回"：没有边框，就是一行 tint 色文字 + 箭头感 */
.topbar .btn:not(.primary) {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  padding: 6px 2px;
  font-size: 16px;
}
.topbar .actions .btn { padding: 6px 10px; }

/* 幽灵按钮：刷新 / 退出这类低频文字操作 */
.btn-ghost {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 4px;
  cursor: pointer;
  min-height: 32px;
}

.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 收件箱的大标题与分段行 ──────────────────────────────────────────
   大标题 28/700（用户指定），下面接"收件箱 / 草稿"分段控件 */
.topbar.large {
  display: block;
  padding-top: calc(env(safe-area-inset-top, 0px) + 6px);
  padding-bottom: 10px;
  border-bottom: 0;
  background: var(--nav-bg);
}
.large-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.large-title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  /* 右侧多了搜索图标之后，长标题（收件箱 · Sales）要能省略而不是换行 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.large-title .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.title-block { min-width: 0; }

/* 右上角的低频操作入口：44px 触摸区，视觉上只有一个 ⋯ */
.nav-more {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}

/* ── 搜索入口 ────────────────────────────────────────────────────────
   和 ⋯ 并排放在大标题右侧：两个 44px 触摸区，视觉上各只有一枚图标。
   放大镜用圆 + 斜柄画（字符 ⌕ 在不同系统字体里粗细和基线都不一样） */
.nav-actions { display: flex; align-items: center; flex: none; }
.nav-search {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.search-glyph {
  display: block;
  flex: none;
  width: 13px;
  height: 13px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.search-glyph::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -2.5px;
  width: 6px;
  height: 1.6px;
  border-radius: 1px;
  background: currentColor;
  transform: rotate(45deg);
}

/* ── 搜索态 ──────────────────────────────────────────────────────────
   标题行原地变成「搜索框 + 取消」，列表原地变结果；分段控件不出现 ——
   搜索跨所有分段，留着会让人以为"在未读里搜不到已读的邮件"是 bug */
.search-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}
.search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 8px 0 10px;
  border-radius: 10px;
  background: var(--track);
  color: var(--muted);
}
/* 16px：iOS 上输入框小于 16px 会在聚焦时把整页放大 */
.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  padding: 0;
  -webkit-appearance: none;
}
.search-input::placeholder { color: var(--muted); }
/* type=search 在桌面 Chrome/Safari 会带一个原生清除按钮，和自绘的 × 重影 */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.search-clear {
  flex: none;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--muted);
  color: var(--card);
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.search-clear[hidden] { display: none; }
.search-cancel {
  flex: none;
  min-width: 44px;
  height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 17px;
  cursor: pointer;
}
.search-sub {
  padding: 0 4px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  min-height: 18px;
}

/* 命中高亮：品牌色的浅底，不加粗 —— 加粗会和"未读"的字重信号打架 */
mark {
  background: var(--accent-soft);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.empty-hint { font-size: 13px; margin-top: 6px; }
.empty-link {
  margin-top: 12px;
  padding: 8px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
}



/* iOS 分段控件：灰色轨道 + 白色滑动块 */
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--track);
  max-width: 100%;
}
.seg button {
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 6px 16px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button.active {
  background: var(--card);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}
/* 五段铺满整行：等宽、字号压到 12.5，中文四个字也不会挤 */
.seg.wide {
  display: flex;
  width: 100%;
  margin: 10px 4px 0;
  box-sizing: border-box;
}
.seg.wide button {
  flex: 1;
  padding: 7px 2px;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 状态后面的数字：小一号、灰一点，选中那段跟正文同色。
   不做彩色圆形角标——iOS 里那种数字属于 App 图标，界面内只是"这一段有几条" */
.seg-count {
  margin-left: 3px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.seg button.active .seg-count { color: var(--text); font-weight: 600; }

/* ── 渠道筛选 ──────────────────────────────────────────────────────── */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px 10px;
  background: transparent;
  border-bottom: 0;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 0.5px solid var(--line);
  font-size: 13px;
  background: var(--card);
  cursor: pointer;
}
/* 选中的账号用 tint 而不是实心橙：整屏只保留一个橙色主操作（右下角写邮件） */
.chip.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}
/* 标签胶囊后面跟的条数：数字用灰字，选中时跟着变淡的 tint，不抢标签本身 */
.chip-count {
  margin-left: 5px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.chip.active .chip-count { color: inherit; opacity: 0.7; }
/* 没有话术的标签压淡（排序也会把它们沉到最后）：13 个标签时一眼就能跳过空的。
   注意不能叫 .empty —— 那个类是全站空状态（带 56px 内边距），会把胶囊撑成圆形 */
.chip.is-empty { color: var(--muted); opacity: 0.65; }

/* ── 列表 ────────────────────────────────────────────────────────────
   一行一个对象，分隔线左缩进（对齐文字，不切整行），不用卡片边框 */
.list {
  background: var(--card);
  border-top: 0.5px solid var(--line);
}
.list:empty { display: none; }

.row {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  align-items: flex-start;
}
.row::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  transform: scaleY(0.5);
  transform-origin: bottom;
}
/* 最后一行不再画分隔线。行现在包在 .swipe 里，所以按"列表的最后一项"判断，
   直接写 .row:last-child 会命中每一行（每行都是自己那个 wrapper 的唯一子元素） */
.list > :last-child .row::after,
.list > .row:last-child::after { display: none; }

/* ── 左滑动作 ────────────────────────────────────────────────────────
   用原生横向滚动 + scroll-snap 做"跟手 + 吸附"：位移在合成器上跑，主线程不参与，
   跟手动逐帧写 transform 相比不会掉帧。第一列是整行内容，第二列是动作面板 */
.swipe {
  display: grid;
  grid-template-columns: 100% max-content;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  /* 横滑到头别带着这一行一起弹，多出来的滚动交给页面继续处理 */
  overscroll-behavior-x: chain;
  scrollbar-width: none;
  background: var(--track);
}
.swipe::-webkit-scrollbar { display: none; }
/* 横竖两个方向的仲裁都交回浏览器：这里再写 touch-action 反而会把横滑抢走 */
.swipe > .row { scroll-snap-align: start; }
.swipe.pending { opacity: 0.45; pointer-events: none; }
.swipe-actions {
  display: flex;
  /* 面板吸附到"打开"位置：松手停下时按钮刚好整块露出来，不会停在半截 */
  scroll-snap-align: end;
}
.swipe-action {
  width: 76px;
  border: 0;
  padding: 0;
  background: var(--muted);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
/* 归档/恢复是"整理"，用中性灰；删除才用红色。一行里不要两个抢眼的颜色 */
.swipe-action.restore { background: var(--accent); }
.swipe-action.danger { background: var(--danger); }

/* 未读只用一个小圆点表示（iOS 邮件的做法）：已读时保留占位，
   保证每一行名称的起始位置完全对齐，不会因为有没有点而左右跳 */
.unread-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.unread-dot.off { background: transparent; }

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--track);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

/* 左侧只放头像：状态交给「未读点 + 字重」，一行只留一个信号 */
.row-lead {
  flex: none;
  padding-top: 1px;
}

/* 未读整行加一点品牌色：头像换成浅橙底 + 橙色首字母 */
.row.unread .avatar { background: var(--accent-soft); color: var(--accent); }

.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; gap: 6px; align-items: center; }
.row-top .name { flex: 1 1 auto; min-width: 0; }
.row-top .time { margin-left: auto; }
.name { font-weight: 500; font-size: 15px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 第一行是「发件方 → 收件方」：客户名用正文色、邮箱名（Linden / Sales / Service）用灰字，
   一眼就能区分"跟谁在聊"和"从哪个邮箱出的" */
.name-customer { color: var(--text); font-weight: 500; }
.name-mailbox { color: var(--muted); font-weight: 400; }
.name-arrow { color: var(--muted); font-weight: 400; margin: 0 3px; }
/* 已读靠常规字重、未读靠半粗：名称和主题的粗细差是扫读时最省力的信号 */
.row.unread .name,
.row.unread .name-customer { font-weight: 600; }
.time { flex: none; color: var(--muted); font-size: 13px; }
.subject {
  font-size: 15px;
  margin-top: 2px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subject.strong { font-weight: 600; }
.preview {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
/* 次要信息是一行灰字，不用彩色胶囊：一行只保留一个视觉信号 */
.meta {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.meta-item { color: var(--muted); }
.meta-item.accent { color: var(--accent); font-weight: 600; }
.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--track);
  color: var(--muted);
  border: 0;
  font-weight: 500;
}

.tag.accent { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
/* 待跟进来源里只有"单据卡点"值得打断视线：系统警示色的浅底 + 红字，
   其余来源保持和"有草稿""已回复"同一层级的灰，不做彩虹标签 */
.tag.warn { background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* 空列表：一句话说明状态，不放插画和按钮 */
.empty {
  text-align: center;
  padding: 56px 24px 24px;
  color: var(--muted);
}
.empty-title { font-size: 15px; }

/* 写邮件：右下角 56px 圆形主操作，落在拇指热区，跟着 safe-area 走 */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  z-index: 6;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.16s ease-out, opacity 0.16s ease-out;
}
.fab:active { transform: scale(0.94); opacity: 0.9; }
.fab .icon { display: flex; }
.fab .icon svg { display: block; }
.fab-spacer { height: calc(env(safe-area-inset-bottom, 0px) + 92px); }

.center { text-align: center; padding: 28px 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.error { color: var(--danger); padding: 8px 0; font-size: 14px; min-height: 1.4em; }
.errorbox {
  margin: 12px 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.errorbox .btn { margin-top: 8px; }

/* ── 线程页的分段控件与吸底工具栏 ─────────────────────────────────────
   分段控件占满整行，四个标签等宽，和 iOS Mail 的位置一致 */
.thread-seg {
  padding: 8px 16px 10px;
  background: var(--card);
  border-bottom: 0.5px solid var(--line);
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--nav-h));
  z-index: 4;
}
.thread-seg .seg { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; }
.thread-seg .seg button { padding: 6px 2px; text-align: center; }

/* 附件分段底部的"查看邮件中的图片"入口：次要动作，不抢主列表的注意力 */
.seg-link {
  display: block;
  width: calc(100% - 32px);
  margin: 6px 16px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.seg-link:active { background: var(--track); }

.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 0.5px solid var(--line);
}
.actionbar .btn { min-height: 44px; font-size: 15px; }
.actionbar .btn.primary { flex: 1; font-weight: 600; }

/* ── 线程 ────────────────────────────────────────────────────────────
   一封一张白卡，圆角 12，靠背景分离而不是描边 */
.thread { padding: 10px 0 104px; }

.msg {
  margin: 10px 12px 0;
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.msg + .msg { margin-top: 10px; }

.msg-head { padding: 12px 14px; cursor: pointer; }
.msg-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
/* 第一行「发件方 → 收件方」可能很长：让它自己吃掉剩余宽度并省略，时间永远靠右 */
.msg-line .msg-who { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }

.msg-body { padding: 0 14px 14px; }
.msg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 2px; }
.msg-actions .btn { min-height: 30px; padding: 5px 12px; font-size: 13px; }

/* 翻译引擎：这是「设置」不是「动作」，所以故意长得和 .btn 不一样
   （圆角徽标 + 引擎名 + 箭头，点开底部面板选） */
.engine-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 3px 9px 3px 3px;
  border: 0.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.engine-pick:disabled { opacity: 0.5; }
.engine-badge {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.engine-name { font-weight: 500; }
.engine-caret { font-size: 10px; opacity: 0.75; margin-left: 1px; }

/* 翻译面板：只有两项引擎 + 底部动作，高度跟着内容走（要压过 .sheet 的 68vh） */
.sheet.engine-sheet { height: auto; max-height: 70vh; }
/* 面板底部的主操作：常驻，不跟着内容滚 */
.sheet-foot {
  flex: none;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 0.5px solid var(--line);
}
.sheet-foot .btn {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
}
.engine-row { align-items: center; cursor: pointer; }
.engine-row.active { background: var(--accent-soft); }
.engine-row .engine-badge { width: 26px; height: 26px; font-size: 12px; }
.engine-check { flex: none; color: var(--accent); font-weight: 700; font-size: 15px; }

/* 翻译结果：橙色左线是唯一的强调，其余交给底色 */
.msg-trans {
  margin: 0 14px 14px;
  padding: 10px 12px;
  background: var(--bg);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-trans.pending { border-left-color: var(--muted); color: var(--muted); }
.msg-trans.err { background: var(--card); border-left-color: var(--danger); color: var(--danger); }

/* 正文 iframe 自己会铺满，这里的底色只在加载完成前露一下，别用白色闪 */
.body-frame {
  display: block;
  width: 100%;
  height: 120px;
  border: 0;
  border-radius: 8px;
  background: var(--card);
}
/* 显示图片在 .msg-actions 那一行里，靠 gap 排版，自己不带外边距 */
.imgbtn { margin: 0; }

/* ── 登录 ────────────────────────────────────────────────────────────── */
.login {
  max-width: 360px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 72px) 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.login p { margin: 0; }
.login input {
  font: inherit;
  font-size: 17px;
  min-height: 48px;
  padding: 12px 14px;
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
}
.login .btn { min-height: 48px; padding: 12px; text-align: center; border-radius: var(--radius); font-size: 17px; }

.sentinel { height: 1px; }

/* 归档 / 发送这类"一闪而过"的结果：挂在 sticky 顶栏（线程页是分段栏）里面，
   用 top: 100% 贴住它的下沿。这样列表滚到哪儿提示都停在同一位置，
   不会像放在文档流里那样"要往上滑才看得到" */
.flash {
  position: absolute;
  top: calc(100% + 8px);
  left: 12px;
  right: 12px;
  z-index: 1;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  /* 只是个通知：不挡住下面的行，不然会挡住刚滑出来的那一行 */
  pointer-events: none;
  animation: flash-in 0.18s ease-out;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; }
}

/* ── 写邮件 ────────────────────────────────────────────────────────────
   卡片式分组：收件人一组、正文一张、附件/签名/引用各一张，最下面是丢弃草稿。
   字段行 48px，分隔线内缩，标签灰、内容黑，和系统表单一致 */
/* 底部留出命令条的高度（46px），最后一张卡不会压在命令条底下 */
.compose { padding: 4px 0 calc(env(safe-area-inset-bottom, 0px) + 78px); }

/* 通用分组卡（附件/签名/引用用的是同一套视觉的 .section） */
.card {
  margin: 12px;
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.card > .field { padding: 0 14px; }
.card > .field:last-child { border-bottom: 0; }
.field > input::placeholder { color: var(--muted); }

/* 收件人：一个地址一个可删的胶囊，输入框只负责"再加一个"。
   字段高度跟着胶囊行数长，不再把所有地址挤在一行里。
   注意这几条要写在 .field 之后（.field 会覆盖 align-items / padding） */
.tokens {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
/* 输入框独占一行：胶囊各占整行宽度，长地址才能完整折行显示，不会被挤成三行 */
.tokens > input {
  flex: 1 0 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 7px 0;
}
.tokens > input::placeholder { color: var(--muted); font-size: 14px; }
.token {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 4px 3px 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 0.5px solid var(--line);
  font-size: 14px;
  line-height: 1.35;
}
/* 长地址允许折行：收件人不能被截断到看不出是谁 */
.token-text { min-width: 0; overflow-wrap: anywhere; }
.token-x {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

/* 草稿自动保存状态：顶栏下面一条细线，不夹在正文和附件之间 */
.draft-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 18px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--bg);
}
.draft-status:empty { display: none; }
.draft-status.error { color: var(--danger); background: var(--danger-soft); }
/* 左边的状态文字可以省略，右边的"保存草稿"按钮不能被挤走 */
.draft-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draft-status .btn { min-height: 26px; padding: 2px 10px; font-size: 12.5px; flex: 0 0 auto; }

/* 说明类提示（草稿格式整理等） */
.notice {
  margin: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* 顶栏：返回是 tint 文字，发送是品牌色 pill */
.compose-bar .btn.back { padding-left: 2px; font-size: 16px; }
.compose-bar .btn.primary { min-height: 32px; padding: 6px 16px; font-size: 15px; }

/* 底部操作卡：整行可点，危险操作走红色 */
.action-card { margin-top: 20px; }
.action-row {
  width: 100%;
  min-height: 50px;
  border: 0;
  background: none;
  font-size: 16px;
  color: var(--accent);
  cursor: pointer;
}
.action-row.danger { color: var(--danger); }

/* ⋯ 菜单：底部 sheet 里的动作列表，左对齐 + 内缩分隔线（复用 .action-row，不再造一套） */
.sheet-list .action-row {
  justify-content: flex-start;
  padding: 0 16px;
  color: var(--text);
}
.sheet-list .action-row.danger { color: var(--danger); }
.sheet-list .action-row + .action-row { border-top: 0.5px solid var(--line); }

/* ⋯ 面板改用 iOS 的分组列表（inset grouped）：写邮件 / 邮箱 / 位置 / 时间范围各成一组，
   组标题 + 白卡；退出登录单独一张卡。平铺成一行行会把五种不同的事混在一起 */
/* 选择器写成 .sheet.action-sheet.grouped：后面 .sheet.action-sheet 的 height:auto
   同权重且更靠后，不加这一级会被它盖掉 */
.sheet.action-sheet.grouped {
  --grouped-chrome: 60px; /* 抓手 11 + 标题行 48 + 一条 0.5px 分隔线 */
  background: var(--bg);
  /* 固定高度：内容区一定在面板内部滚，不依赖浏览器对 height:auto + max-height 的
     flex 收缩（iOS WebKit 上那条路走不通：面板不滚、手势漏给背后的页面）。
     一两行的面板不走这个类，仍是内容高度。
     高度取屏幕 85%：⋯ 面板里现在有写邮件/邮箱/位置/跟进/时间范围五组，
     62% 时最后一组（退出登录）经常刚好被裁在屏幕外 */
  height: 85vh;
  height: 85dvh;
  max-height: 85dvh;
}
/* 内容区自己带确定高度：不靠父级 flex 收缩。有明确高度 + overflow:auto
   才在任何浏览器上都保证"是个能滚的容器" */
.sheet.action-sheet.grouped .grouped-body {
  flex: 0 0 auto;
  height: calc(85vh - var(--grouped-chrome));
  height: calc(85dvh - var(--grouped-chrome));
  max-height: calc(85dvh - var(--grouped-chrome));
}
/* 同样是分组卡片，但只有几行（天数选择器）：借底色，不占整屏 */
.sheet.action-sheet.grouped-lite {
  background: var(--bg);
  height: auto;
  max-height: 70dvh;
}
/* 天数选择器里的自定义输入：一行「输入 + 使用」，和上面的选项卡片同宽 */
.days-custom {
  align-items: center;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
}
.days-custom-input {
  background: var(--bg);
  border: 0.5px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  flex: 1;
  font: inherit;
  font-size: 16px;
  height: 40px;
  min-width: 0;
  padding: 0 10px;
}
/* 数字输入框的上下小箭头在手机上没用还占宽度 */
.days-custom-input::-webkit-outer-spin-button,
.days-custom-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.days-custom-apply {
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  flex: none;
  font-size: 15px;
  font-weight: 600;
  height: 40px;
  padding: 0 16px;
}
.grouped-body {
  min-height: 0;
  overflow-y: auto;
  /* 滚到头也不把页面带着一起滚（链条滚动） */
  overscroll-behavior: contain;
  /* 固定在 fixed 浮层里的滚动区，老 iOS 上要靠这个才肯滚 */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 2px 0 calc(env(safe-area-inset-bottom, 0px) + 20px);
}
.group-section + .group-section { margin-top: 22px; }
.grouped-body > .group-section:first-child { margin-top: 12px; }
/* 组标题：13px 灰字，和卡片左对齐但略缩进（iOS 分组列表的写法） */
.group-caption { padding: 0 28px 7px; font-size: 13px; color: var(--muted); }
.group-card {
  margin: 0 16px;
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.group-card .action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
.group-card .action-row + .action-row { border-top: 0.5px solid var(--line); }
.group-card .action-row:active { background: var(--track); }
.group-card .action-row.accent { color: var(--accent); }
/* 当前视图下不生效的设置（待跟进/老客回访里的时间范围）：变灰、点不动，
   组标题会补一句"当前视图不受限制"，避免用户以为点了没反应 */
.group-card .action-row.disabled { color: var(--muted); pointer-events: none; }
/* 危险操作靠左单独一行，不跟在别的选项后面 */
.group-card .action-row.danger { color: var(--danger); justify-content: flex-start; }
.group-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-value { flex: none; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.group-card .check { flex: none; color: var(--accent); font-weight: 600; }

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  background: var(--card);
  border-bottom: 0.5px solid var(--line);
}
.field > label {
  flex: none;
  min-width: 44px;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
}
.field > input, .field > select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 0;
  outline: none;
  min-height: 48px;
}
.field > .btn { flex: none; }

/* 收件人胶囊行：写在 .field 之后才压得住它的 align-items / padding。
   允许换行：抄送/密送开关在窄屏上会掉到下一行，不再和胶囊抢同一行的宽度 */
.field.field-chips {
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 6px 14px;
}
.field-chips > label { padding-top: 10px; }
.field-chips > .btn { align-self: flex-start; margin-top: 4px; }
/* 抄送/密送开关：单独占一行靠右。以前和收件人胶囊挤在同一行，
   长地址会把这一行顶出卡片（手机上看起来就是被裁掉），现在互不影响 */
.ccbcc-toggle {
  flex: 1 0 100%;
  align-self: stretch;
  margin: 0;
  border: 0;
  background: none;
  padding: 0 0 2px;
  font-size: 13px;
  color: var(--accent);
  text-align: right;
  cursor: pointer;
  white-space: nowrap;
}
.ccbcc-toggle.open { color: var(--muted); }
/* 主题和其它字段同一档（16px 常规）：之前单独放大加粗，和收件人行放在一起不协调 */
.static {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 分组卡片：无描边，圆角 12 */
.section {
  margin: 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--line);
}
.section-head > select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  padding: 8px 10px;
}
/* 卡片里最后一行不画分隔线（话术编辑页的"标题"卡只有一行输入） */
.section > .field:last-child { border-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; }
.pad { padding: 0 16px 12px; }
.warn { color: var(--danger); font-size: 13px; padding: 6px 16px; }
.compose .error { padding: 8px 16px; }

/* 附件行 */
.attach-list { padding: 0 16px 4px; }
.attach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-top: 0.5px solid var(--line);
}
.attach-item:first-child { border-top: 0; }
.attach-main { flex: 1; min-width: 0; }
.attach-name { font-size: 15px; }
.attach-meta { font-size: 12.5px; color: var(--muted); }
.attach-item.error .attach-meta { color: var(--danger); }
.attach-hint { font-size: 12.5px; color: var(--muted); padding: 0 16px 12px; }
/* 一行里有三个按钮（预览 / 重命名 / 移除），手机上要压小一点才不挤掉文件名 */
.attach-item .actions { gap: 6px; }
.attach-item .actions .btn { min-height: 30px; padding: 5px 10px; font-size: 13px; }
/* 改名：直接把文件名变成输入框，不弹 window.prompt（部分壳里不弹） */
.attach-item.renaming .attach-main { padding-right: 2px; }
.attach-rename-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  padding: 4px 10px;
  border: 0.5px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

/* ── 富文本编辑器 ──────────────────────────────────────────────────── */
.editor { background: var(--card); }
.editor-card { overflow: visible; }
.editor-card .editor { border-radius: var(--radius); }
.editor-card .editor-area { border-radius: var(--radius); }

/* 命令条：固定在底部（键盘上方）。
   放顶部会被长按选中文本时系统弹出的"拷贝/粘贴"浮层整块盖住——
   那个浮层是系统画的，压不住也挪不开，只能让命令条躲到它不会出现的位置 */
.cmdbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--kb-inset, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 10px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 0.5px solid var(--line);
  /* 只在编辑某个输入框时才滑上来：平时打开页面不该常驻在底部挡着正文 */
  transform: translateY(calc(100% + 12px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease, visibility 0.18s ease;
}
.cmdbar.is-visible { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
.cmdbar-label {
  flex: none;
  width: 26px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.1;
  text-align: center;
}
.cmdbar-actions {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.cmdbar-sep { flex: none; width: 0.5px; height: 16px; background: var(--line); margin: 0 4px; }
/* 视觉 36，命中区 46：图标小、可点范围大，单手误触少 */
.cmd-btn {
  flex: 1 1 auto;
  min-width: 36px;
  height: 46px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.cmd-btn:active { background: var(--track); }
/* 激活态用浅底 + 品牌色，不用橙色实心块（高频按钮一直实色太抢眼） */
.cmd-btn.active { background: var(--accent-soft); color: var(--accent); }
.cmd-bold { font-weight: 700; }
/* 撤销/重做用箭头，两行中文在 40px 宽的格子里排不开 */
.cmd-history-btn { font-size: 20px; line-height: 1; }
.cmd-size-btn { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.cmd-aa { font-size: 14px; letter-spacing: -0.02em; }
.cmd-size { font-size: 10px; color: var(--muted); margin-top: 4px; }
.cmd-btn.active .cmd-size { color: var(--accent); }
.cmd-color-btn { display: inline-flex; align-items: center; justify-content: center; }
.cmd-dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: inset 0 0 0 0.5px var(--line);
}
.cmd-link-btn, .cmd-more-btn { font-size: 14px; }

/* 桌面/平板：没有系统选区浮层这回事，命令条浮在底部中间就够了，不必占满整宽 */
@media (min-width: 720px) and (pointer: fine) {
  .cmdbar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 20px;
    width: 460px;
    border: 0.5px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  }
  /* 桌面上是水平居中，显示状态不能把 translateX 一起清掉 */
  .cmdbar.is-visible { transform: translateX(-50%); }
}
/* 窄屏（iPhone SE）：主行的"链接"让位给更多面板里的入口，避免挤成一团 */
@media (max-width: 359px) {
  .cmd-link-btn { display: none; }
}

/* ── 面板里的格式控件 ─────────────────────────────────────────────── */
.fmt-row { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; }
.fmt-row .check { color: var(--accent); font-size: 15px; }
.color-track { display: flex; gap: 12px; padding: 14px 16px; overflow-x: auto; }
.color-swatch {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 0.5px var(--line);
}
.color-swatch.active { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--accent); }
/* 字号：两行方块，面板只有一截，不会盖住正文里选中的那段文字 */
.size-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 12px 16px; }
/* 面板外壳：上面一排标签页（分段控件），下面是当前页的内容。
   面板高度跟着当前页走，内容多的时候在内部滚动 */
.panel-wrap { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.panel-tabs {
  display: flex;
  flex: none;
  gap: 2px;
  /* 上边留出和标题栏（格式/关闭）的距离：原来只隔 2px，两排像挤在一起 */
  margin: 16px 16px 10px;
  padding: 2px;
  border-radius: 9px;
  background: var(--track);
}
.panel-tab {
  flex: 1 1 auto;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.panel-tab.active { background: var(--card); font-weight: 600; box-shadow: 0 0.5px 2px rgba(0, 0, 0, 0.18); }
/* 字号方块和格式方块是同一套形状：分组底色 + 选中时品牌橙的淡底。
   不描边、不加阴影——靠底色和字重区分状态，和系统里的分段/标签一致 */
.size-chip {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.size-chip.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
/* 更多页：格式栏式的方块网格（粗体/斜体/下划线/列表…），可反复点、状态常显 */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
}
.panel-tile {
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.panel-tile.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sheet-form { padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px); }
.sheet-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
/* 假输入框（contenteditable）：形状沿用 .sheet-input，但系统不会把它认成表单字段，
   也就不会弹"密码建议"。
   不用 flex 垂直居中：空内容时里面没有文字盒子，光标会落到容器最左边、把占位提示挤到贴边，
   改用行高居中后光标就稳稳停在内边距之后（43 = 44 高减去上下 0.5px 边框） */
.fake-field {
  line-height: 43px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  outline: none;
}
.fake-field:empty::before { content: attr(data-placeholder); color: var(--muted); }
/* 一聚焦就把占位提示收掉：光标和提示文字本来就会重叠在同一格上，隐掉提示更干净 */
.fake-field.is-editing::before { content: none; }
.sheet-error { min-height: 18px; padding-top: 6px; font-size: 13px; color: var(--danger); }
.sheet-primary {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.sheet-note { padding: 8px 16px 0; font-size: 13px; color: var(--muted); }
/* 正文/签名写作区跟着主题走：之前写死 #fff + #1c1c1e，
   夜间模式下这两块就是整屏最刺眼的白斑（输入框和签名各一块） */
.editor-area {
  position: relative;
  padding: 12px 16px;
  outline: none;
  line-height: 1.62;
  overflow-wrap: anywhere;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
  min-height: 160px;
}
/* 收键盘后系统会把选中的高亮抹掉，面板里就看不出改的是哪段字：
   编辑器自己叠一层浮层（按选区矩形铺色块），不动正文 DOM，也不进导出的 HTML */
.mm-hl-layer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.mm-hl-block { position: absolute; border-radius: 3px; background: rgba(0, 122, 255, 0.28); }
.editor-area[data-empty="true"]::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 16px;
  top: 12px;
  color: var(--muted);
  pointer-events: none;
}
.editor-area a { color: #c2400f; text-decoration: underline; }
.editor-area blockquote {
  margin: 8px 0 8px 4px;
  padding-left: 12px;
  border-left: 3px solid #d1d1d6;
  color: #636366;
}
/* 深底上原来的暗橙和灰字对比不够，提亮一档 */
@media (prefers-color-scheme: dark) {
  .editor-area a { color: #ff8b60; }
  .editor-area blockquote { border-left-color: #48484a; color: #a1a1a6; }
}
.editor-area p, .editor-area div { margin: 0; }
.editor-area img { max-width: 100%; height: auto; }
.editor-area ul, .editor-area ol { margin: 6px 0; padding-left: 24px; }

/* ── 素材库 ──────────────────────────────────────────────────────────── */
.lib-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 0.5px solid var(--line);
}
.lib-bar input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  min-height: 38px;
  padding: 8px 12px;
  border: 0.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
/* 搜索框右边的"＋"：方形小按钮，点开是新建文件夹 / 上传 / 从邮件导入 */
.lib-bar .btn.add {
  flex: none;
  min-width: 38px;
  min-height: 38px;
  padding: 0 10px;
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
}
/* tab 条：全部素材 / 未分类 / 已分类，和收件箱的分段控件同一套视觉 */
.lib-tabs {
  padding: 10px 16px 0;
  background: var(--card);
}
.lib-tabs .seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.lib-tabs .seg button { padding: 6px 2px; text-align: center; }
/* 列表：一行一个文件，点整行看大图，点右侧圆圈选中 */
.lib-grid { display: flex; flex-direction: column; padding: 10px 12px 12px; }
/* 文件夹也铺在同一套列表里（行样式和文件行共用 .lib-cell），只是排在上面 */
.lib-folder-rows { display: flex; flex-direction: column; padding: 10px 12px 0; }
.lib-folder-rows:empty { display: none; }
/* 左滑：第一列是整行，第二列是动作区，靠原生横向滚动 + scroll-snap 把按钮吸出来。
   位移在合成器上跑、主线程不参与，跟手和回弹都不会一格一格地卡。
   底色要跟列表一致（透明行 + 页面底色），否则左滑按钮会透出来 */
.lib-swipe-row {
  display: grid;
  grid-template-columns: 100% max-content;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  /* 横滑到头别带着这一行一起弹，多出来的滚动交给页面继续处理 */
  overscroll-behavior-x: chain;
  scrollbar-width: none;
  background: var(--bg);
}
.lib-swipe-row::-webkit-scrollbar { display: none; }
/* 纵向滚动和横向的仲裁都交回浏览器，别在这里写 touch-action */
.lib-swipe-row > .lib-cell { scroll-snap-align: start; }
/* 动作做成圆角方块：图标在上、文字在下，颜色只做 tint。
   整块铺满的色条在浅灰列表里显得又重又糙，留出间距后和系统"邮件"的左滑动作一致 */
.lib-swipe-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 6px 10px 6px 0;
  /* 面板吸附到"打开"位置：松手停下时按钮刚好整块露出来，不会停在半截 */
  scroll-snap-align: end;
}
/* 用 min-width 而不是固定宽度：「重命名」三个字在系统字号放大时会把按钮撑成两行，
   所以让按钮跟着文字自己变宽，滑动的距离由 JS 量实际宽度算 */
.lib-swipe-action {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: 64px;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease;
}
.lib-swipe-glyph { display: flex; }
.lib-swipe-label { font-size: 12.5px; line-height: 1.1; letter-spacing: -0.01em; white-space: nowrap; }
/* 重命名是中性操作，用系统灰 tint，不去抢主色 */
.lib-swipe-action.neutral { background: var(--track); color: var(--text); }
.lib-swipe-action.danger { background: var(--danger-soft); color: var(--danger); }
.lib-swipe-action:active { transform: scale(0.94); }
/* 面包屑：固定一行，路径再长也只是在里面横滑，不会叠高度 */
.lib-folder-path {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.lib-folder-path::-webkit-scrollbar { display: none; }
.lib-crumb {
  flex: 0 0 auto;
  max-width: 40vw;
  padding: 2px 0;
  border: 0;
  background: none;
  font-size: 13px;
  line-height: 1.3;
  color: var(--accent);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
/* 当前所在这一层不可点，用正文色和上面的可点区分 */
.lib-crumb.current { color: var(--text); cursor: default; }
.lib-crumb-sep { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
/* 空文件夹占一行，和列表行同样的缩进 */
.lib-folder-empty {
  padding: 12px 2px;
  font-size: 15px;
  color: var(--muted);
}
/* 上传用的原生 file input 藏起来，由旁边的"上传"按钮触发 */
.lib-upload-input { display: none; }
/* "加载更多"：占满列表一整行 */
.lib-more {
  margin-top: 10px;
  width: 100%;
}
/* 导入模式下列表里只显示文件名（不改名，所以不是输入框） */
.lib-selected-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ── 新建/重命名文件夹用的输入 sheet ──────────────────────────────────
   壳体和客户资料/单据详情一致：grabber + 标题 + 输入框 + 底部主按钮 */
.sheet.name-sheet { height: auto; }
/* sheet 里的说明文字：一行灰字，不抢列表的注意力 */
.sheet-msg {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
/* 新建/改名用的输入框 */
.name-field { padding: 16px 16px 0; }
.name-field input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 11px 12px;
  border: 0.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.name-field input::placeholder { color: var(--muted); }
.name-note {
  padding: 8px 16px 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
/* sheet 标题栏右侧的"完成/取消"：主色文字，比默认灰字更像系统导航按钮 */
.btn-ghost.accent { color: var(--accent); font-weight: 600; }
/* 移动到文件夹：和外面素材库一样「一行一个文件夹、点进去下一层」，
   不再用缩进把整棵树摊平（深目录在手机上又乱又难读） */
/* 固定高度：进二级目录时这一层的文件夹条数会变，高度跟着变会让人点在别处 */
.sheet.folder-picker { height: 72vh; max-height: 72vh; }
.folder-picker .sheet-body { min-height: 0; }
.folder-picker-path { padding: 0 16px 8px; }
.folder-picker-list {
  display: flex;
  flex-direction: column;
  border-top: 0.5px solid var(--line);
}
/* 行沿用素材库的 .lib-cell（文件夹图标 + 名字 + 箭头），底色跟着 sheet 走 */
.folder-picker-list .lib-cell {
  background: transparent;
  padding-left: 16px;
  padding-right: 16px;
}
.folder-picker-list .lib-cell + .lib-cell { border-top: 0.5px solid var(--line); border-bottom: 0; }
.folder-picker-list .lib-cell:active { background: var(--bg); opacity: 1; }
.folder-picker-empty { padding: 16px; font-size: 13px; color: var(--muted); }
/* 底部按钮文案固定，兜一层防溢出（目录名再长也不会把按钮撑破） */
.folder-picker .sheet-foot .btn {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 12px;
  padding-right: 12px;
}
.lib-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  /* 右边多留 8px：选择圆圈别贴着屏幕边缘，单手拇指也更好够到 */
  padding: 10px 10px 10px 2px;
  border-bottom: 0.5px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* 横向滑动的方向仲裁交给浏览器（左滑是父层的横向滚动），再写 touch-action
     会把横滑抢走，行就只跟一下手指然后回弹 */
}
.lib-cell:last-child { border-bottom: 0; }
/* 左滑容器里行不是最后一个孩子（后面还有动作区），末行由容器判断 */
.lib-swipe-row:last-child > .lib-cell { border-bottom: 0; }
.lib-cell.selected { background: var(--accent-soft); }
.lib-cell.selected .lib-name { color: var(--accent); }
.lib-cell:active { opacity: 0.85; }
.lib-check {
  position: relative;
  flex: none;
  padding: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  line-height: 1;
}
/* 圆圈本身只有 22px，手指很难点中：外面套一圈 44px 的透明热区（iOS 最小可点尺寸），
   不用改结构，视觉上仍然是那个小圆圈 */
.lib-check::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
.lib-cell.selected .lib-check { background: var(--accent); border-color: var(--accent); }
/* 文件夹行的缩略图是浅橙底 + 主色描边文件夹，右侧换成进入箭头（没有选择圆圈） */
.lib-thumb.folder { background: var(--accent-soft); color: var(--accent); }
.lib-chev {
  flex: none;
  min-width: 9px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  text-align: right;
}
/* 左侧缩略图：和邮件附件行一个尺寸，图片铺满、其它类型给扩展名 */
.lib-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* 右侧两行：文件名 / 大小 · 创建日期 */
.lib-main { flex: 1; min-width: 0; }
.lib-name {
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-meta {
  margin-top: 1px;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-selected {
  margin: 12px;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
}
.lib-selected-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.lib-selected-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  padding: 8px 10px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}

/* ── 客户资料 ────────────────────────────────────────────────────────── */
.cust-body { padding-bottom: 104px; }
.cust-info { margin: 10px 16px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.cust-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 10px; }

.img-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 12px; }
.img-cell {
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
}
.img-thumb {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 6px;
}
/* 缩略图垫底用分组底色（透明 PNG 不会在深色列表里留一块白框） */
.img-thumb img { width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
.img-meta { padding: 8px 10px; font-size: 12.5px; }
.img-meta .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
}
.lightbox img { max-width: 100%; max-height: 78vh; object-fit: contain; background: #fff; border-radius: 8px; }
.lightbox .cap { color: #fff; font-size: 13px; margin-top: 12px; text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.lightbox .row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.lightbox .btn { background: rgba(255, 255, 255, 0.16); border-color: transparent; color: #fff; }
/* 预览里的"选择"是主操作，深色浮层上仍然用品牌色实心（其余按钮是半透明白） */
.lightbox .btn.primary { background: var(--accent); color: #fff; }
/* 移出素材库是破坏性操作，浮层是深色底，用浅红才看得清 */
.lightbox .btn.lib-remove { color: #ff8a80; }

/* ── 文件预览浮层（图片 / PDF / 视频 / 音频 / 文本共用） ──────────────
   和图片预览同一个 .lightbox，只是内容区要占满整屏：PDF 阅读器和播放器
   需要高度才能用，居中的小图布局不行 */
.lightbox-file {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  /* 几乎不透明：底下还压着邮件正文，透出来会显得脏 */
  background: #0b0b0c;
}
.preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
}
.preview-title {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
}
.preview-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
/* 只约束"直接放进内容区的图片/视频"；PDF 页图在 .pdf-viewer 里，宽度要跟缩放走 */
.preview-stage > img,
.preview-stage > video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}
/* PDF 页图：stage 用 block 而不是 flex —— flex item 的 min-content 会被图片的
   原始像素宽度撑开，导致「宽度 100%」失效、页面比屏幕还宽 */
.preview-stage.stage-pdf {
  display: block;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.pdf-viewer {
  box-sizing: border-box;
  width: 100%;
  padding: 8px;
}
/* 每页是服务端转好的 PNG：宽度按容器 100%（或缩放百分比），高度自适应 */
.pdf-page-img {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  margin: 0 0 8px;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.pdf-page-img.pdf-page-error { min-height: 160px; }
/* 图片预览那套 .lightbox img { max-width: 100% } 会把缩放按回屏幕宽，这里放开 */
.lightbox .pdf-page-img { max-width: none; max-height: none; border-radius: 0; }
.pdf-zoom { min-width: 44px; padding-left: 10px; padding-right: 10px; }
/* pdf.js 起不来时的兜底：交给 WebView 自己的 PDF 渲染 */
.preview-stage.stage-pdf-fallback {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}
.preview-stage .pdf-frame {
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: #fff;
  color-scheme: light;
}
.preview-stage.stage-pdf-fallback .preview-note { flex: none; padding: 8px 16px; font-size: 12px; }
.preview-stage audio { width: calc(100% - 28px); }
.preview-text {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  color: #1b1f24;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* 文本预览是整屏铺满的：夜间模式必须跟着变，否则一点开就一片白 */
@media (prefers-color-scheme: dark) {
  .preview-text { background: #1c1c1e; color: #e8e8ed; }
}
.preview-note {
  padding: 28px 20px;
  color: #fff;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  opacity: 0.86;
}
.preview-note .ext {
  display: block;
  margin-bottom: 10px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.preview-actions {
  display: flex;
  /* 素材库的按钮多（缩放 + 选择/移动/移出 + 下载），放不下要换行而不是挤出屏幕 */
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.preview-actions .btn { background: rgba(255, 255, 255, 0.16); border-color: transparent; color: #fff; }

.cust-card {
  margin: 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  padding: 14px 16px;
}
.cust-card-head { display: flex; justify-content: flex-start; align-items: flex-start; gap: 12px; }
.cust-title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.cust-text { margin-top: 6px; overflow-wrap: anywhere; font-size: 15px; }
.cust-side {
  border-top: 0.5px solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}
.cust-side-title { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.02em; }
.cust-fact { display: flex; gap: 12px; padding: 3px 0; }
.cust-fact-label { flex: none; width: 84px; font-size: 13px; color: var(--muted); }
.cust-fact-body { flex: 1; min-width: 0; }
.cust-list { margin: 2px 0; padding-left: 18px; font-size: 14px; overflow-wrap: anywhere; }
.cust-list.stale { color: var(--muted); text-decoration: line-through; }

/* AI 分析：模型/上次分析做成设置行，主操作单独整宽按钮，和别的页一致 */
.analysis-card { margin: 12px 12px 0; }
.analysis-card > .field { padding: 0 14px; }
.analysis-card > .field:last-child { border-bottom: 0; }
.analysis-field > label { min-width: 56px; }
.analysis-field > select { font-size: 15px; }
.analysis-value {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  padding: 12px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 补充说明：整宽多行输入，跟在状态卡里，和模型行一样左右留 14px */
.analysis-instruction {
  width: 100%;
  min-height: 64px;
  box-sizing: border-box;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  resize: vertical;
}
.analysis-instruction::placeholder { color: var(--muted); }

.analysis-progress-row { padding: 0 14px 12px; }
.analysis-progress { height: 3px; border-radius: 2px; background: var(--track); overflow: hidden; }
.analysis-progress > span { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.3s ease; }
.analysis-actions { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.analysis-actions .btn { min-height: 46px; border-radius: var(--radius); font-size: 16px; background: var(--card); }
.analysis-actions .btn.primary { background: var(--accent); font-weight: 600; }
.cust-draft-body {
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
}

.notice { margin: 12px; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; overflow-wrap: anywhere; }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice.error { background: var(--danger-soft); color: var(--danger); }

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 0;
  cursor: pointer;
}

.cust-attach {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--line);
  background: var(--card);
}
/* 邮件附件行：整块可点开/下载（附件由导入流程自动挂到对应客户，不需要额外的操作按钮） */
.cust-attach-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
/* 附件行整块可点，点开是本页浮层预览（不是链接下载） */
.cust-attach-link[role="button"] { cursor: pointer; }
.cust-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.cust-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* 图片缩略图点开是本页浮层预览（和「邮件图片」一致） */
.cust-thumb-zoom { cursor: zoom-in; }
/* 相关发票：一张卡两行——类型/单号/金额，状态/说明/日期，比原来三行松散堆叠紧凑 */
.inv-card {
  margin: 10px 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
}
.inv-line { display: flex; align-items: center; gap: 8px; }
.inv-type {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}
/* 生产单 / 物流是关联记录，不是单据本身，用灰底区分 */
.inv-type.sub { background: var(--track); color: var(--muted); }
.inv-number {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-amount { flex: none; font-size: 15px; font-weight: 600; }
.inv-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.inv-status {
  flex: none;
  max-width: 62%;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--track);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-status.done { background: rgba(52, 199, 89, 0.16); color: #1f8b3b; }
.inv-status.pending { background: rgba(255, 149, 0, 0.16); color: #a3590a; }
.inv-status.progress { background: rgba(0, 122, 255, 0.14); color: #0062cc; }
.inv-status.moving { background: var(--accent-soft); color: var(--accent); }
.inv-status.void { background: var(--danger-soft); color: var(--danger); }
.inv-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-date { flex: none; margin-left: auto; }
/* 整卡可点：右侧箭头提示"点开有详情" */
.inv-caret { flex: none; margin-left: 2px; color: var(--muted); font-size: 17px; line-height: 1; }

/* ── 挑发票（写邮件时的底部面板） ────────────────────────────────────
   整张卡点一下就是勾选：手机上不给小方块 checkbox 单独留点按区域，
   手指本来就点不准 14px 的方块 */
.inv-pick {
  border: 1px solid transparent;
  cursor: pointer;
}
.inv-pick.selected { border-color: var(--accent); background: var(--accent-soft); }
/* 没存进素材库的单据：能看见但不给点，右侧的"未存档"就是原因 */
.inv-pick.disabled { opacity: 0.55; cursor: default; }
.inv-pick-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: transparent;
}
.inv-pick.selected .inv-pick-mark { border-color: var(--accent); background: var(--accent); color: #fff; }
/* 没存档的标记：在标题行末尾，比底部那一行更靠眼 */
.inv-pick-flag { flex: none; font-size: 12.5px; color: var(--muted); }
/* 预览：扁平的 tint 文字按钮，和卡片同高，不抢"选中"的视觉 */
.inv-pick-preview {
  flex: none;
  border: 0;
  background: none;
  padding: 4px 6px;
  margin-right: -6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
/* 固定 80% 屏高：三级选择器压过 .sheet.action-sheet 的 height:auto */
.sheet.action-sheet.inv-pick-sheet {
  height: 80vh;
  height: 80dvh;
  max-height: 80dvh;
}
.inv-pick-note {
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ── 单据详情（只读 sheet，壳和客户资料一致） ──────────────────────── */
.sheet.inv-sheet { height: 88vh; }
.inv-sheet-body { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }
.inv-sum { padding: 14px 16px 16px; }
.inv-sum-head { display: flex; align-items: center; gap: 8px; }
.inv-sum-number { margin-top: 8px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.inv-sum-amount { margin-top: 4px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.inv-sum-note { margin-top: 4px; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.inv-sum-date { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.inv-sum-numrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.inv-sum-numrow .inv-sum-number { flex: 0 1 auto; min-width: 0; margin-top: 0; }
.inv-copy { flex: none; padding: 3px 9px; border: 0.5px solid var(--line); border-radius: 999px; background: transparent; color: var(--accent); font-family: inherit; font-size: 12px; }
.inv-copy:active { background: var(--track); }
/* 付款计划：标签 + 说明在左，金额在右 */
.inv-pay { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; }
.inv-pay-main { min-width: 0; }
.inv-pay-label { font-size: 14px; }
.inv-pay-desc { margin-top: 1px; font-size: 12px; color: var(--muted); }
.inv-pay-amount { flex: none; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* 关联单据：整行可点，跳到生产单 / 物流详情 */
.inv-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 0; border: 0; border-top: 0.5px solid var(--line); background: transparent; color: var(--text); font-family: inherit; font-size: 14px; text-align: left; }
.inv-link:first-of-type { border-top: 0; }
.inv-link-label { flex: none; width: 56px; color: var(--muted); font-size: 13px; }
.inv-link-value { flex: 1; min-width: 0; }
.inv-link-caret { flex: none; color: var(--muted); font-size: 17px; line-height: 1; }
.inv-toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); z-index: 9999; padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 13px; pointer-events: none; transform: translateX(-50%); }
.inv-sec { padding: 14px 16px; border-top: 0.5px solid var(--line); }
.inv-sec-title { margin-bottom: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.inv-row { display: flex; gap: 12px; padding: 3px 0; font-size: 14px; }
.inv-k { flex: none; width: 92px; font-size: 13px; color: var(--muted); }
.inv-v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* 金额表：标签靠左、数字靠右，长费用名不会被 92px 挤成多行 */
.inv-row.split { align-items: baseline; }
.inv-row.split .inv-k { flex: 1 1 auto; width: auto; }
.inv-row.split .inv-v { flex: 0 0 auto; max-width: 62%; text-align: right; font-variant-numeric: tabular-nums; }
/* 长条款：标签一行、内容一行 */
.inv-row.stack { flex-direction: column; gap: 1px; padding: 6px 0; }
.inv-row.stack .inv-k { width: auto; }
.inv-text { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.inv-sub { margin: 10px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.inv-sub:first-child { margin-top: 0; }
.inv-empty { font-size: 13px; color: var(--muted); }
.inv-item { display: flex; gap: 10px; padding: 10px 0; }
.inv-item + .inv-item { border-top: 0.5px solid var(--line); }
.inv-item-img { flex: none; width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--track); }
.inv-item-main { flex: 1; min-width: 0; }
.inv-item-name { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.inv-item-spec { margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.inv-item-calc { margin-top: 4px; font-size: 13px; }
.inv-item-amount { font-weight: 600; }
.inv-total { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 0.5px solid var(--line); font-size: 15px; font-weight: 700; }
/* 物流轨迹：左侧小圆点 + 竖线的时间线，最新一条高亮 */
.inv-track { display: flex; flex-direction: column; }
.inv-track-item { position: relative; display: flex; gap: 10px; padding-bottom: 12px; }
.inv-track-item:last-child { padding-bottom: 0; }
.inv-track-item::before {
  content: '';
  position: absolute;
  top: 13px;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--line);
}
.inv-track-item:last-child::before { display: none; }
.inv-track-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--track);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.inv-track-item.latest .inv-track-dot { background: var(--accent); box-shadow: none; }
.inv-track-body { flex: 1; min-width: 0; }
.inv-track-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inv-track-desc { margin-top: 2px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.inv-track-item.latest .inv-track-desc { font-weight: 600; }
.inv-track-more {
  width: 100%;
  margin-top: 12px;
  padding: 7px 0;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
}
.inv-track-more:active { background: var(--track); }

@media (prefers-color-scheme: dark) {
  .inv-status.done { color: #30d158; }
  .inv-status.pending { color: #ffa53a; }
  .inv-status.progress { color: #4d9fff; }
}

/* ── 线程工具条 / 选择器 ─────────────────────────────────────────────── */
.thread-tools {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 0.5px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.thread-tools::-webkit-scrollbar { display: none; }

.picker { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); }
.picker-screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.picker-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
}
.picker-tags { border-bottom: 0.5px solid var(--line); }
.picker-row { align-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.picker-row:active { background: var(--bg); }
/* 话术正文是整段邮件，列表里给两行才看得出区别 */
.picker-row .preview { -webkit-line-clamp: 2; }
/* 标签挂在标题行右侧（和桌面端一致）：只做提示，标题该截断就截断 */
.row-top > .tag { flex: none; align-self: center; }

/* 每行右侧的「⋯」：只占一个圆点，正文预览不再被文字按钮挤窄 */
.row-more {
  flex: none;
  align-self: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.row-more:active { background: var(--track); }

/* 行内「⋯」打开的动作条：只有几个动作，高度跟着内容走。
   键盘弹起时上方只剩半屏，高度要卡在可见区域里，内容超出就在内部滚动——
   否则整块会顶出屏幕顶部，标题和"完成"按钮一起消失 */
/* dvh：iOS 上 100vh 算的是"浏览器工具栏收起后"的高度，面板底部会被顶到屏幕外，
   标签栏一出现就滚不到「退出登录」了 */
.sheet.action-sheet {
  height: auto;
  max-height: calc(100vh - var(--kb-inset, 0px) - 12px);
  max-height: calc(100dvh - var(--kb-inset, 0px) - 12px);
}
.action-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
}
.action-sheet-body .action-row + .action-row { border-top: 0.5px solid var(--line); }
.action-sheet-body .error { padding: 0 16px; min-height: 0; }
.action-sheet-body .error:empty { display: none; }

/* 删除确认：先把「删的是什么」摆出来，再给红色的那一行。
   名字用正文色，摘要用灰字并压到三行，长话术也不会把按钮顶出屏幕 */
.confirm-target { padding: 4px 16px 14px; }
.confirm-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.confirm-detail {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.action-sheet-body .confirm-target + .action-row { border-top: 0.5px solid var(--line); }

.pick-text { padding: 0 16px 12px; }
.pick-text textarea {
  width: 100%;
  min-height: 200px;
  font: inherit;
  font-size: 16px;
  padding: 12px;
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  resize: vertical;
}

/* ── 邮件内附件 ──────────────────────────────────────────────────────── */
.msg-attach { margin: 0 14px 14px; padding-top: 10px; border-top: 0.5px solid var(--line); }
.msg-attach > .attach-meta { margin-bottom: 4px; }
.msg-attach .cust-attach { padding: 8px 0; background: transparent; border-bottom: 0; }
.msg-attach .cust-attach + .cust-attach { border-top: 0.5px solid var(--line); }
.msg-attach .btn { margin-top: 8px; }

/* ── 相关邮件主题 ────────────────────────────────────────────────────── */
.rel-section { margin: 12px; }
.rel-head {
  width: 100%;
  background: var(--card);
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}
.rel-head > strong { font-weight: 600; }
.rel-list { background: var(--card); border-top: 0.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rel-list .row:last-child::after { display: none; }
.rel-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rel-row.active .name { color: var(--accent); }
.rel-row.disabled { opacity: 0.55; cursor: default; }
.rel-note { padding: 10px 16px 12px; color: var(--muted); font-size: 13px; }

/* ── 底部 sheet（客户资料） ───────────────────────────────────────── */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: flex-end;
  /* 面板里可能带输入框（链接地址）：键盘弹起时整块抬到键盘上面 */
  padding-bottom: var(--kb-inset, 0px);
  animation: sheet-fade 0.2s ease;
}
.sheet {
  width: 100%;
  /* 固定 68vh：内容少的时候不会缩成一条，内容多的时候内部滚动 */
  height: 68vh;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  animation: sheet-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  /* 面板内部的滚动不传染给页面（配合 openSheet 里的 touchmove 拦截） */
  overscroll-behavior: contain;
}
.sheet-grabber {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  margin: 6px auto 0;
  flex: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--line);
  flex: none;
}
.sheet-title { font-size: 16px; font-weight: 600; }
.sheet .chips { padding: 10px 16px; border-bottom: 0.5px solid var(--line); }
.sheet .cust-body { flex: 1; overflow-y: auto; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }
.sheet-body { flex: 1; overflow-y: auto; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }
.cust-main { min-width: 0; }
.avatar-img { object-fit: cover; background: var(--track); }
.cust-info-line { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.sheet-group { padding: 14px 16px 8px; }
.sheet .rel-list { border-radius: 0; border-top: 0.5px solid var(--line); }
.sheet .rel-section { margin: 0; }

@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }

/* 发送错误贴在顶栏下面，不用滚到表单底部才看得到 */
.send-error {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--nav-h));
  z-index: 4;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 16px;
  overflow-wrap: anywhere;
}
.send-error:empty { display: none; }

/* ── 全局「处理中」遮罩 ───────────────────────────────────────────────
   由 js/busy.js 的 withBusy() 挂上：盖住整页、吃掉手势，用来表达进度并挡重复提交。
   层级压在 sheet(40) / picker(30) / lightbox(20) 之上，面板里的动作也能盖住 */
.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.2);
  /* 手势一律不透到下面那层页面（touchmove 另由脚本拦一道，iOS 只认脚本这一道） */
  touch-action: none;
  overscroll-behavior: contain;
  animation: busy-fade 0.16s ease;
}
.busy-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 78vw;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-size: 15px;
}
.busy-label { min-width: 0; overflow-wrap: anywhere; }
.busy-spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--track);
  border-top-color: var(--accent);
  animation: busy-spin 0.7s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@keyframes busy-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .busy-spinner { animation-duration: 2.4s; }
}

/* ── 定时发送 ──────────────────────────────────────────────────────────
   一套三处：顶栏的入口、顶栏下面的状态行、草稿列表里的标记。
   桌面端用的是"页脚徽标 + 面板"，手机竖屏没有那个横向空间，
   所以状态始终收在一条细行里，真正的选择留给一个底部面板 */

/* 顶栏的定时按钮：和橙色的发送/返回区分开——它是"另一种发送"，进去之后才开始选时间，
   平时是灰字轻按钮，排上定时后才转成品牌色（一眼能看出这封已经不用管了） */
.compose-bar .btn.sched-btn {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 14px;
  color: var(--muted);
  background: var(--bg);
  border: 0.5px solid var(--line);
}
.compose-bar .btn.sched-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
  font-weight: 600;
}

/* 定时状态行：和"草稿已保存"同一条细线语言，但排程比保存重要，多给一个圆点 + 一行说明。
   异常（已错过/发送失败）整条转红：那是"必须现在处理"的信号 */
.schedule-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 18px 9px;
  background: var(--accent-soft);
  font-size: 12.5px;
}
.schedule-status:empty { display: none; }
.schedule-line { display: flex; align-items: center; gap: 6px; }
.schedule-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.schedule-text {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-status .btn {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 2px 10px;
  font-size: 12.5px;
}
.schedule-hint {
  padding-left: 13px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}
.schedule-status.warn { background: var(--danger-soft); }
.schedule-status.warn .schedule-dot { background: var(--danger); }
.schedule-status.warn .schedule-text { color: var(--danger); }
/* 刚因为改内容被取消：不是状态，是一句解释，几秒后自己消失 */
.schedule-status.muted { background: var(--bg); }
.schedule-status.muted .schedule-text { color: var(--muted); font-weight: 400; }

/* 草稿列表的标记：一个点 + 状态词。不做彩色胶囊——列表底色已经很白，
   胶囊会和"附件数"抢位置；点状标记只在有定时时出现，扫一眼就能分出来 */
.sched-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.sched-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.sched-chip.accent { color: var(--accent); }
.sched-chip.danger { color: var(--danger); }
/* 时间列显示的是"什么时候发出去"，不是"最后改于" */
.time.sched {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* 错过/失败时时间也跟着转红：一整行只讲一件事，别让橙色时间去配红色状态 */
.time.sched.danger { color: var(--danger); }
.avatar.sched { background: var(--accent-soft); color: var(--accent); }

/* 定时面板：一句话"什么时候发"就是主角，所以时间用面板里最大的字；
   常用时段是胶囊，精确到分钟交给系统的日期轮盘 */
.sched-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 16px 16px;
}
.sched-current {
  padding: 10px 2px 0;
  color: var(--muted);
  font-size: 12.5px;
}
.sched-hero { padding: 12px 0 2px; text-align: center; }
.sched-time {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sched-day { margin-top: 3px; color: var(--muted); font-size: 13px; }
/* 客户那边几点：挂在主时间下面一行，比主时间低一级 */
.sched-customer { margin-top: 2px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.sched-chips { padding: 12px 0 2px; }
.sched-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg);
}
.sched-pick > label { flex: none; color: var(--muted); font-size: 14px; }
.sched-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sched-zone { margin-top: 8px; }
/* 客户时区是"当前值 + 可改"，做成右对齐的文字按钮，不抢"准确时间"那一行的注意力 */
.sched-zone-btn {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  text-align: right;
  color: var(--accent);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sched-zone-btn.muted { color: var(--muted); }

/* 时区选择面板：搜索框固定，列表自己滚 */
.sched-zone-body { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.sched-zone-search {
  flex: none;
  margin: 10px 14px 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  -webkit-appearance: none;
}
.sched-zone-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.sched-zone-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }

.sched-note {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.sched-error { margin: 8px 2px 0; color: var(--danger); font-size: 13px; }
.sched-error:empty { display: none; }
/* 面板里的"取消定时发送"：白卡在白色面板上看不出边界，给一层浅底把它托出来 */
.sched-body .action-card { margin: 14px 0 0; background: var(--bg); }
