/* =============================================================
   Orbitra · AI 员工会话  chat.css
   三栏 IM：会话列表 / 消息流 / 员工名片
   依赖 theme.css 的色板变量（--panel / --line / --brand / --text …）
   ============================================================= */

/* ---------------- 外框 ---------------- */
/* 工作台里的容器：占满剩余视口，让输入框贴底 */
.chat-holder { height: calc(100vh - 236px); min-height: 520px; }

.im {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 264px;
  height: 100%;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(23, 35, 63, .04);
}

/* ---------------- 左：会话列表 ---------------- */
.im-list {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel-2);
}
.im-search {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 12px 8px; padding: 0 12px; height: 36px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 10px;
  color: var(--dim); flex: none;
}
.im-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: .84rem; color: var(--text);
}
.im-tabs { display: flex; gap: 4px; padding: 0 12px 10px; flex: none; }
.im-tabs button {
  font-size: .76rem; padding: 4px 10px; border-radius: 999px;
  color: var(--muted); background: transparent; border: 1px solid transparent;
}
.im-tabs button.on { background: #EDF2FD; color: var(--brand-ink); border-color: #D6E1FB; font-weight: 600; }

.im-convs { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }
.im-ci {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px; border-radius: 11px; text-align: left;
  transition: background .16s;
}
.im-ci:hover { background: #EEF3FD; }
.im-ci.on { background: #E5EDFD; }
.im-ci-av {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2B5CE6, #1E46C0);
  color: #fff; font-size: .85rem; font-weight: 700;
}
.im-ci-av.grp { background: linear-gradient(135deg, #4C6FE8, #7FA3F5); }
.im-ci-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.im-ci-t {
  font-size: .86rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.im-pin { color: #C9A227; display: inline-flex; }
.im-ci-s {
  font-size: .74rem; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.im-ci-r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.im-ci-time { font-size: .68rem; color: var(--dim); }
.im-ci-n {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700;
  display: grid; place-items: center;
}
.im-empty-s { padding: 24px 12px; text-align: center; font-size: .8rem; color: var(--dim); }
.im-newbar {
  display: flex; gap: 8px; padding: 10px 12px 12px;
  border-top: 1px solid var(--line); flex: none;
}
.im-newbar .btn { flex: 1; justify-content: center; }

/* ---------------- 中：消息流 ---------------- */
.im-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.im-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); flex: none;
  background: var(--panel);
}
.im-top-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.im-top-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.im-top-t b { font-size: .95rem; }
.im-top-t .dim { font-size: .74rem; }
.im-top-r { display: flex; align-items: center; gap: 6px; flex: none; }

.im-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 6px; background: var(--bg-soft); }
.im-time { text-align: center; font-size: .7rem; color: var(--dim); margin: 12px 0 10px; }
.im-sys { display: flex; justify-content: center; margin: 10px 0; }
.im-sys > span {
  max-width: 78%; padding: 5px 12px; border-radius: 999px;
  background: #E9EEF8; color: var(--muted); font-size: .73rem; line-height: 1.5;
}

.im-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.im-row.me { flex-direction: row; justify-content: flex-end; }
.im-row-b { display: flex; flex-direction: column; gap: 5px; min-width: 0; max-width: 74%; }
.im-row.me .im-bub.me { max-width: 74%; }
.im-av {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700;
  background: linear-gradient(135deg, #2B5CE6, #1E46C0); color: #fff;
}
.im-av.sm { width: 26px; height: 26px; border-radius: 8px; font-size: .72rem; }
.im-av.grp { background: linear-gradient(135deg, #4C6FE8, #7FA3F5); }
.im-av.me { background: #E7EDFB; color: var(--brand-ink); }
.im-name { font-size: .73rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.im-tag {
  font-size: .64rem; padding: 1px 7px; border-radius: 999px;
  background: #EDF2FD; color: var(--brand-ink); font-weight: 600;
}
.im-tag.boss { background: #FFF4E0; color: #A9761A; }

.im-bub {
  padding: 10px 14px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); font-size: .87rem; line-height: 1.68; color: var(--text);
  word-break: break-word;
}
.im-bub.me {
  background: linear-gradient(135deg, #2B5CE6, #2450CC); color: #fff;
  border-color: transparent; border-bottom-right-radius: 5px;
}
.im-row:not(.me) .im-bub { border-bottom-left-radius: 5px; }
.im-aud { font-size: .85rem; }
.im-aud.dim { color: var(--dim); font-size: .78rem; margin-top: 8px; }

.im-plan { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 7px; }
.im-plan-i {
  display: flex; align-items: center; gap: 9px;
  background: #F4F7FD; border: 1px solid #E3EAF8; border-radius: 10px; padding: 8px 10px;
}
.im-plan-n {
  width: 18px; height: 18px; border-radius: 999px; flex: none;
  background: var(--brand); color: #fff; font-size: .68rem; font-weight: 700;
  display: grid; place-items: center;
}
.im-plan-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.im-plan-b b { font-size: .81rem; }
.im-plan-b span { font-size: .74rem; color: var(--muted); }
.im-plan-at { font-size: .72rem; color: var(--brand-ink); flex: none; }

/* 任务卡 */
.im-task {
  border: 1px solid #DCE5F8; background: #F6F9FE; border-radius: 12px;
  padding: 11px 13px; margin: 2px 0;
}
.im-task.hl { border-color: #F0D3A4; background: #FFFBF3; }
.im-task-h {
  display: flex; align-items: center; gap: 7px; font-size: .76rem;
  color: var(--muted); margin-bottom: 7px;
}
.im-task-h b { font-size: .79rem; color: var(--text); }
.im-task-h .badge { margin-left: auto; }
.im-task-t { font-size: .85rem; line-height: 1.6; color: var(--text); margin-bottom: 9px; }
.im-task-p { display: flex; align-items: center; gap: 10px; }
.im-task-p .bar { flex: 1; }
.im-task-pc { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.im-task-a {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding-top: 9px; border-top: 1px dashed #DCE5F8;
}
.im-task-wait { font-size: .73rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }

/* 交付物卡 */
.im-dv {
  display: flex; align-items: center; gap: 11px;
  background: #F6F9FE; border: 1px solid #DCE5F8; border-radius: 12px;
  padding: 11px 13px; margin: 2px 0;
}
.im-dv-ic {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: #E7EEFB; color: var(--brand-ink);
}
.im-dv-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.im-dv-b b { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-dv-b .dim { font-size: .72rem; }

/* 欢迎态 */
.im-welcome {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 40px 30px; color: var(--muted);
}
.im-wc-ic {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center;
  background: #EDF2FD; color: var(--brand); margin-bottom: 6px;
}
.im-welcome b { font-size: 1rem; color: var(--text); }
.im-welcome p { font-size: .82rem; line-height: 1.75; max-width: 420px; }

/* ---------------- 输入区 ---------------- */
.im-foot { flex: none; border-top: 1px solid var(--line); padding: 12px 18px 10px; background: var(--panel); position: relative; }
.im-editor {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 8px 10px 8px 14px;
  transition: border-color .16s, box-shadow .16s;
}
.im-editor:focus-within { border-color: #B9CBF5; box-shadow: 0 0 0 3px rgba(43, 92, 230, .09); }
.im-editor textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent;
  font: inherit; font-size: .88rem; line-height: 1.6; color: var(--text);
  max-height: 140px; padding: 7px 0;
}
.im-send {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2B5CE6, #1E46C0); color: #fff;
  transition: transform .14s, opacity .14s;
}
.im-send:hover { transform: translateY(-1px); }
.im-send:active { transform: translateY(0); opacity: .86; }
.im-hint { font-size: .71rem; color: var(--dim); margin-top: 7px; padding-left: 2px; }
.im-hint b { color: var(--brand-ink); }

/* @ 弹窗 */
.im-at-pop {
  position: absolute; left: 18px; bottom: 104px; z-index: 30;
  width: 268px; max-height: 244px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(23, 35, 63, .16);
  padding: 6px; display: none;
}
.im-at-pop.on { display: block; }
.im-at-i {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border-radius: 8px; text-align: left;
}
.im-at-i:hover { background: #EEF3FD; }
.im-at-b { display: flex; flex-direction: column; min-width: 0; }
.im-at-b b { font-size: .81rem; }
.im-at-b span { font-size: .72rem; color: var(--muted); }

/* ---------------- 右：员工名片 / 群成员 ---------------- */
.im-info {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto;
  padding: 14px 12px; border-left: 1px solid var(--line); background: var(--panel-2);
}
.im-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 13px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.im-card-h { font-size: .8rem; font-weight: 700; color: var(--text); display: flex; justify-content: space-between; }
.im-card-n { font-size: .95rem; text-align: center; margin-top: 2px; }
.im-big-av {
  width: 54px; height: 54px; border-radius: 16px; margin: 2px auto 4px;
  display: grid; place-items: center; font-size: 1.2rem; font-weight: 700;
  background: linear-gradient(135deg, #2B5CE6, #1E46C0); color: #fff;
}
.im-card .im-tag { align-self: center; }
.im-card-o { font-size: .78rem; color: var(--muted); line-height: 1.65; text-align: center; }
.im-kv { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); }
.im-kv b { color: var(--text); font-size: .8rem; display: inline-flex; align-items: center; gap: 5px; }
.im-info .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); display: inline-block; }
.im-info .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(30, 158, 106, .14); }
.im-note {
  display: flex; gap: 6px; align-items: flex-start;
  font-size: .74rem; line-height: 1.6; color: #8A6516;
  background: #FFF8EB; border: 1px solid #F3E0BC; border-radius: 9px; padding: 7px 9px;
}
.im-dv-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  font-size: .77rem; color: var(--text); padding: 6px 4px; border-radius: 7px; text-align: left;
}
.im-dv-row:hover { background: #EEF3FD; }
.im-dv-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-dv-row svg { color: var(--dim); flex: none; }
.im-card-p { font-size: .78rem; color: var(--muted); line-height: 1.68; }
.im-card-p b { color: var(--brand-ink); }

.im-mem { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.im-mem-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.im-mem-b b { font-size: .79rem; }
.im-mem-b span { font-size: .7rem; color: var(--dim); }
.im-mem-x {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  color: var(--dim); flex: none;
}
.im-mem-x:hover { background: #FCEFEF; color: var(--danger-ink); }

/* 工作台顶部的视图切换（由 console.html 使用） */
.ws-switch { display: inline-flex; background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.ws-switch button {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; padding: 5px 13px; border-radius: 8px; color: var(--muted);
}
.ws-switch button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(23, 35, 63, .08); }
.im-tab-n {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .63rem; font-weight: 700;
  display: inline-grid; place-items: center; margin-left: 5px;
}

/* 弹窗里的员工选择 */
.im-pick .modal-body { max-height: 62vh; }
.im-pick-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 42vh; overflow-y: auto; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 11px; padding: 6px;
}
.im-pick-i {
  display: flex; align-items: center; gap: 9px; padding: 8px 9px;
  border-radius: 9px; cursor: pointer;
}
.im-pick-i:hover { background: #F2F6FE; }
.im-pick-i.dis { opacity: .5; cursor: default; }
.im-pick-i input { width: 15px; height: 15px; accent-color: var(--brand); flex: none; }
.im-pick-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.im-pick-b b { font-size: .82rem; }
.im-pick-b span { font-size: .72rem; color: var(--muted); }
.im-pick-info { font-size: .74rem; margin-top: 8px; line-height: 1.6; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1280px) {
  .im { grid-template-columns: 244px minmax(0, 1fr) 236px; }
}
@media (max-width: 1140px) {
  .im { grid-template-columns: 236px minmax(0, 1fr); }
  .im-info { display: none; }
}
@media (max-width: 820px) {
  .im { grid-template-columns: minmax(0, 1fr); }
  .im-list { display: flex; }
  .im-main { display: none; }
  .im.chat-on .im-list { display: none; }
  .im.chat-on .im-main { display: flex; }
  .im-back { display: grid !important; }
  .im-row-b { max-width: 84%; }
  .im-row.me .im-bub.me { max-width: 84%; }
  .im-at-pop { width: 220px; left: 12px; }
}
.im-back {
  display: none; width: 30px; height: 30px; border-radius: 8px;
  place-items: center; color: var(--muted); flex: none;
}
.im-back svg { transform: rotate(180deg); }
.im-back:hover { background: var(--panel-3); }

/* ---------------- 正在输入 / 模型标识 ---------------- */
.im-typing .im-bub { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.im-dots { display: inline-flex; gap: 3px; align-items: center; height: 10px; }
.im-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--dim, #8a93a6); display: block;
  animation: imDot 1.1s infinite ease-in-out;
}
.im-dots i:nth-child(2) { animation-delay: .16s; }
.im-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes imDot {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.im-model { font-size: .68rem; color: var(--dim, #8a93a6); white-space: nowrap; }
.im-tag.llm {
  background: rgba(43, 92, 230, .1); color: #2B5CE6;
  border: 1px solid rgba(43, 92, 230, .18);
}

/* 右侧「回话引擎」卡片 */
.im-engine .im-card-h { display: flex; align-items: center; gap: 6px; }
.im-engine .btn { margin-top: 10px; }

/* =============================================================
   悬浮画布 · 2026-10-22
   原来白底白面板，边界糊成一片。这里给容器铺一层雾蓝画布 + 细点阵，
   把三栏面板托起来：面板留边距、加双层阴影，视觉上「浮」在画布上。
   ============================================================= */
.chat-holder {
  position: relative;
  padding: 16px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(760px 400px at 4% -12%, rgba(43, 92, 230, .16), rgba(43, 92, 230, 0) 62%),
    radial-gradient(680px 360px at 102% -4%, rgba(94, 140, 255, .14), rgba(94, 140, 255, 0) 60%),
    radial-gradient(900px 520px at 50% 120%, rgba(43, 92, 230, .12), rgba(43, 92, 230, 0) 64%),
    linear-gradient(180deg, #EDF1FA 0%, #F7F9FD 44%, #ECF0F9 100%);
  border: 1px solid #E2E8F4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95);
}

/* 细点阵：只在顶部浓一点，往下化开，别抢内容 */
.chat-holder::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(43, 92, 230, .16) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .55;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 0%, rgba(0, 0, 0, .35) 46%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 0%, rgba(0, 0, 0, .35) 46%, transparent 78%);
}

/* 顶部一道柔光，强化“面板被照亮”的层次 */
.chat-holder::after {
  content: '';
  position: absolute; left: 12%; right: 12%; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent);
  pointer-events: none;
}

/* 面板本体：浮起来 */
.chat-holder .im {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(43, 92, 230, .12);
  border-radius: 16px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 2px 6px rgba(23, 35, 63, .05),
    0 26px 58px -32px rgba(23, 35, 63, .34),
    0 14px 30px -24px rgba(43, 92, 230, .30);
}

/* 三栏之间的分隔弱化，靠底色区分而不是画线 */
.chat-holder .im-list { border-right: 1px solid rgba(231, 235, 242, .9); background: #FBFCFE; }
.chat-holder .im-info { border-left: 1px solid rgba(231, 235, 242, .9); }
.chat-holder .im-body { background: linear-gradient(180deg, #F9FBFE 0%, #F6F9FD 100%); }
.chat-holder .im-top { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(6px); }
.chat-holder .im-foot { background: rgba(255, 255, 255, .92); }

/* 输入框也稍微提起来一点，和面板同一套阴影语言 */
.chat-holder .im-editor {
  background: #fff;
  border-color: #E1E7F3;
  box-shadow: 0 1px 2px rgba(23, 35, 63, .04), 0 8px 18px -14px rgba(23, 35, 63, .16);
}
.chat-holder .im-editor:focus-within {
  border-color: rgba(43, 92, 230, .42);
  box-shadow: 0 0 0 3px rgba(43, 92, 230, .10), 0 10px 22px -16px rgba(43, 92, 230, .34);
}

/* 会话项选中态在浅底上要更清楚 */
.chat-holder .im-ci.on { background: #fff; box-shadow: 0 1px 2px rgba(23, 35, 63, .05), 0 6px 14px -10px rgba(43, 92, 230, .22); }

@media (max-width: 1140px) {
  .chat-holder { padding: 12px; border-radius: 20px; }
}
@media (max-width: 820px) {
  .chat-holder { padding: 8px; border-radius: 16px; }
  .chat-holder .im { border-radius: 12px; }
  .chat-holder::before { background-size: 18px 18px; }
}

/* 初稿抽屉底部：说一句就能改 */
.im-revise {
  display: flex;
  gap: 8px;
  align-items: center;
}
.im-revise .input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .86rem;
}
.im-revise .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
