:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --brand: #00a9c0;       /* 786 青 */
  --brand-dark: #008296;
  --text: #1f2329;
  --text-soft: #646a73;
  --line: #e7e9ed;
  --bot-bubble: #f2f3f5;
  --user-bubble: #00a9c0;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
}

.app {
  max-width: 960px;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  box-shadow: var(--shadow);
}

/* 会话侧栏 + 主区(issue#8) */
.app__body { flex: 1; display: flex; min-height: 0; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sidebar {
  flex: 0 0 200px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fafbfc;
  min-height: 0;
}
.sidebar__new {
  margin: 12px 12px 8px;
  border: 1px dashed var(--brand); background: #fff; color: var(--brand);
  font-size: 13.5px; font-weight: 600;
  padding: 9px 0; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.sidebar__new:hover { background: #e9f8fb; }
.sidebar__list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.sess {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px; margin: 2px 0;
  border-radius: 9px; cursor: pointer;
  font-size: 13px; color: var(--text-soft);
}
.sess:hover { background: #eef0f3; }
.sess.is-active { background: #e2f5f8; color: var(--brand-dark); font-weight: 600; }
.sess__title {
  flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sess__x {
  flex: 0 0 auto; border: none; background: none; color: #b0b4b9;
  font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 4px;
  border-radius: 5px; visibility: hidden;
}
.sess:hover .sess__x { visibility: visible; }
.sess__x:hover { background: #d6d8dc; color: #333; }
@media (max-width: 640px) { .sidebar { display: none; } }  /* 手机上先藏,客服用电脑 */

/* Header */
.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.app__title { display: flex; align-items: center; gap: 12px; }
.app__logo {
  width: 40px; height: 40px;
  border-radius: 10px; object-fit: cover;
}
.app__name { font-weight: 600; font-size: 16px; }
.app__sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.app__status {
  font-size: 12px; color: var(--text-soft);
  padding: 4px 10px; border-radius: 999px; background: var(--bot-bubble);
}
.app__status.is-ok { color: #0a7d33; background: #e6f4ea; }
.app__status.is-mock { color: #b26a00; background: #fdf0db; }
.app__right { display: flex; align-items: center; gap: 10px; }
.app__logout {
  border: 1px solid var(--line); background: #fff; color: var(--text-soft);
  font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.app__logout:hover { border-color: var(--brand); color: var(--brand); }

/* issue#168:改密码弹窗(复用登录卡片样式) */
.pwmodal {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; background: rgba(31,35,41,.55); padding: 20px;
}
.pwmodal.is-show { display: flex; }
.pwmodal__card { padding: 30px 30px 22px; gap: 12px; }
.pwmodal__cancel {
  border: none; background: transparent; color: var(--text-soft); font-size: 13px; cursor: pointer; padding: 4px;
}
.pwmodal__cancel:hover { color: var(--brand); }

/* Login screen */
.login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #00a9c0 0%, #00798c 100%);
  padding: 20px;
}
.login__card {
  width: 360px; max-width: 92vw;
  background: #fff; border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
  padding: 40px 34px 28px;
  display: flex; flex-direction: column; align-items: stretch; gap: 14px;
}
.login__logo {
  width: 72px; height: 72px; margin: 0 auto 6px;
  border-radius: 18px; object-fit: cover;
  box-shadow: 0 8px 22px rgba(0, 169, 192, .35);
}
.login__brand { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.login__title { text-align: center; font-size: 15px; color: var(--text-soft); margin-top: -6px; }
.login__sub { text-align: center; font-size: 13px; color: #9aa0a6; margin: 4px 0 10px; }
.login__field {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 0 13px; background: #fafbfc;
  transition: border-color .15s, background .15s;
}
.login__field:focus-within { border-color: var(--brand); background: #fff; }
.login__ico { font-size: 15px; opacity: .6; }
.login__field input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 13px 0; font-size: 14.5px;
}
.login__btn {
  border: none; background: linear-gradient(135deg, #00a9c0, #008296); color: #fff;
  font-size: 16px; font-weight: 600; letter-spacing: 4px;
  padding: 13px; border-radius: 12px; cursor: pointer; margin-top: 6px;
  transition: transform .1s, box-shadow .15s;
  box-shadow: 0 6px 16px rgba(0, 169, 192, .3);
}
.login__btn:hover { box-shadow: 0 8px 22px rgba(0, 169, 192, .4); }
.login__btn:active { transform: translateY(1px); }
.login__err { color: var(--brand); font-size: 13px; text-align: center; min-height: 18px; }
.login__foot { text-align: center; font-size: 12px; color: #b0b4b9; margin-top: 6px; }

/* Chat area */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { display: flex; gap: 10px; max-width: 86%; }
.msg--bot { align-self: flex-start; }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }
.msg__avatar {
  flex: 0 0 30px; width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px; font-size: 13px; font-weight: 700;
  background: var(--brand); color: #fff;
}
.msg--user .msg__avatar { background: #5b6066; }
.msg__bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.6;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;   /* issue#136①:表格比气泡宽时在卡片内横向滚动,而不是把气泡撑破跑出屏幕 */
}
.msg--bot .msg__bubble { background: var(--bot-bubble); border-top-left-radius: 4px; }
.msg--user .msg__bubble { background: var(--user-bubble); color: #fff; border-top-right-radius: 4px; }
.hint { margin-top: 8px; font-size: 12.5px; color: var(--text-soft); }

/* AI 回复的 Markdown 渲染样式(.md 由前端在机器人气泡上加) */
.msg__text.md { white-space: normal; }
.msg__text.md p { margin: 0 0 8px; }
.msg__text.md > :first-child { margin-top: 0; }
.msg__text.md > :last-child { margin-bottom: 0; }
.msg__text.md ul,
.msg__text.md ol { margin: 4px 0 8px; padding-left: 20px; }
.msg__text.md li { margin: 2px 0; }
.msg__text.md h1,
.msg__text.md h2,
.msg__text.md h3,
.msg__text.md h4,
.msg__text.md h5,
.msg__text.md h6 { margin: 10px 0 6px; font-size: 15px; font-weight: 600; line-height: 1.4; }
.msg__text.md strong { font-weight: 600; }
.msg__text.md em { font-style: italic; }
.msg__text.md a { color: var(--brand-dark); text-decoration: underline; word-break: break-all; }
.msg__text.md code {
  background: rgba(0, 0, 0, .06);
  padding: 1px 5px; border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px;
}
.msg__text.md pre {
  /* issue#92③:话术框由黑改 786 蓝(色值取自客服提供的图二 logo #02ACC3) */
  background: #02ACC3; color: #fff;
  padding: 10px 12px; border-radius: 8px;
  overflow-x: auto; margin: 6px 0;
}
.msg__text.md pre code { background: none; padding: 0; color: inherit; }
.msg__text.md table {
  border-collapse: collapse; width: 100%;
  margin: 6px 0; font-size: 13.5px;
}
.msg__text.md th,
.msg__text.md td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.msg__text.md th { background: #02ACC3; color: #fff; font-weight: 600; }  /* issue#93④:表头786蓝 */
.msg__text.md hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }

/* Typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #b8bcc2;
  animation: blink 1.2s infinite ease-in-out both;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
/* 断线重试提示:跟在等待动画下面的一行小字(手机弱网自动重试时才出现) */
.typing__note { margin-top: 2px; font-size: 12px; color: #8a8f98; }

/* Chips */
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 18px 10px;
}
.chip {
  border: 1px solid var(--line); background: #fff;
  color: var(--text); font-size: 13px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* In-bubble image (uploaded screenshot) */
.msg__img {
  display: block; max-width: 220px; max-height: 220px;
  border-radius: 8px; margin-bottom: 6px;
}
.msg__bubble:has(.msg__img) .msg__text:empty { display: none; }

/* Image preview strip (above composer) */
.preview {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px 0;
}
.preview img {
  max-height: 64px; max-width: 96px;
  border: 1px solid var(--line); border-radius: 8px;
}
.preview__x {
  border: none; background: #e7e9ed; color: #333;
  width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; font-size: 15px; line-height: 1;
}
.preview__x:hover { background: #d6d8dc; }

/* Composer */
.composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--line);
}
.composer__attach {
  flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: #fff; color: var(--text-soft);
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.composer__attach:hover { border-color: var(--brand); color: var(--brand); }
.composer__input {
  flex: 1; resize: none; max-height: 140px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; font-size: 14.5px; font-family: inherit;
  line-height: 1.5; outline: none;
}
.composer__input:focus { border-color: var(--brand); }
.composer__send {
  flex: 0 0 auto;
  border: none; background: var(--brand); color: #fff;
  font-size: 14.5px; font-weight: 600;
  padding: 11px 20px; border-radius: 12px; cursor: pointer;
  transition: background .15s;
}
.composer__send:hover { background: var(--brand-dark); }
.composer__send:disabled { background: #d6a6ae; cursor: not-allowed; }

/* 下载/打开 链接按钮(托运单/款号明细) */
.dl-btn{display:inline-block;margin:6px 8px 6px 0;padding:8px 14px;background:#00a9c0;
  color:#fff !important;border-radius:8px;text-decoration:none;font-size:14px;font-weight:600;
  box-shadow:0 1px 3px rgba(0,0,0,.15)}
.dl-btn:hover{background:#0093a8}

/* ---- issue#24 会话管理:分区 / 菜单 / 拖拽 / toast ---- */
.ssec { margin-top: 8px; }
.ssec.is-dragover { outline: 2px dashed var(--brand); outline-offset: -2px; border-radius: 8px; background: #e0f4f7; }
.ssec__h { display: flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 12px; color: var(--text-soft); cursor: pointer; user-select: none; }
.ssec__tri { font-size: 13px; transition: transform .15s; margin-left: 1px; }
.ssec__h:not(.is-closed) .ssec__tri { transform: rotate(90deg); }
.ssec__cnt { margin-left: auto; background: var(--line); border-radius: 8px; padding: 0 7px; font-size: 11px; }
.ssec__dots { visibility: hidden; border: none; background: none; cursor: pointer; font-size: 13px; color: var(--text-soft); padding: 0 4px; border-radius: 5px; }
.ssec__h:hover .ssec__dots { visibility: visible; }
.ssec__dots:hover { background: #e2e4e8; }
.ssec__body.is-hidden { display: none; }
.sess__dots { visibility: hidden; border: none; background: none; font-size: 15px; color: var(--text-soft); cursor: pointer; padding: 0 5px; border-radius: 5px; flex: none; }
.sess:hover .sess__dots { visibility: visible; }
.sess__dots:hover { background: #e2e4e8; }
.sess.is-archived .sess__title { color: var(--text-soft); }
.menu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 158px; padding: 6px; display: none; }
.menu.is-show { display: block; }
.menu__i { padding: 8px 12px; border-radius: 7px; font-size: 14px; cursor: pointer; }
.menu__i:hover { background: var(--bot-bubble); }
.menu__i--danger { color: #d93025; }
.menu__sep { height: 1px; background: var(--line); margin: 5px 4px; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #323232; color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 99; }
.toast.is-show { opacity: .95; }

/* ---- issue#59 表格卡片 + 放大浮层 ---- */
.tblcard { position: relative; max-width: 100%; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.tblcard__scroll { overflow-x: auto; }
.tblcard table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13px; }
.tblcard th { background: #02ACC3; color: #fff; font-weight: 600; white-space: nowrap; }  /* issue#93④:青绿改786蓝 */
.tblcard th, .tblcard td { border: 1px solid var(--line); padding: 6px 10px; text-align: center; }
.tblcard tbody tr:nth-child(even) { background: #fafbfc; }
/* issue#108:预计到货列不换行,列宽随内容伸延(聊天卡片与 ⛶ 放大浮层共用,clone 会带 class) */
.tblcard .td-nowrap, .tblov__body .td-nowrap { white-space: nowrap; }
.tblcard__zoom { position: absolute; top: 4px; right: 4px; z-index: 2; border: 1px solid var(--line); background: #ffffffd9; border-radius: 6px; cursor: pointer; font-size: 13px; padding: 2px 7px; color: var(--text-soft); }
.tblcard__zoom:hover { background: #e6f7f9; color: var(--brand-dark); }
.tblov { position: fixed; inset: 0; z-index: 80; background: rgba(31,35,41,.55); display: none; padding: 4vh 4vw; }
.tblov.is-show { display: flex; flex-direction: column; }
.tblov__bar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.tblov__btn { border: none; background: #fff; border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--text); }
.tblov__btn:hover { background: #e6f7f9; }
.tblov__body { flex: 1; overflow: auto; background: #fff; border-radius: 12px; padding: 16px; }
.tblov__body table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 15px; }
.tblov__body th { background: #e6f7f9; font-weight: 600; white-space: nowrap; }
.tblov__body th, .tblov__body td { border: 1px solid var(--line); padding: 10px 14px; text-align: center; }
.tblov__body th { background: #02ACC3; color: #fff; }   /* issue#93④:放大页表头同786蓝 */
.tblov__body .col-wide { white-space: nowrap; }          /* issue#93③:票号/批次列不折行 */
.tblov__body tbody tr:nth-child(even) { background: #fafbfc; }
/* issue#136① 小田:表格比屏幕宽时右边几列看不到,要一条能来回拉的线(以蓝色系统的横向滚动条为标准)。
   表格改 max-content 宽(列不再被挤扁)+ 滚动容器常驻加粗滚动条,鼠标按住就能左右拉。 */
/* 注意:Chrome 121+ 一旦写了 scrollbar-color 就会忽略 ::-webkit-scrollbar,滚动条又变回
   macOS/系统那种滑过才显形的细条 → 标准属性只留给 Firefox 用。 */
@supports not selector(::-webkit-scrollbar) {
  .tblcard__scroll, .tblov__body { scrollbar-color: #b6bcc4 #eef0f2; scrollbar-width: auto; }
}
.tblcard__scroll::-webkit-scrollbar, .tblov__body::-webkit-scrollbar { height: 14px; width: 14px; }
.tblcard__scroll::-webkit-scrollbar-track, .tblov__body::-webkit-scrollbar-track {
  background: #eef0f2; border-radius: 8px;
}
.tblcard__scroll::-webkit-scrollbar-thumb, .tblov__body::-webkit-scrollbar-thumb {
  background: #b6bcc4; border-radius: 8px; border: 3px solid #eef0f2;
}
.tblcard__scroll::-webkit-scrollbar-thumb:hover, .tblov__body::-webkit-scrollbar-thumb:hover { background: #8f99a3; }
.tblcard__scroll::-webkit-scrollbar-corner, .tblov__body::-webkit-scrollbar-corner { background: #eef0f2; }

@media (max-width: 640px) {
  .tblcard table { font-size: 12px; }
  .tblcard th, .tblcard td { padding: 5px 6px; white-space: nowrap; }  /* 手机端不再一行一字,横向滚动 */
  .tblov { padding: 2vh 2vw; }
}

/* issue#74:话术代码块一键复制
   issue#92④:按钮会挡住话术尾巴 → 平时近乎透明,鼠标碰到代码块/按钮才显现 */
.codewrap { position: relative; }
.codewrap .copybtn {
  position: absolute; top: 6px; right: 6px; padding: 2px 10px;
  font-size: 12px; border: 1px solid #d0d5da; border-radius: 6px;
  background: #fff; color: #333; cursor: pointer; opacity: .22;
  transition: opacity .15s;
}
.codewrap:hover .copybtn, .codewrap .copybtn:hover, .codewrap .copybtn:focus { opacity: 1; }
/* issue#131:> 引用块也当话术卡(模型偶尔不用代码块),观感与 pre 一致 */
.codewrap blockquote {
  margin: 6px 0; padding: 10px 44px 10px 12px; border-left: 3px solid #12a5b5;
  background: #f4f6f8; border-radius: 6px; font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
}

/* issue#96:聊天时间条(微信样式:居中灰字,点击切换详细日期) */
.tdiv { text-align: center; color: #b4bac1; font-size: 12px; margin: 12px 0 4px; cursor: pointer; user-select: none; }
.tdiv:hover { color: #868d95; }

/* issue#99:会话菜单图标 + "移除到分组"悬停子菜单小三角 */
.menu__i { display: flex; align-items: center; gap: 8px; }
.menu__ico { width: 18px; text-align: center; flex: none; }
.menu__tri { margin-left: auto; color: #a7adb4; font-size: 12px; }

/* issue#100:输入框高度拉伸把手 */
.composer__grip { height: 7px; margin: 0 14px; border-radius: 4px; cursor: ns-resize; flex: none; }
.composer__grip:hover, .composer__grip:active { background: var(--line); }

/* issue#66 二期:右键翻译的译文,贴在原消息气泡下面(灰底小字,和原文分开) */
.msg__trans {
  margin-top: 8px; padding: 7px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, .05); font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.msg--user .msg__trans { background: rgba(255, 255, 255, .22); }

/* issue#139⑤:任务模块上的未读小红点(别人把我选成参与人、我还没点开过) */
.taskcats__btn { position: relative; }
.taskcats__dot {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: #d93f0b; color: #fff;
  font-size: 11px; line-height: 17px; text-align: center; font-weight: 600;
}

/* issue#139 追评:消息多选删除(右键某条→删除 后,每条左边出现方框) */
.msgsel { flex: none; margin: 10px 2px 0 0; width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-dark); }
/* 小于要求方框统一在每条消息左边;我方消息那一行是 row-reverse,排最后才是最左 */
.msg--user .msgsel { order: 9; margin: 10px 0 0 2px; }
.chat.is-sel .msg { background: #fbfcfd; border-radius: 8px; }
.msgsel__bar { display: none; align-items: center; gap: 10px; padding: 8px 16px;
  border-top: 1px solid var(--line); background: #fff; font-size: 13.5px; color: var(--text-soft); }
.msgsel__bar.is-show { display: flex; }
.msgsel__cnt { margin-right: auto; }
.msgsel__btn { border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--text); }
.msgsel__btn:hover { background: #f2f4f6; }
.msgsel__btn--danger { border-color: #e3a3a3; color: #c0392b; }
.msgsel__btn--danger:hover { background: #fdeeee; }
/* issue#139②:未分组不显示标题行,但仍是拖拽落点,留一点高度别塌成 0 */
.ssec--nohead { min-height: 10px; }

/* issue#133:多票发货单一次导出 */
.cnbatch { margin: 8px 0 4px; }
.cnbatch__btn { border: 1px solid var(--brand-dark); background: #fff; color: var(--brand-dark);
  border-radius: 8px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; }
.cnbatch__btn:hover { background: #e6f7f9; }

/* ---- 托运单内嵌卡片与放大浮层(issue#117) ---- */
.cncard { position: relative; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.cncard__frame { width: 100%; height: 420px; border: none; display: block; }
.cncard__zoom { position: absolute; top: 6px; right: 6px; z-index: 2; border: 1px solid var(--line); background: #ffffffd9; border-radius: 6px; cursor: pointer; font-size: 13px; padding: 2px 7px; color: var(--text-soft); }
.cncard__zoom:hover { background: #e6f7f9; color: var(--brand-dark); }
.cnov { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); display: none; flex-direction: column; }
.cnov.is-show { display: flex; }
.cnov__bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; color: #fff; font-size: 15px; }
.cnov__close { border: none; background: none; color: #fff; font-size: 18px; cursor: pointer; }
.cnov__frame { flex: 1; border: none; background: #fff; margin: 0 24px 24px; border-radius: 10px; }
@media (max-width: 640px) { .cnov__frame { margin: 0; border-radius: 0; } .cncard__frame { height: 320px; } }

/* ---- 任务栏(issue#98) ---- */
/* 侧栏四类分类:蓝色框体(图一样式,客服点名用 786 蓝做框) */
.taskcats { display: flex; flex-direction: column; gap: 7px; margin: 10px 0 6px; }
.taskcats__btn {
  border: 1.5px solid #02ACC3; background: #fff; color: #1f2d3d;
  border-radius: 8px; padding: 7px 10px; font-size: 13.5px; cursor: pointer; text-align: center;
}
.taskcats__btn:hover { background: #e6f7f9; }
.taskcats__btn.is-active { background: #02ACC3; color: #fff; }
/* 左下角蓝色加号(图一) */
.taskfab {
  position: absolute; left: 14px; bottom: 14px; z-index: 5;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: #1e6fff; color: #fff; font-size: 24px; line-height: 42px; padding: 0;
  box-shadow: 0 4px 12px rgba(30,111,255,.35);
}
.taskfab:hover { filter: brightness(1.08); }
.sidebar { position: relative; padding-bottom: 64px; }  /* 给 FAB 留位 */

/* 任务面板(替换右侧聊天区) */
.taskpane { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.taskpane__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.taskpane__title { font-size: 17px; font-weight: 700; }
.taskpane__close { border: none; background: none; font-size: 16px; cursor: pointer; color: #888; }
.taskpane__close:hover { color: #333; }
.taskpane__body { flex: 1; overflow-y: auto; padding: 12px 18px; }
.taskpane__loading, .taskpane__empty { color: #98a1ab; text-align: center; padding: 40px 0; font-size: 14px; }
.taskpane__donesep { color: #98a1ab; font-size: 12px; margin: 14px 0 4px; }
.taskpane__search { display: flex; gap: 8px; padding: 10px 18px 4px; flex-wrap: wrap; }
.taskpane__search input { flex: 1 1 160px; min-width: 0; }
.taskpane__search input, .taskpane__search select, .taskpane__search button, .taskpane__retry {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; font-size: 13px;
}
.taskpane__search button { cursor: pointer; }
.taskpane__search button[type="submit"] { color: #fff; background: #008b9b; border-color: #008b9b; }
.taskpane__hint { padding: 6px 18px; color: #687580; font-size: 12px; }
.taskpane__completed { margin-top: 16px; border-top: 1px solid var(--line); }
.taskpane__completed summary { padding: 12px 6px; color: #687580; cursor: pointer; font-size: 13px; }
.taskrow__main { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.taskrow__more { border: 0; background: transparent; color: #687580; cursor: pointer; font-size: 22px; padding: 0 8px; }
.taskmenu { position: fixed; z-index: 60; width: 190px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px #172b4d26; }
.taskmenu button { display: block; width: 100%; padding: 9px 12px; text-align: left; border: 0; background: none; cursor: pointer; border-radius: 5px; font: inherit; font-size: 13px; overflow-wrap: anywhere; }
.taskmenu button:hover, .taskmenu button:focus-visible { background: #e6f7f9; }
.taskmenu button:disabled { opacity: .5; cursor: not-allowed; }
.taskmenu__reason { margin: 0 12px 8px; color: #697682; font-size: 12px; line-height: 1.5; }
.taskrow__readonly { color: #697682; font-size: 12px; white-space: nowrap; }
.taskmenu__targets { border-top: 1px solid var(--line); padding-left: 12px; }
.taskmenu .taskmenu__delete { color: #b93636; }
.taskdetail__attachment { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 172px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.taskdetail__preview { border: 0; padding: 0; background: #f4f9fa; cursor: pointer; width: 100%; min-height: 72px; border-radius: 5px; color: #087d8a; }
.taskdetail__preview img { display: block; max-width: 100%; max-height: 150px; margin: auto; }
.taskdetail__filename { font-size: 13px; overflow-wrap: anywhere; }
.taskdetail__attachment a { font-size: 13px; color: #087d8a; }
.taskdetail__unsupported { font-size: 12px; color: #687580; }
.taskpreview { padding: 0; border: 0; border-radius: 10px; width: min(920px, 94vw); max-width: 94vw; max-height: 90vh; }
.taskpreview::backdrop { background: #12202bcc; }
.taskpreview__head { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.taskpreview__head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.taskpreview__head a { color: #087d8a; white-space: nowrap; }
.taskpreview__head button { background: transparent; border: 0; padding: 5px; font-size: 18px; cursor: pointer; }
.taskpreview__content { padding: 16px; text-align: center; }
.taskpreview__content img, .taskpreview__content video { max-width: 100%; max-height: 70vh; }
.taskpreview__content video { width: 100%; background: #111; }
.taskpreview__tools { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.taskpreview__tools button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: pointer; }
.taskpreview__tools button:disabled { opacity: .4; cursor: not-allowed; }
.taskpreview__tools output { min-width: 45px; font-variant-numeric: tabular-nums; }
.taskpreview__tools span { font-size: 12px; color: var(--text-soft); }
.taskpreview__viewport { height: 60vh; max-height: calc(90vh - 170px); overflow: auto; background: #f3f5f7; }
.taskpreview__stage { display: grid; place-items: center; }
.taskpreview__stage img { display: block; max-width: none; max-height: none; }
.taskpreview__stage { user-select: none; }
.taskpreview__viewport.can-pan { cursor: grab; touch-action: none; }
.taskpreview__viewport.is-dragging { cursor: grabbing; }
.taskpreview__error { color: #a43b32; font-size: 14px; }

/* 列表行(图二:checkbox 清单,完成划线) */
.taskrow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 6px; border-radius: 8px; cursor: pointer; }
.taskrow:hover { background: #f4f9fa; }
.taskrow__chk { margin-top: 3px; width: 16px; height: 16px; accent-color: #02ACC3; cursor: pointer; }
.taskrow__title { font-size: 14.5px; }
.taskrow__meta { font-size: 12px; color: #8a939d; margin-top: 2px; }
.taskrow.is-done .taskrow__title { color: #a7aeb6; text-decoration: line-through; }

/* 创建/编辑表单(图一模版) */
.taskform { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
.taskform > * { flex-shrink: 0; }
.taskform__title { border: none; border-bottom: 2px solid var(--line); font-size: 19px; font-weight: 700; padding: 6px 2px; outline: none; }
.taskform__title:focus { border-bottom-color: #02ACC3; }
.taskform__desc { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; resize: vertical; }
.taskform__row { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.taskform__row select, .taskform__row input[name="labels"] {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 13.5px;
}
.taskform__row input[name="labels"] { flex: 1; min-width: 160px; }
.taskform__chip { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.taskform__chip:hover { border-color: #02ACC3; color: #02ACC3; }
.taskform__date { border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 13px; }
.taskform__datefield { position: relative; display: inline-flex; min-width: 180px; max-width: 100%; }
.taskform__datefield .taskform__date { width: 100%; min-height: 38px; background: #fff; color: var(--text); }
.taskform__datehint { display: none; position: absolute; left: 10px; right: 26px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 12px; color: var(--text-soft); background: #fff; white-space: nowrap; z-index: 1; }
.taskform__datehint[hidden] { display: none; }
.taskform__part { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; margin: 2px; }
.taskform__part.is-on { background: #02ACC3; border-color: #02ACC3; color: #fff; }
.taskform__hint { font-size: 12px; color: #98a1ab; }
.taskform__save {
  align-self: flex-start; border: none; background: #02ACC3; color: #fff;
  border-radius: 8px; padding: 9px 22px; font-size: 14.5px; cursor: pointer;
}
.taskform__save:hover { filter: brightness(1.06); }

/* 详情 */
.taskdetail__done { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; margin-bottom: 10px; }
.taskdetail__row { display: flex; gap: 12px; font-size: 14px; padding: 5px 0; }
.taskdetail__row > span { flex: 0 0 64px; color: #8a939d; }
.taskdetail__files { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.taskdetail__img img { max-width: 160px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); }
.taskdetail__file { font-size: 13.5px; color: #02ACC3; }
.taskdetail__actions { margin-top: 16px; display: flex; gap: 10px; }
.taskdetail__actions button {
  border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 16px; font-size: 13.5px; cursor: pointer;
}
.taskdetail__actions button:hover { border-color: #02ACC3; color: #02ACC3; }
.taskdetail__actions .is-danger { color: #d64541; }
.taskdetail__actions .is-danger:hover { border-color: #d64541; color: #d64541; }

/* ---- 语音助手(issue#66) ---- */
/* 按住说话按钮:禁掉触屏滚动/长按选中/拖拽,手势才稳 */
/* 微信式「按住 说话」长条:占满输入框位置,目标大好按 */
.composer__hold {
  flex: 1; min-height: 42px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 15px; font-weight: 600; color: #1f2d3d; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.composer__hold.is-hold { background: #e6f7f9; border-color: #02ACC3; color: #02ACC3; }
/* 录音浮层:全屏遮罩,上方两个手势区(取消/转文字),中部麦克风+计时 */
.vcov { position: fixed; inset: 0; z-index: 90; background: rgba(20,24,30,.72); display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 26px; touch-action: none; }
.vcov.is-show { display: flex; }
.vcov__zones { display: flex; gap: 56px; }
.vcov__zone { width: 74px; height: 74px; border-radius: 50%; background: #ffffff22; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 22px; }
.vcov__zone span { font-size: 12px; margin-top: 2px; opacity: .85; }
.vcov__zone.is-on { background: #02ACC3; transform: scale(1.15); }
.vcov__zone[data-z="cancel"].is-on { background: #d64541; }
.vcov__mic { font-size: 44px; color: #fff; text-align: center; }
.vcov__time { font-size: 15px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.vcov__hint { color: #ffffffcc; font-size: 13.5px; }

/* 语音消息气泡:紧凑音频条 + 转写小字 */
.msg__voice { width: 230px; height: 36px; display: block; }
.msg__voicetext { margin-top: 6px; font-size: 13px; opacity: .85; }

/* 🔊 朗读按钮:bot 气泡末尾 */
.spkbtn { border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
  font-size: 13px; padding: 2px 8px; margin-top: 8px; display: inline-block; color: var(--text-soft); }
.spkbtn:hover { border-color: #02ACC3; color: #02ACC3; }
.spkbtn.is-on { background: #02ACC3; border-color: #02ACC3; color: #fff; }

.mobile-menu, .sidebar-backdrop, .sidebar__mobilehead, .taskpane__create { display: none; }

/* App/mobile workspace: a compact toolbar, accessible drawer and fixed composer. */
@media (max-width: 640px) {
  html, body { overflow: hidden; overscroll-behavior: none; }
  .app { height: var(--app-height, 100dvh); max-width: none; box-shadow: none; min-height: 0; }
  .app__header { flex: 0 0 60px; min-height: 60px; padding: 8px 12px; gap: 8px; }
  .app__title { min-width: 0; flex: 1; gap: 8px; }
  .app__title > div { min-width: 0; }
  .app__logo { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; }
  .app__name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app__sub { font-size: 11px; margin-top: 3px; }
  .app__right { flex: 0 0 auto; gap: 6px; }
  .app__logout { white-space: nowrap; padding: 8px; min-height: 40px; font-size: 12px; border-radius: 10px; }
  .app__status { width: 8px; height: 8px; padding: 0; font-size: 0; flex: 0 0 8px; background: #a4abb3; }
  .app__status.is-ok { background: #0a9b55; }
  .app__status.is-mock { background: #c38b21; }
  .mobile-menu { display: block; font-size: 18px; width: 40px; }
  .is-app #logoutBtn { display: none; }
  .main { min-height: 0; overflow: hidden; }
  .chat { min-height: 0; padding: 16px 12px; gap: 16px; overscroll-behavior: contain; }
  .msg { max-width: 96%; min-width: 0; gap: 8px; flex-shrink: 0; }
  .msg__avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: 12px; }
  .msg__bubble { padding: 10px 12px; font-size: 14px; overflow-wrap: anywhere; }
  .msg__img, .msg__voice { max-width: 100%; }
  .chips { flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto; padding: 6px 12px 10px; scrollbar-width: none; }
  .chip { flex: 0 0 auto; font-size: 12px; white-space: nowrap; }
  .composer__grip { display: none; }
  .composer { flex: 0 0 auto; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); gap: 6px; align-items: flex-end; }
  .composer__attach { width: 40px; height: 44px; border: none; border-radius: 10px; }
  .composer__input { width: 0; min-width: 0; min-height: 44px; max-height: 100px; padding: 10px; font-size: 16px; }
  .composer__hold { min-width: 0; min-height: 44px; font-size: 14px; }
  .composer__send { height: 44px; padding: 0 13px; font-size: 14px; }
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 60px 0 0; width: 100%; height: calc(var(--app-height, 100dvh) - 60px); background: #172b4d55; border: 0; padding: 0; z-index: 39; touch-action: none; }
  .sidebar { display: flex; position: fixed; top: 60px; bottom: 0; left: 0; width: min(82vw, 300px); z-index: 40; box-shadow: 8px 0 28px #172b4d18; transform: translate3d(-105%, 0, 0); visibility: hidden; pointer-events: none; transition: transform 180ms ease-out, visibility 0s 180ms; }
  .sidebar-open .sidebar { transform: translate3d(0, 0, 0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .sidebar__mobilehead { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px; font-size: 13px; color: var(--text-soft); }
  .sidebar__mobilehead button { width: 44px; height: 44px; border: 0; background: none; font-size: 26px; color: inherit; }
  .taskpane { position: relative; }
  .taskpane__list { padding-bottom: 88px; }
  .taskpane__create { display: block; position: absolute; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); padding: 12px 18px; min-height: 48px; background: var(--brand); color: #fff; border: 0; border-radius: 24px; box-shadow: 0 4px 16px #00829633; font-size: 14px; }
  .taskpane__head, .taskpane__body { padding: 12px; }
  .taskpane__head { flex-shrink: 0; }
  .taskpane__close { width: 44px; min-height: 44px; padding: 0; flex: 0 0 44px; }
  .taskdetail__row { overflow-wrap: anywhere; min-width: 0; }
  .taskdetail__row > :last-child { min-width: 0; }
  .taskdetail__actions { flex-wrap: wrap; }
  .taskform, .taskform__title, .taskform__desc { min-width: 0; max-width: 100%; }
  .taskform { min-height: 0; overscroll-behavior: contain; scroll-padding: 12px; }
  .taskform__title { min-height: 44px; }
  .taskform__desc { min-height: 108px; line-height: 1.5; font-size: 16px; }
  .taskform__datehint:not([hidden]) { display: block; }
  .taskform__datefield.is-empty .taskform__date { color: transparent; }
  .taskform__datefield.is-empty .taskform__date::-webkit-datetime-edit { color: transparent; }
  .taskform__row input[type="file"] { width: 100%; min-width: 0; max-width: 100%; font-size: 14px; }
  .taskpreview { width: calc(100vw - 20px); max-width: calc(100vw - 20px); }
  .toast { max-width: calc(100vw - 32px); white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
