/* ══════════════════════════════════════════════════════════
   SIM Gateway — 移动端网页
   参照 iOS：系统字体、内嵌分组列表、大标题、毛玻璃导航、气泡会话。
   零外部资源（CSP 也不允许），全部自带。
   ══════════════════════════════════════════════════════════ */

:root {
  --bg:            #f2f2f7;
  --bg-elev:       #ffffff;
  --fill-1:        rgba(120,120,128,0.12);
  --fill-2:        rgba(120,120,128,0.16);
  --press:         rgba(0,0,0,0.055);
  --label:         #000000;
  --label-2:       rgba(60,60,67,0.60);
  --label-3:       rgba(60,60,67,0.30);
  /* iOS 的 separator 实际是 0.29。之前用 0.20 偏淡，
     碰上小数行高被反锯齿摊成两半后就彻底看不见了——这正是
     「分隔线有的有有的没有」的直接原因。 */
  --sep:           rgba(60,60,67,0.29);
  --blue:          #007aff;
  --green:         #34c759;
  --red:           #ff3b30;
  --orange:        #ff9500;
  --bub-in:        #e9e9eb;
  --bub-in-fg:     #000000;
  --glass:         rgba(249,249,249,0.80);
  --radius:        12px;
  --gutter:        16px;

  /* 分隔线宽度。
     默认 1px 而不是 0.5px：在 devicePixelRatio 不是整数的屏幕上
     （Windows 125% 缩放就是 1.25），0.5px 边框会按每一行的小数位置分别舍入——
     有的行凑够一个设备像素画得出来，有的凑不够直接消失，
     看上去就是「分隔线有的有有的没有」。
     只有 2x 以上的屏幕才用真正的 0.5px 细线（见下面的媒体查询）。 */
  --hair: 1px;
}

