/* =========================================================================
   义乌宝贝 · 手机看消息  —— 外贸单据(manifest)气质的暖调只读台
   设计：米白纸面 + 深墨绿墨水/边栏 + 橙色强调；竖屏单列，拇指可及。
   无外部字体（国内网络 + CSP 'self' 友好），全部系统 CJK 字体 + 等宽做编号/时间。
   ========================================================================= */

:root {
  --paper:   #ECE5DD;   /* 会话/页面底（WhatsApp 米色） */
  --paper-2: #F5F2EC;   /* 次级面：输入底/译文面板/按下态 */
  --card:    #FFFFFF;   /* 卡片/列表/收到气泡 */
  --ink:     #111111;   /* 主文字 */
  --ink-2:   #303030;   /* 次级正文 */
  --ink-3:   #667781;   /* 弱文字：时间/预览/次要灰 */
  --line:    #E9E9E9;   /* 分隔线 */
  --line-2:  #D1D7DB;   /* 强分隔线 */
  --green:   #25D366;   /* 品牌绿 */
  --green-2: #1FB356;   /* 深一档品牌绿（渐变/按下） */
  --green-ink:#FFFFFF;  /* 绿底上的字 */
  --accent:  #25D366;   /* 强调=品牌绿（替换原橙 #ff8a3d） */
  --accent-ink:#06351f; /* 绿底上的深字（个别用） */
  --accent-soft:#D9F5E3;/* 未读点淡绿晕 */
  --in-bubble:  #FFFFFF; /* 客户(入站)气泡 */
  --out-bubble: #D9FDD3; /* 我方(出站)气泡 */
  --trans-bg:   #F5F2EC; /* 译文面板 */
  --danger:  #C0442E;
  --ok:      #1FA855;
  --radius:  18px;
  --radius-s: 12px;
  --shadow:  0 1px 2px rgba(11,20,26,.06), 0 10px 30px rgba(11,20,26,.08);
  --shadow-s:0 1px .5px rgba(11,20,26,.13);
  --font-cjk:-apple-system,BlinkMacSystemFont,system-ui,"SF Pro Text","PingFang SC","Hiragino Sans GB","Microsoft YaHei UI","Microsoft YaHei","Noto Sans SC","Segoe UI",sans-serif;
  --font-num:ui-monospace,"SF Mono","JetBrains Mono","Cascadia Mono","Roboto Mono",Menlo,Consolas,monospace;
  --h-top: 92px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:#0B141A; --paper-2:#111B21; --card:#202C33;
    --ink:#E9EDEF; --ink-2:#D1D7DB; --ink-3:#8696A0;
    --line:#222E35; --line-2:#2A3942;
    --green:#25D366; --green-2:#1DAA57; --green-ink:#FFFFFF;
    --accent:#25D366; --accent-ink:#06351f; --accent-soft:#1B3A2B;
    --in-bubble:#202C33; --out-bubble:#005C4B; --trans-bg:#111B21;
    --danger:#F2A099; --ok:#53BD86;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.45);
    --shadow-s:0 1px .5px rgba(0,0,0,.4);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;              /* 关长按弹出菜单，像原生 */
  -webkit-user-select: none; user-select: none; /* 界面文字不可选中 */
}
html, body { margin:0; height:100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-cjk);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  touch-action: manipulation;               /* 禁双击缩放 / 去 300ms 延迟 */
}
/* 输入框仍可正常选中/编辑 */
.inp, input, textarea { -webkit-user-select: text; user-select: text; }
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* WhatsApp 纯色底（无纸纹、无图片，不触 img-src） */
.app {
  position: relative;
  width: 100%;              /* 永远占满(最多 480)，不随会话内容长短缩成窄条(E-7 问题⑥) */
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
/* 外层 #app 固定为视口高度，内层页面填满；这样滚动发生在 .scroll 内部，
   scrollTop=scrollHeight 能真正把会话滚到底，不再变成整页滚动(E-7 问题⑤)。 */
#app { height: 100%; }
#app > .app { flex: 1 1 auto; min-height: 0; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: .2px; }

/* ---------- 启动 ---------- */
.boot { height: 100vh; display:grid; place-content:center; text-align:center; gap:6px; }
.boot-mark { font-size: 22px; font-weight: 800; letter-spacing: 4px; color: var(--ink); }
.boot-sub { color: var(--ink-3); font-size: 13px; letter-spacing: 1px; }

/* ===================== 顶栏（iOS 大标题，浅底，与列表同色） ===================== */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 6px) 16px 10px;
  background: var(--card);
  color: var(--ink);
  border-bottom: 1px solid var(--line);     /* 唯一一条极细 hairline */
}
/* 导航行：右上放「只读」胶囊 + gear */
.nav-row { display:flex; align-items:center; gap:10px; min-height:38px; }
.nav-spacer { flex:1; }

