:root{
  --blue:#3370ff;
  --bg:#f5f6f7;
  --card:#ffffff;
  --text:#1f2329;
  --sub:#8f959e;
  --line:#e5e6eb;
  --bubble-left:#f2f3f5;
  --bubble-right:#e1eaff;
  --green:#34c759;
  --orange:#ff9f0a;
  --red:#ff3b30;
  --gray:#c9cdd4;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;height:100%;background:var(--bg);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",system-ui,sans-serif;font-size:15px}
#app{position:relative;height:100%;max-width:520px;margin:0 auto;background:var(--bg);overflow:hidden}
.view{position:absolute;inset:0;display:flex;flex-direction:column;background:var(--bg)}
.hidden{display:none!important}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}

/* 通用图标 */
.icon-btn{width:36px;height:36px;display:flex;align-items:center;justify-content:center;color:var(--text)}
.icon-btn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.icon-btn svg circle[fill]{stroke:none}

/* 头像 */
.avatar{border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;flex:none}
.avatar.big{width:44px;height:44px;font-size:17px;background:linear-gradient(135deg,#ff8a5b,#ff5f6d)}
.avatar.mid{width:34px;height:34px;font-size:14px}
.avatar.sm{width:44px;height:44px;font-size:16px}
.avatar.xl{width:72px;height:72px;font-size:26px;background:linear-gradient(135deg,#ff8a5b,#ff5f6d)}

/* 列表页 */
.list-head{display:flex;align-items:center;gap:10px;padding:14px 16px 10px;background:#fff}
.head-text{flex:1;min-width:0}
.head-title{font-size:18px;font-weight:600}
.head-sub{font-size:12px;color:var(--sub);margin-top:2px}
.head-actions{display:flex;gap:6px}
.tabs{display:flex;background:#fff;padding:0 16px 10px}
.tabs{position:relative}
.tabs .tab{flex:1;height:34px;border-radius:8px;font-size:15px;color:var(--text);display:flex;align-items:center;justify-content:center;gap:4px}
.tabs .tab.active{background:#f0f1f3;font-weight:600}
.tabs .tab span{color:var(--sub);font-size:14px}
.session-list{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;background:#fff}
.session-row{display:flex;align-items:center;gap:12px;padding:12px 16px;position:relative}
.session-row:active{background:#f7f8fa}
.session-row .avatar.sm{position:relative}
.dot{position:absolute;right:-2px;bottom:-2px;width:12px;height:12px;border-radius:50%;border:2px solid #fff}
.dot.online{background:var(--green)}.dot.busy{background:var(--orange)}
.dot.offline{background:var(--gray)}.dot.error{background:var(--red)}
.sr-main{flex:1;min-width:0}
.sr-name{display:flex;align-items:center;gap:6px;font-size:16px;font-weight:500}
.tag{font-size:11px;padding:1px 5px;border-radius:4px;background:#eef1ff;color:#5b7cfa;font-weight:400}
.sr-preview{font-size:13px;color:var(--sub);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sr-right{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:none}
.sr-time{font-size:12px;color:var(--sub)}
.badge{min-width:18px;height:18px;border-radius:9px;background:#ff3b30;color:#fff;font-size:11px;display:flex;align-items:center;justify-content:center;padding:0 5px}
.badge.work{background:#fff1e6;color:#ff8f1f}

/* 底部 tab */
.tabbar{display:flex;background:#fff;border-top:1px solid var(--line);padding:6px 0 calc(6px + env(safe-area-inset-bottom))}
.tabbar-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;color:var(--sub)}
.tabbar-item.active{color:var(--blue)}
.tb-ico{font-size:19px;line-height:1}

/* 聊天页 */
.chat-head{background:#fff;padding:8px 6px 6px;border-bottom:1px solid #f0f1f3}
.chat-row1{display:flex;align-items:center;gap:6px}
.back{width:34px}
.chat-title-wrap{flex:1;min-width:0;text-align:center}
.chat-title{display:flex;align-items:center;justify-content:center;gap:6px;font-size:17px;font-weight:600}
.chat-title svg{width:14px;height:14px;fill:none;stroke:var(--sub);stroke-width:2}
.chat-sub{font-size:11px;color:var(--sub);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-actions{display:flex;align-items:center;gap:2px}
.chat-scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:12px 14px 4px}
.date-divider{display:flex;align-items:center;gap:10px;color:var(--sub);font-size:12px;margin:14px 0 10px}
.date-divider::before,.date-divider::after{content:"";flex:1;height:1px;background:#eef0f2}
.msg{display:flex;gap:8px;margin:10px 0;align-items:flex-start}
.msg.me{flex-direction:row-reverse}
.msg .avatar{width:34px;height:34px;font-size:13px}
.bubble{max-width:74%;padding:9px 12px;border-radius:10px;font-size:15px;line-height:1.5;word-break:break-word;white-space:pre-wrap}
.bubble.left{background:var(--bubble-left);border-top-left-radius:3px}
.bubble.right{background:var(--bubble-right);border-top-right-radius:3px}
.bubble img{max-width:210px;border-radius:8px;display:block}
.msg-meta{font-size:11px;color:#a9adb4;margin-top:4px;padding-left:42px}
.msg.me .msg-meta{text-align:right;padding:0 42px 0 0}
.status-mini{font-size:11px;color:var(--sub);margin-left:6px}

.pills{display:flex;gap:8px;padding:8px 10px 6px;overflow-x:auto}
.pill{display:flex;align-items:center;gap:4px;height:34px;padding:0 12px;border:1px solid #e3e5e8;border-radius:9px;
  background:#fff;font-size:14px;color:#3b414a;white-space:nowrap}
.pill svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.pill.state{margin-left:auto;border-color:#e3e5e8;color:#6b7280}
.pill.state.online{color:#059669;border-color:#a7f3d0;background:#ecfdf5}
.pill.state.busy{color:#b45309;border-color:#fde68a;background:#fffbeb}
.pill.state.offline{color:#6b7280;background:#f6f7f8}
.pill.state.error{color:#dc2626;border-color:#fecaca;background:#fef2f2}

.composer{background:#fff;border-top:1px solid var(--line);padding:8px 10px calc(6px + env(safe-area-inset-bottom))}
.input-wrap{display:flex;align-items:flex-end;gap:8px;background:#fff;border:1px solid #e8eaed;border-radius:10px;padding:8px 10px}
textarea#msgInput{flex:1;border:0;outline:none;resize:none;font:inherit;max-height:96px;line-height:1.4;background:transparent}
textarea::placeholder{color:#a9adb4}
.expand{color:#9aa0a6}
.expand svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.icon-row{display:flex;justify-content:space-between;padding:10px 8px 0}
.tool{width:40px;height:32px;display:flex;align-items:center;justify-content:center;color:#4b5563}
.tool svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.at-glyph{font-size:20px;font-weight:500}
.aa-glyph{font-size:17px;font-weight:600;font-family:Georgia,serif}

/* 设置与通道页 */.page-head{display:flex;align-items:center;padding:10px 8px;background:#f5f6f7}
.page-title{flex:1;text-align:center;font-size:16px;font-weight:600}
.page-body{flex:1;overflow-y:auto;padding:0 12px 24px}
.card{background:#fff;border-radius:12px;margin-bottom:12px;overflow:hidden}
.card-profile{display:flex;align-items:center;gap:12px;padding:14px}
.card-profile .avatar.mid{width:44px;height:44px;font-size:17px}
.card-profile .p-name{display:flex;align-items:center;gap:6px;font-size:16px;font-weight:600}
.card-profile .p-sub{font-size:12px;color:var(--sub);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card-section{padding:12px 14px 4px;font-size:13px;color:var(--sub);background:#fff}
.card-row{display:flex;align-items:center;gap:10px;padding:14px;border-top:1px solid #f2f3f5;background:#fff}
.card-row:first-child{border-top:0}
.card-row .r-label{flex:1}
.card-row .r-value{color:var(--sub);font-size:13px;max-width:58%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right}
.card-row .chev{width:16px;height:16px;fill:none;stroke:#c9cdd4;stroke-width:2}
.chev{width:16px;height:16px;flex:none;fill:none;stroke:#c9cdd4;stroke-width:2}
.switch{width:44px;height:26px;border-radius:13px;background:#e5e6eb;position:relative;flex:none;transition:background .18s}
.switch.on{background:var(--green)}
.switch::after{content:"";position:absolute;top:2px;left:2px;width:22px;height:22px;border-radius:50%;background:#fff;transition:left .18s;box-shadow:0 1px 2px rgba(0,0,0,.16)}
.switch.on::after{left:20px}
.grid-apps{display:flex;gap:28px;padding:16px 14px;background:#fff}
.app-cell{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:12px;color:#4b5563}
.app-ico{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:19px;background:#f4f6ff}
.session-id{font-size:12px;color:#b1b5bd;text-align:center;margin:18px 0}

/* 通道页 */
.info-grid{background:#fff;border-radius:12px;margin-bottom:12px;overflow:hidden}
.info-row{display:flex;gap:10px;padding:11px 14px;border-top:1px solid #f2f3f5;font-size:14px}
.info-row:first-child{border-top:0}
.info-row .k{color:var(--sub);width:96px;flex:none}
.info-row .v{flex:1;word-break:break-all}
.cmd-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:12px}
.cmd-btn{background:#f6f7f9;border-radius:10px;padding:12px 10px;text-align:left;font-size:14px;display:flex;flex-direction:column;gap:4px}
.cmd-btn span.sub{font-size:11px;color:var(--sub)}
.cmd-btn:active{background:#eceef2}
.ab-card{padding:12px 14px;border-top:1px solid #f2f3f5}
.ab-head{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600}
.ab-head .dot{position:static;border:0;width:8px;height:8px}
.ab-desc{font-size:12px;color:var(--sub);margin:6px 0 10px}
.ab-btn{height:34px;padding:0 14px;border-radius:9px;background:#3370ff;color:#fff;font-size:13px}
.ab-btn.ghost{background:#f2f4f8;color:#3370ff}
.logbox{background:#0f172a;color:#d1e0ff;font-family:ui-monospace,Consolas,monospace;font-size:11.5px;
  border-radius:10px;padding:10px;white-space:pre-wrap;max-height:240px;overflow:auto;margin-bottom:12px}

/* sheet */
.sheet{position:absolute;inset:0;z-index:30}
.sheet-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.35)}
.sheet-panel{position:absolute;left:0;right:0;bottom:0;background:#f7f8fa;border-radius:16px 16px 0 0;
  padding:10px 12px calc(12px + env(safe-area-inset-bottom));max-height:70%;overflow-y:auto;animation:up .22s ease}
@keyframes up{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
.sheet-title{font-size:13px;color:var(--sub);text-align:center;padding:6px 0 10px}
.sheet-body{background:#fff;border-radius:12px;overflow:hidden}
.sheet-item{display:flex;align-items:center;gap:12px;padding:14px;border-top:1px solid #f2f3f5;font-size:15px;width:100%;text-align:left}
.sheet-item:first-child{border-top:0}
.sheet-item .s-sub{margin-left:auto;font-size:12px;color:var(--sub)}
.sheet-item:active{background:#f5f6f8}
.sheet-cancel{width:100%;height:46px;margin-top:8px;background:#fff;border-radius:12px;font-size:16px;color:#3b414a}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:6px;padding:10px}
.emoji-grid button{font-size:22px;height:38px}

/* toast / login */
.toast{position:absolute;left:50%;bottom:120px;transform:translateX(-50%);background:rgba(17,24,39,.9);color:#fff;
  padding:9px 14px;border-radius:9px;font-size:13px;max-width:80%;z-index:40;white-space:pre-wrap;text-align:center}
.login{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:30px}
.login h1{font-size:20px;margin:10px 0 0}
.login-sub{color:var(--sub);font-size:13px;margin:0 0 8px}
.login input{width:200px;height:48px;border:1px solid #e5e6eb;border-radius:10px;text-align:center;font-size:20px;letter-spacing:6px;outline:none;font-family:inherit}
.login input::placeholder{letter-spacing:0;font-size:15px;color:#a9adb4}
.login button{width:200px;height:46px;border-radius:10px;background:var(--blue);color:#fff;font-size:16px;font-weight:500}
.login-tip{color:var(--red);font-size:12px;min-height:16px}

/* 回执小字 / 任务页 */
.ack-line{text-align:center;color:#a9adb4;font-size:11px;margin:4px 0 10px;padding:0 30px}
.task-counts{display:flex;gap:8px;padding:12px 12px 0}
.task-chip{flex:1;background:#fff;border-radius:10px;padding:10px 8px;text-align:center;font-size:12px;color:var(--sub)}
.task-chip b{display:block;font-size:20px;color:var(--text);font-weight:600;margin-bottom:2px}
.task-item{display:flex;gap:10px;padding:12px 14px;border-bottom:1px solid #f0f1f3;align-items:flex-start}
.task-item .t-main{flex:1;min-width:0}
.task-item .t-title{font-size:14px;line-height:1.45;word-break:break-word}
.task-item .t-sub{font-size:11px;color:var(--sub);margin-top:5px}
.t-status{font-size:11px;padding:2px 6px;border-radius:4px;flex:none;margin-top:2px}
.t-status.done{background:#ecfdf5;color:#059669}
.t-status.claimed,.t-status.claiming{background:#fff7ed;color:#b45309}
.t-status.pending{background:#eef1ff;color:#5b7cfa}
.t-status.cancelled,.t-status.released{background:#f3f4f6;color:#6b7280}

/* 搜索页 / 断线提示 */
.search-bar{padding:8px 12px;background:#f5f6f7}
.search-bar input{width:100%;height:40px;border:0;border-radius:9px;background:#fff;padding:0 12px;font:inherit;font-size:14px;outline:none;box-style:none}
.search-item{padding:12px 14px;border-bottom:1px solid #f0f1f3}
.search-item .s-head{font-size:12px;color:var(--sub);display:flex;gap:6px;align-items:center}
.search-item .s-body{font-size:14px;line-height:1.5;margin-top:4px;word-break:break-word}
.net-bar{position:absolute;top:0;left:0;right:0;z-index:50;background:#fff4e6;color:#b45309;font-size:12px;text-align:center;padding:5px}
.net-bar.hidden{display:none}
.retry{color:#dc2626;margin-left:6px;text-decoration:underline}

/* 图片放大 / 长按复制 */
.img-view{position:fixed;inset:0;background:rgba(0,0,0,.92);z-index:200;display:flex;align-items:center;justify-content:center}
.img-view.hidden{display:none}
.img-view img{max-width:100%;max-height:100%;object-fit:contain}
.bubble img{cursor:zoom-in}

/* 产物页 */
.files-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:10px}
.file-cell{background:#fff;border-radius:8px;overflow:hidden;font-size:11px;color:#6b7280}
.file-cell .thumb{aspect-ratio:1;background:#f3f4f6;display:flex;align-items:center;justify-content:center;overflow:hidden}
.file-cell .thumb img{width:100%;height:100%;object-fit:cover}
.file-cell .meta{padding:5px 6px;line-height:1.3}
.file-cell .meta .t{color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* 宽屏自适应：桌面/平板浏览器里不再只占左半边 */
@media (min-width:760px){
  body{background:#e7e9ee}
  #app{max-width:760px;height:calc(100% - 40px);margin:20px auto;border-radius:18px;
       box-shadow:0 14px 44px rgba(17,24,39,.18);border:1px solid #dde1e6}
  .view{border-radius:18px;overflow:hidden}
  .bubble{max-width:62%}
  .icon-row{justify-content:flex-start;gap:6px}
  .icon-row .tool{width:44px}
}
@media (min-width:1180px){
  #app{max-width:980px}
  .bubble{max-width:56%}
}

@media (min-width:760px){
  html,body{overflow:hidden}
}