@media (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) {
  :root { --hair: 0.5px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #000000;
    --bg-elev:   #1c1c1e;
    --fill-1:    rgba(120,120,128,0.24);
    --fill-2:    rgba(120,120,128,0.32);
    --press:     rgba(255,255,255,0.07);
    --label:     #ffffff;
    --label-2:   rgba(235,235,245,0.60);
    --label-3:   rgba(235,235,245,0.30);
    --sep:       rgba(84,84,88,0.60);
    --bub-in:    #26262a;
    --bub-in-fg: #ffffff;
    --glass:     rgba(20,20,22,0.80);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px; line-height: 1.41;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { background: transparent; border: 0; outline: none; }
.hidden { display: none !important; }

/* ─────────────── 登录 ─────────────── */

.login { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: var(--bg); }
.login-inner { width: 100%; max-width: 330px; text-align: center; }
.app-icon {
  width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 18px;
  background: linear-gradient(160deg, #0a84ff, #0060df); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(0,110,255,0.32);
}
.login-title { margin: 0; font-size: 27px; font-weight: 700; letter-spacing: -0.5px; }
.login-sub { margin: 4px 0 30px; color: var(--label-2); font-size: 15px; }
.login-form .inset-group { margin: 0; }
.login-form .inset-row { padding: 0 16px; }
.login-form input { width: 100%; padding: 13px 0; font-size: 17px; }

.form-error { min-height: 19px; margin: 10px 4px 0; color: var(--red);
  font-size: 13px; text-align: left; }
.btn-filled {
  width: 100%; margin-top: 10px; padding: 14px;
  background: var(--blue); color: #fff; border-radius: 12px;
  font-size: 17px; font-weight: 600;
}
.btn-filled:active { opacity: 0.8; }
.btn-filled:disabled { opacity: 0.45; }

/* ─────────────── 框架 ─────────────── */

.app { height: 100%; }
.view { position: fixed; inset: 0; display: none; flex-direction: column; background: var(--bg); }
.view.active { display: flex; }
.scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}
.view[data-view="thread"] .scroll { padding-bottom: 10px; }
.tail-pad { height: 34px; }

/* ─────────────── 导航 ─────────────── */

.nav {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-bottom: var(--hair) solid var(--sep);
}
.nav-bar { display: flex; align-items: center; height: 44px; padding: 0 8px; }
.nav-slot { flex: 0 0 auto; min-width: 70px; display: flex; align-items: center; }
.nav-slot.right { justify-content: flex-end; }
.nav-title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }
.nav-large { margin: 0; padding: 2px var(--gutter) 10px;
  font-size: 34px; font-weight: 700; letter-spacing: -0.9px; }

.icon-btn { color: var(--blue); padding: 8px; display: flex; border-radius: 50%; }
.icon-btn:active { background: var(--fill-1); }
.back-btn { display: flex; align-items: center; gap: 1px; color: var(--blue);
  margin-left: -6px; font-size: 17px; padding: 6px 4px; }
.back-btn:active { opacity: 0.5; }

.nav-thread .nav-bar { height: 52px; }
.nav-peer { flex: 1; min-width: 0; text-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 1px; }
.nav-peer-num { font-size: 16px; font-weight: 600; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-peer-sub { font-size: 11.5px; color: var(--label-2); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 搜索 */
.search-wrap { padding: 0 var(--gutter) 10px; }
.search {
  display: flex; align-items: center; gap: 6px;
  background: var(--fill-1); border-radius: 10px; padding: 7px 9px;
  color: var(--label-2);
}
.search input { flex: 1; min-width: 0; font-size: 16px; color: var(--label);
  appearance: none; -webkit-appearance: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { color: var(--label-3); display: flex; }

/* 设备分段 */
.seg-wrap { padding: 0 var(--gutter) 10px; }
.seg { display: flex; gap: 2px; padding: 2px; background: var(--fill-1); border-radius: 9px; }
.seg button {
  flex: 1; min-width: 0; padding: 6px 6px; border-radius: 7px;
  font-size: 13px; color: var(--label);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seg button.on { background: var(--bg-elev); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.14); }
/* 离线设备淡一档就够了，不用额外的符号 */
.seg button.off { color: var(--label-2); }
.seg button.off.on { color: var(--label); }

/* ─────────────── 内嵌分组列表 ─────────────── */

.group-head { margin: 26px var(--gutter) 7px; font-size: 13px; color: var(--label-2); }
.group-foot { margin: 8px var(--gutter) 0; font-size: 12.5px;
  color: var(--label-2); line-height: 1.42; }
.inset-group { margin: 0 var(--gutter); background: var(--bg-elev);
  border-radius: var(--radius); overflow: hidden; }
/* 相邻的分组之间必须留空，否则两张卡片会粘成一整块，
   看上去像是同一个分组里的内容（二维码和「更换密钥」按钮就踩过这个坑）。 */
.inset-group + .inset-group,
.group-foot + .inset-group { margin-top: 18px; }

.inset-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 9px 16px; width: 100%;
  border-bottom: var(--hair) solid var(--sep);
}
.inset-row:last-child { border-bottom: 0; }
.tappable:active { background: var(--press); }
.row-title { flex: 0 0 auto; min-width: 76px; }
.row-field { flex: 1; min-width: 0; text-align: right; color: var(--label); }
.row-field::placeholder { color: var(--label-3); }
select.row-field { direction: rtl; }
.row-value { flex: 1; text-align: right; color: var(--label-2); }
.row-action { flex: 1; text-align: center; color: var(--blue); }
.row-action.danger { color: var(--red); }

/* 开关 */
.switch {
  appearance: none; -webkit-appearance: none; position: relative;
  width: 51px; height: 31px; flex: 0 0 51px; margin-left: auto;
  border-radius: 16px; background: rgba(120,120,128,0.32); transition: background .25s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.26); transition: transform .25s;
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* ─────────────── 会话列表 ─────────────── */

.conv {
  display: flex; gap: 12px; align-items: center; width: 100%;
  padding: 9px var(--gutter); background: var(--bg-elev); text-align: left;
  border-bottom: var(--hair) solid var(--sep);
}
.conv:active { background: var(--press); }
.avatar {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; letter-spacing: 0.3px;
}
.conv-body { flex: 1; min-width: 0; }
.conv-line1 { display: flex; align-items: baseline; gap: 8px; }
.conv-peer { font-size: 16.5px; font-weight: 600; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { flex: 0 0 auto; font-size: 13px; color: var(--label-2); }
.conv-label { display: block; font-size: 11.5px; color: var(--label-3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-prev { margin-top: 2px; font-size: 14.5px; color: var(--label-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conv-prev mark { background: rgba(255,214,10,0.45); color: inherit; border-radius: 3px; }
.chev { flex: 0 0 auto; color: var(--label-3); display: flex; }

/* ─────────────── 气泡 ─────────────── */

.bubbles { padding: 10px 12px 6px; }
.bub-day { text-align: center; font-size: 11.5px; color: var(--label-2);
  margin: 14px 0 10px; font-weight: 500; }
.bub-row { display: flex; margin-bottom: 2px; }
.bub-row.out { justify-content: flex-end; }
.bub {
  max-width: 76%; padding: 8px 13px; border-radius: 19px;
  font-size: 16px; line-height: 1.33; white-space: pre-wrap;
  word-break: break-word; text-align: left;
}
.bub:active { filter: brightness(0.92); }
.bub-row.in .bub  { background: var(--bub-in); color: var(--bub-in-fg); border-bottom-left-radius: 5px; }
.bub-row.out .bub { background: var(--blue); color: #fff; border-bottom-right-radius: 5px; }
.bub-row.out.pending .bub { opacity: 0.5; }
.bub-row.out.failed  .bub { background: var(--red); }
.bub-meta { font-size: 11px; color: var(--label-2); margin: 1px 6px 9px; }
.bub-meta.out { text-align: right; }
.bub-meta.err { color: var(--red); }

/* 验证码快捷复制 —— 这个网关最常用的动作 */
.code-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 5px 4px 9px; padding: 7px 13px;
  background: var(--fill-1); border-radius: 16px;
  font-size: 14px; font-weight: 600; letter-spacing: 1px; color: var(--label);
}
.code-chip:active { background: var(--fill-2); }
.code-chip svg { color: var(--blue); letter-spacing: 0; }
.code-chip .code-hint { font-size: 12px; font-weight: 400;
  letter-spacing: 0; color: var(--label-2); }

/* ─────────────── 输入栏 ─────────────── */

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border-top: var(--hair) solid var(--sep);
}
.sim-select { flex: 0 0 auto; max-width: 86px; padding: 7px 6px;
  background: var(--fill-1); border-radius: 16px; font-size: 13px; }
.input-pill { flex: 1; min-width: 0; background: var(--bg-elev);
  border: var(--hair) solid var(--sep); border-radius: 18px; padding: 6px 13px; }
.input-pill textarea { width: 100%; max-height: 110px; resize: none;
  font-size: 16px; line-height: 1.35; }
.send-fab { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff; display: flex;
  align-items: center; justify-content: center; }
.send-fab:disabled { background: var(--label-3); }

/* ─────────────── 通话 ─────────────── */

.day-head { padding: 22px var(--gutter) 6px; font-size: 13px; color: var(--label-2); }
.call-row { display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px var(--gutter); background: var(--bg-elev);
  border-bottom: var(--hair) solid var(--sep); text-align: left; }
.call-row:active { background: var(--press); }
.call-ico { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(52,199,89,0.14); color: var(--green);
  display: flex; align-items: center; justify-content: center; }
.call-body { flex: 1; min-width: 0; }
.call-peer { display: block; font-size: 16.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 必须 display:block —— 行内元素上的 overflow/text-overflow 不生效，
   之前这三处都是 span，省略号从来没起过作用，长文本直接溢出到别的元素下面。 */
.call-sub { display: block; font-size: 12.5px; color: var(--label-2); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-time { flex: 0 0 auto; font-size: 13px; color: var(--label-2); }
.copy-btn { flex: 0 0 auto; padding: 8px; color: var(--blue); display: flex;
  border-radius: 50%; }
.copy-btn:active { background: var(--fill-1); }

/* ─────────────── 设备 ─────────────── */

.dev-card { margin: 14px var(--gutter) 0; background: var(--bg-elev);
  border-radius: var(--radius); overflow: hidden; }
.dev-top { display: flex; align-items: center; gap: 10px; padding: 15px 16px 11px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(52,199,89,0.18); }
.dot.off { background: var(--label-3); }
.dev-name { flex: 1; min-width: 0; font-size: 17px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-state { font-size: 13px; color: var(--label-2); }
.dev-meta { padding: 0 16px 13px; font-size: 13px; color: var(--label-2); line-height: 1.55; }
.chip { display: inline-block; margin: 4px 6px 0 0; padding: 3px 10px;
  background: var(--fill-1); border-radius: 11px; font-size: 12px; color: var(--label); }

/* ─────────────── 标签栏 ─────────────── */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: var(--hair) solid var(--sep);
}
.tabbar.hide { display: none; }
.tab { flex: 1; padding: 6px 0 4px; display: flex; flex-direction: column;
  align-items: center; gap: 1px; color: var(--label-2); font-size: 10px; }
.tab.active { color: var(--blue); }
.tab:active { opacity: 0.6; }

/* ─────────────── 弹层 ─────────────── */

.sheet-mask { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.42);
  display: flex; align-items: flex-end; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(100%) } to { transform: translateY(0) } }

.sheet { width: 100%; background: var(--bg); border-radius: 14px 14px 0 0;
  padding-bottom: calc(22px + env(safe-area-inset-bottom)); animation: rise .26s ease; }
.sheet-bar { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: var(--hair) solid var(--sep); margin-bottom: 18px; }
.sheet-title { font-size: 17px; font-weight: 600; }
.sheet-btn { color: var(--blue); font-size: 17px; }
.sheet-btn.strong { font-weight: 600; }
.sheet-err { margin: 10px var(--gutter) 0; }

/* iOS 操作面板 */
.action-wrap { width: 100%; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  animation: rise .24s ease; }
.action-card { width: 100%; background: var(--bg-elev); border-radius: 14px;
  overflow: hidden; margin-bottom: 8px; }
@media (prefers-color-scheme: light) { .action-card { background: rgba(255,255,255,0.96); } }
.action-head { margin: 0; padding: 14px 16px; text-align: center;
  font-size: 13px; color: var(--label-2); border-bottom: var(--hair) solid var(--sep);
  word-break: break-all; }
.action-item { display: block; width: 100%; padding: 16px;
  font-size: 19px; color: var(--blue); text-align: center;
  border-bottom: var(--hair) solid var(--sep); }
.action-item:last-child { border-bottom: 0; }
.action-item:active { background: var(--press); }
.action-item.danger { color: var(--red); }
.action-cancel { padding: 16px; font-size: 19px; font-weight: 600;
  color: var(--blue); text-align: center; margin-bottom: 0; }

/* ─────────────── 提示 / 空态 ─────────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(14px);
  max-width: 84%; padding: 11px 18px; border-radius: 19px;
  background: rgba(0,0,0,0.85); color: #fff; font-size: 14px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { padding: 72px 36px; text-align: center; color: var(--label-2); }
.empty svg { color: var(--label-3); margin-bottom: 14px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--label); margin-bottom: 5px; }
.empty-sub { font-size: 14px; line-height: 1.5; }

/* 二维码 */
.qr-card { padding: 20px 16px; text-align: center; }
.qr-frame { display: flex; justify-content: center; }
.qr-frame img { width: 206px; height: 206px; background: #fff;
  padding: 10px; border-radius: 10px; }
.qr-tip { margin: 14px 0 0; font-size: 14px; color: var(--label-2); }
/* 接入配置那串 base64：允许手选，长了就自己换行，不要把卡片撑破。 */
.enroll-b64 {
  flex: 1; min-width: 0; font-size: 11px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--label-2); word-break: break-all;
  user-select: all; -webkit-user-select: all;
}
.qr-url { margin: 5px 0 0; font-size: 11px; color: var(--label-3); word-break: break-all; }

/* 断连横幅：固定在标签栏上方，不遮挡内容但一定看得见。 */
.link-banner {
  position: fixed; left: 0; right: 0;
  bottom: calc(49px + env(safe-area-inset-bottom));
  z-index: 25; padding: 7px 16px;
  background: var(--orange); color: #fff;
  font-size: 13px; text-align: center;
}

/* 分页占位：告诉用户还能继续拉，而不是让人以为到底了。 */
.load-more { padding: 16px; text-align: center;
  font-size: 13px; color: var(--label-3); }

/* ─────────────── 输入栏（重做） ─────────────── */

.composer {
  gap: 7px;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  align-items: flex-end;
}
/* SIM 选择做成小胶囊按钮，点开走操作面板。
   原生 select 在窄屏会把「SIM1 · 13512345678」截断，还带个系统箭头。 */
.sim-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 3px;
  height: 34px; padding: 0 9px 0 11px;
  background: var(--fill-1); border-radius: 17px;
  font-size: 13px; font-weight: 500; color: var(--label);
  max-width: 108px;
}
.sim-chip:active { background: var(--fill-2); }
.sim-chip:disabled { opacity: 0.45; }
.sim-chip span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sim-chip svg { flex: 0 0 auto; color: var(--label-2); }

.input-pill {
  border-radius: 17px; padding: 6px 14px; min-height: 34px;
  display: flex; align-items: center;
}
.input-pill textarea { max-height: 104px; font-size: 16px; }

.send-fab {
  flex: 0 0 34px; width: 34px; height: 34px;
  transition: background .15s, transform .12s;
}
.send-fab:active { transform: scale(0.92); }
.send-fab:disabled { background: var(--fill-2); color: var(--label-3); }

/* ─────────────── 左滑删除 ─────────────── */

/* 整行刚性平移，和 iOS 一致。
   试过「压缩内容宽度」——不裁切行首，但文字会重排、行高跟着跳，
   比行首滑出去难看得多，也完全没有原生感。平移不触发任何重排。
   底色用卡片色而不是红色：行间分隔线是半透明的，衬红底会透出红线。 */
.swipe { position: relative; overflow: hidden; background: var(--bg-elev); }
.swipe-content {
  position: relative; z-index: 1; background: var(--bg-elev);
  transform: translateX(0);
  transition: transform .25s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
  /* 拖动时不要顺手把号码文字选中（鼠标拖拽尤其明显）。
     要复制号码有长按菜单和复制按钮，不靠手选。 */
  user-select: none; -webkit-user-select: none;
}
.swipe.dragging .swipe-content { transition: none; }
/* 平时根本不渲染，只有拖动中和展开时才画出来。
   原因是一条真实的显示 bug：.swipe-content 带 will-change: transform，
   自己是一个合成层，按小数像素合成时底边会被抗锯齿成半透明的一行，
   把垫在下面的红色按钮透出来——表现就是「某些行的分隔线是红的」。
   （DPR 1.25 上行高 62.688px，每隔几行边界就落在半个设备像素上，所以有的行有、有的没有。）
   让红色只在需要时存在，这条路彻底堵死。 */
.swipe-del {
  position: absolute; top: 0; right: 0; bottom: 0; width: 78px;
  display: none; align-items: center; justify-content: center;
  background: var(--red); color: #fff; font-size: 15px;
  white-space: nowrap;
}
.swipe.peek .swipe-del { display: flex; }
.swipe-del:active { filter: brightness(0.9); }

/* ─────────────── 设备分段（多设备时可横向滚动） ─────────────── */

.seg.scrollable {
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.seg.scrollable::-webkit-scrollbar { display: none; }
/* 超过三台设备就不再等分——等分会把设备名压成一两个字看不出是谁。
   改成按内容宽度排列、横向滚动。 */
.seg.scrollable button { flex: 0 0 auto; padding: 6px 13px; max-width: 46vw; }

/* ─────────────── 移动端原生手感 ─────────────── */

/* 所有可滚动容器统一带惯性。
   iOS 13 起原生就有动量滚动，但 -webkit-overflow-scrolling 对老版本仍有效，
   留着没有副作用。overscroll-behavior: contain 是关键——
   列表滚到底时不要把整个页面一起橡皮筋拖动，那一下最出戏。 */
.scroll,
.seg.scrollable,
.sheet,
#thread-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 双击缩放会让点击延迟 300ms，也破坏原生感。
   注意：iOS 10 起 Safari 会忽略 viewport 里的 user-scalable=no，
   真正管用的是这条 touch-action 加上 JS 里拦掉 gesture 事件。 */
html, body { touch-action: manipulation; }

/* 可以正常缩放的地方要留出来：气泡内容允许选中复制。 */
.bub { user-select: text; -webkit-user-select: text; }

/* ─────────────── 大标题行的动作按钮 ─────────────── */

/* 新建短信从顶部小导航栏挪到大标题右侧：
   iPhone 屏幕越做越高，44px 导航栏在单手握持时拇指根本够不到，
   大标题这一行正好在舒适区内。 */
.nav-large-row { display: flex; align-items: center; padding-right: 8px; }
.nav-large-row .nav-large { flex: 1; min-width: 0; }
.icon-btn.lg { margin-bottom: 6px; }

/* 导航栏上的文字按钮（选择 / 全选 / 完成） */
.nav-txt { color: var(--blue); font-size: 17px; padding: 6px 2px; white-space: nowrap; }
.nav-txt.strong { font-weight: 600; }
.nav-txt:active { opacity: 0.45; }

/* ─────────────── 多选 ─────────────── */

/* 圆形勾选标记。默认不占位（display:none），只有列表进入多选态才出现——
   这样非多选时的行高、缩进和以前完全一样，不会因为多了一个隐藏元素而错位。 */
.sel-dot { display: none; }
.selecting .sel-dot {
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--label-3); color: transparent;
  transition: background .12s, border-color .12s;
}
.selecting .picked .sel-dot { background: var(--blue); border-color: var(--blue); color: #fff; }
/* 多选时右边的箭头和复制按钮收起来：一是腾地方，
   二是避免手指落在「复制」上却以为自己在勾选。 */
.selecting .chev, .selecting .copy-btn { display: none; }

.sel-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: var(--hair) solid var(--sep);
}
.sel-btn { font-size: 16px; color: var(--blue); padding: 4px 2px; white-space: nowrap; }
.sel-btn.danger { color: var(--red); font-weight: 600; }
.sel-btn:disabled { color: var(--label-3); font-weight: 400; }
.sel-btn:active:not(:disabled) { opacity: 0.45; }
.sel-count { flex: 1; text-align: center; font-size: 13px; color: var(--label-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─────────────── 删除所有 ─────────────── */

/* 面板可能要列上百个号码，必须自己滚动而不是把整页撑长。 */
.sheet.purge { display: flex; flex-direction: column; max-height: 86vh; }
.sheet.purge .sheet-bar { margin-bottom: 12px; flex: 0 0 auto; }
.purge-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; }
.purge-scroll .search-wrap { padding-top: 0; }
.purge-scroll .group-head { margin-top: 18px; }
.purge-scroll .group-head:first-child { margin-top: 0; }
.sheet-btn.danger { color: var(--red); }

.check-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 46px; padding: 9px 16px; text-align: left;
  border-bottom: var(--hair) solid var(--sep);
}
.check-row:last-child { border-bottom: 0; }
.check-row:active { background: var(--press); }
.check-box {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--label-3); color: transparent;
  display: flex; align-items: center; justify-content: center;
}
.check-row.on .check-box { background: var(--blue); border-color: var(--blue); color: #fff; }
.check-main { flex: 1; min-width: 0; }
.check-t { display: block; font-size: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-s { display: block; font-size: 12px; color: var(--label-2); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-n { flex: 0 0 auto; font-size: 13px; color: var(--label-3); }
.purge-note { padding: 14px 16px; font-size: 14px; color: var(--label-2); text-align: center; }
/* 钉在顶部的影响范围说明 */
.purge-foot {
  flex: 0 0 auto; margin: 0; padding: 0 16px 11px;
  font-size: 12.5px; line-height: 1.45; color: var(--label-2);
}
.purge-foot.hot { background: rgba(255,59,48,0.10); padding-top: 10px; }
/* 没有任何条件＝清空全部，这种时候必须让人一眼看出危险。 */
.purge-danger { color: var(--red); }
