/* ===== 凯盛接待后台 · v0.5.0 界面（苹果极简风格） ===== */
* { box-sizing: border-box; }
:root {
  --bg: #f5f5f7; --panel: #fff; --line: rgba(0,0,0,.08); --line-2: #d2d2d7;
  --text: #1d1d1f; --text-2: #424245; --muted: #86868b;
  --brand: #128c7e; --brand-2: #0e7468; --brand-soft: #e7f4f2;
  --danger: #e5484d; --danger-soft: #fdeeee; --warn: #b26a00; --warn-soft: #fff4e0; --ok: #1a7f4b; --ok-soft: #e6f6ec;
  --cust: #ffffff; --ai: #e8f1fd; --human: #d9fdd3; --blocked: #fdeeee;
  --r: 12px; --r-s: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-pop: 0 10px 30px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.05);
  --side: 216px;
}
/* 字号只用 4 档：20 标题 / 16 小标题 / 14 正文 / 12 说明 */
body { margin: 0; font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Text", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; cursor: pointer; }
h2 { margin: 0 0 16px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
h3 { margin: 20px 0 10px; font-size: 16px; font-weight: 600; }
.panel > h3:first-child, .panel > h2:first-child { margin-top: 0; }
p { margin: 8px 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }

/* 按钮：次要 = 浅灰底；主要 = 品牌绿；危险 = 红字 */
button { font: inherit; font-size: 14px; cursor: pointer; border: 0; background: #ececf0; color: var(--text); border-radius: var(--r-s); padding: 0 14px; height: 32px; line-height: 32px; white-space: nowrap; transition: background .15s, opacity .15s; }
button:hover { background: #e2e2e7; }
button.primary { background: var(--brand); color: #fff; font-weight: 500; }
button.primary:hover { background: var(--brand-2); }
button.danger { background: var(--danger-soft); color: var(--danger); }
button.danger:hover { background: #fbdcdc; }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-s); padding: 6px 10px; background: #fff; width: 100%; min-height: 34px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(18,140,126,.15); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type=file] { border: 0; padding: 0; min-height: 0; font-size: 12px; }
select { appearance: none; -webkit-appearance: none; padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2386868b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center; }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; margin: 14px 0 6px; color: var(--text-2); font-size: 14px; }
pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ===== 框架：左侧菜单 + 内容 ===== */
.shell { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: rgba(250,250,252,.92); backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 30; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; font-weight: 600; font-size: 16px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.sidenav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.sidenav .grp { margin-top: 14px; }
.sidenav .gt { font-size: 12px; color: var(--muted); padding: 0 10px 4px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0; border-radius: var(--r-s); color: var(--text); }
.sidenav a:hover { background: rgba(0,0,0,.04); }
.sidenav a.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 500; }
.sidenav a .t { flex: 1; }
.ic { width: 18px; height: 18px; flex: none; }
.sidenav a .ic { color: var(--muted); }
.sidenav a.active .ic { color: var(--brand); }
.me { display: flex; align-items: center; gap: 10px; margin: 8px 10px 12px; padding: 8px 10px; border-radius: var(--r-s); cursor: pointer; }
.me:hover { background: rgba(0,0,0,.04); }
.me .who { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me .who b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { font-size: 12px; color: var(--muted); }
.me .ic { color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #d8ece9; color: var(--brand-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; cursor: pointer; }
.menu { position: fixed; left: 12px; bottom: 64px; width: 200px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; }
.menu.from-top { left: auto; right: 12px; top: 52px; bottom: auto; }
.menu .mhead { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.menu a:hover { background: rgba(0,0,0,.04); }
.menu a.danger { color: var(--danger); }
.mainwrap { flex: 1; margin-left: var(--side); min-width: 0; }
main { padding: 24px 28px 40px; }
.mtop, .subnav, .tabbar { display: none; }
.unread { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center; background: var(--brand); color: #fff; border-radius: 9px; padding: 0 5px; font-size: 12px; font-weight: 500; margin-left: 6px; }
.unread.red { background: var(--danger); }

/* 卡片 */
.panel { background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.chat-layout .panel + .panel, .assets .panel + .panel { margin-top: 0; }
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pagehead h2 { margin: 0; flex: 1; }

/* 表格：只留横向细线 */
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }

/* 状态标签：柔和色块 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; line-height: 20px; background: #f0f0f3; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.badge.online { background: var(--ok-soft); color: var(--ok); }
.badge.offline, .badge.unbound { background: var(--danger-soft); color: var(--danger); }
.badge.qr { background: var(--warn-soft); color: var(--warn); }
.badge.ai { background: var(--ai); color: #1d5fa8; }
.badge.human { background: #e3f7df; color: #2f6b1f; }
.badge.A { background: #fde2e1; color: #b42318; }
.badge.B { background: var(--warn-soft); color: var(--warn); }
.badge.C { background: #f0f0f3; }
.badge.D { background: #f5f5f7; color: var(--muted); }
.badge.wl { background: #fff; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); margin-top: 2px; font-weight: 400; }

/* 登录 */
.login { max-width: 360px; margin: 14vh auto; padding: 32px 28px; }
.login h2 { text-align: center; }
.login button.primary { height: 40px; font-size: 16px; }

/* ===== 会话页 ===== */
main.page-chats { padding: 16px; }
.chat-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 12px; height: calc(100vh - 32px); }
.list { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.list .filters { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.list .filters .row { gap: 6px; }
.list .filters select { min-height: 32px; font-size: 12px; padding: 4px 24px 4px 8px; background-position: right 8px center; }
.list .filters #fq { background: #f2f2f5; border-color: transparent; }
.list .filters #fq:focus { background: #fff; border-color: var(--brand); }
#batchbar { font-size: 12px; color: var(--muted); }
#batchbar label { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
#batchbar button { height: 26px; line-height: 26px; font-size: 12px; padding: 0 10px; }
.list .items { overflow-y: auto; flex: 1; padding: 4px 6px; }
.item { padding: 10px; border-radius: 10px; cursor: pointer; margin: 2px 0; }
.item:hover { background: #f5f5f7; }
.item.active { background: var(--brand-soft); }
.item .l1 { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.item .l1 b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .l2 { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item .l2:last-child { color: var(--text-2); }
.conv { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.conv .head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 56px; }
.conv .head .hwho { display: flex; flex-direction: column; line-height: 1.3; margin-right: 4px; }
.conv .head .hwho b { font-size: 16px; font-weight: 600; }
.conv .head button { height: 30px; line-height: 30px; font-size: 12px; padding: 0 12px; }
.mback, .mcard, .mclose { display: none !important; }
.conv .msgs { flex: 1; overflow-y: auto; padding: 16px 18px; background: #f2f2f5; }
.conv-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.conv-empty .ic { width: 40px; height: 40px; color: #c7c7cc; }
.msg { max-width: 70%; width: fit-content; margin: 8px 0; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.04); line-height: 1.5; }
.msg.customer { background: var(--cust); border-bottom-left-radius: 4px; }
.msg.ai { background: var(--ai); margin-left: auto; border-bottom-right-radius: 4px; }
.msg.human { background: var(--human); margin-left: auto; border-bottom-right-radius: 4px; }
.msg.blocked { background: var(--blocked); box-shadow: inset 0 0 0 1px #f3b4b6; margin-left: auto; }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 10px; justify-content: flex-end; white-space: normal; }
.msg .meta > * { white-space: nowrap; }
.msg .meta a { color: var(--muted); }
.msg .meta a:hover { color: var(--brand); }
.msg img { max-width: 240px; max-height: 240px; display: block; border-radius: 10px; margin-bottom: 4px; }
.msg video { max-width: 280px; max-height: 320px; border-radius: 10px; }
.msg audio { width: 240px; }
.msg .zh { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(0,0,0,.06); font-size: 12px; color: var(--text-2); }
.msg.revoked { box-shadow: inset 0 0 0 1.5px var(--danger); opacity: .85; }
.flag-revoked { font-size: 12px; color: var(--danger); font-weight: 600; margin-bottom: 4px; }
.flag-edited { font-size: 12px; color: var(--warn); margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(0,0,0,.06); }
.send-wrap { border-top: 1px solid var(--line); background: #fff; }
.send-tools { display: flex; align-items: center; gap: 12px; padding: 8px 14px 0; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.send-tools label { font-size: 12px; color: var(--muted) !important; display: flex; align-items: center; gap: 6px; }
.send-tools button { height: 28px; line-height: 28px; padding: 0 8px; font-size: 16px; background: transparent; }
.send-tools button:hover { background: #f2f2f5; }
.send-tools a { cursor: pointer; }
.conv .send { padding: 8px 14px 12px; display: flex; gap: 8px; align-items: flex-end; }
.conv .send textarea { min-height: 40px; max-height: 140px; background: #f2f2f5; border-color: transparent; border-radius: 18px; padding: 9px 14px; }
.conv .send textarea:focus { background: #fff; border-color: var(--brand); }
.conv .send button { height: 40px; border-radius: 20px; padding: 0 18px; }
.emopanel { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 14px; max-width: 440px; }
.emopanel span { font-size: 20px; cursor: pointer; padding: 3px; border-radius: 6px; }
.emopanel span:hover { background: #f2f2f5; }
.card { overflow-y: auto; }
.cardhead { display: flex; align-items: center; margin-bottom: 12px; }
.cardhead h3 { margin: 0; flex: 1; }
.card dl { margin: 0; display: grid; grid-template-columns: 72px 1fr; gap: 10px 10px; align-items: center; }
.card dt { color: var(--muted); font-size: 12px; }
.card dd { margin: 0; min-width: 0; }
.card dd input, .card dd select { min-height: 30px; padding: 4px 8px; }
.card dd select { padding-right: 24px; }
.card dd label { font-size: 12px; display: flex; gap: 6px; align-items: center; }
.card > label { margin-top: 16px; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* 下拉菜单（导出） */
.dropdown { position: relative; display: inline-block; }
.dropmenu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border-radius: 10px; box-shadow: var(--shadow-pop); min-width: 280px; padding: 6px; }
.dropmenu a { display: block; padding: 8px 10px; color: var(--text); border-radius: 6px; cursor: pointer; white-space: nowrap; }
.dropmenu a:hover { background: #f2f2f5; }

/* ===== 设置页：分小页 ===== */
.settings { max-width: 760px; padding-bottom: 72px; }
.seg { display: inline-flex; background: #e8e8ed; border-radius: 9px; padding: 2px; margin-bottom: 16px; flex-wrap: wrap; }
.seg a { padding: 5px 16px; border-radius: 7px; color: var(--text); font-size: 14px; cursor: pointer; }
.seg a.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.1); font-weight: 500; }
.setsec .panel h3 { margin-top: 0; }
.setsec select { max-width: 420px; }
.setsec .panel > input, .setsec .panel > .row, .setsec .panel > textarea { max-width: 560px; }
.setsec .panel > input[type=number] { max-width: 200px; }
.savebar { position: fixed; left: var(--side); right: 0; bottom: 0; background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); padding: 10px 28px; display: flex; align-items: center; gap: 12px; justify-content: flex-end; z-index: 20; }
table.keys td { vertical-align: top; padding: 12px 8px; }
table.keys td:first-child { padding-left: 0; }
table.keys input { flex: 1; }

/* 号码页、素材库 */
.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.numbers .panel + .panel { margin-top: 0; }
.qr-img { width: 280px; height: 280px; display: block; margin: 10px auto; }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.panel.asset { padding: 12px; margin: 0; }

/* 弹窗、提示 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.28); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 70; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: min(500px, 92vw); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-pop); }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: rgba(29,29,31,.92); color: #fff; padding: 10px 18px; border-radius: 20px; z-index: 80; font-size: 14px; max-width: 90vw; }
#pops { position: fixed; top: 16px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: 320px; }
.pop { background: #fff; border-radius: 12px; padding: 12px 30px 12px 14px; box-shadow: var(--shadow-pop); cursor: pointer; position: relative; font-size: 14px; border-left: 4px solid #25d366; }
.pop.handoff { border-left-color: var(--danger); }
.pop div { color: var(--text-2); margin-top: 4px; word-break: break-word; font-size: 12px; }
.pop .x { position: absolute; right: 10px; top: 6px; color: var(--muted); font-size: 16px; }
.newver { background: var(--warn-soft); color: #7a5200; padding: 8px 16px; text-align: center; font-size: 14px; }
.newver a { font-weight: 600; cursor: pointer; text-decoration: underline; color: inherit; }
.hidden.newver { display: none; }


/* ===== v0.5.0 第二步：各页面通用 ===== */
.narrow { max-width: 760px; }
.mid { max-width: 1000px; }
.wide { max-width: 1200px; }
.pagehead select { width: auto; }
h3 .count, h2 .count { font-size: 12px; font-weight: 500; color: var(--muted); background: #f0f0f3; border-radius: 10px; padding: 1px 8px; margin-left: 8px; vertical-align: 2px; }
.notice { border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.trainbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.trainbar .seg { margin-bottom: 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; background: #f2f2f5; padding: 1px 5px; border-radius: 4px; }
.ctx { color: var(--muted); }
.ctx-hit { background: var(--warn-soft); border-radius: 4px; padding: 1px 4px; font-weight: 600; color: var(--text); }

/* 号码卡片 */
.numbers .panel { display: flex; flex-direction: column; }
.kv { margin-top: 12px; color: var(--text-2); line-height: 1.9; flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.actions button { height: 30px; line-height: 30px; font-size: 12px; padding: 0 12px; }

/* 开关（iOS 样式） */
input.toggle { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 12px; background: #e2e2e7; position: relative; cursor: pointer; border: 0; flex: none; transition: background .2s; margin: 0; padding: 0; min-height: 0; box-shadow: none; }
input.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
input.toggle:checked { background: var(--brand); }
input.toggle:checked::after { transform: translateX(16px); }
input.toggle:disabled { opacity: .5; cursor: default; }
input.toggle:focus { box-shadow: 0 0 0 3px rgba(18,140,126,.15); }
.switches { margin: 6px 0 4px; }
label.sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); cursor: pointer; }
.switches label.sw:last-child { border-bottom: 0; }
label.sw.inline { border: 0; padding: 0 4px; font-size: 14px; justify-content: flex-start; }

/* 登录 */
.login-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.login-logo .logo { width: 48px; height: 48px; border-radius: 12px; font-size: 22px; }

/* v0.6.0 广告效果 */
.badge.ad { background: #f3ecfd; color: #6b3fb5; font-weight: 400; }
.filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filterbar .seg { margin-bottom: 0; }
.filterbar input[type=date], .filterbar select { width: auto; }
table.adtable td { vertical-align: middle; }
table.adtable tr.total td { font-weight: 600; border-top: 1px solid var(--line-2); }
.list .filters .row select { min-width: 0; }

/* v0.6.0 上传进度 */
.upbar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(560px, 92vw); background: rgba(29,29,31,.94); color: #fff; border-radius: 14px; padding: 12px 16px; z-index: 85; font-size: 14px; box-shadow: var(--shadow-pop); }
.upbar.err { background: var(--danger); }
.upbar .ub { height: 6px; background: rgba(255,255,255,.2); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.upbar .ub i { display: block; height: 100%; background: #34c759; border-radius: 3px; transition: width .3s; }

/* v0.6.0 规则（训练）页 */
.flow { display: flex; align-items: stretch; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.flow .fs { flex: 1; min-width: 150px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.flow .fs b { font-size: 14px; }
.flow .fs .fd { font-size: 12px; color: var(--muted); line-height: 1.4; }
.flow .fn { width: 22px; height: 22px; border-radius: 50%; background: #ececf0; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.flow .fs.now { box-shadow: 0 0 0 2px var(--brand); }
.flow .fs.now .fn { background: var(--brand); color: #fff; }
.flow .fs.done .fn { background: var(--ok-soft); color: var(--ok); }
.flow .fa { align-self: center; color: #c7c7cc; font-size: 20px; }
.vops { white-space: nowrap; }
.vops button { height: 30px; line-height: 30px; font-size: 12px; padding: 0 12px; }
.vops .dropmenu { min-width: 160px; }
.vops .dropmenu a.danger { color: var(--danger); }
.checkbox { border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: #f5f5f7; }
.checkbox.ok { background: var(--ok-soft); color: var(--ok); }
.checkbox.warn { background: var(--warn-soft); }
.checkbox ul, ul.issues { margin: 8px 0; padding-left: 18px; }
.checkbox li, ul.issues li { margin: 8px 0; font-size: 14px; line-height: 1.5; }
.quote { font-weight: 500; }


/* ===== v0.6.1：中文弹窗、日期、选文件、逐条翻译 ===== */
.dlg { z-index: 78; }
.dlg-box { width: min(420px, 90vw); padding: 22px 22px 18px; }
.dlg-msg { font-size: 15px; line-height: 1.6; color: var(--text); margin-bottom: 14px; word-break: break-word; }
.dlg-box input { margin-bottom: 14px; }
.dlg-btns { justify-content: flex-end; gap: 8px; }
.dlg-btns button { min-width: 72px; }
input.dpick { cursor: pointer; background-image: linear-gradient(transparent, transparent); }
.dpbox { position: fixed; z-index: 85; width: 280px; background: #fff; border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 12px; user-select: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head b { font-size: 15px; font-weight: 600; }
.dp-head a { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 20px; color: var(--text); cursor: pointer; }
.dp-head a:hover { background: #f2f2f5; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-wk span { font-size: 12px; color: var(--muted); padding: 4px 0; }
.dp-grid a { display: block; padding: 7px 0; border-radius: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.dp-grid a:hover { background: #f2f2f5; }
.dp-grid a.today { color: var(--brand); font-weight: 600; }
.dp-grid a.sel { background: var(--brand); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.dp-foot a { font-size: 14px; color: var(--brand); cursor: pointer; padding: 4px 6px; }
.fpick { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.send-tools .fpick-btn { font-size: 12px; height: 28px; padding: 0 10px; background: #f2f2f5; border-radius: 14px; color: var(--text-2); }
.fpick-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text); }
.fpick-x { cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 4px; }
.fpick-x:hover { color: var(--danger); }
.msg .meta a.trone { color: var(--brand); cursor: pointer; }
.send-tools b#trlang { font-weight: 600; color: var(--text-2); }
.conv .send .mtools { display: none; }

/* ===== 手机（900px 以下） ===== */
@media (max-width: 900px) {
  /* 聊天发送框：小工具收进“＋” */
  .send-tools { display: none; padding: 10px 14px 0; gap: 10px 14px; }
  .send-wrap.tools-open .send-tools { display: flex; }
  .send-wrap.has-file:not(.tools-open) .send-tools { display: flex; }
  .send-wrap.has-file:not(.tools-open) .send-tools > :not(.fpick) { display: none; }
  .send-tools label, .send-tools a { font-size: 14px; }
  .send-tools .fpick-btn { font-size: 14px; height: 32px; }
  .fpick-name { max-width: 50vw; font-size: 13px; }
  .conv .send { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .conv .send .mtools { display: flex; align-items: center; justify-content: center; flex: none; width: 40px; padding: 0; font-size: 22px; background: #f2f2f5; }
  .send-wrap.tools-open .mtools { background: var(--brand-soft); color: var(--brand); }
  .conv .send textarea { font-size: 16px; }
  .msg .meta a.trone { padding: 2px 10px; border-radius: 10px; background: var(--brand-soft); }
  .dpbox.dp-sheet { left: 0; right: 0; bottom: 0; width: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dp-sheet .dp-grid a { padding: 11px 0; font-size: 16px; }
  .dlg { align-items: flex-end; }
  .dlg-box { width: 100vw; border-radius: 16px 16px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .dlg-btns button { flex: 1; height: 44px; }
  .side { display: none; }
  .mainwrap { margin-left: 0; padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .mtop { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 25; height: 48px; padding: 0 16px; background: rgba(250,250,252,.9); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
  .mtop b { font-size: 16px; font-weight: 600; }
  .subnav { display: flex; gap: 6px; padding: 10px 12px 0; overflow-x: auto; }
  .subnav a { flex: none; padding: 5px 14px; border-radius: 16px; background: #e8e8ed; color: var(--text); font-size: 14px; }
  .subnav a.active { background: var(--text); color: #fff; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(250,250,252,.94); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 5px; font-size: 12px; color: var(--muted); position: relative; }
  .tabbar a .ic { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar .unread { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
  main { padding: 12px; }
  .panel { padding: 16px; }
  .menu { left: auto; right: 12px; top: 52px; bottom: auto; }
  .savebar { left: 0; bottom: calc(56px + env(safe-area-inset-bottom)); padding: 10px 16px; }
  .savebar .muted { display: none; }
  .seg { display: flex; overflow-x: auto; flex-wrap: nowrap; }
  .seg a { flex: none; padding: 5px 12px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table > tbody { display: table; width: 100%; min-width: 720px; }
  table.keys > tbody { min-width: 0; }

  /* 会话页：列表 → 点进去整屏聊天 → 资料从右边滑出 */
  main.page-chats { padding: 0; }
  .page-chats .chat-layout { display: block; height: calc(100vh - 48px - 46px - 56px - env(safe-area-inset-bottom)); height: calc(100dvh - 48px - 46px - 56px - env(safe-area-inset-bottom)); position: relative; margin-top: 10px; }
  .chat-layout .list, .chat-layout .conv { height: 100%; border-radius: 0; box-shadow: none; padding: 0; }
  .pagehead h2 { display: none; }
  .pagehead:not(:has(button, select)) { display: none; }
  .pagehead { justify-content: flex-end; margin-bottom: 12px; }
  .trainbar .muted { display: none; }
  .flow .fa { display: none; }
  .flow .fs { min-width: 46%; }
  .chat-layout .conv, .chat-layout.has-chat .list { display: none; }
  .chat-layout.has-chat .conv { display: flex; }
  .chat-layout .card { display: none; }
  .chat-layout.show-card .card { display: block; position: fixed; inset: 0 0 0 auto; width: min(360px, 92vw); z-index: 65; border-radius: 0; box-shadow: var(--shadow-pop); animation: slidein .2s ease-out; padding-bottom: 40px; }
  @keyframes slidein { from { transform: translateX(100%); } to { transform: none; } }
  .mback { display: inline-flex !important; align-items: center; justify-content: center; font-size: 28px; line-height: 1; width: 28px; height: 32px; color: var(--brand); margin-left: -6px; }
  .mcard { display: inline-block !important; }
  .mclose { display: inline !important; font-weight: 500; }
  .conv .head { padding: 8px 12px; gap: 6px; }
  .conv .head .hwho b { font-size: 14px; }
  .msg { max-width: 86%; }
  #pops { top: 56px; right: 8px; left: 8px; width: auto; }
  .upbar { bottom: calc(68px + env(safe-area-inset-bottom)); }
  /* 打开聊天时整屏：藏掉小菜单和底部栏 */
  .shell:has(.chat-layout.has-chat) .subnav, .shell:has(.chat-layout.has-chat) .tabbar { display: none; }
  .shell:has(.chat-layout.has-chat) .mainwrap { padding-bottom: 0; }
  .page-chats .chat-layout.has-chat { height: calc(100vh - 48px); height: calc(100dvh - 48px); margin-top: 0; }
}