/* iOS 大标题 */
.lg-title-wrap { margin-top: 2px; }
.lg-title { margin:0; font-size: 34px; font-weight: 800; letter-spacing: -.6px; line-height:1.1; color: var(--ink); }
.lg-sub { margin-top:3px; font-size:11px; font-weight:600; letter-spacing:2.5px; text-transform:uppercase; color: var(--ink-3); }

.iconbtn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--paper-2);
  color: var(--ink);
  display:grid; place-content:center; flex:0 0 auto;
  transition: background .15s, transform .1s;
}
.iconbtn:active { transform: scale(.92); background: var(--line); }
.iconbtn svg { width:20px; height:20px; display:block; }

/* 电脑状态条（浅底，深字） */
.status {
  margin-top: 11px;
  display:flex; align-items:center; gap:8px;
  font-size: 13.5px; color: var(--ink-2);
}
.dot { width:8px; height:8px; border-radius:50%; flex:0 0 auto; }
.dot.on  { background: #30b766; box-shadow:0 0 0 3px rgba(48,183,102,.16); }  /* 品牌绿点 */
.dot.off { background: #c9893f; box-shadow:0 0 0 3px rgba(201,137,63,.16); }
.status .muted { color: var(--ink-3); }
/* 「只读」胶囊：品牌绿描边，放右上导航位 */
.ro-chip {
  flex:0 0 auto;
  font-size:11.5px; letter-spacing:1px; padding:3px 11px; border-radius:999px;
  background: transparent; border:1px solid color-mix(in srgb, var(--green) 55%, transparent);
  color: var(--green);
}
.status-note {
  margin-top: 6px; font-size: 12px; line-height:1.45;
  color: var(--ink-3);
}
@media (prefers-color-scheme: dark){
  /* 深色模式头区沿用 paper(深绿)，字自动翻白；只读胶囊改用浅描边 */
  .ro-chip { border-color: rgba(233,242,236,.4); color: var(--green-ink); }
  .dot.on { background:#57d99a; }
}

/* ===================== 滚动主体 ===================== */
.scroll { flex:1; min-height:0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ===================== 客户列表 ===================== */
/* WhatsApp 列表为白底（会话页才是米色）；短列表也铺满白，下方不露米色。 */
.list { padding: 4px 0 calc(var(--safe-bot) + 20px); background: var(--card); min-height: 100%; }
.row {
  position: relative;
  display:flex; align-items:center; gap:13px;
  padding: 11px 16px; min-height: 72px;
  border:0; background: transparent;
  width:100%; text-align:left;
  transition: background .12s;
}
/* iOS 内缩分隔线：横线从文字处起，头像下方不画 */
.row::after {
  content:""; position:absolute; left: 81px; right:0; bottom:0;
  height:1px; background: var(--line);
}
.row:last-child::after { display:none; }
.row:active { background: var(--paper-2); }
.avatar {
  width:52px; height:52px; border-radius: 50%; flex:0 0 auto;
  display:grid; place-content:center;
  font-weight:600; font-size:16px; color:#fff; letter-spacing:.2px; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 1px rgba(0,0,0,.12);
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.07);
}
/* 苹果 Contacts 式单字母头像：淡竖向渐变正圆(上浅下深) + 白色半粗首字母。
   12 个雅色,按名字稳定取色;品牌绿不进头像。class 不用内联 style(守 CSP style-src 'self')。 */
.av0 { background: linear-gradient(180deg,#F27C7C,#E35151); } /* 红 */
.av1 { background: linear-gradient(180deg,#F5A95E,#EE8C39); } /* 橙 */
.av2 { background: linear-gradient(180deg,#E8BC53,#D9A630); } /* 金 */
.av3 { background: linear-gradient(180deg,#63C584,#40AF62); } /* 绿 */
.av4 { background: linear-gradient(180deg,#52C5C1,#2FABA8); } /* 青 */
.av5 { background: linear-gradient(180deg,#5FBAEA,#3B9FD6); } /* 天蓝 */
.av6 { background: linear-gradient(180deg,#7197F1,#4F7AE6); } /* 蓝 */
.av7 { background: linear-gradient(180deg,#8E8AE8,#6F6BDC); } /* 靛 */
.av8 { background: linear-gradient(180deg,#B380E2,#9A62D3); } /* 紫 */
.av9 { background: linear-gradient(180deg,#F088B7,#E8639E); } /* 粉 */
.av10{ background: linear-gradient(180deg,#CB9E78,#B6855C); } /* 棕 */
.av11{ background: linear-gradient(180deg,#9DA6B1,#828D9A); } /* 灰 */
/* 真头像（服务端 MOBILE_AVATAR 开后，data: URL 的 <img>）：盖满圆圈、裁成正圆；
   底下的末四位与色块保留作兜底——图片撤掉（解码失败）即回原样。 */
.avatar, .conv-av { position: relative; overflow: hidden; }
.av-img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; border-radius:50%; }
.has-img { color: transparent; text-shadow: none; }

.row-main { flex:1; min-width:0; }
.row-top { display:flex; align-items:baseline; gap:8px; }
.row-name { flex:0 0 auto; font-weight:600; font-size:17px; letter-spacing:-.2px; color:var(--ink); white-space:nowrap; }
/* 用户名：与编号同排、同字号（17px）；有名字才渲染。长名字截断不换行、不把右侧时间挤掉 */
.row-cust { flex:0 1 auto; min-width:0; font-size:17px; font-weight:400; letter-spacing:-.2px; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-time { margin-left:auto; font-size:13px; color:var(--ink-3); flex:0 0 auto; }
/* 备注：有才出一行灰色小字、超长截断（列表里不换行） */
.row-note { margin-top:2px; font-size:13px; color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.35; }
.row-prev { margin-top:4px; display:flex; align-items:center; gap:6px; }
.row-prev-text { font-size:15px; color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; line-height:1.35; }
.row-prev-text.unread { color:var(--ink); font-weight:600; }
.tag {
  font-size:11px; padding:1px 7px; border-radius:7px; flex:0 0 auto;
  background: var(--paper-2); color: var(--ink-2); border:1px solid var(--line);
}
.tag.dir-out { color: var(--ink-3); }
.flag { font-size:11px; color:var(--ink-3); letter-spacing:1px; flex:0 0 auto; }
.unread-pip { width:9px; height:9px; border-radius:50%; background:var(--accent); flex:0 0 auto; box-shadow:0 0 0 3px var(--accent-soft); }

/* ===================== 对话 ===================== */
.conv-head {
  padding: calc(var(--safe-top) + 8px) 12px 9px;
  position: sticky; top:0; z-index:20;
  background: var(--card);
  color: var(--ink);
  display:flex; align-items:center; gap:11px;
  border-bottom: 1px solid var(--line);
}
.conv-av {
  width:38px; height:38px; border-radius:50%; flex:0 0 auto;
  display:grid; place-content:center; font-weight:600; font-size:12.5px; color:#fff; letter-spacing:.2px; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.08);
}
.conv-id { min-width:0; flex:1 1 auto; }
/* 会话页备注：完整显示、可换行；很长时限高内部滚动，不把对话挤没 */
.conv-note { margin-top:2px; font-size:12.5px; color:var(--ink-3); line-height:1.4; white-space:pre-wrap; overflow-wrap:anywhere; max-height:5.6em; overflow-y:auto; }
.conv-note[hidden] { display:none; }
.conv-id .n { font-size:16.5px; font-weight:700; letter-spacing:-.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.conv-id .c { font-size:12.5px; color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.thread { padding: 16px 14px calc(var(--safe-bot) + 150px); display:flex; flex-direction:column; gap:3px; }
.loadmore {
  align-self:center; margin:4px 0 14px; padding:7px 16px; border-radius:999px;
  border:1px solid var(--line-2); background:var(--card); color:var(--ink-2); font-size:12.5px;
}
.daysep {
  align-self:center; margin:16px 0 10px; font-size:11.5px; color:var(--ink-2);
  background: var(--paper-2); border:1px solid var(--line);
  padding:3px 12px; border-radius:999px; letter-spacing:.5px;
}
/* 触顶加载更早历史：加载中指示 / 已到最早提示。
   三种顶部区（.loadmore / .hist-load / .hist-end）共用同一外框高度，互换时高度中性、不推挤内容（锚点不跳动）。 */
.hist-load, .hist-end {
  align-self:center; margin:4px 0 14px; padding:7px 16px;
  border:1px solid transparent; border-radius:999px; box-sizing:border-box;
  display:flex; align-items:center; gap:8px;
  font-size:12.5px; line-height:1.1; color:var(--ink-3);
}
.hist-load .spin { width:15px; height:15px; border-width:2px; }

.msg { display:flex; margin-top:6px; max-width:82%; }
.msg.in  { align-self:flex-start; }
.msg.out { align-self:flex-end; }
.bubble {
  padding:7px 10px 6px; border-radius: 18px;
  font-size:15.5px; line-height:1.42;
  word-break: break-word; overflow-wrap:anywhere;
  box-shadow: var(--shadow-s);               /* WhatsApp 式微投影，无描边 */
}
/* 尾角在顶部靠发信人一侧（对齐 WhatsApp） */
.msg.in  .bubble { background: var(--in-bubble);  border-top-left-radius:6px; }
.msg.out .bubble { background: var(--out-bubble); border-top-right-radius:6px; }

/* 双语单据：原文 + 译文面板 */
.orig { color: var(--ink); white-space:pre-wrap; }
.trans {
  margin-top:6px; padding-top:6px; border-top:1px solid color-mix(in srgb, var(--ink-3) 24%, transparent);
  color: var(--ink-3); white-space:pre-wrap; font-size:13.5px;
  position: relative;
}
.trans::before {
  content:"译"; position:absolute; top:-9px; left:0;
  background: var(--accent); color:#fff; font-size:10px; line-height:1;
  padding:3px 5px; border-radius:5px; letter-spacing:1px;
}
.trans.pending { color: var(--ink-3); font-style: italic; }
/* 出站消息下方那条是「我们记的中文原文」，不是译文：标签改「中文」、用中性色，和入站的橙色「译」区分(E-7 问题④) */
.trans.sent::before { content:"中文"; background: var(--ink-3); letter-spacing:0; }

/* 媒体占位卡 */
.media {
  display:flex; align-items:center; gap:10px; padding:11px 13px;
  border:1px dashed var(--line-2); border-radius: var(--radius-s); background: var(--paper-2);
  color: var(--ink-2); font-size:13.5px;
}
.media svg { width:22px; height:22px; flex:0 0 auto; opacity:.7; }
.media .media-label { font-weight:600; color:var(--ink); }
.media .hint { font-size:11.5px; color:var(--ink-3); margin-top:1px; }

/* 图片 / 文件（电脑已传上来的）：缩略图框固定尺寸，加载前后高度不变 → 会话不跳动 */
.bubble.has-media { padding:4px 4px 5px; }
.bubble.has-media .msg-time { padding:0 6px; margin-top:4px; }
.mthumb {
  display:grid; place-content:center; justify-items:center; gap:2px;
  width:min(240px, 62vw); height:200px; padding:0; border:0; border-radius:14px; overflow:hidden;
  background: var(--paper-2); color: var(--ink-3); font: inherit; cursor:pointer;
}
.mthumb svg { opacity:.5; }
.mthumb img { width:100%; height:100%; object-fit:cover; display:block; }
.mthumb.ok { display:block; }
.mthumb .mthumb-label { font-size:13.5px; color: var(--ink-2); }
.mthumb .hint { font-size:11.5px; color: var(--ink-3); }
.mdoc { display:flex; flex-direction:column; gap:4px; width:min(240px, 62vw); }
.mdoc .mthumb { width:100%; height:200px; }
/* 按「文件」发的图片：只显示图片；预览失败时才露出文件卡片（照样能下载） */
.mdoc .mfile { display:none; }
.mdoc.preview-err .mfile { display:flex; }
.mfile { width:min(240px, 62vw); text-align:left; font: inherit; cursor:pointer; border-style:solid; }
.mdoc .mfile { width:100%; }
.mfile-main { min-width:0; flex:1 1 auto; }
.mfile-name { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:14px; }
.mfile.busy { opacity:.6; }
/* 大图：全屏黑底，默认完整显示（contain）；点图片切到 2.5 倍、可拖动（.zoomed），再点还原 */
.mviewer {
  position:fixed; inset:0; z-index:80; background:#000;
  animation: ovfade .15s ease;
}
.mviewer-stage {
  position:absolute; inset:0; padding: var(--safe-top) 0 var(--safe-bot);
  display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.mviewer-stage img { max-width:100%; max-height:100%; object-fit:contain; cursor:zoom-in; }
.mviewer.zoomed .mviewer-stage {
  display:block; overflow:auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y;
}
.mviewer.zoomed .mviewer-stage img { display:block; width:250%; max-width:none; max-height:none; height:auto; cursor:zoom-out; }
.mviewer-bar {
  position:absolute; top: calc(var(--safe-top) + 10px); right:12px; z-index:1;
  display:flex; gap:10px;
}
.mviewer-btn {
  width:40px; height:40px; border-radius:50%; border:0; display:grid; place-content:center;
  background: rgba(255,255,255,.16); color:#fff; cursor:pointer;
}
.mviewer-btn.busy { opacity:.45; }
.mviewer-btn.err { background: rgba(220,60,60,.55); }

/* 时间：小号灰字，放进气泡右下角（对齐 WhatsApp） */
.msg-time { display:block; text-align:right; font-size:11px; color:var(--ink-3); margin-top:2px; line-height:1; }

/* 底部动作区（拇指区，第一期只放"翻译这条"占位） */
.dock {
  position: fixed; left:50%; transform:translateX(-50%); bottom:0;
  width:100%; max-width:480px;
  padding:14px 14px calc(var(--safe-bot) + 12px);
  background: linear-gradient(to top, var(--paper) 86%, transparent);
  display:flex; flex-direction:column; gap:8px; align-items:stretch; z-index:15;
}
.ro-note { display:flex; align-items:center; justify-content:center; gap:6px; font-size:12px; color:var(--ink-3); }
.ro-note svg { width:15px; height:15px; opacity:.75; flex:0 0 auto; }
.btn {
  flex:1; min-height:50px; border-radius:14px; border:1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-size:15px; font-weight:600;
  box-shadow: var(--shadow-s); transition: transform .1s, opacity .15s;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn.primary { background: var(--accent); color:#fff; border-color: transparent; }
.btn[disabled] { opacity:.45; }
.btn .sub { display:block; font-weight:400; font-size:11px; opacity:.7; margin-top:1px; }

/* ===================== 回复（能力开着时的底部输入区；fail-closed，关着时整段不出现） ===================== */
/* 开 compose 时底部留出空间，最后一条（含回复气泡）不被固定输入区盖住。
   回复状态已移进时间线，dock 只剩「暂停横幅 + 一行提示 + 输入框」，故比旧的 248px 矮。 */
.thread.compose { padding-bottom: calc(var(--safe-bot) + 150px); }
.dock.compose { gap: 8px; }

/* 安全阀暂停：输入框上方醒目提示 */
.reply-halt {
  padding: 9px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--danger) 36%, transparent);
  color: var(--danger); font-size: 12.5px; line-height: 1.5; text-align: center;
}

/* 手机回复气泡：排进对话时间线（出站侧）。用卡片底 + 绿描边 + 「手机回复」小标签，
   和员工绿气泡（.msg.out .bubble = --out-bubble）、客户气泡（.msg.in）区分开。 */
.msg.out.reply .bubble {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-s);
}
.reply-tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  color: var(--accent); margin-bottom: 3px;
}
.reply-status { margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; font-size: 12px; }
.reply-state-label { font-weight: 700; letter-spacing: .2px; }
.reply-row-guide { color: var(--ink-3); font-weight: 400; font-size: 12px; }
/* 各状态的小圆点 + 标签色（走令牌，深浅自动） */
.reply-state-label::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle; background: currentColor;
}
.reply-status.st-pending .reply-state-label { color: var(--ink-3); }
.reply-status.st-sending .reply-state-label { color: var(--accent); }
.reply-status.st-sent    .reply-state-label { color: var(--ok); }
.reply-status.st-maybe   .reply-state-label { color: #C9893F; }      /* 暖黄：可能已发 */
.reply-status.st-notsent .reply-state-label { color: var(--danger); }
.reply-resend {
  margin-left: auto; min-height: 30px; padding: 0 13px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink);
  font-size: 12.5px; font-weight: 600;
}
.reply-resend:active { transform: scale(.96); background: var(--line); }

/* 输入框下方一行临时提示（发送失败 / 待确认等） */
.composer-note { font-size: 12px; color: var(--danger); padding: 0 4px; line-height: 1.5; }

/* 输入框 + 发送键（WhatsApp 式：圆角输入 + 绿色圆形发送） */
.composer { display: flex; align-items: flex-end; gap: 9px; }
.reply-input {
  flex: 1; min-width: 0;
  min-height: 46px; max-height: 120px; resize: none;
  padding: 12px 15px; border-radius: 22px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 15.5px; line-height: 1.35;
}
.reply-input:focus { border-color: var(--accent); outline: none; }
.reply-input:disabled { opacity: .55; }
.reply-input::placeholder { color: var(--ink-3); }
.send-btn {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff;
  display: grid; place-content: center;
  box-shadow: var(--shadow-s); transition: transform .1s, opacity .15s;
}
.send-btn svg { width: 20px; height: 20px; display: block; }
.send-btn:active { transform: scale(.92); }
.send-btn[disabled] { opacity: .4; }

/* ===================== 登录 ===================== */
.login { flex:1; display:flex; flex-direction:column; padding: calc(var(--safe-top) + 8vh) 26px calc(var(--safe-bot) + 26px); }
.brand { margin-bottom: 7vh; }
.brand-logo { width:64px; height:64px; border-radius:15px; display:block; margin-bottom:16px; box-shadow: 0 6px 18px rgba(6,32,28,.18); }
.brand .mk { font-size:30px; font-weight:800; letter-spacing:2px; }
.brand .en { font-size:11px; letter-spacing:5px; color:var(--ink-3); text-transform:uppercase; margin-top:4px; }
.brand .tag2 { margin-top:16px; color:var(--ink-2); font-size:14px; max-width:16em; line-height:1.6; }

.seg { display:flex; background:var(--paper-2); border:1px solid var(--line); border-radius:12px; padding:3px; margin-bottom:18px; }
.seg button { flex:1; border:0; background:transparent; padding:9px 0; border-radius:9px; font-size:14px; color:var(--ink-2); font-weight:600; }
.seg button.on { background:var(--card); color:var(--ink); box-shadow: var(--shadow-s); }

.field { margin-bottom:14px; }
.field label { display:block; font-size:12px; color:var(--ink-2); margin-bottom:6px; letter-spacing:.5px; }
.inp {
  width:100%; min-height:52px; border-radius:13px; border:1px solid var(--line-2);
  background:var(--card); color:var(--ink); font-size:16px; padding:0 15px;
}
.inp:focus { border-color: var(--accent); }
.code-row { display:flex; gap:10px; }
.code-row .inp { flex:1; }
.sendcode {
  flex:0 0 auto; min-width:118px; border-radius:13px; border:1px solid var(--line-2);
  background:var(--paper-2); color:var(--ink); font-size:14px; font-weight:600; padding:0 12px;
}
.sendcode[disabled] { color: var(--ink-3); }

.login-btn { margin-top:10px; width:100%; min-height:54px; border-radius:14px; border:0; background:var(--accent); color:#fff; font-size:17px; font-weight:700; box-shadow: var(--shadow); }
.login-btn[disabled] { opacity:.5; }
.login-note {
  margin: 2px 0 2px; padding:11px 13px 11px 14px; border-radius:12px;
  background:var(--paper-2); border:1px solid var(--line-2); border-left:3px solid var(--accent);
  color:var(--ink-2); font-size:12.5px; line-height:1.6;
}
.login-note-t { font-weight:700; color:var(--ink); margin-bottom:3px; }
.login-foot { margin-top:18px; text-align:center; font-size:12.5px; color:var(--ink-3); line-height:1.7; }

/* ===================== 扫码 / 输码配对（Q-3b）===================== */
/* 内置浏览器里带 #pair 的引导块（去手机自带浏览器打开）——醒目一点，放登录表单上方 */
.pair-inapp {
  margin: 4px 0 20px; padding: 14px 15px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.pair-inapp-t { font-size:15px; font-weight:700; color:var(--ink); margin-bottom:6px; }
.pair-inapp-s { font-size:12.5px; line-height:1.6; color:var(--ink-2); margin-top:4px; }

/* 手输 8 位码小节（放验证码登录下面） */
.pair-code { margin-top:26px; padding-top:20px; border-top:1px solid var(--line); }
.pair-title { font-size:15px; font-weight:700; color:var(--ink); margin-bottom:5px; }
.pair-note { font-size:12.5px; line-height:1.6; color:var(--ink-3); margin-bottom:12px; }
.pair-code .inp { letter-spacing:4px; font-size:18px; text-align:center; }

/* ===================== 通用：提示/空/错误 ===================== */
.msgbar {
  margin:10px 16px; padding:11px 13px; border-radius:11px; font-size:13.5px; line-height:1.5;
  border:1px solid; display:flex; gap:9px; align-items:flex-start;
}
.msgbar.err  { background: #fdece8; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.msgbar.info { background: var(--paper-2); color: var(--ink-2); border-color: var(--line); }
@media (prefers-color-scheme: dark){ .msgbar.err { background: color-mix(in srgb, var(--danger) 16%, transparent); } }

.empty { text-align:center; color:var(--ink-3); padding: 18vh 30px; }
.empty .big { font-size:17px; color:var(--ink-2); margin-bottom:8px; }
.empty .sm { font-size:13px; line-height:1.7; }

.spin { width:22px; height:22px; border-radius:50%; border:2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display:grid; place-content:center; padding: 24vh 0; }

/* 骨架（首屏列表） */
.sk { padding:14px 16px; display:flex; gap:14px; align-items:center; border-bottom:1px solid var(--line); }
.sk .b { background: linear-gradient(90deg,var(--paper-2),var(--line),var(--paper-2)); background-size:200% 100%; animation: sheen 1.3s linear infinite; border-radius:8px; }
.sk .av { width:46px; height:46px; border-radius:13px; }
.sk .l1 { height:13px; width:45%; } .sk .l2 { height:11px; width:70%; margin-top:8px; }
@keyframes sheen { to { background-position:-200% 0; } }

/* ===================== 设置面板（齿轮打开；底部动作表，iOS 风） ===================== */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6,32,28,.28);
  display: flex; align-items: flex-end; justify-content: center;
  animation: ovfade .18s ease;
}
@keyframes ovfade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 480px;
  padding: 14px 12px calc(var(--safe-bot) + 12px);
  background: var(--paper);
  border-top-left-radius: 20px; border-top-right-radius: 20px;
  box-shadow: 0 -8px 40px rgba(6,32,28,.22);
  display: flex; flex-direction: column; gap: 8px;
  animation: sheetup .22s cubic-bezier(.22,.61,.36,1);
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-title { text-align: center; font-size: 15px; font-weight: 700; color: var(--ink); padding: 4px 0 2px; }
.sheet-note { text-align: center; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); padding: 0 14px 8px; }
.sheet-item {
  width: 100%; min-height: 52px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .1s;
}
.sheet-item:active { transform: scale(.985); background: var(--paper-2); }
.sheet-item.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* ===================== 设备待确认屏 ===================== */
.pending {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px;
  padding: calc(var(--safe-top) + 10vh) 32px calc(var(--safe-bot) + 32px);
}
.pending .brand-logo { margin: 0 0 4px; }
.pending-title { font-size: 20px; font-weight: 800; letter-spacing: -.2px; color: var(--ink); }
.pending-text { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); max-width: 18em; }
.pending-wait { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.pending-logout {
  margin-top: 10px; border: 0; background: transparent;
  color: var(--ink-3); font-size: 13.5px; text-decoration: underline; padding: 8px 14px;
}

/* ===================== 「加到主屏幕」首次引导（iOS Safari 非 standalone 时一次性） ===================== */
.a2hs {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bot) + 12px);
  z-index: 55;                                  /* 在 dock(15) 之上、设置浮层(60) 之下 */
  width: calc(100% - 24px); max-width: 456px;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px 11px 13px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow);
  animation: a2hsin .24s cubic-bezier(.22,.61,.36,1);
}
@keyframes a2hsin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.a2hs-ic {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-content: center;
  background: var(--paper-2); color: var(--green);
}
.a2hs-ic svg { width: 20px; height: 20px; display: block; }
.a2hs-txt { flex: 1; min-width: 0; }
.a2hs-t { font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.a2hs-s { margin-top: 2px; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.a2hs-x {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--paper-2); color: var(--ink-2);
  display: grid; place-content: center;
}
.a2hs-x:active { transform: scale(.9); }
.a2hs-x svg { width: 16px; height: 16px; display: block; }

@media (prefers-reduced-motion: reduce){ *{animation:none!important; transition:none!important;} }
